From 645d395d9af74573ed09223720e799073d34b647 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Fri, 5 Aug 2016 01:28:17 +0200 Subject: winsys/radeon: track the amount of mapped memory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Nicolai Hähnle --- src/gallium/winsys/radeon/drm/radeon_drm_bo.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/gallium/winsys/radeon/drm/radeon_drm_bo.c') diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c index 897b5367092..56aab489540 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c @@ -375,8 +375,13 @@ void *radeon_bo_do_map(struct radeon_bo *bo) } bo->ptr = ptr; bo->map_count = 1; - pipe_mutex_unlock(bo->map_mutex); + if (bo->initial_domain & RADEON_DOMAIN_VRAM) + bo->rws->mapped_vram += bo->base.size; + else + bo->rws->mapped_gtt += bo->base.size; + + pipe_mutex_unlock(bo->map_mutex); return bo->ptr; } @@ -479,6 +484,12 @@ static void radeon_bo_unmap(struct pb_buffer *_buf) os_munmap(bo->ptr, bo->base.size); bo->ptr = NULL; + + if (bo->initial_domain & RADEON_DOMAIN_VRAM) + bo->rws->mapped_vram -= bo->base.size; + else + bo->rws->mapped_gtt -= bo->base.size; + pipe_mutex_unlock(bo->map_mutex); } -- cgit v1.2.3