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 <sviatoslav.peleshko@globallogic.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30581>
(cherry picked from commit 1904fe1186)
This commit is contained in:
Sviatoslav Peleshko 2024-08-09 00:01:44 +03:00 committed by Eric Engestrom
parent f6432697e7
commit 97fdcffb0c
2 changed files with 2 additions and 2 deletions

View file

@ -634,7 +634,7 @@
"description": "anv: Release correct BO in anv_cmd_buffer_set_ray_query_buffer",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "5d3e4193786f1b55aa6a3d74e2b9b954eb9287e5",
"notes": null

View file

@ -463,7 +463,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;
}