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.
This commit is contained in:
Michel Dänzer 2023-06-23 18:33:12 +02:00 committed by Michel Dänzer
parent 9fb1f0ef22
commit c38442bc30
3 changed files with 9 additions and 4 deletions

View File

@ -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;

View File

@ -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

View File

@ -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