summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/svga
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2012-10-17 09:55:54 -0600
committerBrian Paul <[email protected]>2012-10-17 15:30:33 -0600
commit0d1ee26489af98df68c43b8a9b1b51454fe10fdd (patch)
tree5b3ebe09a0a986fdcd0f1828dedddd366a63870c /src/gallium/drivers/svga
parente20a0f14b5fdbff9afa5d0d6ee35de8728f6a200 (diff)
svga: add svga_screen_cache_dump() debug helper
Diffstat (limited to 'src/gallium/drivers/svga')
-rw-r--r--src/gallium/drivers/svga/svga_screen_cache.c34
-rw-r--r--src/gallium/drivers/svga/svga_screen_cache.h3
2 files changed, 37 insertions, 0 deletions
diff --git a/src/gallium/drivers/svga/svga_screen_cache.c b/src/gallium/drivers/svga/svga_screen_cache.c
index fa190737286..09f4fe871dd 100644
--- a/src/gallium/drivers/svga/svga_screen_cache.c
+++ b/src/gallium/drivers/svga/svga_screen_cache.c
@@ -490,3 +490,37 @@ svga_screen_surface_destroy(struct svga_screen *svgascreen,
sws->surface_reference(sws, p_handle, NULL);
}
}
+
+
+/**
+ * Print/dump the contents of the screen cache. For debugging.
+ */
+void
+svga_screen_cache_dump(const struct svga_screen *svgascreen)
+{
+ const struct svga_host_surface_cache *cache = &svgascreen->cache;
+ unsigned bucket;
+ unsigned count = 0;
+
+ debug_printf("svga3d surface cache:\n");
+ for (bucket = 0; bucket < SVGA_HOST_SURFACE_CACHE_BUCKETS; bucket++) {
+ struct list_head *curr;
+ curr = cache->bucket[bucket].next;
+ while (curr && curr != &cache->bucket[bucket]) {
+ struct svga_host_surface_cache_entry *entry =
+ LIST_ENTRY(struct svga_host_surface_cache_entry,
+ curr, bucket_head);
+ if (entry->key.format != 37) {
+ debug_printf(" %u x %u x %u format %u\n",
+ entry->key.size.width,
+ entry->key.size.height,
+ entry->key.size.depth,
+ entry->key.format);
+ }
+ curr = curr->next;
+ count++;
+ }
+ }
+
+ debug_printf("%u surfaces, %u bytes\n", count, cache->total_size);
+}
diff --git a/src/gallium/drivers/svga/svga_screen_cache.h b/src/gallium/drivers/svga/svga_screen_cache.h
index 55e1c66a6e7..56aff59fd31 100644
--- a/src/gallium/drivers/svga/svga_screen_cache.h
+++ b/src/gallium/drivers/svga/svga_screen_cache.h
@@ -144,5 +144,8 @@ svga_screen_surface_destroy(struct svga_screen *svgascreen,
const struct svga_host_surface_cache_key *key,
struct svga_winsys_surface **handle);
+void
+svga_screen_cache_dump(const struct svga_screen *svgascreen);
+
#endif /* SVGA_SCREEN_CACHE_H_ */