From: Samuel Pitoiset Date: Tue, 29 Aug 2017 14:24:45 +0000 (+0200) Subject: winsys/amdgpu: add BO to the global list only when RADEON_ALL_BOS is set X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0d9117b7bdc3f378c27d48412b6b9d9be55d66fc;p=mesa.git winsys/amdgpu: add BO to the global list only when RADEON_ALL_BOS is set Only useful when that debug option is enabled. Signed-off-by: Samuel Pitoiset Reviewed-by: Marek Olšák --- diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c index 97bbe235a43..1323be8356e 100644 --- a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c @@ -167,10 +167,12 @@ void amdgpu_bo_destroy(struct pb_buffer *_buf) assert(bo->bo && "must not be called for slab entries"); - mtx_lock(&bo->ws->global_bo_list_lock); - LIST_DEL(&bo->u.real.global_list_item); - bo->ws->num_buffers--; - mtx_unlock(&bo->ws->global_bo_list_lock); + if (bo->ws->debug_all_bos) { + mtx_lock(&bo->ws->global_bo_list_lock); + LIST_DEL(&bo->u.real.global_list_item); + bo->ws->num_buffers--; + mtx_unlock(&bo->ws->global_bo_list_lock); + } amdgpu_bo_va_op(bo->bo, 0, bo->base.size, bo->va, 0, AMDGPU_VA_OP_UNMAP); amdgpu_va_range_free(bo->u.real.va_handle); @@ -360,10 +362,12 @@ static void amdgpu_add_buffer_to_global_list(struct amdgpu_winsys_bo *bo) assert(bo->bo); - mtx_lock(&ws->global_bo_list_lock); - LIST_ADDTAIL(&bo->u.real.global_list_item, &ws->global_bo_list); - ws->num_buffers++; - mtx_unlock(&ws->global_bo_list_lock); + if (ws->debug_all_bos) { + mtx_lock(&ws->global_bo_list_lock); + LIST_ADDTAIL(&bo->u.real.global_list_item, &ws->global_bo_list); + ws->num_buffers++; + mtx_unlock(&ws->global_bo_list_lock); + } } static struct amdgpu_winsys_bo *amdgpu_create_bo(struct amdgpu_winsys *ws, diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c index 9cadfc4298d..5ddde8e7944 100644 --- a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c @@ -903,8 +903,6 @@ static unsigned amdgpu_cs_get_buffer_list(struct radeon_winsys_cs *rcs, return cs->num_real_buffers; } -DEBUG_GET_ONCE_BOOL_OPTION(all_bos, "RADEON_ALL_BOS", false) - static void amdgpu_add_fence_dependency(struct amdgpu_cs *acs, struct amdgpu_cs_buffer *buffer) { @@ -1097,7 +1095,7 @@ void amdgpu_cs_submit_ib(void *job, int thread_index) /* Create the buffer list. * Use a buffer list containing all allocated buffers if requested. */ - if (debug_get_option_all_bos()) { + if (ws->debug_all_bos) { struct amdgpu_winsys_bo *bo; amdgpu_bo_handle *handles; unsigned num = 0; diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c index a8b5e5b41a1..5e0c1fd8d8f 100644 --- a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c @@ -50,6 +50,8 @@ static struct util_hash_table *dev_tab = NULL; static mtx_t dev_tab_mutex = _MTX_INITIALIZER_NP; +DEBUG_GET_ONCE_BOOL_OPTION(all_bos, "RADEON_ALL_BOS", false) + /* Helper function to do the ioctls needed for setup and init. */ static bool do_winsys_init(struct amdgpu_winsys *ws, int fd) { @@ -70,6 +72,7 @@ static bool do_winsys_init(struct amdgpu_winsys *ws, int fd) } ws->check_vm = strstr(debug_get_option("R600_DEBUG", ""), "check_vm") != NULL; + ws->debug_all_bos = debug_get_option_all_bos(); return true; diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h index 7aca612f452..de54470ede2 100644 --- a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h @@ -79,6 +79,7 @@ struct amdgpu_winsys { ADDR_HANDLE addrlib; bool check_vm; + bool debug_all_bos; /* List of all allocated buffers */ mtx_t global_bo_list_lock;