radv: inhibit clock gating when tracing with SQTT

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8616>
(cherry picked from commit 5b5cd18853)
This commit is contained in:
Samuel Pitoiset 2021-01-21 10:14:48 +01:00 committed by Dylan Baker
parent acfd179fe3
commit 291eebfaa4
2 changed files with 24 additions and 1 deletions

View file

@ -130,7 +130,7 @@
"description": "radv: inhibit clock gating when tracing with SQTT",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"master_sha": null,
"because_sha": null
},

View file

@ -357,6 +357,19 @@ radv_emit_spi_config_cntl(struct radv_device *device,
}
}
static void
radv_emit_inhibit_clockgating(struct radv_device *device,
struct radeon_cmdbuf *cs, bool inhibit)
{
if (device->physical_device->rad_info.chip_class >= GFX10) {
radeon_set_uconfig_reg(cs, R_037390_RLC_PERFMON_CLK_CNTL,
S_037390_PERFMON_CLOCK_STATE(inhibit));
} else if (device->physical_device->rad_info.chip_class >= GFX8) {
radeon_set_uconfig_reg(cs, R_0372FC_RLC_PERFMON_CLK_CNTL,
S_0372FC_PERFMON_CLOCK_STATE(inhibit));
}
}
static void
radv_emit_wait_for_idle(struct radv_device *device,
struct radeon_cmdbuf *cs, int family)
@ -407,6 +420,11 @@ radv_thread_trace_init_cs(struct radv_device *device)
device->thread_trace.start_cs[family],
family);
/* Disable clock gating before starting SQTT. */
radv_emit_inhibit_clockgating(device,
device->thread_trace.start_cs[family],
true);
/* Enable SQG events that collects thread trace data. */
radv_emit_spi_config_cntl(device,
device->thread_trace.start_cs[family],
@ -456,6 +474,11 @@ radv_thread_trace_init_cs(struct radv_device *device)
device->thread_trace.stop_cs[family],
false);
/* Restore previous state by re-enabling clock gating. */
radv_emit_inhibit_clockgating(device,
device->thread_trace.stop_cs[family],
false);
result = ws->cs_finalize(device->thread_trace.stop_cs[family]);
if (result != VK_SUCCESS)
return;