From c38442bc305048dc547db711773b642a50c4cb04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Fri, 23 Jun 2023 18:33:12 +0200 Subject: [PATCH] xwayland/glamor: Require equal pixmap depths in xwl_glamor_check_flip This will be needed with the next commit: If a child window completely obscures a toplevel ancestor of different depth, the child window can use page flipping only if the depth of the presented pixmap matches that of the window's backing pixmap, or the former may contain pixel values which are not suitable for the toplevel window's depth. --- hw/xwayland/xwayland-glamor.c | 9 +++++++-- hw/xwayland/xwayland-glamor.h | 2 +- hw/xwayland/xwayland-present.c | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/hw/xwayland/xwayland-glamor.c b/hw/xwayland/xwayland-glamor.c index 3c03b2523..9ac1aa8d4 100644 --- a/hw/xwayland/xwayland-glamor.c +++ b/hw/xwayland/xwayland-glamor.c @@ -85,9 +85,14 @@ glamor_egl_screen_init(ScreenPtr screen, struct glamor_context *glamor_ctx) } Bool -xwl_glamor_check_flip(PixmapPtr pixmap) +xwl_glamor_check_flip(WindowPtr present_window, PixmapPtr pixmap) { - struct xwl_screen *xwl_screen = xwl_screen_get(pixmap->drawable.pScreen); + ScreenPtr screen = pixmap->drawable.pScreen; + struct xwl_screen *xwl_screen = xwl_screen_get(screen); + PixmapPtr backing_pixmap = screen->GetWindowPixmap(present_window); + + if (pixmap->drawable.depth != backing_pixmap->drawable.depth) + return FALSE; if (!xwl_glamor_pixmap_get_wl_buffer(pixmap)) return FALSE; diff --git a/hw/xwayland/xwayland-glamor.h b/hw/xwayland/xwayland-glamor.h index 313d7faf1..183fe755a 100644 --- a/hw/xwayland/xwayland-glamor.h +++ b/hw/xwayland/xwayland-glamor.h @@ -149,7 +149,7 @@ Bool xwl_glamor_get_drawable_modifiers_and_scanout(DrawablePtr drawable, Bool *supports_scanout); Bool xwl_glamor_get_drawable_modifiers(DrawablePtr drawable, uint32_t format, uint32_t *num_modifiers, uint64_t **modifiers); -Bool xwl_glamor_check_flip(PixmapPtr pixmap); +Bool xwl_glamor_check_flip(WindowPtr present_window, PixmapPtr pixmap); PixmapPtr xwl_glamor_create_pixmap_for_window (struct xwl_window *xwl_window); #ifdef XV diff --git a/hw/xwayland/xwayland-present.c b/hw/xwayland/xwayland-present.c index 42fd0067a..5ede33e4c 100644 --- a/hw/xwayland/xwayland-present.c +++ b/hw/xwayland/xwayland-present.c @@ -676,7 +676,7 @@ xwl_present_check_flip(RRCrtcPtr crtc, if (!RegionEqual(&present_window->clipList, &present_window->winSize)) return FALSE; - if (!xwl_glamor_check_flip(pixmap)) + if (!xwl_glamor_check_flip(present_window, pixmap)) return FALSE; /* Can't flip if the window pixmap doesn't match the xwl_window parent