From 3c54d73e4b54c9519170dba27939dadc0d5eb20e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Fri, 14 Aug 2020 23:56:05 -0400 Subject: [PATCH] radeonsi: change PIPE_SHADER to MESA_SHADER (debug flags) Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/gallium/drivers/radeonsi/si_pipe.h | 16 ++++++++-------- src/gallium/drivers/radeonsi/si_shader.c | 12 +++++++----- src/gallium/drivers/radeonsi/si_shader_llvm.c | 4 ++-- src/gallium/drivers/radeonsi/si_shader_llvm_gs.c | 2 +- src/gallium/drivers/radeonsi/si_state_shaders.c | 2 +- 5 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h index 61b36bb06d8..cbef8667e9d 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.h +++ b/src/gallium/drivers/radeonsi/si_pipe.h @@ -141,12 +141,12 @@ enum si_clear_code enum { /* Shader logging options: */ - DBG_VS = PIPE_SHADER_VERTEX, - DBG_PS = PIPE_SHADER_FRAGMENT, - DBG_GS = PIPE_SHADER_GEOMETRY, - DBG_TCS = PIPE_SHADER_TESS_CTRL, - DBG_TES = PIPE_SHADER_TESS_EVAL, - DBG_CS = PIPE_SHADER_COMPUTE, + DBG_VS = MESA_SHADER_VERTEX, + DBG_TCS = MESA_SHADER_TESS_CTRL, + DBG_TES = MESA_SHADER_TESS_EVAL, + DBG_GS = MESA_SHADER_GEOMETRY, + DBG_PS = MESA_SHADER_FRAGMENT, + DBG_CS = MESA_SHADER_COMPUTE, DBG_NO_IR, DBG_NO_NIR, DBG_NO_ASM, @@ -1658,9 +1658,9 @@ static inline struct si_shader *si_get_vs_state(struct si_context *sctx) return vs->current ? vs->current : NULL; } -static inline bool si_can_dump_shader(struct si_screen *sscreen, unsigned processor) +static inline bool si_can_dump_shader(struct si_screen *sscreen, gl_shader_stage stage) { - return sscreen->debug_flags & (1 << processor); + return sscreen->debug_flags & (1 << stage); } static inline bool si_get_strmout_en(struct si_context *sctx) diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index da1f8435da0..44fc036b877 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -1046,7 +1046,7 @@ static void si_shader_dump_stats(struct si_screen *sscreen, struct si_shader *sh { const struct ac_shader_config *conf = &shader->config; - if (!check_debug_option || si_can_dump_shader(sscreen, shader->selector->type)) { + if (!check_debug_option || si_can_dump_shader(sscreen, shader->selector->info.stage)) { if (shader->selector->info.stage == MESA_SHADER_FRAGMENT) { fprintf(file, "*** SHADER CONFIG ***\n" @@ -1114,8 +1114,9 @@ void si_shader_dump(struct si_screen *sscreen, struct si_shader *shader, struct pipe_debug_callback *debug, FILE *file, bool check_debug_option) { enum pipe_shader_type shader_type = shader->selector->type; + gl_shader_stage stage = shader->selector->info.stage; - if (!check_debug_option || si_can_dump_shader(sscreen, shader_type)) + if (!check_debug_option || si_can_dump_shader(sscreen, stage)) si_dump_shader_key(shader, file); if (!check_debug_option && shader->binary.llvm_ir_string) { @@ -1129,7 +1130,7 @@ void si_shader_dump(struct si_screen *sscreen, struct si_shader *shader, } if (!check_debug_option || - (si_can_dump_shader(sscreen, shader_type) && !(sscreen->debug_flags & DBG(NO_ASM)))) { + (si_can_dump_shader(sscreen, stage) && !(sscreen->debug_flags & DBG(NO_ASM)))) { unsigned wave_size = si_get_shader_wave_size(shader); fprintf(file, "\n%s:\n", si_get_shader_name(shader)); @@ -1826,7 +1827,7 @@ static bool si_llvm_compile_shader(struct si_screen *sscreen, struct ac_llvm_com /* Post-optimization transformations and analysis. */ si_optimize_vs_outputs(&ctx); - if ((debug && debug->debug_message) || si_can_dump_shader(sscreen, ctx.type)) { + if ((debug && debug->debug_message) || si_can_dump_shader(sscreen, ctx.stage)) { ctx.shader->info.private_mem_vgprs = ac_count_scratch_private_memory(ctx.main_fn); } @@ -1855,7 +1856,8 @@ bool si_compile_shader(struct si_screen *sscreen, struct ac_llvm_compiler *compi /* Dump NIR before doing NIR->LLVM conversion in case the * conversion fails. */ - if (si_can_dump_shader(sscreen, sel->type) && !(sscreen->debug_flags & DBG(NO_NIR))) { + if (si_can_dump_shader(sscreen, sel->info.stage) && + !(sscreen->debug_flags & DBG(NO_NIR))) { nir_print_shader(nir, stderr); si_dump_streamout(&sel->so); } diff --git a/src/gallium/drivers/radeonsi/si_shader_llvm.c b/src/gallium/drivers/radeonsi/si_shader_llvm.c index 51072c1efc9..724af7ed9bc 100644 --- a/src/gallium/drivers/radeonsi/si_shader_llvm.c +++ b/src/gallium/drivers/radeonsi/si_shader_llvm.c @@ -74,7 +74,7 @@ bool si_compile_llvm(struct si_screen *sscreen, struct si_shader_binary *binary, { unsigned count = p_atomic_inc_return(&sscreen->num_compilations); - if (si_can_dump_shader(sscreen, shader_type)) { + if (si_can_dump_shader(sscreen, tgsi_processor_to_shader_stage(shader_type))) { fprintf(stderr, "radeonsi: Compiling shader %d\n", count); if (!(sscreen->debug_flags & (DBG(NO_IR) | DBG(PREOPT_IR)))) { @@ -197,7 +197,7 @@ void si_llvm_create_func(struct si_shader_context *ctx, const char *name, LLVMTy void si_llvm_optimize_module(struct si_shader_context *ctx) { /* Dump LLVM IR before any optimization passes */ - if (ctx->screen->debug_flags & DBG(PREOPT_IR) && si_can_dump_shader(ctx->screen, ctx->type)) + if (ctx->screen->debug_flags & DBG(PREOPT_IR) && si_can_dump_shader(ctx->screen, ctx->stage)) LLVMDumpModule(ctx->ac.module); /* Run the pass */ diff --git a/src/gallium/drivers/radeonsi/si_shader_llvm_gs.c b/src/gallium/drivers/radeonsi/si_shader_llvm_gs.c index c28fe59e92f..904c81d7165 100644 --- a/src/gallium/drivers/radeonsi/si_shader_llvm_gs.c +++ b/src/gallium/drivers/radeonsi/si_shader_llvm_gs.c @@ -571,7 +571,7 @@ struct si_shader *si_generate_gs_copy_shader(struct si_screen *sscreen, bool ok = false; if (si_compile_llvm(sscreen, &ctx.shader->binary, &ctx.shader->config, ctx.compiler, &ctx.ac, debug, PIPE_SHADER_GEOMETRY, "GS Copy Shader", false)) { - if (si_can_dump_shader(sscreen, PIPE_SHADER_GEOMETRY)) + if (si_can_dump_shader(sscreen, MESA_SHADER_GEOMETRY)) fprintf(stderr, "GS Copy Shader:\n"); si_shader_dump(sscreen, ctx.shader, debug, stderr, true); diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index 432a55dcaa4..16a6f1fcc90 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -2525,7 +2525,7 @@ void si_schedule_initial_compile(struct si_context *sctx, gl_shader_stage stage, struct util_async_debug_callback async_debug; bool debug = (sctx->debug.debug_message && !sctx->debug.async) || sctx->is_debug || - si_can_dump_shader(sctx->screen, pipe_shader_type_from_mesa(stage)); + si_can_dump_shader(sctx->screen, stage); if (debug) { u_async_debug_init(&async_debug); -- 2.30.2