From ea7f5f7f1c23995877bf28aa12bc73c94243ff89 Mon Sep 17 00:00:00 2001 From: Aitor Camacho Date: Mon, 15 Dec 2025 20:33:47 +0900 Subject: [PATCH] kk: Propagate availability before we reset it in vkCmdResetQueryPool Required to avoid availability write races. We could have an availability update pending so adding the reset availability write to the same pool of writes led to write races. Avoid this by flushing writes before reseting queries. Acked-by: Arcady Goldmints-Orlov Signed-off-by: Aitor Camacho Part-of: --- src/kosmickrisp/vulkan/kk_query_pool.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/kosmickrisp/vulkan/kk_query_pool.c b/src/kosmickrisp/vulkan/kk_query_pool.c index ed52d26b99c..60d252c1573 100644 --- a/src/kosmickrisp/vulkan/kk_query_pool.c +++ b/src/kosmickrisp/vulkan/kk_query_pool.c @@ -254,10 +254,13 @@ kk_CmdResetQueryPool(VkCommandBuffer commandBuffer, VkQueryPool queryPool, { VK_FROM_HANDLE(kk_cmd_buffer, cmd, commandBuffer); VK_FROM_HANDLE(kk_query_pool, pool, queryPool); + /* Need to flush other availabilities just in case there is a reset after it + * was made available but the writes have not propagated yet. Need to avoid + * data rances in the writes. This is save to do sice vkCmdResetQueryPool + * cannot be called when a render pass is active. */ + upload_queue_writes(cmd); emit_zero_queries(cmd, pool, firstQuery, queryCount, false); - /* If we are not mid encoder, just upload the writes */ - if (cmd->encoder->main.last_used == KK_ENC_NONE) - upload_queue_writes(cmd); + upload_queue_writes(cmd); } VKAPI_ATTR void VKAPI_CALL