From c7d56b0e294f572c0685a572077b5bfdfbf33b49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Thu, 15 Feb 2024 18:34:13 +0100 Subject: [PATCH] xwayland/present: Redirect surface window as needed for page flips It's needed when the surface window is a depth 24 descendant of a depth 32 toplevel window. xwl_source_validate ensures the toplevel window pixmap has valid contents when a client reads from it, or when the window hierarchy / geometry changes. It's never called in the normal fullscreen application case, so there's no GPU copy overhead with that. v2: * Don't try to redirect a depth 32 descendant of different-depth ancestors, the alpha channel wouldn't be handled correctly. (Olivier Fourdan) Part-of: --- hw/xwayland/xwayland-glamor.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/xwayland/xwayland-glamor.c b/hw/xwayland/xwayland-glamor.c index f03366437..ab56fe551 100644 --- a/hw/xwayland/xwayland-glamor.c +++ b/hw/xwayland/xwayland-glamor.c @@ -46,6 +46,7 @@ #include "xwayland-dmabuf.h" #include "xwayland-glamor.h" #include "xwayland-glamor-gbm.h" +#include "xwayland-present.h" #include "xwayland-screen.h" #include "xwayland-window.h" #include "xwayland-window-buffers.h" @@ -96,8 +97,12 @@ xwl_glamor_check_flip(WindowPtr present_window, PixmapPtr pixmap) ScreenPtr screen = pixmap->drawable.pScreen; PixmapPtr backing_pixmap = screen->GetWindowPixmap(present_window); - if (pixmap->drawable.depth != backing_pixmap->drawable.depth) - return FALSE; + if (pixmap->drawable.depth != backing_pixmap->drawable.depth) { + if (pixmap->drawable.depth == 32) + return FALSE; + + return xwl_present_maybe_redirect_window(present_window, pixmap); + } return TRUE; }