Hello Daniel, this is pre-requisite for 0fde901f1ddd2ce0e380a6444f1fb7ca555859e9
to be applied to the 3.7.x stable. Also, this alone looks like a valid
fix for stable while it was missing in the first place. The back-port patch used
i915_drm_thaw() instead __i915_drm_thaw() in the first hunk for the 3.7.x
code-base. Please help ACK/NAK this.

Regards,
CAI Qian

>From 45e2b5f640b3766da3eda48f6c35f088155c06f3 Mon Sep 17 00:00:00 2001
From: Daniel Vetter <[email protected]>
Date: Fri, 23 Nov 2012 18:16:34 +0100
Subject: [PATCH] drm/i915: force restore on lid open

There seem to be indeed some awkwards machines around, mostly those
without OpRegion support, where the firmware changes the display hw
state behind our backs when closing the lid.

This force-restore logic has been originally introduced in

commit c1c7af60892070e4b82ad63bbfb95ae745056de0
Author: Jesse Barnes <[email protected]>
Date:   Thu Sep 10 15:28:03 2009 -0700

    drm/i915: force mode set at lid open time

but after the modeset-rework we've disabled it in the vain hope that
it's no longer required:

commit 3b7a89fce3e3dc96b549d6d829387b4439044d0d
Author: Daniel Vetter <[email protected]>
Date:   Mon Sep 17 22:27:21 2012 +0200

    drm/i915: fix OOPS in lid_notify

Alas, no.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54677
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=57434
Tested-by: Krzysztof Mazur <[email protected]>
Reviewed-by: Jesse Barnes <[email protected]>
Signed-off-by: Daniel Vetter <[email protected]>
Signed-off-by: CAI Qian <[email protected]>

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 6770ee6..1f20ead 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -552,7 +552,7 @@ static int i915_drm_thaw(struct drm_device *dev)
                 mutex_unlock(&dev->struct_mutex);
 
                 intel_modeset_init_hw(dev);
-                intel_modeset_setup_hw_state(dev);
+                intel_modeset_setup_hw_state(dev, false);
                 drm_mode_config_reset(dev);
                 drm_irq_install(dev);
         }
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index f511fa2..92f1750 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1595,7 +1595,8 @@ extern void intel_modeset_init(struct drm_device *dev);
 extern void intel_modeset_gem_init(struct drm_device *dev);
 extern void intel_modeset_cleanup(struct drm_device *dev);
 extern int intel_modeset_vga_set_state(struct drm_device *dev, bool state);
-extern void intel_modeset_setup_hw_state(struct drm_device *dev);
+extern void intel_modeset_setup_hw_state(struct drm_device *dev,
+                                         bool force_restore);
 extern bool intel_fbc_enabled(struct drm_device *dev);
 extern void intel_disable_fbc(struct drm_device *dev);
 extern bool ironlake_set_drps(struct drm_device *dev, u8 val);
diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index 210b758..c6f5ed3 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -8281,7 +8281,8 @@ static void intel_sanitize_encoder(struct intel_encoder 
*encoder)
 
 /* Scan out the current hw modeset state, sanitizes it and maps it into the drm
  * and i915 state tracking structures. */
-void intel_modeset_setup_hw_state(struct drm_device *dev)
+void intel_modeset_setup_hw_state(struct drm_device *dev,
+                                  bool force_restore)
 {
         struct drm_i915_private *dev_priv = dev->dev_private;
         enum pipe pipe;
@@ -8352,7 +8353,15 @@ void intel_modeset_setup_hw_state(struct drm_device *dev)
                 intel_sanitize_crtc(crtc);
         }
 
-        intel_modeset_update_staged_output_state(dev);
+        if (force_restore) {
+                for_each_pipe(pipe) {
+                        crtc = 
to_intel_crtc(dev_priv->pipe_to_crtc_mapping[pipe]);
+                        intel_set_mode(&crtc->base, &crtc->base.mode,
+                                       crtc->base.x, crtc->base.y, 
crtc->base.fb);
+                }
+        } else {
+                intel_modeset_update_staged_output_state(dev);
+        }
 
         intel_modeset_check_state(dev);
 }
@@ -8363,7 +8372,7 @@ void intel_modeset_gem_init(struct drm_device *dev)
 
         intel_setup_overlay(dev);
 
-        intel_modeset_setup_hw_state(dev);
+        intel_modeset_setup_hw_state(dev, false);
 }
 
 void intel_modeset_cleanup(struct drm_device *dev)
diff --git a/drivers/gpu/drm/i915/intel_lvds.c 
b/drivers/gpu/drm/i915/intel_lvds.c
index edba93b..e2f5c04 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -526,7 +526,7 @@ static int intel_lid_notify(struct notifier_block *nb, 
unsigned long val,
         dev_priv->modeset_on_lid = 0;
 
         mutex_lock(&dev->mode_config.mutex);
-        intel_modeset_check_state(dev);
+        intel_modeset_setup_hw_state(dev, true);
         mutex_unlock(&dev->mode_config.mutex);
 
         return NOTIFY_OK;
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to