[Intel-gfx] [PATCH 1/2] drm/i915: Cancel outstanding modeset workers before suspend

Chris Wilson chris at chris-wilson.co.uk
Mon Jul 23 21:09:33 CEST 2012


Upon resume we will do a complete restoration of the mode and so reset
all tasks.

Signed-off-by: Chris Wilson <chris at 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(-)

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);
 
-- 
1.7.10.4




More information about the Intel-gfx mailing list