[RFC PATCH 8/8] drm: trace memory import per DRM device

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

 



- drm_gem_prime_import_dev increases the per-device import memory
  counter

  * Most drivers use it.

  * drivers that have a (*gem_prime_import) callback will need
    additional changes, which can be done if everyone likes the
    overall RFC.

- drm_prime_gem_destroy decreases the per-device import memory
  counter.

  * All drivers seem to use it?

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

diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
index 1afcae0c4038..c2057b7a63b4 100644
--- a/drivers/gpu/drm/drm_prime.c
+++ b/drivers/gpu/drm/drm_prime.c
@@ -955,6 +955,7 @@ struct drm_gem_object *drm_gem_prime_import_dev(struct drm_device *dev,
 
 	obj->import_attach = attach;
 	obj->resv = dma_buf->resv;
+	drm_gem_trace_gpu_mem_total(dev, obj->size, true);
 
 	return obj;
 
@@ -1055,6 +1056,7 @@ void drm_prime_gem_destroy(struct drm_gem_object *obj, struct sg_table *sg)
 	struct dma_buf_attachment *attach;
 	struct dma_buf *dma_buf;
 
+	drm_gem_trace_gpu_mem_total(obj->dev, -obj->size, true);
 	attach = obj->import_attach;
 	if (sg)
 		dma_buf_unmap_attachment(attach, sg, DMA_BIDIRECTIONAL);
-- 
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