From c79697fec5163ea94de68acb79a038d48a1f5db3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Tue, 30 Jan 2024 12:06:53 -0500 Subject: [PATCH] winsys/amdgpu: skip code checking RADEON_USAGE_SYNCHRONIZED for slabs We unset RADEON_USAGE_SYNCHRONIZED, but we still checked it. Iterate over such buffers separately without checking RADEON_USAGE_SYNCHRONIZED. Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/gallium/winsys/amdgpu/drm/amdgpu_cs.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c index e143246b244..3944911fc9f 100644 --- a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c @@ -1294,11 +1294,8 @@ static void amdgpu_cs_submit_ib(void *job, void *gdata, int thread_index) amdgpu_lookup_or_add_buffer(cs, &get_slab_entry_real_bo(buffer->bo)->b, &cs->buffer_lists[AMDGPU_BO_REAL]); - /* We need to set the usage because it determines the BO priority. - * Mask out the SYNCHRONIZED flag because the backing buffer of slabs shouldn't add its - * BO fences to fence dependencies. Only the slab entries should do that. - */ - real_buffer->usage |= buffer->usage & ~RADEON_USAGE_SYNCHRONIZED; + /* We need to set the usage because it determines the BO priority. */ + real_buffer->usage |= buffer->usage; } /* Sparse BOs: Add fence dependencies, update seq_no in BOs, add real buffers. */ @@ -1346,7 +1343,7 @@ static void amdgpu_cs_submit_ib(void *job, void *gdata, int thread_index) alloca(num_real_buffers * sizeof(struct drm_amdgpu_bo_list_entry)); unsigned i; - for (i = 0; i < num_real_buffers_except_sparse; i++) { + for (i = 0; i < initial_num_real_buffers; i++) { struct amdgpu_cs_buffer *buffer = &real_buffers[i]; struct amdgpu_winsys_bo *bo = buffer->bo; @@ -1355,6 +1352,15 @@ static void amdgpu_cs_submit_ib(void *job, void *gdata, int thread_index) amdgpu_add_to_kernel_bo_list(&bo_list[i], bo, buffer->usage); } + /* These are backing buffers of slab entries. Don't add their fence dependencies. */ + for (; i < num_real_buffers_except_sparse; i++) { + struct amdgpu_cs_buffer *buffer = &real_buffers[i]; + struct amdgpu_winsys_bo *bo = buffer->bo; + + amdgpu_set_bo_seq_no(queue_index, bo, next_seq_no); + amdgpu_add_to_kernel_bo_list(&bo_list[i], bo, buffer->usage); + } + /* Sparse backing BOs are last. Don't update their fences because we don't use them. */ for (; i < num_real_buffers; ++i) { struct amdgpu_cs_buffer *buffer = &real_buffers[i];