mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 19:58:09 +02:00
vulkan wsi: add support for PresentOptionAsyncMayTear
This commit adds tearing support for Xwayland Signed-off-by: Xaver Hugl <xaver.hugl@gmail.com> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Cc: mesa-stable Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19125>
This commit is contained in:
parent
39aa483760
commit
0a1ccd4a9a
1 changed files with 21 additions and 0 deletions
|
|
@ -68,6 +68,13 @@
|
|||
#include <sys/shm.h>
|
||||
#endif
|
||||
|
||||
#ifndef XCB_PRESENT_OPTION_ASYNC_MAY_TEAR
|
||||
#define XCB_PRESENT_OPTION_ASYNC_MAY_TEAR 16
|
||||
#endif
|
||||
#ifndef XCB_PRESENT_CAPABILITY_ASYNC_MAY_TEAR
|
||||
#define XCB_PRESENT_CAPABILITY_ASYNC_MAY_TEAR 8
|
||||
#endif
|
||||
|
||||
struct wsi_x11_connection {
|
||||
bool has_dri3;
|
||||
bool has_dri3_modifiers;
|
||||
|
|
@ -1045,6 +1052,7 @@ struct x11_swapchain {
|
|||
|
||||
bool has_dri3_modifiers;
|
||||
bool has_mit_shm;
|
||||
bool has_async_may_tear;
|
||||
|
||||
xcb_connection_t * conn;
|
||||
xcb_window_t window;
|
||||
|
|
@ -1601,6 +1609,10 @@ x11_present_to_x11_dri3(struct x11_swapchain *chain, uint32_t image_index,
|
|||
chain->base.present_mode == VK_PRESENT_MODE_FIFO_RELAXED_KHR)
|
||||
options |= XCB_PRESENT_OPTION_ASYNC;
|
||||
|
||||
if (chain->base.present_mode == VK_PRESENT_MODE_IMMEDIATE_KHR
|
||||
&& chain->has_async_may_tear)
|
||||
options |= XCB_PRESENT_OPTION_ASYNC_MAY_TEAR;
|
||||
|
||||
#ifdef HAVE_DRI3_MODIFIERS
|
||||
if (chain->has_dri3_modifiers)
|
||||
options |= XCB_PRESENT_OPTION_SUBOPTIMAL;
|
||||
|
|
@ -2728,6 +2740,15 @@ x11_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
|
|||
chain->has_dri3_modifiers = wsi_conn->has_dri3_modifiers;
|
||||
chain->has_mit_shm = wsi_conn->has_mit_shm;
|
||||
|
||||
xcb_present_query_capabilities_cookie_t present_query_cookie;
|
||||
xcb_present_query_capabilities_reply_t *present_query_reply;
|
||||
present_query_cookie = xcb_present_query_capabilities(conn, chain->window);
|
||||
present_query_reply = xcb_present_query_capabilities_reply(conn, present_query_cookie, NULL);
|
||||
if (present_query_reply) {
|
||||
chain->has_async_may_tear = present_query_reply->capabilities & XCB_PRESENT_CAPABILITY_ASYNC_MAY_TEAR;
|
||||
free(present_query_reply);
|
||||
}
|
||||
|
||||
/* When images in the swapchain don't fit the window, X can still present them, but it won't
|
||||
* happen by flip, only by copy. So this is a suboptimal copy, because if the client would change
|
||||
* the chain extents X may be able to flip
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue