c/main: Guard VkQueue access when calling vkQueuePresentKHR

The VkQueue in vkQueuePresentKHR is externally synchronized, so we need
to take the queue_mutex when we call that function.

Found this with the [latest validation layers][1] and the OpenXR CTS test
Swapchains. This has probably been a longstanding bug in Monado as that
particular code is fairly old.

[1]: https://github.com/KhronosGroup/Vulkan-ValidationLayers/pull/6631
This commit is contained in:
Jakob Bornecrantz 2023-11-19 16:12:29 +00:00
parent c3157335ef
commit adc3fe879d

View file

@ -884,7 +884,12 @@ comp_target_swapchain_present(struct comp_target *ct,
.pImageIndices = &index,
};
// Need to take the queue lock for present.
os_mutex_lock(&vk->queue_mutex);
VkResult ret = vk->vkQueuePresentKHR(queue, &presentInfo);
os_mutex_unlock(&vk->queue_mutex);
#ifdef VK_EXT_display_control
if (cts->vblank.has_started) {