From: Nicolai Hähnle <nicolai.haeh...@amd.com> Fixes: 420c438589c8 ("radeonsi: log draw and compute state into log context") --- src/gallium/drivers/radeonsi/si_debug.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/src/gallium/drivers/radeonsi/si_debug.c b/src/gallium/drivers/radeonsi/si_debug.c index c2242a6deab..43ad73d92df 100644 --- a/src/gallium/drivers/radeonsi/si_debug.c +++ b/src/gallium/drivers/radeonsi/si_debug.c @@ -53,72 +53,78 @@ struct si_log_chunk_shader { /* The shader destroy code assumes a current context for unlinking of * PM4 packets etc. * * While we should be able to destroy shaders without a context, doing * so would happen only very rarely and be therefore likely to fail * just when you're trying to debug something. Let's just remember the * current context in the chunk. */ struct si_context *ctx; struct si_shader *shader; + enum pipe_shader_type processor; /* For keep-alive reference counts */ struct si_shader_selector *sel; struct si_compute *program; }; static void si_log_chunk_shader_destroy(void *data) { struct si_log_chunk_shader *chunk = data; si_shader_selector_reference(chunk->ctx, &chunk->sel, NULL); si_compute_reference(&chunk->program, NULL); FREE(chunk); } static void si_log_chunk_shader_print(void *data, FILE *f) { struct si_log_chunk_shader *chunk = data; struct si_screen *sscreen = chunk->ctx->screen; - si_dump_shader(sscreen, chunk->shader->selector->info.processor, + si_dump_shader(sscreen, chunk->processor, chunk->shader, f); } static struct u_log_chunk_type si_log_chunk_type_shader = { .destroy = si_log_chunk_shader_destroy, .print = si_log_chunk_shader_print, }; static void si_dump_gfx_shader(struct si_context *ctx, const struct si_shader_ctx_state *state, struct u_log_context *log) { struct si_shader *current = state->current; if (!state->cso || !current) return; struct si_log_chunk_shader *chunk = CALLOC_STRUCT(si_log_chunk_shader); chunk->ctx = ctx; + chunk->processor = state->cso->info.processor; chunk->shader = current; si_shader_selector_reference(ctx, &chunk->sel, current->selector); u_log_chunk(log, &si_log_chunk_type_shader, chunk); } -static void si_dump_compute_shader(const struct si_cs_shader_state *state, +static void si_dump_compute_shader(struct si_context *ctx, struct u_log_context *log) { - if (!state->program || state->program != state->emitted_program) + const struct si_cs_shader_state *state = &ctx->cs_shader_state; + + if (!state->program) return; struct si_log_chunk_shader *chunk = CALLOC_STRUCT(si_log_chunk_shader); + chunk->ctx = ctx; + chunk->processor = PIPE_SHADER_COMPUTE; chunk->shader = &state->program->shader; si_compute_reference(&chunk->program, state->program); u_log_chunk(log, &si_log_chunk_type_shader, chunk); } /** * Shader compiles can be overridden with arbitrary ELF objects by setting * the environment variable RADEON_REPLACE_SHADERS=num1:filename1[;num2:filename2] */ bool si_replace_shader(unsigned num, struct ac_shader_binary *binary) @@ -737,22 +743,21 @@ static void si_dump_gfx_descriptors(struct si_context *sctx, { if (!state->cso || !state->current) return; si_dump_descriptors(sctx, state->cso->type, &state->cso->info, log); } static void si_dump_compute_descriptors(struct si_context *sctx, struct u_log_context *log) { - if (!sctx->cs_shader_state.program || - sctx->cs_shader_state.program != sctx->cs_shader_state.emitted_program) + if (!sctx->cs_shader_state.program) return; si_dump_descriptors(sctx, PIPE_SHADER_COMPUTE, NULL, log); } struct si_shader_inst { char text[160]; /* one disasm line */ unsigned offset; /* instruction offset */ unsigned size; /* instruction size = 4 or 8 */ }; @@ -1060,21 +1065,21 @@ void si_log_draw_state(struct si_context *sctx, struct u_log_context *log) si_dump_gfx_descriptors(sctx, &sctx->tes_shader, log); si_dump_gfx_descriptors(sctx, &sctx->gs_shader, log); si_dump_gfx_descriptors(sctx, &sctx->ps_shader, log); } void si_log_compute_state(struct si_context *sctx, struct u_log_context *log) { if (!log) return; - si_dump_compute_shader(&sctx->cs_shader_state, log); + si_dump_compute_shader(sctx, log); si_dump_compute_descriptors(sctx, log); } static void si_dump_dma(struct si_context *sctx, struct radeon_saved_cs *saved, FILE *f) { static const char ib_name[] = "sDMA IB"; unsigned i; si_dump_bo_list(sctx, saved, f); -- 2.11.0 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev