vulkan/wsi/wayland: return VK_ERROR_NATIVE_WINDOW_IN_USE_KHR

If the surface is already in use by another swapchain, return
VK_ERROR_NATIVE_WINDOW_IN_USE_KHR. The spec states:

> If pCreateInfo->oldSwapchain is VK_NULL_HANDLE, and the native
> window referred to by pCreateInfo->surface is already associated
> with a Vulkan swapchain, VK_ERROR_NATIVE_WINDOW_IN_USE_KHR must
> be returned.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Acked-by: Daniel Stone <daniels@collabora.com>
References: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7467
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19229>
This commit is contained in:
Simon Ser 2022-10-21 15:35:55 +02:00 committed by Marge Bot
parent b4921b5d7a
commit 2fdc3846e7

View file

@ -1775,14 +1775,13 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
return VK_ERROR_OUT_OF_HOST_MEMORY;
/* We are taking ownership of the wsi_wl_surface, so remove ownership from
* oldSwapchain.
*
* If the surface is currently owned by a swapchain that is not
* oldSwapchain we should return VK_ERROR_NATIVE_WINDOW_IN_USE_KHR. There's
* an open issue tracking that:
*
* https://gitlab.freedesktop.org/mesa/mesa/-/issues/7467
* oldSwapchain. If the surface is currently owned by a swapchain that is
* not oldSwapchain we return an error.
*/
if (wsi_wl_surface->chain &&
wsi_swapchain_to_handle(&wsi_wl_surface->chain->base) != pCreateInfo->oldSwapchain) {
return VK_ERROR_NATIVE_WINDOW_IN_USE_KHR;
}
if (pCreateInfo->oldSwapchain) {
VK_FROM_HANDLE(wsi_wl_swapchain, old_chain, pCreateInfo->oldSwapchain);
old_chain->wsi_wl_surface = NULL;