vulkan/wsi: Reset the image fence right before vkQueueSubmit

Instead of resetting at the top of the loop, we create the fence in the
signaled state and then unconditionally reset it before vkQueueSubmit.
This gives us a bit more flexibility with how we handle the fence in the
case where the client provides zero semaphores.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16333>
This commit is contained in:
Jason Ekstrand 2020-03-03 12:45:16 -06:00 committed by Marge Bot
parent 5576e8b735
commit 5f4ee14895

View file

@ -900,7 +900,7 @@ wsi_common_queue_present(const struct wsi_device *wsi,
const VkFenceCreateInfo fence_info = {
.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO,
.pNext = NULL,
.flags = 0,
.flags = VK_FENCE_CREATE_SIGNALED_BIT,
};
result = wsi->CreateFence(device, &fence_info,
&swapchain->alloc,
@ -926,11 +926,6 @@ wsi_common_queue_present(const struct wsi_device *wsi,
true, ~0ull);
if (result != VK_SUCCESS)
goto fail_present;
result =
wsi->ResetFences(device, 1, &swapchain->fences[image_index]);
if (result != VK_SUCCESS)
goto fail_present;
}
struct wsi_image *image =
@ -971,6 +966,10 @@ wsi_common_queue_present(const struct wsi_device *wsi,
submit_info.pWaitDstStageMask = stage_flags;
}
result = wsi->ResetFences(device, 1, &swapchain->fences[image_index]);
if (result != VK_SUCCESS)
goto fail_present;
VkFence fence = swapchain->fences[image_index];
if (swapchain->use_buffer_blit) {
if (swapchain->buffer_blit_queue == VK_NULL_HANDLE) {