From: Paulo Zanoni <paulo.r.zan...@intel.com>

Since we merged runtime PM support for DPMS, it is possible that these
functions will be called when the power wells are disabled but a mode
is "set", resulting in "failed assertion" and "device suspended while
reading register" WARNs.

To reproduce the bug: disable all screens using mode unset, do a
modeset on one screen, disable it using DPMS, then try to do a mode
unset on it again to see the WARNs.

Testcase: igt/rpm_rpm/dpms-mode-unset-lpsp
Testcase: igt/rpm_rpm/dpms-mode-unset-non-lpsp
Signed-off-by: Paulo Zanoni <paulo.r.zan...@intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index 54e3af9..7ad46e2 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -1216,7 +1216,9 @@ static void assert_cursor(struct drm_i915_private 
*dev_priv,
        struct drm_device *dev = dev_priv->dev;
        bool cur_state;
 
-       if (IS_845G(dev) || IS_I865G(dev))
+       if (!intel_display_power_enabled(dev_priv, POWER_DOMAIN_PIPE(pipe)))
+               cur_state = false;
+       else if (IS_845G(dev) || IS_I865G(dev))
                cur_state = I915_READ(_CURACNTR) & CURSOR_ENABLE;
        else
                cur_state = I915_READ(CURCNTR(pipe)) & CURSOR_MODE;
@@ -1262,9 +1264,13 @@ static void assert_plane(struct drm_i915_private 
*dev_priv,
        u32 val;
        bool cur_state;
 
-       reg = DSPCNTR(plane);
-       val = I915_READ(reg);
-       cur_state = !!(val & DISPLAY_PLANE_ENABLE);
+       if (!intel_display_power_enabled(dev_priv, POWER_DOMAIN_PIPE(plane))) {
+               cur_state = false;
+       } else {
+               reg = DSPCNTR(plane);
+               val = I915_READ(reg);
+               cur_state = !!(val & DISPLAY_PLANE_ENABLE);
+       }
        WARN(cur_state != state,
             "plane %c assertion failure (expected %s, current %s)\n",
             plane_name(plane), state_string(state), state_string(cur_state));
-- 
2.0.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to