diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-03-01 09:08:19 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-03-01 09:08:19 +0000 |
commit | e05d2e481434084291503efdb84c944a560d8c29 (patch) | |
tree | a0b9b230f2316c883faa6e10fe3870109e0a3c5d | |
parent | 89038ddb96aabc4bc1f04402b2aca0ce546e8bf3 (diff) |
sna: Track number of pixmaps allocated whilst counting bo leaks
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna.h | 8 | ||||
-rw-r--r-- | src/sna/sna_accel.c | 9 |
2 files changed, 13 insertions, 4 deletions
diff --git a/src/sna/sna.h b/src/sna/sna.h index f259e2b2..7dc838c2 100644 --- a/src/sna/sna.h +++ b/src/sna/sna.h @@ -296,10 +296,10 @@ struct sna { #if DEBUG_MEMORY struct { - int shadow_pixels_allocs; - int cpu_bo_allocs; - size_t shadow_pixels_bytes; - size_t cpu_bo_bytes; + int pixmap_allocs; + int cpu_bo_allocs; + size_t shadow_pixels_bytes; + size_t cpu_bo_bytes; } debug_memory; #endif }; diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index bacd4313..fd2337ff 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -760,6 +760,9 @@ create_pixmap(struct sna *sna, ScreenPtr screen, #endif pixmap->usage_hint = usage_hint; +#if DEBUG_MEMORY + sna->debug_memory.pixmap_allocs++; +#endif DBG(("%s: serial=%ld, usage=%d, %dx%d\n", __FUNCTION__, @@ -1313,6 +1316,10 @@ static Bool sna_destroy_pixmap(PixmapPtr pixmap) if (--pixmap->refcnt) return TRUE; +#if DEBUG_MEMORY + to_sna_from_pixmap(pixmap)->debug_memory.pixmap_allocs--; +#endif + priv = sna_pixmap(pixmap); DBG(("%s: pixmap=%ld, attached?=%d\n", __FUNCTION__, pixmap->drawable.serialNumber, priv != NULL)); @@ -14021,6 +14028,8 @@ static bool sna_accel_do_debug_memory(struct sna *sna) static void sna_accel_debug_memory(struct sna *sna) { + ErrorF("Allocated pixmaps: %d\n", + sna->debug_memory.pixmap_allocs); ErrorF("Allocated bo: %d, %ld bytes\n", sna->kgem.debug_memory.bo_allocs, (long)sna->kgem.debug_memory.bo_bytes); |