From 010c00828a4fec4527f44e3d2a5d34e50dfe835b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Wed, 16 Jul 2025 16:30:53 +0200 Subject: [PATCH] xwayland/present: Only flip if the window pixmap dimensions match If they don't, attaching the new buffer changes the dimensions of the wl_surface representing the window, which can break stuff as described in https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2044 . Part-of: --- hw/xwayland/xwayland-present.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/hw/xwayland/xwayland-present.c b/hw/xwayland/xwayland-present.c index 07d58ee6a..dcacb8ee8 100644 --- a/hw/xwayland/xwayland-present.c +++ b/hw/xwayland/xwayland-present.c @@ -741,6 +741,7 @@ xwl_present_check_flip(RRCrtcPtr crtc, WindowPtr toplvl_window = xwl_present_toplvl_pixmap_window(present_window); struct xwl_window *xwl_window = xwl_window_from_window(present_window); ScreenPtr screen = pixmap->drawable.pScreen; + PixmapPtr window_pixmap = screen->GetWindowPixmap(present_window); if (reason) *reason = PRESENT_FLIP_REASON_UNKNOWN; @@ -761,9 +762,11 @@ xwl_present_check_flip(RRCrtcPtr crtc, if (valid) return FALSE; - /* Flip pixmap must have same dimensions as window */ + /* Flip pixmap must have same dimensions as the window and its pixmap */ if (present_window->drawable.width != pixmap->drawable.width || - present_window->drawable.height != pixmap->drawable.height) + present_window->drawable.height != pixmap->drawable.height || + pixmap->drawable.width != window_pixmap->drawable.width || + pixmap->drawable.height != window_pixmap->drawable.height) return FALSE; if (!xwl_pixmap_get_wl_buffer(pixmap)) @@ -781,7 +784,7 @@ xwl_present_check_flip(RRCrtcPtr crtc, * window's, e.g. because a client redirected this window or one of its * parents. */ - if (screen->GetWindowPixmap(xwl_window->surface_window) != screen->GetWindowPixmap(present_window)) + if (screen->GetWindowPixmap(xwl_window->surface_window) != window_pixmap) return FALSE; /*