radv/winsys: add the resident BOs to the list of BOs at submit time
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 4 Feb 2021 17:08:34 +0000 (18:08 +0100)
committerMarge Bot <eric+marge@anholt.net>
Tue, 9 Feb 2021 10:03:47 +0000 (10:03 +0000)
The number of resident BOs is currently 0.

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/8868>

src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c

index 275e5d3..ebb5d16 100644 (file)
@@ -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;