[Intel-gfx] [CI 3/8] timeline

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


---
 drivers/gpu/drm/i915/i915_dma.c | 12 ++++++++++--
 drivers/gpu/drm/i915/i915_drv.c |  5 +++++
 drivers/gpu/drm/i915/i915_drv.h |  4 ++++
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index a8c79f6512a4..b97d93f9b572 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1427,11 +1427,13 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
 	/* Must be set before calling __i915_printk */
 	dev_priv->dev = dev;
 
+	async_register_domain(&dev_priv->async_domain, false);
+
 	ret = i915_driver_init_early(dev_priv, dev,
 				     (struct intel_device_info *)flags);
 
 	if (ret < 0)
-		goto out_free_priv;
+		goto out_free_timeline;
 
 	intel_runtime_pm_get(dev_priv);
 
@@ -1475,7 +1477,9 @@ out_cleanup_mmio:
 out_runtime_pm_put:
 	intel_runtime_pm_put(dev_priv);
 	i915_driver_cleanup_early(dev_priv);
-out_free_priv:
+out_free_timeline:
+	async_synchronize_full_domain(&dev_priv->async_domain);
+	async_unregister_domain(&dev_priv->async_domain);
 	i915_load_error(dev_priv, "Device initialization failed (%d)\n", ret);
 
 	kfree(dev_priv);
@@ -1542,6 +1546,10 @@ int i915_driver_unload(struct drm_device *dev)
 	intel_display_power_put(dev_priv, POWER_DOMAIN_INIT);
 
 	i915_driver_cleanup_early(dev_priv);
+
+	async_synchronize_full_domain(&dev_priv->async_domain);
+	async_unregister_domain(&dev_priv->async_domain);
+
 	kfree(dev_priv);
 
 	return 0;
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 4f6de54c14fa..5955cc869cf4 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -586,6 +586,9 @@ static int i915_drm_suspend(struct drm_device *dev)
 	pci_power_t opregion_target_state;
 	int error;
 
+	/* Flush all pending resume tasks */
+	async_synchronize_full_domain(&dev_priv->async_domain);
+
 	/* ignore lid events during suspend */
 	mutex_lock(&dev_priv->modeset_restore_lock);
 	dev_priv->modeset_restore = MODESET_SUSPENDED;
@@ -642,6 +645,8 @@ static int i915_drm_suspend(struct drm_device *dev)
 	intel_csr_ucode_suspend(dev_priv);
 
 out:
+	/* Flush all incomplete suspend tasks */
+	async_synchronize_full_domain(&dev_priv->async_domain);
 	enable_rpm_wakeref_asserts(dev_priv);
 
 	return error;
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 72f0b02a8372..7837b7f2f650 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -33,6 +33,7 @@
 #include <uapi/drm/i915_drm.h>
 #include <uapi/drm/drm_fourcc.h>
 
+#include <linux/async.h>
 #include <linux/io-mapping.h>
 #include <linux/i2c.h>
 #include <linux/i2c-algo-bit.h>
@@ -1732,6 +1733,9 @@ struct drm_i915_private {
 	struct kmem_cache *vmas;
 	struct kmem_cache *requests;
 
+	struct async_domain async_domain;
+	void *async_context;
+
 	const struct intel_device_info info;
 
 	int relative_constants_mode;
-- 
2.8.1



More information about the Intel-gfx mailing list