i915_gem.c: Revisit initialization code
authorFrançois Tigeot <ftigeot@wolfpond.org>
Sun, 21 Jul 2013 05:41:49 +0000 (07:41 +0200)
committerFrançois Tigeot <ftigeot@wolfpond.org>
Tue, 30 Jul 2013 19:19:16 +0000 (21:19 +0200)
sys/dev/drm2/i915/i915_gem.c

index 265cf9f..015dd71 100644 (file)
@@ -323,14 +323,15 @@ i915_gem_init_ioctl(struct drm_device *dev, void *data,
            (args->gtt_end | args->gtt_start) & (PAGE_SIZE - 1))
                return (-EINVAL);
 
-       if (mtx_initialized(&dev_priv->mm.gtt_space.unused_lock))
-               return (-EBUSY);
        /*
         * XXXKIB. The second-time initialization should be guarded
         * against.
         */
-       return (i915_gem_do_init(dev, args->gtt_start, args->gtt_end,
-           args->gtt_end));
+       lockmgr(&dev->dev_lock, LK_EXCLUSIVE|LK_RETRY|LK_CANRECURSE);
+       i915_gem_do_init(dev, args->gtt_start, args->gtt_end, args->gtt_end);
+       lockmgr(&dev->dev_lock, LK_RELEASE);
+
+       return 0;
 }
 
 int