xwayland: add workaround for drivers that don't support impicit sync

Without either implicit or explicit synchronization, the result of rendering is
pretty much undefined, and many glitches can appear. This still doesn't synchronize
buffer release, but it works around most glitches until explicit sync is supported.

Signed-off-by: Xaver Hugl <xaver.hugl@kde.org>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/967>
This commit is contained in:
Xaver Hugl 2024-03-04 17:15:13 +01:00 committed by Olivier Fourdan
parent 89c327f263
commit d411a8b611
2 changed files with 13 additions and 1 deletions

View File

@ -695,7 +695,10 @@ xwl_present_check_flip(RRCrtcPtr crtc,
if (xwl_window->xwl_screen->glamor &&
!xwl_glamor_check_flip(present_window, pixmap))
return FALSE;
#endif
if (!xwl_glamor_supports_implicit_sync(xwl_window->xwl_screen))
return FALSE;
#endif /* XWL_HAS_GLAMOR */
/* Can't flip if the window pixmap doesn't match the xwl_window parent
* window's, e.g. because a client redirected this window or one of its

View File

@ -32,6 +32,9 @@
#include "xwayland-pixmap.h"
#include "xwayland-screen.h"
#include "xwayland-window-buffers.h"
#ifdef XWL_HAS_GLAMOR
#include "glamor.h"
#endif
#define BUFFER_TIMEOUT 1 * 1000 /* ms */
@ -384,6 +387,12 @@ xwl_window_swap_pixmap(struct xwl_window *xwl_window)
/* Hold a reference on the buffer until it's released by the compositor */
xwl_window_buffer->refcnt++;
#ifdef XWL_HAS_GLAMOR
if (!xwl_glamor_supports_implicit_sync(xwl_screen)) {
glamor_finish(xwl_screen->screen);
}
#endif /* XWL_HAS_GLAMOR */
xwl_pixmap_set_buffer_release_cb(xwl_window_buffer->pixmap,
xwl_window_buffer_release_callback,
xwl_window_buffer);