[intel-gem] Must hold DRM lock while setting object domain
authorKeith Packard <keithp@keithp.com>
Tue, 27 May 2008 00:41:46 +0000 (17:41 -0700)
committerKeith Packard <keithp@keithp.com>
Tue, 27 May 2008 00:41:46 +0000 (17:41 -0700)
Object domain transfer can involve adding flush ops to the request queue,
and so the DRM lock must be held to avoid having the X server smash pointers
badly.

linux-core/i915_gem.c

index 3ad3f40..5eeabda 100644 (file)
@@ -1529,9 +1529,11 @@ i915_gem_set_domain(struct drm_gem_object *obj,
 
        BUG_ON(!mutex_is_locked(&dev->struct_mutex));
 
+       drm_idlelock_take (&dev->lock);
        i915_kernel_lost_context(dev);
        i915_gem_object_set_domain(obj, read_domains, write_domain);
        i915_gem_dev_set_domain(obj->dev);
+       drm_idlelock_release (&dev->lock);
 
        return 0;
 }