From ca0ed07588a26c6a46bb753633b5d0ff8153d4fc Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Tue, 17 Jun 2025 14:51:50 +0200 Subject: [PATCH] ac/pm4: determine spi_shader_pgm_lo_reg when PKT3_SET_SH_REG_PAIRS is used MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Marek Olšák Part-of: --- src/amd/common/ac_pm4.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/amd/common/ac_pm4.c b/src/amd/common/ac_pm4.c index df9a6d9448c..cfb7541ebd2 100644 --- a/src/amd/common/ac_pm4.c +++ b/src/amd/common/ac_pm4.c @@ -204,6 +204,22 @@ ac_pm4_finalize(struct ac_pm4_state *state) } } } + + if (state->debug_sqtt && state->last_opcode == PKT3_SET_SH_REG_PAIRS) { + /* Set reg_va_low_idx to where the shader address is stored in the pm4 state. */ + unsigned reg_count = (PKT_COUNT_G(state->pm4[state->last_pm4]) + 1) / 2; + + for (unsigned i = 0; i < reg_count; i++) { + unsigned reg_base_offset = SI_SH_REG_OFFSET + state->pm4[state->last_pm4 + 1 + 2 * i] * 4; + if (strstr(ac_get_register_name(state->info->gfx_level, + state->info->family, reg_base_offset), + "SPI_SHADER_PGM_LO_")) { + state->spi_shader_pgm_lo_reg = reg_base_offset; + + break; + } + } + } } void