Wait for device to be idle because this function is also called in
window resizes.
And if we destroy old swapchain it also destroy the old VkImages,
those images could be in use by a vulkan render.
This fixes a issue reported in Mesa repository when running
GTK with Xe KMD.
Fixes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9044
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
device = gdk_vulkan_context_get_device (context);
+ /*
+ * Wait for device to be idle because this function is also called in window resizes.
+ * And if we destroy old swapchain it also destroy the old VkImages, those images could
+ * be in use by a vulkan render.
+ */
+ vkDeviceWaitIdle (device);
+
res = GDK_VK_CHECK (vkGetPhysicalDeviceSurfaceCapabilitiesKHR, gdk_vulkan_context_get_physical_device (context),
priv->surface,
&capabilities);