Skip to content

vulkan/wsi/x11: do not inherit last_present_mode

Chia-I Wu requested to merge olv/mesa:vk-wsi-suboptimal into main

Under XWayland, the first present after a window resize is sometimes completed with COPY (seems to happen when the previous present with the old size is pending; not really sure). The following presents are completed with FLIP.

When a swapchain is created with an old swapchain, and old_chain->last_present_mode is FLIP, chain->last_present_mode is set to FLIP as well. This causes the new swapchain to be marked VK_SUBOPTIMAL_KHR, which is sticky, if the first present is completed with COPY.

Instead of inheriting, treat each swapchain as independent. We will miss the case where an old swapchain is flipping but a new swapchain is copying. But swapchain reallocation normally happens in response to present engine state change. If the newly allocated swapchain is copying, another reallocation is unlikely to fix that.

/cc @lfrb @daniels

Merge request reports