summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeonsi
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2017-11-26 03:08:59 +0100
committerMarek Olšák <[email protected]>2017-11-29 18:21:30 +0100
commit2208b760f338fbd9176f4375e23f0ba20a05ce96 (patch)
treec339a3613e4f7d0ffef0389563f418fa3b4d09a9 /src/gallium/drivers/radeonsi
parente4cce7dbbab178018d43fc64a6808ae8f3c6e305 (diff)
radeonsi: move shader debug helpers out of r600_pipe_common.c
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi')
-rw-r--r--src/gallium/drivers/radeonsi/si_compute.c2
-rw-r--r--src/gallium/drivers/radeonsi/si_pipe.h13
-rw-r--r--src/gallium/drivers/radeonsi/si_shader.c14
-rw-r--r--src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c4
-rw-r--r--src/gallium/drivers/radeonsi/si_state_shaders.c2
5 files changed, 24 insertions, 11 deletions
diff --git a/src/gallium/drivers/radeonsi/si_compute.c b/src/gallium/drivers/radeonsi/si_compute.c
index dc409895602..f3dce65e3dd 100644
--- a/src/gallium/drivers/radeonsi/si_compute.c
+++ b/src/gallium/drivers/radeonsi/si_compute.c
@@ -178,7 +178,7 @@ static void *si_create_compute_state(
bool wait =
(sctx->debug.debug_message && !sctx->debug.async) ||
sctx->is_debug ||
- si_can_dump_shader(&sscreen->b, PIPE_SHADER_COMPUTE);
+ si_can_dump_shader(sscreen, PIPE_SHADER_COMPUTE);
if (wait) {
u_async_debug_init(&async_debug);
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h
index 3131a8bf24b..0c16cfb71b8 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -750,6 +750,19 @@ 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)
+{
+ return sscreen->b.debug_flags & (1 << processor);
+}
+
+static inline bool si_extra_shader_checks(struct si_screen *sscreen,
+ unsigned processor)
+{
+ return (sscreen->b.debug_flags & DBG(CHECK_IR)) ||
+ si_can_dump_shader(sscreen, processor);
+}
+
static inline bool si_get_strmout_en(struct si_context *sctx)
{
return sctx->streamout.streamout_enabled ||
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index 0340133a8af..e942d345dbc 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -5171,7 +5171,7 @@ static void si_shader_dump_stats(struct si_screen *sscreen,
max_simd_waves = MIN2(max_simd_waves, 16384 / lds_per_wave);
if (!check_debug_option ||
- si_can_dump_shader(&sscreen->b, processor)) {
+ si_can_dump_shader(sscreen, processor)) {
if (processor == PIPE_SHADER_FRAGMENT) {
fprintf(file, "*** SHADER CONFIG ***\n"
"SPI_PS_INPUT_ADDR = 0x%04x\n"
@@ -5243,7 +5243,7 @@ void si_shader_dump(struct si_screen *sscreen, const struct si_shader *shader,
FILE *file, bool check_debug_option)
{
if (!check_debug_option ||
- si_can_dump_shader(&sscreen->b, processor))
+ si_can_dump_shader(sscreen, processor))
si_dump_shader_key(processor, shader, file);
if (!check_debug_option && shader->binary.llvm_ir_string) {
@@ -5260,7 +5260,7 @@ void si_shader_dump(struct si_screen *sscreen, const struct si_shader *shader,
}
if (!check_debug_option ||
- (si_can_dump_shader(&sscreen->b, processor) &&
+ (si_can_dump_shader(sscreen, processor) &&
!(sscreen->b.debug_flags & DBG(NO_ASM)))) {
fprintf(file, "\n%s:\n", si_get_shader_name(shader, processor));
@@ -5298,7 +5298,7 @@ static int si_compile_llvm(struct si_screen *sscreen,
int r = 0;
unsigned count = p_atomic_inc_return(&sscreen->b.num_compilations);
- if (si_can_dump_shader(&sscreen->b, processor)) {
+ if (si_can_dump_shader(sscreen, processor)) {
fprintf(stderr, "radeonsi: Compiling shader %d\n", count);
if (!(sscreen->b.debug_flags & (DBG(NO_IR) | DBG(PREOPT_IR)))) {
@@ -5498,7 +5498,7 @@ si_generate_gs_copy_shader(struct si_screen *sscreen,
debug, PIPE_SHADER_GEOMETRY,
"GS Copy Shader");
if (!r) {
- if (si_can_dump_shader(&sscreen->b, PIPE_SHADER_GEOMETRY))
+ if (si_can_dump_shader(sscreen, PIPE_SHADER_GEOMETRY))
fprintf(stderr, "GS Copy Shader:\n");
si_shader_dump(sscreen, ctx.shader, debug,
PIPE_SHADER_GEOMETRY, stderr, true);
@@ -6416,7 +6416,7 @@ int si_compile_tgsi_shader(struct si_screen *sscreen,
/* Dump TGSI code before doing TGSI->LLVM conversion in case the
* conversion fails. */
- if (si_can_dump_shader(&sscreen->b, sel->info.processor) &&
+ if (si_can_dump_shader(sscreen, sel->info.processor) &&
!(sscreen->b.debug_flags & DBG(NO_TGSI))) {
if (sel->tokens)
tgsi_dump(sel->tokens, 0);
@@ -6625,7 +6625,7 @@ int si_compile_tgsi_shader(struct si_screen *sscreen,
si_optimize_vs_outputs(&ctx);
if ((debug && debug->debug_message) ||
- si_can_dump_shader(&sscreen->b, ctx.type))
+ si_can_dump_shader(sscreen, ctx.type))
si_count_scratch_private_memory(&ctx);
/* Compile to bytecode. */
diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
index 59d02605e9f..9c1ea91f06e 100644
--- a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
+++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
@@ -1359,7 +1359,7 @@ void si_llvm_optimize_module(struct si_shader_context *ctx)
/* Dump LLVM IR before any optimization passes */
if (ctx->screen->b.debug_flags & DBG(PREOPT_IR) &&
- si_can_dump_shader(&ctx->screen->b, ctx->type))
+ si_can_dump_shader(ctx->screen, ctx->type))
LLVMDumpModule(ctx->gallivm.module);
/* Create the pass manager */
@@ -1368,7 +1368,7 @@ void si_llvm_optimize_module(struct si_shader_context *ctx)
target_library_info = gallivm_create_target_library_info(triple);
LLVMAddTargetLibraryInfo(target_library_info, gallivm->passmgr);
- if (si_extra_shader_checks(&ctx->screen->b, ctx->type))
+ if (si_extra_shader_checks(ctx->screen, ctx->type))
LLVMAddVerifierPass(gallivm->passmgr);
LLVMAddAlwaysInlinerPass(gallivm->passmgr);
diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c
index 513e30b6abe..53955307b4f 100644
--- a/src/gallium/drivers/radeonsi/si_state_shaders.c
+++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
@@ -2272,7 +2272,7 @@ static void *si_create_shader_selector(struct pipe_context *ctx,
bool wait =
(sctx->debug.debug_message && !sctx->debug.async) ||
sctx->is_debug ||
- si_can_dump_shader(&sscreen->b, sel->info.processor);
+ si_can_dump_shader(sscreen, sel->info.processor);
if (wait) {
u_async_debug_init(&async_debug);