From 61af9cb76bc9ac8d5e6723a35fde0140cd3eeb11 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Wed, 30 Dec 2020 14:16:51 -0500 Subject: [PATCH] pan/bi: Add internal debug flag Since 31864017510 ("pan/bi: Suppress disassembly for internal shaders"), we haven't had a good way to debug blit shaders. I keep rewriting this patch manually, let's just a debug flag for it. Signed-off-by: Alyssa Rosenzweig Reviewed-by: Boris Brezillon Part-of: --- src/panfrost/bifrost/bifrost.h | 1 + src/panfrost/bifrost/bifrost_compile.c | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/panfrost/bifrost/bifrost.h b/src/panfrost/bifrost/bifrost.h index d9c9730d6cb..d9a78b3c65a 100644 --- a/src/panfrost/bifrost/bifrost.h +++ b/src/panfrost/bifrost/bifrost.h @@ -33,6 +33,7 @@ #define BIFROST_DBG_SHADERS 0x0002 #define BIFROST_DBG_SHADERDB 0x0004 #define BIFROST_DBG_VERBOSE 0x0008 +#define BIFROST_DBG_INTERNAL 0x0010 extern int bifrost_debug; diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c index 8073db20913..68e3975fd43 100644 --- a/src/panfrost/bifrost/bifrost_compile.c +++ b/src/panfrost/bifrost/bifrost_compile.c @@ -42,6 +42,7 @@ static const struct debug_named_value bifrost_debug_options[] = { {"shaders", BIFROST_DBG_SHADERS, "Dump shaders in NIR and MIR"}, {"shaderdb", BIFROST_DBG_SHADERDB, "Print statistics"}, {"verbose", BIFROST_DBG_VERBOSE, "Disassemble verbosely"}, + {"internal", BIFROST_DBG_INTERNAL, "Dump even internal shaders"}, DEBUG_NAMED_VALUE_END }; @@ -2325,7 +2326,10 @@ bifrost_compile_shader_nir(void *mem_ctx, nir_shader *nir, NIR_PASS_V(nir, pan_nir_reorder_writeout); - if (bifrost_debug & BIFROST_DBG_SHADERS && !nir->info.internal) { + bool skip_internal = nir->info.internal; + skip_internal &= !(bifrost_debug & BIFROST_DBG_INTERNAL); + + if (bifrost_debug & BIFROST_DBG_SHADERS && !skip_internal) { nir_print_shader(nir, stdout); } @@ -2370,11 +2374,11 @@ bifrost_compile_shader_nir(void *mem_ctx, nir_shader *nir, bi_lower_fau(ctx, block); } - if (bifrost_debug & BIFROST_DBG_SHADERS && !nir->info.internal) + if (bifrost_debug & BIFROST_DBG_SHADERS && !skip_internal) bi_print_shader(ctx, stdout); bi_schedule(ctx); bi_register_allocate(ctx); - if (bifrost_debug & BIFROST_DBG_SHADERS && !nir->info.internal) + if (bifrost_debug & BIFROST_DBG_SHADERS && !skip_internal) bi_print_shader(ctx, stdout); util_dynarray_init(&program->compiled, NULL);