zink/kopper: Don't recycle unused acquire semaphores

Fixes: e9f18f64b9 ("zink: also cache swapchain semaphores")
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36014>
(cherry picked from commit 8d9675520f)
This commit is contained in:
Faith Ekstrand 2025-07-11 16:15:04 -04:00 committed by Eric Engestrom
parent 052a8a9426
commit d30dedf5fb
2 changed files with 9 additions and 4 deletions

View file

@ -1594,7 +1594,7 @@
"description": "zink/kopper: Don't recycle unused acquire semaphores",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "e9f18f64b9ec56ed0e89a5baa41b4536585a8a90",
"notes": null

View file

@ -150,9 +150,14 @@ destroy_swapchain(struct zink_screen *screen, struct kopper_swapchain *cswap)
return;
util_queue_fence_destroy(&cswap->present_fence);
for (unsigned i = 0; i < cswap->num_images; i++) {
simple_mtx_lock(&screen->semaphores_lock);
util_dynarray_append(&screen->semaphores, VkSemaphore, cswap->images[i].acquire);
simple_mtx_unlock(&screen->semaphores_lock);
/* Destroy the acquire semaphore directly, if any. If acquire != NULL
* then we've called vkAcquireNextImage() with the given semaphore but
* not submitted anything which waits on it. This means the semaphore
* has a pending signal operation and is not safe to recycle.
*/
if (cswap->images[i].acquire != VK_NULL_HANDLE)
VKSCR(DestroySemaphore)(screen->dev, cswap->images[i].acquire, NULL);
pipe_resource_reference(&cswap->images[i].readback, NULL);
}
free(cswap->images);