aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-10-14 08:20:40 -0400
committerChris Wilson <chris@chris-wilson.co.uk>2010-10-19 04:19:28 -0400
commit202f2fef7a1aa6b2e4fa6e1de3ef582342fd41f0 (patch)
tree4094308fc3d12f51920e1889ff0160d78095f0d7
parentf0c43d9b7ec1bb9827b3dd5ac5915d22ceed8f6a (diff)
drm/i915: Avoid taking the mutex for dropping the refcnt upon creation
After allocation a handle for the fresh object, we know that we can safely drop the refcnt without triggering a free so we do not need the mutex. Strangely, this mutex acquisition is the one that appears on driver profiles. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 32ff571672b4..942e4b351cdd 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -244,12 +244,17 @@ i915_gem_create_ioctl(struct drm_device *dev, void *data,
244 return -ENOMEM; 244 return -ENOMEM;
245 245
246 ret = drm_gem_handle_create(file_priv, obj, &handle); 246 ret = drm_gem_handle_create(file_priv, obj, &handle);
247 /* drop reference from allocate - handle holds it now */
248 drm_gem_object_unreference_unlocked(obj);
249 if (ret) { 247 if (ret) {
248 drm_gem_object_release(obj);
249 i915_gem_info_remove_obj(dev->dev_private, obj->size);
250 kfree(obj);
250 return ret; 251 return ret;
251 } 252 }
252 253
254 /* drop reference from allocate - handle holds it now */
255 drm_gem_object_unreference(obj);
256 trace_i915_gem_object_create(obj);
257
253 args->handle = handle; 258 args->handle = handle;
254 return 0; 259 return 0;
255} 260}
@@ -4380,8 +4385,6 @@ struct drm_gem_object * i915_gem_alloc_object(struct drm_device *dev,
4380 INIT_LIST_HEAD(&obj->gpu_write_list); 4385 INIT_LIST_HEAD(&obj->gpu_write_list);
4381 obj->madv = I915_MADV_WILLNEED; 4386 obj->madv = I915_MADV_WILLNEED;
4382 4387
4383 trace_i915_gem_object_create(&obj->base);
4384
4385 return &obj->base; 4388 return &obj->base;
4386} 4389}
4387 4390