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 <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
Samuel Pitoiset 2017-08-29 16:24:45 +02:00
parent 59101e771d
commit 0d9117b7bd
4 changed files with 17 additions and 11 deletions

View File

@ -167,10 +167,12 @@ void amdgpu_bo_destroy(struct pb_buffer *_buf)
assert(bo->bo && "must not be called for slab entries"); assert(bo->bo && "must not be called for slab entries");
mtx_lock(&bo->ws->global_bo_list_lock); if (bo->ws->debug_all_bos) {
LIST_DEL(&bo->u.real.global_list_item); mtx_lock(&bo->ws->global_bo_list_lock);
bo->ws->num_buffers--; LIST_DEL(&bo->u.real.global_list_item);
mtx_unlock(&bo->ws->global_bo_list_lock); 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_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); 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); assert(bo->bo);
mtx_lock(&ws->global_bo_list_lock); if (ws->debug_all_bos) {
LIST_ADDTAIL(&bo->u.real.global_list_item, &ws->global_bo_list); mtx_lock(&ws->global_bo_list_lock);
ws->num_buffers++; LIST_ADDTAIL(&bo->u.real.global_list_item, &ws->global_bo_list);
mtx_unlock(&ws->global_bo_list_lock); ws->num_buffers++;
mtx_unlock(&ws->global_bo_list_lock);
}
} }
static struct amdgpu_winsys_bo *amdgpu_create_bo(struct amdgpu_winsys *ws, static struct amdgpu_winsys_bo *amdgpu_create_bo(struct amdgpu_winsys *ws,

View File

@ -903,8 +903,6 @@ static unsigned amdgpu_cs_get_buffer_list(struct radeon_winsys_cs *rcs,
return cs->num_real_buffers; 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, static void amdgpu_add_fence_dependency(struct amdgpu_cs *acs,
struct amdgpu_cs_buffer *buffer) struct amdgpu_cs_buffer *buffer)
{ {
@ -1097,7 +1095,7 @@ void amdgpu_cs_submit_ib(void *job, int thread_index)
/* Create the buffer list. /* Create the buffer list.
* Use a buffer list containing all allocated buffers if requested. * 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; struct amdgpu_winsys_bo *bo;
amdgpu_bo_handle *handles; amdgpu_bo_handle *handles;
unsigned num = 0; unsigned num = 0;

View File

@ -50,6 +50,8 @@
static struct util_hash_table *dev_tab = NULL; static struct util_hash_table *dev_tab = NULL;
static mtx_t dev_tab_mutex = _MTX_INITIALIZER_NP; 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. */ /* Helper function to do the ioctls needed for setup and init. */
static bool do_winsys_init(struct amdgpu_winsys *ws, int fd) 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->check_vm = strstr(debug_get_option("R600_DEBUG", ""), "check_vm") != NULL;
ws->debug_all_bos = debug_get_option_all_bos();
return true; return true;

View File

@ -79,6 +79,7 @@ struct amdgpu_winsys {
ADDR_HANDLE addrlib; ADDR_HANDLE addrlib;
bool check_vm; bool check_vm;
bool debug_all_bos;
/* List of all allocated buffers */ /* List of all allocated buffers */
mtx_t global_bo_list_lock; mtx_t global_bo_list_lock;