From 5b967ccf77c2c7d928933c4c16868a8bc381c8df Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Thu, 4 Feb 2021 18:08:34 +0100 Subject: [PATCH] radv/winsys: add the resident BOs to the list of BOs at submit time The number of resident BOs is currently 0. Signed-off-by: Samuel Pitoiset Reviewed-by: Bas Nieuwenhuizen Part-of: --- src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c index 275e5d3fe94..ebb5d167b97 100644 --- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c +++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c @@ -712,7 +712,8 @@ radv_amdgpu_get_bo_list(struct radv_amdgpu_winsys *ws, num_handles++; } } else if (count == 1 && !num_extra_bo && !extra_cs && !radv_bo_list && - !radv_amdgpu_cs(cs_array[0])->num_virtual_buffers) { + !radv_amdgpu_cs(cs_array[0])->num_virtual_buffers && + !ws->global_bo_list.count) { struct radv_amdgpu_cs *cs = (struct radv_amdgpu_cs*)cs_array[0]; if (cs->num_buffers == 0) return VK_SUCCESS; @@ -742,6 +743,8 @@ radv_amdgpu_get_bo_list(struct radv_amdgpu_winsys *ws, total_buffer_count += radv_bo_list->count; } + total_buffer_count += ws->global_bo_list.count; + if (total_buffer_count == 0) return VK_SUCCESS; @@ -822,6 +825,23 @@ radv_amdgpu_get_bo_list(struct radv_amdgpu_winsys *ws, } } } + + unsigned unique_bo_so_far = num_handles; + for (unsigned i = 0; i < ws->global_bo_list.count; ++i) { + struct radv_amdgpu_winsys_bo *bo = ws->global_bo_list.bos[i]; + bool found = false; + for (unsigned j = 0; j < unique_bo_so_far; ++j) { + if (bo->bo_handle == handles[j].bo_handle) { + found = true; + break; + } + } + if (!found) { + handles[num_handles].bo_handle = bo->bo_handle; + handles[num_handles].bo_priority = bo->priority; + ++num_handles; + } + } } *rhandles = handles;