radeonsi: check has_stable_pstate in the winsys

so that we don't duplicate the condition everywhere

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28725>
This commit is contained in:
Marek Olšák
2024-03-24 13:57:29 -04:00
committed by Marge Bot
parent a094339d64
commit d29d215df7
2 changed files with 7 additions and 5 deletions
+3 -5
View File
@@ -212,8 +212,7 @@ static void si_destroy_context(struct pipe_context *context)
if (sctx->sqtt) {
struct si_screen *sscreen = sctx->screen;
if (sscreen->info.has_stable_pstate && sscreen->b.num_contexts == 1 &&
!(sctx->context_flags & SI_CONTEXT_FLAG_AUX))
if (sscreen->b.num_contexts == 1 && !(sctx->context_flags & SI_CONTEXT_FLAG_AUX))
sscreen->ws->cs_set_pstate(&sctx->gfx_cs, RADEON_CTX_PSTATE_NONE);
si_destroy_sqtt(sctx);
@@ -904,9 +903,8 @@ static struct pipe_context *si_pipe_create_context(struct pipe_screen *screen, v
if (ctx && sscreen->info.gfx_level >= GFX9 && sscreen->debug_flags & DBG(SQTT)) {
/* Auto-enable stable performance profile if possible. */
if (sscreen->info.has_stable_pstate && screen->num_contexts == 1 &&
sscreen->ws->cs_set_pstate(&((struct si_context *)ctx)->gfx_cs, RADEON_CTX_PSTATE_PEAK)) {
}
if (screen->num_contexts == 1)
sscreen->ws->cs_set_pstate(&((struct si_context *)ctx)->gfx_cs, RADEON_CTX_PSTATE_PEAK);
if (ac_check_profile_state(&sscreen->info)) {
fprintf(stderr, "radeonsi: Canceling RGP trace request as a hang condition has been "
@@ -320,6 +320,10 @@ static bool
amdgpu_cs_set_pstate(struct radeon_cmdbuf *rcs, enum radeon_ctx_pstate pstate)
{
struct amdgpu_cs *cs = amdgpu_cs(rcs);
if (!cs->aws->info.has_stable_pstate)
return false;
uint32_t amdgpu_pstate = radeon_to_amdgpu_pstate(pstate);
return amdgpu_cs_ctx_stable_pstate(cs->ctx->ctx,
AMDGPU_CTX_OP_SET_STABLE_PSTATE, amdgpu_pstate, NULL) == 0;