diff mbox

drm/i915: don't check inconsistent modeset state when force-restoring

Message ID CACraW2pORbuy-OfZq=NANBLzKhPYWXBzFJfzZa+k2SHyuCdqZQ@mail.gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Tomas Melin April 10, 2013, 6:32 p.m. UTC
On Tue, Apr 9, 2013 at 10:51 PM, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> v2: Try harder not to create a big patch (Chris).
>
Tested the patch applied to 3.9-rc6. Atleast on my machine that
helped, although once I managed to get the error (but not warning and
call trace as before):
[drm:i9xx_crtc_mode_set] *ERROR* Couldn't find PLL settings for mode!


On Wed, Apr 10, 2013 at 8:27 PM, Richard Cochran
<richardcochran@gmail.com> wrote:
> I couldn't see right away how to fix it up, so I just compiled your
> drm-intel-next-queued plus this patch. If I close the netbook's lid
> and open it again, the screen is blank, no backlight, and the machine
> seems to be frozen.

The patch doesn't apply at all to 3.8 since function crtc_restore_mode
is missing and also 3.9-rc6 was quite different.
This version of the patch applies atleast to 3.9-rc6 if you want to test it:

From 9f498da114cea3d82c291b7090d4441664d7870c Mon Sep 17 00:00:00 2001
From: Tomas Melin <tomas.melin@iki.fi>
Date: Wed, 10 Apr 2013 18:53:42 +0300
Subject: [PATCH] applied patch

---
 drivers/gpu/drm/i915/intel_display.c |   36 +++++++++++++++++++++++++++-------
 1 file changed, 29 insertions(+), 7 deletions(-)

--
1.7.9.5

Comments

Tomas Melin April 11, 2013, 5:16 a.m. UTC | #1
On Wed, Apr 10, 2013 at 9:32 PM, Tomas Melin <tomas.melin@iki.fi> wrote:
> On Tue, Apr 9, 2013 at 10:51 PM, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
>> v2: Try harder not to create a big patch (Chris).
>>
> Tested the patch applied to 3.9-rc6. Atleast on my machine that
> helped, although once I managed to get the error (but not warning and
> call trace as before):
> [drm:i9xx_crtc_mode_set] *ERROR* Couldn't find PLL settings for mode!
>

Update: the situation where I still get an error is if the machine is
in standby with the lid open. Then close and open will generate that
kind of error. The patch however fixes the original problem.

thanks,
Tomas
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_display.c
b/drivers/gpu/drm/i915/intel_display.c
index b20d501..83b11c5 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -7771,9 +7771,9 @@  intel_modeset_check_state(struct drm_device *dev)
     }
 }

-int intel_set_mode(struct drm_crtc *crtc,
-           struct drm_display_mode *mode,
-           int x, int y, struct drm_framebuffer *fb)
+static int __intel_set_mode(struct drm_crtc *crtc,
+                struct drm_display_mode *mode,
+                int x, int y, struct drm_framebuffer *fb)
 {
     struct drm_device *dev = crtc->dev;
     drm_i915_private_t *dev_priv = dev->dev_private;
@@ -7863,18 +7863,33 @@  done:
     if (ret && crtc->enabled) {
         crtc->hwmode = *saved_hwmode;
         crtc->mode = *saved_mode;
-    } else {
-        intel_modeset_check_state(dev);
     }

 out:
     kfree(saved_mode);
     return ret;
 }
+int intel_set_mode(struct drm_crtc *crtc,
+             struct drm_display_mode *mode,
+             int x, int y, struct drm_framebuffer *fb)
+{
+    int ret;
+
+    ret = __intel_set_mode(crtc, mode, x, y, fb);
+
+    if (ret == 0)
+        intel_modeset_check_state(crtc->dev);
+
+    return ret;
+}
+
+

 void intel_crtc_restore_mode(struct drm_crtc *crtc)
 {
-    intel_set_mode(crtc, &crtc->mode, crtc->x, crtc->y, crtc->fb);
+    __intel_set_mode(crtc, &crtc->mode, crtc->x, crtc->y, crtc->fb);
+
+    intel_modeset_check_state(crtc->dev);
 }

 #undef for_each_intel_crtc_masked
@@ -9172,8 +9187,15 @@  void intel_modeset_setup_hw_state(struct drm_device *dev,
     }

     if (force_restore) {
+        /*
+         * We need to use raw interfaces for restoring state to avoid
+         * checking (bogus) intermediate states.
+         */
         for_each_pipe(pipe) {
-            intel_crtc_restore_mode(dev_priv->pipe_to_crtc_mapping[pipe]);
+             struct drm_crtc *crtc =
+                 dev_priv->pipe_to_crtc_mapping[pipe];
+            __intel_set_mode(crtc, &crtc->mode, crtc->x, crtc->y,
+                     crtc->fb);
         }

         i915_redisable_vga(dev);