From 1896111d25220e91622115a281558f1bcfd8de01 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 29 Aug 2022 11:40:50 -0400 Subject: [PATCH] zink: defer more semaphore destruction these have noticeable overhead, so handle them in the submit thread Reviewed-by: Adam Jackson Part-of: --- src/gallium/drivers/zink/zink_batch.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/zink/zink_batch.c b/src/gallium/drivers/zink/zink_batch.c index 3fa4450b471..256d7afc51e 100644 --- a/src/gallium/drivers/zink/zink_batch.c +++ b/src/gallium/drivers/zink/zink_batch.c @@ -87,13 +87,14 @@ zink_reset_batch_state(struct zink_context *ctx, struct zink_batch_state *bs) bs->resource_size = 0; bs->signal_semaphore = VK_NULL_HANDLE; - while (util_dynarray_contains(&bs->wait_semaphores, VkSemaphore)) - VKSCR(DestroySemaphore)(screen->dev, util_dynarray_pop(&bs->wait_semaphores, VkSemaphore), NULL); util_dynarray_clear(&bs->wait_semaphore_stages); bs->present = VK_NULL_HANDLE; memcpy(&bs->unref_semaphores, &bs->acquires, sizeof(struct util_dynarray)); util_dynarray_init(&bs->acquires, NULL); + while (util_dynarray_contains(&bs->wait_semaphores, VkSemaphore)) + util_dynarray_append(&bs->unref_semaphores, VkSemaphore, util_dynarray_pop(&bs->wait_semaphores, VkSemaphore)); + util_dynarray_init(&bs->wait_semaphores, NULL); bs->swapchain = NULL; while (util_dynarray_contains(&bs->dead_swapchains, VkImageView))