From 8ea72e912c96192c1c22eed8d05c23dc7ba5abb9 Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Wed, 25 Sep 2024 10:29:03 +0200 Subject: [PATCH] glamor: Add debug for pixmap allocations Add a new debug level (4) to track GLAMOR pixmap allocations. Signed-off-by: Olivier Fourdan --- glamor/glamor.c | 3 +++ glamor/glamor_debug.h | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/glamor/glamor.c b/glamor/glamor.c index 914c414a1..b1d224c65 100644 --- a/glamor/glamor.c +++ b/glamor/glamor.c @@ -234,6 +234,7 @@ glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth, if (usage == GLAMOR_CREATE_PIXMAP_NO_TEXTURE) { glamor_init_pixmap_private_small(pixmap, pixmap_priv); + glamor_debug_pixmap_alloc("pixmap %p\n", pixmap); return pixmap; } else if (usage == GLAMOR_CREATE_NO_LARGE || @@ -255,6 +256,7 @@ glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth, } glamor_pixmap_attach_fbo(pixmap, fbo); + glamor_debug_pixmap_alloc("pixmap %p\n", pixmap); return pixmap; } @@ -263,6 +265,7 @@ Bool glamor_destroy_pixmap(PixmapPtr pixmap) { if (pixmap->refcnt == 1) { + glamor_debug_pixmap_alloc("pixmap %p\n", pixmap); glamor_pixmap_destroy_fbo(pixmap); } diff --git a/glamor/glamor_debug.h b/glamor/glamor_debug.h index 68189d484..1f076c034 100644 --- a/glamor/glamor_debug.h +++ b/glamor/glamor_debug.h @@ -34,6 +34,7 @@ #define GLAMOR_DEBUG_FALLBACK 1 #define GLAMOR_DEBUG_TEXTURE_DOWNLOAD 2 #define GLAMOR_DEBUG_TEXTURE_DYNAMIC_UPLOAD 3 +#define GLAMOR_DEBUG_PIXMAP_ALLOC 4 #define GLAMOR_PANIC(_format_, ...) \ do { \ @@ -66,6 +67,13 @@ "Glamor fallback", \ ##__VA_ARGS__);} while(0) +#define glamor_debug_pixmap_alloc(_format_,...) \ + do { \ + if (glamor_debug_level >= GLAMOR_DEBUG_PIXMAP_ALLOC) \ + __debug_output_message(_format_, \ + "Glamor pixmap alloc", \ + ##__VA_ARGS__);} while(0) + #define DEBUGF(str, ...) do {} while(0) //#define DEBUGF(str, ...) ErrorF(str, ##__VA_ARGS__) #define DEBUGRegionPrint(x) do {} while (0)