]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
drm/i915: Avoid taking the mutex for dropping the refcnt upon creation
authorChris Wilson <chris@chris-wilson.co.uk>
Thu, 14 Oct 2010 12:20:40 +0000 (13:20 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Tue, 19 Oct 2010 08:19:28 +0000 (09:19 +0100)
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>
drivers/gpu/drm/i915/i915_gem.c

index 32ff571672b4ba21b92c1a1ddb63a9fc9290856f..942e4b351cdd9617b8c22f63333f8df86611fa9b 100644 (file)
@@ -244,12 +244,17 @@ i915_gem_create_ioctl(struct drm_device *dev, void *data,
                return -ENOMEM;
 
        ret = drm_gem_handle_create(file_priv, obj, &handle);
-       /* drop reference from allocate - handle holds it now */
-       drm_gem_object_unreference_unlocked(obj);
        if (ret) {
+               drm_gem_object_release(obj);
+               i915_gem_info_remove_obj(dev->dev_private, obj->size);
+               kfree(obj);
                return ret;
        }
 
+       /* drop reference from allocate - handle holds it now */
+       drm_gem_object_unreference(obj);
+       trace_i915_gem_object_create(obj);
+
        args->handle = handle;
        return 0;
 }
@@ -4380,8 +4385,6 @@ struct drm_gem_object * i915_gem_alloc_object(struct drm_device *dev,
        INIT_LIST_HEAD(&obj->gpu_write_list);
        obj->madv = I915_MADV_WILLNEED;
 
-       trace_i915_gem_object_create(&obj->base);
-
        return &obj->base;
 }