From 1904fe118624b25817873271fea6285cf2dbbaf5 Mon Sep 17 00:00:00 2001 From: Sviatoslav Peleshko Date: Fri, 9 Aug 2024 00:01:44 +0300 Subject: [PATCH] anv: Release correct BO in anv_cmd_buffer_set_ray_query_buffer If p_atomic_cmpxchg doesn't set the ray_query_shadow_bos[bucket] to new_bo allocated by this thread, it returns the bucket BO allocated by the other thread and we use it. But due to a mistake, we also release that BO, not the candidate just allocated by this thread and never used again. Fixes: 5d3e4193 ("anv: enable ray queries") Signed-off-by: Sviatoslav Peleshko Reviewed-by: Lionel Landwerlin Part-of: --- src/intel/vulkan/anv_cmd_buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/intel/vulkan/anv_cmd_buffer.c b/src/intel/vulkan/anv_cmd_buffer.c index 795cff18f9e..639c88192d1 100644 --- a/src/intel/vulkan/anv_cmd_buffer.c +++ b/src/intel/vulkan/anv_cmd_buffer.c @@ -464,7 +464,7 @@ anv_cmd_buffer_set_ray_query_buffer(struct anv_cmd_buffer *cmd_buffer, bo = p_atomic_cmpxchg(&device->ray_query_shadow_bos[bucket], NULL, new_bo); if (bo != NULL) { - anv_device_release_bo(device, bo); + anv_device_release_bo(device, new_bo); } else { bo = new_bo; }