vulkan/android: improve vkQueueSignalReleaseImageANDROID

There're two issues with the current implementation:
1. Wait semaphores are implicitly required to be SYNC_FD exportable
2. As a queue command that can further record cmds against the wsi
   image, it currently doesn't account for pending cmds in the queue
   beyond the wait semaphores.

This change fixes both by doing a queue submission in the call with a
SYNC_FD external signal semaphore. However, due to Android wsi not
exposing swapchain to icd, we have to cache the signal semaphore in the
queue, otherwise would have to create/destroy in each present.

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25185>
This commit is contained in:
Yiwei Zhang
2023-09-09 17:10:44 -07:00
committed by Marge Bot
parent 6ed2515df1
commit 3c4c263dc7
3 changed files with 69 additions and 36 deletions
+18
View File
@@ -145,6 +145,24 @@ struct vk_queue {
*/
struct util_dynarray labels;
bool region_begin;
#ifdef ANDROID
/** SYNC_FD signal semaphore for vkQueueSignalReleaseImageANDROID
*
* VK_ANDROID_native_buffer enforces explicit fencing on the present api
* boundary. To avoid assuming all waitSemaphores exportable to sync file
* and to capture pending cmds in the queue, we do a simple submission and
* signal a SYNC_FD handle type external sempahore for native fence export.
*
* This plays the same role as wsi_swapchain::dma_buf_semaphore for WSI.
* The VK_ANDROID_native_buffer spec hides the swapchain object from the
* icd, so we have to cache the semaphore in common vk_queue.
*
* This also makes it easier to add additional cmds to prepare the wsi
* image for implementations requiring such (e.g. for layout transition).
*/
VkSemaphore anb_semaphore;
#endif
};
VK_DEFINE_HANDLE_CASTS(vk_queue, base, VkQueue, VK_OBJECT_TYPE_QUEUE)