drm/i915: Perform initial configuration asynchronously
diff mbox

Message ID 1281358339-1477-1-git-send-email-chris@chris-wilson.co.uk
State Deferred, archived
Headers show

Commit Message

Chris Wilson Aug. 9, 2010, 12:52 p.m. UTC
None

Patch
diff mbox

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.
  */