aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/drm_gem.c10
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c3
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_gem.c3
-rw-r--r--drivers/gpu/drm/radeon/radeon_gem.c3
-rw-r--r--include/drm/drmP.h1
5 files changed, 13 insertions, 7 deletions
diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
index 3b64d0ef1998..33dad3fa6043 100644
--- a/drivers/gpu/drm/drm_gem.c
+++ b/drivers/gpu/drm/drm_gem.c
@@ -422,15 +422,15 @@ drm_gem_release(struct drm_device *dev, struct drm_file *file_private)
422 idr_destroy(&file_private->object_idr); 422 idr_destroy(&file_private->object_idr);
423} 423}
424 424
425static void 425void
426drm_gem_object_free_common(struct drm_gem_object *obj) 426drm_gem_object_release(struct drm_gem_object *obj)
427{ 427{
428 struct drm_device *dev = obj->dev; 428 struct drm_device *dev = obj->dev;
429 fput(obj->filp); 429 fput(obj->filp);
430 atomic_dec(&dev->object_count); 430 atomic_dec(&dev->object_count);
431 atomic_sub(obj->size, &dev->object_memory); 431 atomic_sub(obj->size, &dev->object_memory);
432 kfree(obj);
433} 432}
433EXPORT_SYMBOL(drm_gem_object_release);
434 434
435/** 435/**
436 * Called after the last reference to the object has been lost. 436 * Called after the last reference to the object has been lost.
@@ -448,8 +448,6 @@ drm_gem_object_free(struct kref *kref)
448 448
449 if (dev->driver->gem_free_object != NULL) 449 if (dev->driver->gem_free_object != NULL)
450 dev->driver->gem_free_object(obj); 450 dev->driver->gem_free_object(obj);
451
452 drm_gem_object_free_common(obj);
453} 451}
454EXPORT_SYMBOL(drm_gem_object_free); 452EXPORT_SYMBOL(drm_gem_object_free);
455 453
@@ -472,8 +470,6 @@ drm_gem_object_free_unlocked(struct kref *kref)
472 dev->driver->gem_free_object(obj); 470 dev->driver->gem_free_object(obj);
473 mutex_unlock(&dev->struct_mutex); 471 mutex_unlock(&dev->struct_mutex);
474 } 472 }
475
476 drm_gem_object_free_common(obj);
477} 473}
478EXPORT_SYMBOL(drm_gem_object_free_unlocked); 474EXPORT_SYMBOL(drm_gem_object_free_unlocked);
479 475
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 80871c62a571..d4ea90999f67 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -4474,6 +4474,9 @@ void i915_gem_free_object(struct drm_gem_object *obj)
4474 kfree(obj_priv->page_cpu_valid); 4474 kfree(obj_priv->page_cpu_valid);
4475 kfree(obj_priv->bit_17); 4475 kfree(obj_priv->bit_17);
4476 kfree(obj->driver_private); 4476 kfree(obj->driver_private);
4477
4478 drm_gem_object_release(obj);
4479 kfree(obj);
4477} 4480}
4478 4481
4479/** Unbinds all inactive objects. */ 4482/** Unbinds all inactive objects. */
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c
index 1bc0b38a5167..6d1aa89ec870 100644
--- a/drivers/gpu/drm/nouveau/nouveau_gem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
@@ -57,6 +57,9 @@ nouveau_gem_object_del(struct drm_gem_object *gem)
57 } 57 }
58 58
59 ttm_bo_unref(&bo); 59 ttm_bo_unref(&bo);
60
61 drm_gem_object_release(gem);
62 kfree(gem);
60} 63}
61 64
62int 65int
diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c
index 28dd3e1b9c3a..a72a3ee5d69b 100644
--- a/drivers/gpu/drm/radeon/radeon_gem.c
+++ b/drivers/gpu/drm/radeon/radeon_gem.c
@@ -44,6 +44,9 @@ void radeon_gem_object_free(struct drm_gem_object *gobj)
44 if (robj) { 44 if (robj) {
45 radeon_bo_unref(&robj); 45 radeon_bo_unref(&robj);
46 } 46 }
47
48 drm_gem_object_release(gobj);
49 kfree(gobj);
47} 50}
48 51
49int radeon_gem_object_create(struct radeon_device *rdev, int size, 52int radeon_gem_object_create(struct radeon_device *rdev, int size,
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index b3b57b561b92..c1b987158dfa 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -1428,6 +1428,7 @@ extern void drm_sysfs_connector_remove(struct drm_connector *connector);
1428/* Graphics Execution Manager library functions (drm_gem.c) */ 1428/* Graphics Execution Manager library functions (drm_gem.c) */
1429int drm_gem_init(struct drm_device *dev); 1429int drm_gem_init(struct drm_device *dev);
1430void drm_gem_destroy(struct drm_device *dev); 1430void drm_gem_destroy(struct drm_device *dev);
1431void drm_gem_object_release(struct drm_gem_object *obj);
1431void drm_gem_object_free(struct kref *kref); 1432void drm_gem_object_free(struct kref *kref);
1432void drm_gem_object_free_unlocked(struct kref *kref); 1433void drm_gem_object_free_unlocked(struct kref *kref);
1433struct drm_gem_object *drm_gem_object_alloc(struct drm_device *dev, 1434struct drm_gem_object *drm_gem_object_alloc(struct drm_device *dev,