From a73e3d5e004f2743b74aa0dbdbe9074c42d7dab6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Mon, 16 Jul 2018 13:04:53 -0400 Subject: [PATCH] winsys/amdgpu: shorten bo->ws in amdgpu_bo_destroy Tested-by: Leo Liu Acked-by: Leo Liu --- src/gallium/winsys/amdgpu/drm/amdgpu_bo.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c index e3d56613dfa..0622fb2563e 100644 --- a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c @@ -168,14 +168,15 @@ static void amdgpu_bo_remove_fences(struct amdgpu_winsys_bo *bo) void amdgpu_bo_destroy(struct pb_buffer *_buf) { struct amdgpu_winsys_bo *bo = amdgpu_winsys_bo(_buf); + struct amdgpu_winsys *ws = bo->ws; assert(bo->bo && "must not be called for slab entries"); - if (bo->ws->debug_all_bos) { - simple_mtx_lock(&bo->ws->global_bo_list_lock); + if (ws->debug_all_bos) { + simple_mtx_lock(&ws->global_bo_list_lock); LIST_DEL(&bo->u.real.global_list_item); - bo->ws->num_buffers--; - simple_mtx_unlock(&bo->ws->global_bo_list_lock); + ws->num_buffers--; + simple_mtx_unlock(&ws->global_bo_list_lock); } amdgpu_bo_va_op(bo->bo, 0, bo->base.size, bo->va, 0, AMDGPU_VA_OP_UNMAP); @@ -185,16 +186,16 @@ void amdgpu_bo_destroy(struct pb_buffer *_buf) amdgpu_bo_remove_fences(bo); if (bo->initial_domain & RADEON_DOMAIN_VRAM) - bo->ws->allocated_vram -= align64(bo->base.size, bo->ws->info.gart_page_size); + ws->allocated_vram -= align64(bo->base.size, 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); + ws->allocated_gtt -= align64(bo->base.size, ws->info.gart_page_size); if (bo->u.real.map_count >= 1) { if (bo->initial_domain & RADEON_DOMAIN_VRAM) - bo->ws->mapped_vram -= bo->base.size; + ws->mapped_vram -= bo->base.size; else if (bo->initial_domain & RADEON_DOMAIN_GTT) - bo->ws->mapped_gtt -= bo->base.size; - bo->ws->num_mapped_buffers--; + ws->mapped_gtt -= bo->base.size; + ws->num_mapped_buffers--; } FREE(bo); -- 2.30.2