[RFC PATCH 4/8] drm: start using drm_gem_trace_gpu_mem_total

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



- drm_gem_private_object_init(..) increases the total memory
  counter.

  * All GEM objects (whether allocated or imported) seem to begin
    there.
  * If there's a better place/method, please do let
    me know.

- drm_gem_object_free(..) decreases the total memory counter.

Signed-off-by: Gurchetan Singh <gurchetansingh@xxxxxxxxxxxx>
---
 drivers/gpu/drm/drm_gem.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
index 24a719b79400..528d7b29dccf 100644
--- a/drivers/gpu/drm/drm_gem.c
+++ b/drivers/gpu/drm/drm_gem.c
@@ -213,6 +213,7 @@ void drm_gem_private_object_init(struct drm_device *dev,
 		obj->resv = &obj->_resv;
 
 	drm_vma_node_reset(&obj->vma_node);
+	drm_gem_trace_gpu_mem_total(dev, obj->size, false);
 }
 EXPORT_SYMBOL(drm_gem_private_object_init);
 
@@ -1015,6 +1016,10 @@ drm_gem_object_free(struct kref *kref)
 	struct drm_gem_object *obj =
 		container_of(kref, struct drm_gem_object, refcount);
 
+	struct drm_device *dev = obj->dev;
+
+	drm_gem_trace_gpu_mem_total(dev, -obj->size, false);
+
 	if (WARN_ON(!obj->funcs->free))
 		return;
 
-- 
2.25.1




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux