[Intel-gfx] [CI 6/8] resume-kms

Chris Wilson chris at chris-wilson.co.uk
Wed May 18 09:50:45 UTC 2016


---
 drivers/gpu/drm/i915/i915_drv.c | 98 ++++++++++++++++++++++++++---------------
 1 file changed, 62 insertions(+), 36 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 46f1fd542d73..44c4743770ed 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -822,6 +822,65 @@ static void i915_gem_resume(void *data, async_cookie_t cookie)
 	resume_context_put(ctx);
 }
 
+static void intel_kms_register(void *data, async_cookie_t cookie)
+{
+	struct resume_context *ctx = data;
+	struct drm_device *dev = ctx->i915->dev;
+
+	/*
+	 * ... but also need to make sure that hotplug processing
+	 * doesn't cause havoc. Like in the driver load code we don't
+	 * bother with the tiny race here where we might loose hotplug
+	 * notifications.
+	 * */
+	intel_hpd_init(ctx->i915);
+	/* Config may have changed between suspend and resume */
+	drm_helper_hpd_irq_event(dev);
+
+	intel_opregion_init(dev);
+
+	intel_fbdev_set_suspend(dev, FBINFO_STATE_RUNNING, false);
+
+	mutex_lock(&ctx->i915->modeset_restore_lock);
+	ctx->i915->modeset_restore = MODESET_DONE;
+	mutex_unlock(&ctx->i915->modeset_restore_lock);
+
+	intel_opregion_notify_adapter(dev, PCI_D0);
+
+	drm_kms_helper_poll_enable(dev);
+
+	resume_context_put(ctx);
+}
+
+static void intel_kms_resume(void *data, async_cookie_t cookie)
+{
+	struct resume_context *ctx = data;
+	struct drm_device *dev = ctx->i915->dev;
+
+	intel_init_pch_refclk(dev);
+	drm_mode_config_reset(dev);
+
+	async_fence_wait(ctx->irq_fence);
+
+	intel_modeset_init_hw(dev);
+
+	spin_lock_irq(&ctx->i915->irq_lock);
+	if (ctx->i915->display.hpd_irq_setup)
+		ctx->i915->display.hpd_irq_setup(ctx->i915);
+	spin_unlock_irq(&ctx->i915->irq_lock);
+
+	intel_dp_mst_resume(dev);
+
+	intel_display_resume(dev);
+
+	/* And register the outputs without pausing resume */
+	async_schedule_domain(intel_kms_register,
+			      resume_context_get(ctx),
+			      &ctx->i915->async_domain);
+
+	resume_context_put(ctx);
+}
+
 static int i915_drm_resume(struct drm_device *dev)
 {
 	struct resume_context *ctx;
@@ -844,8 +903,9 @@ static int i915_drm_resume(struct drm_device *dev)
 	i915_restore_state(dev);
 	intel_opregion_setup(dev);
 
-	intel_init_pch_refclk(dev);
-	drm_mode_config_reset(dev);
+	ctx->cookie = async_schedule_domain(intel_kms_resume,
+					    resume_context_get(ctx),
+					    &ctx->i915->async_domain);
 
 	/*
 	 * Interrupts have to be enabled before any batches are run. If not the
@@ -856,44 +916,10 @@ static int i915_drm_resume(struct drm_device *dev)
 	 * interrupts.
 	 */
 	intel_runtime_pm_enable_interrupts(ctx->i915);
-
 	async_fence_signal(ctx->irq_fence);
 
 	intel_guc_resume(dev);
 
-	intel_modeset_init_hw(dev);
-
-	spin_lock_irq(&ctx->i915->irq_lock);
-	if (ctx->i915->display.hpd_irq_setup)
-		ctx->i915->display.hpd_irq_setup(ctx->i915);
-	spin_unlock_irq(&ctx->i915->irq_lock);
-
-	intel_dp_mst_resume(dev);
-
-	intel_display_resume(dev);
-
-	/*
-	 * ... but also need to make sure that hotplug processing
-	 * doesn't cause havoc. Like in the driver load code we don't
-	 * bother with the tiny race here where we might loose hotplug
-	 * notifications.
-	 * */
-	intel_hpd_init(ctx->i915);
-	/* Config may have changed between suspend and resume */
-	drm_helper_hpd_irq_event(dev);
-
-	intel_opregion_init(dev);
-
-	intel_fbdev_set_suspend(dev, FBINFO_STATE_RUNNING, false);
-
-	mutex_lock(&ctx->i915->modeset_restore_lock);
-	ctx->i915->modeset_restore = MODESET_DONE;
-	mutex_unlock(&ctx->i915->modeset_restore_lock);
-
-	intel_opregion_notify_adapter(dev, PCI_D0);
-
-	drm_kms_helper_poll_enable(dev);
-
 	enable_rpm_wakeref_asserts(ctx->i915);
 
 	return 0;
-- 
2.8.1



More information about the Intel-gfx mailing list