diff options
author | Marek Olšák <[email protected]> | 2016-08-05 01:28:17 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2016-08-10 01:11:10 +0200 |
commit | 645d395d9af74573ed09223720e799073d34b647 (patch) | |
tree | 0f9404e34d52e377f02b65624993c7af087c53d4 /src/gallium/winsys/radeon/drm/radeon_drm_bo.c | |
parent | 1e04483c22e372aac8a664fe2b272b10aa774eea (diff) |
winsys/radeon: track the amount of mapped memory
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium/winsys/radeon/drm/radeon_drm_bo.c')
-rw-r--r-- | src/gallium/winsys/radeon/drm/radeon_drm_bo.c | 13 |
1 files changed, 12 insertions, 1 deletions
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); } |