radv: add radeon_winsys_bo::use_global_list

This will allow us to use the global BO list even without
RADEON_FLAG_PREFER_LOCAL_BO which can cause a lot of troubles
on APUs.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8779>
This commit is contained in:
Samuel Pitoiset 2021-02-02 18:43:45 +01:00 committed by Marge Bot
parent 263bd5e6fd
commit 6a3de3a31f
3 changed files with 7 additions and 1 deletions

View File

@ -2478,6 +2478,7 @@ VkResult radv_bo_list_add(struct radv_device *device,
}
bo_list->list.bos[bo_list->list.count++] = bo;
bo->use_global_list = true;
u_rwlock_wrunlock(&bo_list->rwlock);
return VK_SUCCESS;
}
@ -2499,6 +2500,7 @@ void radv_bo_list_remove(struct radv_device *device,
for(unsigned i = bo_list->list.count; i-- > 0;) {
if (bo_list->list.bos[i] == bo) {
bo_list->list.bos[i] = bo_list->list.bos[bo_list->list.count - 1];
bo->use_global_list = false;
--bo_list->list.count;
break;
}

View File

@ -159,6 +159,7 @@ struct radeon_winsys_bo {
uint64_t va;
bool is_local;
bool vram_no_cpu_access;
bool use_global_list;
enum radeon_bo_domain initial_domain;
};
struct radv_winsys_sem_counts {
@ -369,7 +370,7 @@ static inline void radv_cs_add_buffer(struct radeon_winsys *ws,
struct radeon_cmdbuf *cs,
struct radeon_winsys_bo *bo)
{
if (bo->is_local)
if (bo->use_global_list)
return;
ws->cs_add_buffer(cs, bo);

View File

@ -534,6 +534,7 @@ radv_amdgpu_winsys_bo_create(struct radeon_winsys *_ws,
bo->bo = buf_handle;
bo->base.initial_domain = initial_domain;
bo->base.use_global_list = bo->base.is_local;
bo->is_shared = false;
bo->priority = priority;
@ -662,6 +663,7 @@ radv_amdgpu_winsys_bo_from_ptr(struct radeon_winsys *_ws,
bo->ref_count = 1;
bo->bo = buf_handle;
bo->base.initial_domain = RADEON_DOMAIN_GTT;
bo->base.use_global_list = false;
bo->priority = priority;
ASSERTED int r = amdgpu_bo_export(buf_handle, amdgpu_bo_handle_type_kms, &bo->bo_handle);
@ -736,6 +738,7 @@ radv_amdgpu_winsys_bo_from_fd(struct radeon_winsys *_ws,
bo->base.va = va;
bo->va_handle = va_handle;
bo->base.initial_domain = initial;
bo->base.use_global_list = false;
bo->size = result.alloc_size;
bo->is_shared = true;
bo->priority = priority;