svga: add svga_screen_cache_dump() debug helper
authorBrian Paul <brianp@vmware.com>
Wed, 17 Oct 2012 15:55:54 +0000 (09:55 -0600)
committerBrian Paul <brianp@vmware.com>
Wed, 17 Oct 2012 21:30:33 +0000 (15:30 -0600)
src/gallium/drivers/svga/svga_screen_cache.c
src/gallium/drivers/svga/svga_screen_cache.h

index fa190737286cd5617245176b7c90523d53a75902..09f4fe871ddd63e90f83bba948fbfa2ad95af10c 100644 (file)
@@ -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);
+}
index 55e1c66a6e77c4d5c8a8c9467e4c5018e23e469b..56aff59fd31337adcb5fff588053e54912708f8c 100644 (file)
@@ -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_ */