From c4e5661f29c522ad5ad1e086f778433e8c86857c Mon Sep 17 00:00:00 2001 From: Yiwei Zhang Date: Mon, 25 Aug 2025 21:23:55 +0000 Subject: [PATCH] vulkan/android: improve stage masks for semaphore ops Strictly speaking, for an empty batch, there is no inherit/defined ordering between the wait and signal operations within the batch. We are relying on MESA impl defined behavior to transfer payloads of the wait sempahores to the signal sempahore here. Ideally we need a MESA internal hint to ensure transitivity, but since this is on the legacy fallback path, it's not worth the effort. So here we follow common wsi to use TRANSFER_BIT which avoids most unnecessary stalls on the queue (an improvement over the previous ALL_COMMANDS_BIT). Reviewed-by: Faith Ekstrand Part-of: --- src/vulkan/runtime/vk_android.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/vulkan/runtime/vk_android.c b/src/vulkan/runtime/vk_android.c index dffba8c8bfa..51ee8429aff 100644 --- a/src/vulkan/runtime/vk_android.c +++ b/src/vulkan/runtime/vk_android.c @@ -419,13 +419,15 @@ vk_common_QueueSignalReleaseImageANDROID(VkQueue _queue, wait_infos[i] = (VkSemaphoreSubmitInfo){ .sType = VK_STRUCTURE_TYPE_SEMAPHORE_SUBMIT_INFO, .semaphore = pWaitSemaphores[i], - .stageMask = VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT, + /* see wsi_common_queue_present for the rationale */ + .stageMask = VK_PIPELINE_STAGE_2_TRANSFER_BIT, }; } const VkSemaphoreSubmitInfo signal_info = { .sType = VK_STRUCTURE_TYPE_SEMAPHORE_SUBMIT_INFO, .semaphore = queue->anb_semaphore, - .stageMask = VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT, + /* see wsi_common_queue_present for the rationale */ + .stageMask = VK_PIPELINE_STAGE_2_TRANSFER_BIT, }; if (device->copy_sync_payloads != NULL) { result = vk_device_copy_semaphore_payloads(