[Intel-gfx] [PATCH 11/11] drm/i915: Perform initial configuration asynchronously

Chris Wilson chris at chris-wilson.co.uk
Wed Aug 11 11:31:36 CEST 2010


It takes over 0.5s to probe the outputs and configure the i915 console.
This can be performed in the background whilst the rest of the system
is booting.

Based on a patch by Arjan van de Van <arjan at linux.intel.com>

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Dave Airlie <airlied at redhat.com>
---
 drivers/gpu/drm/drm_drv.c       |    6 ++++++
 drivers/gpu/drm/i915/intel_fb.c |   13 +++++++++++--
 include/drm/drmP.h              |    2 ++
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 90288ec..fc1f641 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -48,9 +48,12 @@
 
 #include <linux/debugfs.h>
 #include <linux/slab.h>
+#include <linux/async.h>
 #include "drmP.h"
 #include "drm_core.h"
 
+LIST_HEAD(drm_async_domain);
+EXPORT_SYMBOL_GPL(drm_async_domain);
 
 static int drm_version(struct drm_device *dev, void *data,
 		       struct drm_file *file_priv);
@@ -266,6 +269,9 @@ void drm_exit(struct drm_driver *driver)
 	struct drm_device *dev, *tmp;
 	DRM_DEBUG("\n");
 
+	/* make sure all async operations are finished */
+	async_synchronize_full_domain(&drm_async_domain);
+
 	if (driver->driver_features & DRIVER_MODESET) {
 		pci_unregister_driver(&driver->pci_driver);
 	} else {
diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c
index fe2ab62..cb37c08 100644
--- a/drivers/gpu/drm/i915/intel_fb.c
+++ b/drivers/gpu/drm/i915/intel_fb.c
@@ -34,6 +34,7 @@
 #include <linux/delay.h>
 #include <linux/fb.h>
 #include <linux/init.h>
+#include <linux/async.h>
 #include <linux/vga_switcheroo.h>
 
 #include "drmP.h"
@@ -245,6 +246,14 @@ int intel_fbdev_destroy(struct drm_device *dev,
 	return 0;
 }
 
+static void intel_fbdev_init_async(void *ptr, async_cookie_t cookie)
+{
+	struct intel_fbdev *ifbdev = ptr;
+
+	drm_fb_helper_single_add_all_connectors(&ifbdev->helper);
+	drm_fb_helper_initial_config(&ifbdev->helper, 32);
+}
+
 int intel_fbdev_init(struct drm_device *dev)
 {
 	struct intel_fbdev *ifbdev;
@@ -266,8 +275,8 @@ int intel_fbdev_init(struct drm_device *dev)
 		return ret;
 	}
 
-	drm_fb_helper_single_add_all_connectors(&ifbdev->helper);
-	drm_fb_helper_initial_config(&ifbdev->helper, 32);
+	async_schedule_domain(intel_fbdev_init_async, ifbdev,
+			      &drm_async_domain);
 	return 0;
 }
 
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index e2a4da7..4a5b902 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -326,6 +326,8 @@ struct drm_vma_entry {
 	pid_t pid;
 };
 
+extern struct list_head drm_async_domain;
+
 /**
  * DMA buffer.
  */
-- 
1.7.1




More information about the Intel-gfx mailing list