wsi/x11: Use PresentOptionAsync for MAILBOX present mode with Xwayland

This allows Xwayland to forward buffers to the Wayland compositor ASAP
for fullscreen / undecorated windows, which in turn allows true mailbox
behaviour in the Wayland compositor.

Without this, Xwayland has to emulate the mailbox behaviour itself,
which it cannot do as well as the Wayland compositor by design.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8197>
This commit is contained in:
Michel Dänzer 2020-12-21 15:41:56 +01:00 committed by Michel Dänzer
parent b5268d532a
commit 4292fb2139
1 changed files with 7 additions and 0 deletions

View File

@ -1059,7 +1059,14 @@ x11_present_to_x11_dri3(struct x11_swapchain *chain, uint32_t image_index,
int64_t divisor = 0;
int64_t remainder = 0;
struct wsi_x11_connection *wsi_conn =
wsi_x11_connection_create((struct wsi_device*)chain->base.wsi, chain->conn);
if (!wsi_conn)
return VK_ERROR_OUT_OF_HOST_MEMORY;
if (chain->base.present_mode == VK_PRESENT_MODE_IMMEDIATE_KHR ||
(chain->base.present_mode == VK_PRESENT_MODE_MAILBOX_KHR &&
wsi_conn->is_xwayland) ||
chain->base.present_mode == VK_PRESENT_MODE_FIFO_RELAXED_KHR)
options |= XCB_PRESENT_OPTION_ASYNC;