summaryrefslogtreecommitdiff
path: root/linux-core/drm_gem.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux-core/drm_gem.c')
-rw-r--r--linux-core/drm_gem.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/linux-core/drm_gem.c b/linux-core/drm_gem.c
index 47b55434..434155b3 100644
--- a/linux-core/drm_gem.c
+++ b/linux-core/drm_gem.c
@@ -74,6 +74,11 @@ drm_gem_init(struct drm_device *dev)
spin_lock_init(&dev->object_name_lock);
idr_init(&dev->object_name_idr);
atomic_set(&dev->object_count, 0);
+ atomic_set(&dev->object_memory, 0);
+ atomic_set(&dev->pin_count, 0);
+ atomic_set(&dev->pin_memory, 0);
+ atomic_set(&dev->gtt_count, 0);
+ atomic_set(&dev->gtt_memory, 0);
return 0;
}
@@ -106,6 +111,7 @@ drm_gem_object_alloc(struct drm_device *dev, size_t size)
return NULL;
}
atomic_inc(&dev->object_count);
+ atomic_add(obj->size, &dev->object_memory);
return obj;
}
EXPORT_SYMBOL(drm_gem_object_alloc);
@@ -376,6 +382,7 @@ drm_gem_object_free(struct kref *kref)
fput(obj->filp);
atomic_dec(&dev->object_count);
+ atomic_sub(obj->size, &dev->object_memory);
kfree(obj);
}
EXPORT_SYMBOL(drm_gem_object_free);