From 3fc9de7539128f06f91e323817f30cef32dba662 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 24 Apr 2024 20:38:45 -0400 Subject: [PATCH] offload: Make logging more compact MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use a format of [XXX] SYMBOL DETAILS where SYMBOL indicates the offloading status: 🗙 - no offload ▲ - offload above, with background △ - offload above, no background ▼ - offload below, with background ▽ - offload below, no background --- gdk/wayland/gdksubsurface-wayland.c | 76 +++++++++++++++-------------- gsk/gskoffload.c | 16 +++--- 2 files changed, 47 insertions(+), 45 deletions(-) diff --git a/gdk/wayland/gdksubsurface-wayland.c b/gdk/wayland/gdksubsurface-wayland.c index d9e0c8ad0f..666c66b428 100644 --- a/gdk/wayland/gdksubsurface-wayland.c +++ b/gdk/wayland/gdksubsurface-wayland.c @@ -411,63 +411,61 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub, if (!scaled_rect_is_integral (dest, 1, &device_rect)) { GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD, - "Non-integer coordinates %g %g %g %g for %dx%d texture, hiding subsurface %p", + "[%p] 🗙 Non-integral coordinates %g %g %g %g", + self, dest->origin.x, dest->origin.y, - dest->size.width, dest->size.height, - gdk_texture_get_width (texture), - gdk_texture_get_height (texture), - self); + dest->size.width, dest->size.height); } else if (!scaled_rect_is_integral (dest, scale, &device_rect)) { GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD, - "Non-integral device coordinates %g %g %g %g (fractional scale %.2f), hiding subsurface %p", + "[%p] 🗙 Non-integral device coordinates %g %g %g %g (scale %.2f)", + self, device_rect.origin.x, device_rect.origin.y, device_rect.size.width, device_rect.size.height, - scale, - self); + scale); } else if (background && !scaled_rect_is_integral (background, 1, &device_rect)) { GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD, - "Non-integral background coordinates %g %g %g %g, hiding subsurface %p", + "[%p] 🗙 Non-integral background coordinates %g %g %g %g", + self, background->origin.x, background->origin.y, - background->size.width, background->size.height, - self); + background->size.width, background->size.height); } else if (background && !scaled_rect_is_integral (background, scale, &device_rect)) { GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD, - "Non-integral background device coordinates %g %g %g %g (fractional scale %.2f), hiding subsurface %p", + "[%p] 🗙 Non-integral background device coordinates %g %g %g %g (scale %.2f)", + self, device_rect.origin.x, device_rect.origin.y, device_rect.size.width, device_rect.size.height, - scale, - self); + scale); } else if (!GDK_IS_DMABUF_TEXTURE (texture) && !GDK_DISPLAY_DEBUG_CHECK (gdk_surface_get_display (sub->parent), FORCE_OFFLOAD)) { GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD, - "%dx%d %s is not a GdkDmabufTexture, hiding subsurface %p", - gdk_texture_get_width (texture), - gdk_texture_get_height (texture), + "[%p] 🗙 %s (%dx%d) is not a GdkDmabufTexture", + self, G_OBJECT_TYPE_NAME (texture), - self); + gdk_texture_get_width (texture), + gdk_texture_get_height (texture)); } else if (!will_be_above && gdk_memory_format_alpha (gdk_texture_get_format (texture)) != GDK_MEMORY_ALPHA_OPAQUE && !has_background) { GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD, - "Cannot offload non-opaque %dx%d texture below, hiding subsurface %p", + "[%p] 🗙 Non-opaque texture (%dx%d) below", + self, gdk_texture_get_width (texture), - gdk_texture_get_height (texture), - self); + gdk_texture_get_height (texture)); } 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", + "[%p] 🗙 Texture has background, but no single-pixel buffer support", self); } else @@ -496,35 +494,39 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub, } GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD, - "Attached %dx%d texture to subsurface %p at %d %d %d %d%s%s", + "[%p] %s Attaching texture (%dx%d) at %d %d %d %d", + self, + will_be_above + ? (has_background ? "▲" : "△") + : (has_background ? "▼" : "▽"), gdk_texture_get_width (texture), gdk_texture_get_height (texture), - self, self->dest.x, self->dest.y, - self->dest.width, self->dest.height, - will_be_above ? ", above parent" : "", - has_background ? ", with background" : ""); + self->dest.width, self->dest.height); result = TRUE; } else { GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD, - "Compositor failed to create wl_buffer for %dx%d texture, hiding subsurface %p", - gdk_texture_get_width (texture), - gdk_texture_get_height (texture), + "[%p] 🗙 Failed to create wl_buffer", self); } } else { + if (dest_changed) + GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD, + "[%p] %s Moving texture (%dx%d) to %d %d %d %d", + self, + will_be_above + ? (has_background ? "▲" : "△") + : (has_background ? "▼" : "▽"), + gdk_texture_get_width (texture), + gdk_texture_get_height (texture), + self->dest.x, self->dest.y, + self->dest.width, self->dest.height); + buffer = NULL; - GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD, - "Moved %dx%d texture in subsurface %p to %d %d %d %d", - gdk_texture_get_width (texture), - gdk_texture_get_height (texture), - self, - self->dest.x, self->dest.y, - self->dest.width, self->dest.height); result = TRUE; } } diff --git a/gsk/gskoffload.c b/gsk/gskoffload.c index 11c83c08ff..0a3d7dd1bd 100644 --- a/gsk/gskoffload.c +++ b/gsk/gskoffload.c @@ -137,7 +137,7 @@ find_texture_to_attach (GskOffload *self, } GDK_DISPLAY_DEBUG (gdk_surface_get_display (self->surface), OFFLOAD, - "Can't offload subsurface %p: too much content, container with %d children", + "[%p] 🗙 Too much content, container with %d children", subsurface, gsk_container_node_get_n_children (node)); goto out; @@ -149,7 +149,7 @@ find_texture_to_attach (GskOffload *self, { char *s = gsk_transform_to_string (t); GDK_DISPLAY_DEBUG (gdk_surface_get_display (self->surface), OFFLOAD, - "Can't offload subsurface %p: transform %s is not just scale/translate", + "[%p] 🗙 Transform %s is not just scale/translate", subsurface, s); g_free (s); goto out; @@ -177,7 +177,7 @@ find_texture_to_attach (GskOffload *self, if (!gsk_rect_intersection (c, &clip, &clip)) { GDK_DISPLAY_DEBUG (gdk_surface_get_display (self->surface), OFFLOAD, - "Can't offload subsurface %p: empty clip", subsurface); + "[%p] 🗙 Empty clip", subsurface); goto out; } } @@ -227,7 +227,7 @@ find_texture_to_attach (GskOffload *self, default: GDK_DISPLAY_DEBUG (gdk_surface_get_display (self->surface), OFFLOAD, - "Can't offload subsurface %p: Only textures supported but found %s", + "[%p] 🗙 Only textures supported (found %s)", subsurface, g_type_name_from_instance ((GTypeInstance *) node)); goto out; } @@ -488,7 +488,7 @@ visit_node (GskOffload *self, type != GSK_DEBUG_NODE) { GDK_DISPLAY_DEBUG (gdk_surface_get_display (self->surface), OFFLOAD, - "Can't raise subsurface %p because a %s overlaps", + "[%p] Lowering because a %s overlaps", info->subsurface, g_type_name_from_instance ((GTypeInstance *) node)); info->can_raise = FALSE; @@ -631,19 +631,19 @@ complex_clip: if (info == NULL) { GDK_DISPLAY_DEBUG (gdk_surface_get_display (self->surface), OFFLOAD, - "Can't offload: unknown subsurface %p", + "[%p] 🗙 Unknown subsurface", subsurface); } else if (!self->current_clip->is_fully_contained) { GDK_DISPLAY_DEBUG (gdk_surface_get_display (self->surface), OFFLOAD, - "Can't offload subsurface %p: clipped", + "[%p] 🗙 Clipped", subsurface); } else if (gsk_transform_get_category (transform) < GSK_TRANSFORM_CATEGORY_2D_AFFINE) { GDK_DISPLAY_DEBUG (gdk_surface_get_display (self->surface), OFFLOAD, - "Can't offload subsurface %p: non-affine transform", + "[%p] 🗙 Non-affine transform", subsurface); } else