From b03216de9cc8a9d22db69bf96d82b1898806e7e8 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Thu, 19 May 2022 19:33:01 -0500 Subject: [PATCH] wsi: Always signal semaphores and fences in wsi_common_acquire_next_image If the driver wants to do something special, it can reset the semaphore or fence again and re-signal it. Sure, that wastes a malloc/free but this is the window-system path. It'll be fine. Reviewed-by: Iago Toral Quiroga Reviewed-by: Bas Nieuwenhuizen Reviewed-by: Lionel Landwerlin Part-of: --- src/vulkan/wsi/wsi_common.c | 40 ++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c index a97e2aa9f7f..c8c9b73a57a 100644 --- a/src/vulkan/wsi/wsi_common.c +++ b/src/vulkan/wsi/wsi_common.c @@ -33,6 +33,8 @@ #include "vk_physical_device.h" #include "vk_queue.h" #include "vk_semaphore.h" +#include "vk_sync.h" +#include "vk_sync_dummy.h" #include "vk_util.h" #include @@ -834,15 +836,22 @@ wsi_signal_semaphore_for_image(struct vk_device *device, const struct wsi_image *image, VkSemaphore _semaphore) { - VK_FROM_HANDLE(vk_semaphore, semaphore, _semaphore); - - if (!chain->wsi->signal_semaphore_with_memory) + if (device->physical->supported_sync_types == NULL) return VK_SUCCESS; + VK_FROM_HANDLE(vk_semaphore, semaphore, _semaphore); + vk_semaphore_reset_temporary(device, semaphore); - return device->create_sync_for_memory(device, image->memory, - false /* signal_memory */, - &semaphore->temporary); + + if (chain->wsi->signal_semaphore_with_memory) { + return device->create_sync_for_memory(device, image->memory, + false /* signal_memory */, + &semaphore->temporary); + } else { + return vk_sync_create(device, &vk_sync_dummy_type, + 0 /* flags */, 0 /* initial_value */, + &semaphore->temporary); + } } static VkResult @@ -851,15 +860,22 @@ wsi_signal_fence_for_image(struct vk_device *device, const struct wsi_image *image, VkFence _fence) { - VK_FROM_HANDLE(vk_fence, fence, _fence); - - if (!chain->wsi->signal_fence_with_memory) + if (device->physical->supported_sync_types == NULL) return VK_SUCCESS; + VK_FROM_HANDLE(vk_fence, fence, _fence); + vk_fence_reset_temporary(device, fence); - return device->create_sync_for_memory(device, image->memory, - false /* signal_memory */, - &fence->temporary); + + if (chain->wsi->signal_fence_with_memory) { + return device->create_sync_for_memory(device, image->memory, + false /* signal_memory */, + &fence->temporary); + } else { + return vk_sync_create(device, &vk_sync_dummy_type, + 0 /* flags */, 0 /* initial_value */, + &fence->temporary); + } } VkResult