[RFC PATCH 4/5] drm/cma-helper: account memory used by CMA GEM objects

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

 



CMA buffer are pinned into system memory as soon as they are allocated
and will only disappear when they are freed.

Signed-off-by: Lucas Stach <l.stach@xxxxxxxxxxxxxx>
---
 drivers/gpu/drm/drm_gem_cma_helper.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c b/drivers/gpu/drm/drm_gem_cma_helper.c
index 42abee9a0f4f..f0c4e7e6cc33 100644
--- a/drivers/gpu/drm/drm_gem_cma_helper.c
+++ b/drivers/gpu/drm/drm_gem_cma_helper.c
@@ -162,6 +162,8 @@ struct drm_gem_cma_object *drm_gem_cma_create(struct drm_device *drm,
 		goto error;
 	}
 
+	drm_gem_add_resident(&cma_obj->base);
+
 	return cma_obj;
 
 error:
@@ -230,6 +232,8 @@ void drm_gem_cma_free(struct drm_gem_cma_object *cma_obj)
 	struct drm_gem_object *gem_obj = &cma_obj->base;
 	struct iosys_map map = IOSYS_MAP_INIT_VADDR(cma_obj->vaddr);
 
+	drm_gem_dec_resident(gem_obj);
+
 	if (gem_obj->import_attach) {
 		if (cma_obj->vaddr)
 			dma_buf_vunmap(gem_obj->import_attach->dmabuf, &map);
-- 
2.30.2





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux