From fbe000734a9d5d03f4a21fd6a81614208f86a46d Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 15 Apr 2024 11:11:39 -0400 Subject: [PATCH] wayland: Refuse offloading when we can't If we have a subsurface with background, but no single-pixel buffer support, refuse to offload. --- gdk/wayland/gdksubsurface-wayland.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gdk/wayland/gdksubsurface-wayland.c b/gdk/wayland/gdksubsurface-wayland.c index 1cf5fa4cf1..eaf5b72e8b 100644 --- a/gdk/wayland/gdksubsurface-wayland.c +++ b/gdk/wayland/gdksubsurface-wayland.c @@ -311,6 +311,7 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub, { GdkWaylandSubsurface *self = GDK_WAYLAND_SUBSURFACE (sub); GdkWaylandSurface *parent = GDK_WAYLAND_SURFACE (sub->parent); + GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (sub->parent)); struct wl_buffer *buffer = NULL; gboolean result = FALSE; GdkWaylandSubsurface *sib = sibling ? GDK_WAYLAND_SUBSURFACE (sibling) : NULL; @@ -457,6 +458,12 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub, gdk_texture_get_height (texture), self); } + else if (has_background && !display->single_pixel_buffer) + { + GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD, + "Cannot offload subsurface %p with background, no single-pixel buffer support", + self); + } else { gboolean was_transparent;