i915 - Add delay after attach to avoid console/X races
authorMatthew Dillon <dillon@apollo.backplane.com>
Wed, 16 Dec 2015 01:17:44 +0000 (17:17 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Wed, 16 Dec 2015 01:17:44 +0000 (17:17 -0800)
* Add a delay in the i915 attach to give the kms_console time to
  initialize before X starts to muck around with the gpu.

* Appears to avoid deadlock-on-startup problems when X itself loads
  the i915 driver (verses it being preloaed).

sys/dev/drm/i915/i915_drv.c

index 024bc9d..f56c98f 100644 (file)
@@ -1642,11 +1642,21 @@ static int
 i915_attach(device_t kdev)
 {
        struct drm_device *dev = device_get_softc(kdev);
+       int error;
+       int dummy;
 
        i915_init();
 
        dev->driver = &driver;
-       return (drm_attach(kdev, i915_attach_list));
+       error = drm_attach(kdev, i915_attach_list);
+
+       /*
+        * XXX hack - give the kvm_console time to come up before X starts
+        * messing with everything, avoiding at least one deadlock.
+        */
+       tsleep(&dummy, 0, "i915_attach", hz*2);
+
+       return error;
 }
 
 static device_method_t i915_methods[] = {