mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 09:08:10 +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>
(cherry picked from commit 0a1ccd4a9a)
This commit is contained in:
parent
0a6043c632
commit
2537864f90
2 changed files with 22 additions and 1 deletions
|
|
@ -4584,7 +4584,7 @@
|
|||
"description": "vulkan wsi: add support for PresentOptionAsyncMayTear",
|
||||
"nominated": true,
|
||||
"nomination_type": 0,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null,
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -1041,6 +1048,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;
|
||||
|
|
@ -1597,6 +1605,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;
|
||||
|
|
@ -2724,6 +2736,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