Skip to content

RFC: vulkan/wsi/x11: properly treat XCB_PRESENT_COMPLETE_MODE_SUBOPTIMAL_COPY

Yiwei Zhang requested to merge zzyiwei/mesa:vk-wsi-suboptimal-linux-dmabuf into main

What does this MR do and why?

vulkan/wsi/x11: properly treat XCB_PRESENT_COMPLETE_MODE_SUBOPTIMAL_COPY

Currently Xwayland always sends PresentCompleteModeSuboptimalCopy when it has received new dmabuf feedback before present_execute_post (with vblank->kind == PresentCompleteKindPixmap). From the Xwayland side commit xorg/xserver@d67383a6, it believes it's the X11 client's responsibility to query and check the new feedback.

Meanwhile, mesa X11 directly treats XCB_PRESENT_COMPLETE_MODE_SUBOPTIMAL_COPY as VK_SUBOPTIMAL_KHR, hinting the app to initiate the swapchain recreation to follow the latest feedback.

However, the false alarm here is that the set of modifiers in the feedback can very likely be identical to the list in use (might be a Wayland compositor bug? per !26616 (comment 2214838)). So at least one side has to do the check to avoid putting the chain into sticky suboptimal status.

Based on the mode description:

'mode' is PresentCompleteModeSuboptimalCopy when the source pixmap contents are copied but it would be possible to flip the pixmap if the buffer format/modifier was different (options given to PresentPixmap must contain PresentOptionSuboptimal).

It reads to me that Xwayland side should check if the format/modifier is indeed different or not before brutely returning suboptimal copy as the complete mode.

/cc @olv @ryanneph @lfrb @daniels

Edited by Yiwei Zhang

Merge request reports