xwayland: Try manual redirection for surface window in glamor_check_flip

If the surface window already uses automatic redirection, we can upgrade
to manual redirection and save some blits with common use cases.

This fixes a minor performance regression from a65bb8480a ('Revert
"xwayland/glamor: Avoid implicit redirection with depth 32 parent
windows"') with mutter >= 44.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1570>
This commit is contained in:
Michel Dänzer 2024-06-13 18:43:11 +02:00 committed by Marge Bot
parent e1b8a12194
commit 8e8bc0a1ef

View File

@ -93,6 +93,8 @@ xwl_glamor_check_flip(WindowPtr present_window, PixmapPtr pixmap)
{ {
ScreenPtr screen = pixmap->drawable.pScreen; ScreenPtr screen = pixmap->drawable.pScreen;
PixmapPtr backing_pixmap = screen->GetWindowPixmap(present_window); PixmapPtr backing_pixmap = screen->GetWindowPixmap(present_window);
struct xwl_window *xwl_window = xwl_window_from_window(present_window);
WindowPtr surface_window = xwl_window->surface_window;
if (pixmap->drawable.depth != backing_pixmap->drawable.depth) { if (pixmap->drawable.depth != backing_pixmap->drawable.depth) {
if (pixmap->drawable.depth == 32) if (pixmap->drawable.depth == 32)
@ -101,6 +103,10 @@ xwl_glamor_check_flip(WindowPtr present_window, PixmapPtr pixmap)
return xwl_present_maybe_redirect_window(present_window); return xwl_present_maybe_redirect_window(present_window);
} }
if (surface_window->redirectDraw == RedirectDrawAutomatic &&
surface_window->drawable.depth != 32)
xwl_present_maybe_redirect_window(surface_window);
return TRUE; return TRUE;
} }