[gtk/debug-envvars-cleanup: 9/14] gsk: Use the new debug macros
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/debug-envvars-cleanup: 9/14] gsk: Use the new debug macros
- Date: Fri, 23 Sep 2022 22:52:25 +0000 (UTC)
commit 9818ec4ad999557f807235dae2aa6b4fda6515dc
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Sep 22 21:36:50 2022 -0400
gsk: Use the new debug macros
gsk/gl/gskgltexturelibrary.c | 47 +++++++++++++++++++----------------
gsk/gskdebug.c | 2 ++
gsk/gskrenderer.c | 8 +++---
gsk/gskrendernode.c | 6 ++---
gsk/gskrendernodeimpl.c | 8 +++---
gsk/vulkan/gskvulkanglyphcache.c | 11 ++++----
gsk/vulkan/gskvulkanpipelineprivate.h | 2 +-
gsk/vulkan/gskvulkanrenderpass.c | 22 ++++++++--------
gsk/vulkan/gskvulkanshader.c | 2 +-
9 files changed, 57 insertions(+), 51 deletions(-)
---
diff --git a/gsk/gl/gskgltexturelibrary.c b/gsk/gl/gskgltexturelibrary.c
index 24d3c5ab12..c2ec0f84ab 100644
--- a/gsk/gl/gskgltexturelibrary.c
+++ b/gsk/gl/gskgltexturelibrary.c
@@ -74,9 +74,9 @@ gsk_gl_texture_library_real_compact (GskGLTextureLibrary *self,
if (gsk_gl_texture_atlas_get_unused_ratio (atlas) > MAX_OLD_RATIO)
{
- GSK_NOTE (GLYPH_CACHE,
- g_message ("Dropping atlas %d (%g.2%% old)", i,
- 100.0 * gsk_gl_texture_atlas_get_unused_ratio (atlas)));
+ GSK_DEBUG (GLYPH_CACHE,
+ "Dropping atlas %d (%g.2%% old)", i,
+ 100.0 * gsk_gl_texture_atlas_get_unused_ratio (atlas));
if (removed == NULL)
removed = g_ptr_array_new_with_free_func ((GDestroyNotify)gsk_gl_texture_atlas_free);
g_ptr_array_add (removed, g_ptr_array_steal_index (self->atlases, i - 1));
@@ -122,14 +122,14 @@ gsk_gl_texture_library_real_compact (GskGLTextureLibrary *self,
}
}
- GSK_NOTE (GLYPH_CACHE, g_message ("%s: Dropped %d individual items",
- G_OBJECT_TYPE_NAME (self),
- dropped);
- g_message ("%s: %d items cached (%d atlased, %d individually)",
- G_OBJECT_TYPE_NAME (self),
- g_hash_table_size (self->hash_table),
- atlased,
- g_hash_table_size (self->hash_table) - atlased));
+ GSK_DEBUG (GLYPH_CACHE, "%s: Dropped %d individual items",
+ G_OBJECT_TYPE_NAME (self),
+ dropped);
+ GSK_DEBUG (GLYPH_CACHE, "%s: %d items cached (%d atlased, %d individually)",
+ G_OBJECT_TYPE_NAME (self),
+ g_hash_table_size (self->hash_table),
+ atlased,
+ g_hash_table_size (self->hash_table) - atlased);
if (dropped > 0)
gsk_gl_texture_library_clear_cache (self);
@@ -139,17 +139,20 @@ gsk_gl_texture_library_real_compact (GskGLTextureLibrary *self,
g_clear_pointer (&removed, g_ptr_array_unref);
}
- GSK_NOTE (GLYPH_CACHE, {
- static gint64 last_message;
- gint64 now = g_get_monotonic_time ();
- if (now - last_message > G_USEC_PER_SEC)
- {
- last_message = now;
- g_message ("%s contains %d atlases",
- G_OBJECT_TYPE_NAME (self),
- self->atlases->len);
- }
- });
+#ifdef G_ENABLE_DEBUG
+ if (GSK_DEBUG_CHECK (GLYPH_CACHE))
+ {
+ static gint64 last_message;
+ gint64 now = g_get_monotonic_time ();
+ if (now - last_message > G_USEC_PER_SEC)
+ {
+ last_message = now;
+ gdk_debug_message ("%s contains %d atlases",
+ G_OBJECT_TYPE_NAME (self),
+ self->atlases->len);
+ }
+ }
+#endif
return ret;
}
diff --git a/gsk/gskdebug.c b/gsk/gskdebug.c
index 83a3619fe7..cda64af2fa 100644
--- a/gsk/gskdebug.c
+++ b/gsk/gskdebug.c
@@ -1,3 +1,5 @@
+#include "config.h"
+
#include "gskdebugprivate.h"
#include "gdk/gdk-private.h"
diff --git a/gsk/gskrenderer.c b/gsk/gskrenderer.c
index a3ceb0172b..eeb6408506 100644
--- a/gsk/gskrenderer.c
+++ b/gsk/gskrenderer.c
@@ -648,10 +648,10 @@ gsk_renderer_new_for_surface (GdkSurface *surface)
if (gsk_renderer_realize (renderer, surface, &error))
{
- GSK_RENDERER_NOTE (renderer, RENDERER,
- g_message ("Using renderer of type '%s' for surface '%s'\n",
- G_OBJECT_TYPE_NAME (renderer),
- G_OBJECT_TYPE_NAME (surface)));
+ GSK_RENDERER_DEBUG (renderer, RENDERER,
+ "Using renderer of type '%s' for surface '%s'",
+ G_OBJECT_TYPE_NAME (renderer),
+ G_OBJECT_TYPE_NAME (surface));
return renderer;
}
diff --git a/gsk/gskrendernode.c b/gsk/gskrendernode.c
index 14a29c358c..1587ab61b3 100644
--- a/gsk/gskrendernode.c
+++ b/gsk/gskrendernode.c
@@ -439,9 +439,9 @@ gsk_render_node_draw (GskRenderNode *node,
cairo_save (cr);
- GSK_NOTE (CAIRO, g_message ("Rendering node %s[%p]",
- g_type_name_from_instance ((GTypeInstance *) node),
- node));
+ GSK_DEBUG (CAIRO, "Rendering node %s[%p]",
+ g_type_name_from_instance ((GTypeInstance *) node),
+ node);
GSK_RENDER_NODE_GET_CLASS (node)->draw (node, cr);
diff --git a/gsk/gskrendernodeimpl.c b/gsk/gskrendernodeimpl.c
index c43a4636c1..ef5158313f 100644
--- a/gsk/gskrendernodeimpl.c
+++ b/gsk/gskrendernodeimpl.c
@@ -2881,10 +2881,10 @@ gsk_transform_node_draw (GskRenderNode *node,
gsk_transform_to_2d (self->transform, &xx, &yx, &xy, &yy, &dx, &dy);
cairo_matrix_init (&ctm, xx, yx, xy, yy, dx, dy);
- GSK_NOTE (CAIRO, g_message ("CTM = { .xx = %g, .yx = %g, .xy = %g, .yy = %g, .x0 = %g, .y0 = %g }",
- ctm.xx, ctm.yx,
- ctm.xy, ctm.yy,
- ctm.x0, ctm.y0));
+ GSK_DEBUG (CAIRO, "CTM = { .xx = %g, .yx = %g, .xy = %g, .yy = %g, .x0 = %g, .y0 = %g }",
+ ctm.xx, ctm.yx,
+ ctm.xy, ctm.yy,
+ ctm.x0, ctm.y0);
if (xx * yy == xy * yx)
{
/* broken matrix here. This can happen during transitions
diff --git a/gsk/vulkan/gskvulkanglyphcache.c b/gsk/vulkan/gskvulkanglyphcache.c
index 830b4d70c9..f1adefafca 100644
--- a/gsk/vulkan/gskvulkanglyphcache.c
+++ b/gsk/vulkan/gskvulkanglyphcache.c
@@ -309,8 +309,8 @@ upload_dirty_glyphs (GskVulkanGlyphCache *cache,
for (l = atlas->dirty_glyphs, i = 0; l; l = l->next, i++)
render_glyph (atlas, (DirtyGlyph *)l->data, ®ions[i]);
- GSK_RENDERER_NOTE (cache->renderer, GLYPH_CACHE,
- g_message ("uploading %d glyphs to cache", num_regions));
+ GSK_RENDERER_DEBUG (cache->renderer, GLYPH_CACHE,
+ "uploading %d glyphs to cache", num_regions);
gsk_vulkan_image_upload_regions (atlas->image, uploader, num_regions, regions);
@@ -471,8 +471,9 @@ gsk_vulkan_glyph_cache_begin_frame (GskVulkanGlyphCache *cache)
if (atlas->old_pixels > MAX_OLD * atlas->width * atlas->height)
{
- GSK_RENDERER_NOTE(cache->renderer, GLYPH_CACHE,
- g_message ("Dropping atlas %d (%g.2%% old)", i, 100.0 * (double)atlas->old_pixels /
(double)(atlas->width * atlas->height)));
+ GSK_RENDERER_DEBUG (cache->renderer, GLYPH_CACHE,
+ "Dropping atlas %d (%g.2%% old)",
+ i, 100.0 * (double)atlas->old_pixels / (double)(atlas->width * atlas->height));
g_ptr_array_remove_index (cache->atlases, i);
drops[i] = 1;
@@ -501,5 +502,5 @@ gsk_vulkan_glyph_cache_begin_frame (GskVulkanGlyphCache *cache)
}
}
- GSK_RENDERER_NOTE(cache->renderer, GLYPH_CACHE, g_message ("Dropped %d glyphs", dropped));
+ GSK_RENDERER_DEBUG (cache->renderer, GLYPH_CACHE, "Dropped %d glyphs", dropped);
}
diff --git a/gsk/vulkan/gskvulkanpipelineprivate.h b/gsk/vulkan/gskvulkanpipelineprivate.h
index cd41f822b3..9adf44a1b6 100644
--- a/gsk/vulkan/gskvulkanpipelineprivate.h
+++ b/gsk/vulkan/gskvulkanpipelineprivate.h
@@ -25,7 +25,7 @@ gsk_vulkan_handle_result (VkResult res,
{
if (res != VK_SUCCESS)
{
- GSK_NOTE (VULKAN,g_printerr ("%s(): %s (%d)\n", called_function, gdk_vulkan_strerror (res), res));
+ GSK_DEBUG (VULKAN, "%s(): %s (%d)", called_function, gdk_vulkan_strerror (res), res);
}
return res;
}
diff --git a/gsk/vulkan/gskvulkanrenderpass.c b/gsk/vulkan/gskvulkanrenderpass.c
index 34b035245a..48127e20b9 100644
--- a/gsk/vulkan/gskvulkanrenderpass.c
+++ b/gsk/vulkan/gskvulkanrenderpass.c
@@ -235,7 +235,7 @@ gsk_vulkan_render_pass_free (GskVulkanRenderPass *self)
}
#define FALLBACK(...) G_STMT_START { \
- GSK_RENDERER_NOTE (gsk_vulkan_render_get_renderer (render), FALLBACK, g_message (__VA_ARGS__)); \
+ GSK_RENDERER_DEBUG (gsk_vulkan_render_get_renderer (render), FALLBACK, __VA_ARGS__); \
goto fallback; \
}G_STMT_END
@@ -763,9 +763,9 @@ gsk_vulkan_render_pass_get_node_as_texture (GskVulkanRenderPass *self,
}
}
- GSK_RENDERER_NOTE (gsk_vulkan_render_get_renderer (render), FALLBACK, g_message ("Node as texture not
implemented for this case. Using %gx%g fallback surface",
- ceil (bounds->size.width),
- ceil (bounds->size.height)));
+ GSK_RENDERER_DEBUG (gsk_vulkan_render_get_renderer (render), FALLBACK, "Node as texture not implemented
for this case. Using %gx%g fallback surface",
+ ceil (bounds->size.width),
+ ceil (bounds->size.height));
#ifdef G_ENABLE_DEBUG
{
GskProfiler *profiler = gsk_renderer_get_profiler (gsk_vulkan_render_get_renderer (render));
@@ -816,13 +816,13 @@ gsk_vulkan_render_pass_upload_fallback (GskVulkanRenderPass *self,
node = op->node;
- GSK_RENDERER_NOTE (gsk_vulkan_render_get_renderer (render), FALLBACK,
- g_message ("Upload op=%s, node %s[%p], bounds %gx%g",
- op->type == GSK_VULKAN_OP_FALLBACK_CLIP ? "fallback-clip" :
- (op->type == GSK_VULKAN_OP_FALLBACK_ROUNDED_CLIP ? "fallback-rounded-clip" :
"fallback"),
- g_type_name_from_instance ((GTypeInstance *) node), node,
- ceil (node->bounds.size.width),
- ceil (node->bounds.size.height)));
+ GSK_RENDERER_DEBUG (gsk_vulkan_render_get_renderer (render), FALLBACK,
+ "Upload op=%s, node %s[%p], bounds %gx%g",
+ op->type == GSK_VULKAN_OP_FALLBACK_CLIP ? "fallback-clip" :
+ (op->type == GSK_VULKAN_OP_FALLBACK_ROUNDED_CLIP ? "fallback-rounded-clip" :
"fallback"),
+ g_type_name_from_instance ((GTypeInstance *) node), node,
+ ceil (node->bounds.size.width),
+ ceil (node->bounds.size.height));
#ifdef G_ENABLE_DEBUG
{
GskProfiler *profiler = gsk_renderer_get_profiler (gsk_vulkan_render_get_renderer (render));
diff --git a/gsk/vulkan/gskvulkanshader.c b/gsk/vulkan/gskvulkanshader.c
index 0446412ea7..bd7475a7f0 100644
--- a/gsk/vulkan/gskvulkanshader.c
+++ b/gsk/vulkan/gskvulkanshader.c
@@ -65,7 +65,7 @@ gsk_vulkan_shader_new_from_resource (GdkVulkanContext *context,
g_free (path);
if (bytes == NULL)
{
- GSK_NOTE (VULKAN, g_message ("Error loading shader data: %s", local_error->message));
+ GSK_DEBUG (VULKAN, "Error loading shader data: %s", local_error->message);
g_propagate_error (error, local_error);
return NULL;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]