aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_program_cache.c
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2016-11-11 14:47:53 -0800
committerKenneth Graunke <[email protected]>2017-01-17 21:47:36 -0800
commitce892392948e18241a872878873dbdd46e546fb2 (patch)
treeec134b285ca4e9fdf0cd76de0c39d0586688f74a /src/mesa/drivers/dri/i965/brw_program_cache.c
parentf9edc550b2bb76f77e33b6cb122a91f266bc5958 (diff)
i965: Move program cache printing to brw_program_cache.c.
It makes sense to put a function which prints out the entire contents of the program cache in the file that implements the program cache. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Eduardo Lima Mitev <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_program_cache.c')
-rw-r--r--src/mesa/drivers/dri/i965/brw_program_cache.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_program_cache.c b/src/mesa/drivers/dri/i965/brw_program_cache.c
index 3d95372bc0e..8939fb110fd 100644
--- a/src/mesa/drivers/dri/i965/brw_program_cache.c
+++ b/src/mesa/drivers/dri/i965/brw_program_cache.c
@@ -480,3 +480,49 @@ brw_destroy_caches(struct brw_context *brw)
{
brw_destroy_cache(brw, &brw->cache);
}
+
+static const char *
+cache_name(enum brw_cache_id cache_id)
+{
+ switch (cache_id) {
+ case BRW_CACHE_VS_PROG:
+ return "VS kernel";
+ case BRW_CACHE_TCS_PROG:
+ return "TCS kernel";
+ case BRW_CACHE_TES_PROG:
+ return "TES kernel";
+ case BRW_CACHE_FF_GS_PROG:
+ return "Fixed-function GS kernel";
+ case BRW_CACHE_GS_PROG:
+ return "GS kernel";
+ case BRW_CACHE_CLIP_PROG:
+ return "CLIP kernel";
+ case BRW_CACHE_SF_PROG:
+ return "SF kernel";
+ case BRW_CACHE_FS_PROG:
+ return "FS kernel";
+ case BRW_CACHE_CS_PROG:
+ return "CS kernel";
+ default:
+ return "unknown";
+ }
+}
+
+void
+brw_print_program_cache(struct brw_context *brw)
+{
+ const struct brw_cache *cache = &brw->cache;
+ struct brw_cache_item *item;
+
+ drm_intel_bo_map(cache->bo, false);
+
+ for (unsigned i = 0; i < cache->size; i++) {
+ for (item = cache->items[i]; item; item = item->next) {
+ fprintf(stderr, "%s:\n", cache_name(i));
+ brw_disassemble(&brw->screen->devinfo, cache->bo->virtual,
+ item->offset, item->size, stderr);
+ }
+ }
+
+ drm_intel_bo_unmap(cache->bo);
+}