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