From 4292fb2139282e6906d4ad2a8be2fd81ed7ca8af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Mon, 21 Dec 2020 15:41:56 +0100 Subject: [PATCH] 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 Part-of: --- src/vulkan/wsi/wsi_common_x11.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c index 26ffa902172..5da44dfc270 100644 --- a/src/vulkan/wsi/wsi_common_x11.c +++ b/src/vulkan/wsi/wsi_common_x11.c @@ -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;