From: Marek Olšák Date: Sun, 4 Sep 2016 12:21:41 +0000 (+0200) Subject: gallium/radeon/winsyses: fix counting mapped memory X-Git-Tag: upstream/17.1.0~6593 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=53d74e055e3596a05b9a306ea867dac0d4591f95;p=platform%2Fupstream%2Fmesa.git gallium/radeon/winsyses: fix counting mapped memory Not all buffers are unmapped explicitly. Reviewed-by: Nicolai Hähnle --- diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c index a4bc474..32df0be 100644 --- a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c @@ -151,6 +151,14 @@ void amdgpu_bo_destroy(struct pb_buffer *_buf) bo->ws->allocated_vram -= align64(bo->base.size, bo->ws->info.gart_page_size); else if (bo->initial_domain & RADEON_DOMAIN_GTT) bo->ws->allocated_gtt -= align64(bo->base.size, bo->ws->info.gart_page_size); + + if (bo->map_count >= 1) { + if (bo->initial_domain & RADEON_DOMAIN_VRAM) + bo->ws->mapped_vram -= bo->base.size; + else + bo->ws->mapped_gtt -= bo->base.size; + } + FREE(bo); } diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c index 56aab48..5db2061 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c @@ -316,6 +316,14 @@ void radeon_bo_destroy(struct pb_buffer *_buf) rws->allocated_vram -= align(bo->base.size, rws->info.gart_page_size); else if (bo->initial_domain & RADEON_DOMAIN_GTT) rws->allocated_gtt -= align(bo->base.size, rws->info.gart_page_size); + + if (bo->map_count >= 1) { + if (bo->initial_domain & RADEON_DOMAIN_VRAM) + bo->rws->mapped_vram -= bo->base.size; + else + bo->rws->mapped_gtt -= bo->base.size; + } + FREE(bo); }