[1/2] drm/i915: Cancel outstanding modeset workers before suspend
diff mbox

Message ID 1343070574-23917-1-git-send-email-chris@chris-wilson.co.uk
State New, archived
Headers show

Commit Message

Chris Wilson July 23, 2012, 7:09 p.m. UTC
Upon resume we will do a complete restoration of the mode and so reset
all tasks.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_drv.c      |    1 +
 drivers/gpu/drm/i915/intel_display.c |   18 ++++++++++++------
 drivers/gpu/drm/i915/intel_drv.h     |    3 ++-
 3 files changed, 15 insertions(+), 7 deletions(-)

Patch
diff mbox

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index ff569cc..3d34b54 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -442,6 +442,7 @@  static int i915_drm_freeze(struct drm_device *dev)
 			return error;
 		}
 		drm_irq_uninstall(dev);
+		intel_modeset_quiesce(dev);
 	}
 
 	i915_save_state(dev);
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 1a5cf1d..994d41d 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -7311,9 +7311,19 @@  void intel_modeset_gem_init(struct drm_device *dev)
 	intel_setup_overlay(dev);
 }
 
-void intel_modeset_cleanup(struct drm_device *dev)
+void intel_modeset_quiesce(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
+
+	cancel_work_sync(&dev_priv->hotplug_work);
+	cancel_work_sync(&dev_priv->rps_work);
+
+	/* flush any delayed tasks or pending work */
+	flush_scheduled_work();
+}
+
+void intel_modeset_cleanup(struct drm_device *dev)
+{
 	struct drm_crtc *crtc;
 
 	/* Clear the vblank worker prior to taking any locks */
@@ -7350,11 +7360,7 @@  void intel_modeset_cleanup(struct drm_device *dev)
 	/* Disable the irq before mode object teardown, for the irq might
 	 * enqueue unpin/hotplug work. */
 	drm_irq_uninstall(dev);
-	cancel_work_sync(&dev_priv->hotplug_work);
-	cancel_work_sync(&dev_priv->rps_work);
-
-	/* flush any delayed tasks or pending work */
-	flush_scheduled_work();
+	intel_modeset_quiesce(dev);
 
 	drm_mode_config_cleanup(dev);
 }
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 93a53bc..727a479 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -395,7 +395,8 @@  extern int intel_edp_target_clock(struct intel_encoder *,
 				  struct drm_display_mode *mode);
 extern bool intel_encoder_is_pch_edp(struct drm_encoder *encoder);
 extern struct intel_plane *intel_plane_init(struct drm_device *dev, enum pipe pipe);
-void intel_plane_cleanup(struct intel_plane *plane);
+extern void intel_modeset_quiesce(struct drm_device *dev);
+extern void intel_plane_cleanup(struct intel_plane *plane);
 extern void intel_flush_display_plane(struct drm_i915_private *dev_priv,
 				      enum plane plane);