Mesa (master): wsi/x11: Use PresentOptionAsync for MAILBOX present mode with Xwayland

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jan 7 14:32:50 UTC 2021


Module: Mesa
Branch: master
Commit: 4292fb2139282e6906d4ad2a8be2fd81ed7ca8af
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4292fb2139282e6906d4ad2a8be2fd81ed7ca8af

Author: Michel Dänzer <mdaenzer at redhat.com>
Date:   Mon Dec 21 15:41:56 2020 +0100

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 at basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8197>

---

 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;
 



More information about the mesa-commit mailing list