From: Bhawanpreet Lakha <bhawanpreet.la...@amd.com>

[Why&How]
Some panels don't meet the stutter threshold (4k etc), this leads to
power regressions. Allow z8 for panels that don't meet the threshold
but support PSR/replay

Reviewed-by: Nicholas Kazlauskas <nicholas.kazlaus...@amd.com>
Acked-by: Tom Chung <chiahsuan.ch...@amd.com>
Signed-off-by: Bhawanpreet Lakha <bhawanpreet.la...@amd.com>
---
 drivers/gpu/drm/amd/display/dc/dml/dcn35/dcn35_fpu.c | 2 +-
 drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.c   | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn35/dcn35_fpu.c 
b/drivers/gpu/drm/amd/display/dc/dml/dcn35/dcn35_fpu.c
index 33ea89f20449..714c2fe03c5f 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn35/dcn35_fpu.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn35/dcn35_fpu.c
@@ -603,7 +603,7 @@ void dcn35_decide_zstate_support(struct dc *dc, struct 
dc_state *context)
                if (is_pwrseq0 && allow_z10)
                        support = DCN_ZSTATE_SUPPORT_ALLOW;
                else if (is_pwrseq0 && (is_psr || is_replay))
-                       support = allow_z8 ? 
DCN_ZSTATE_SUPPORT_ALLOW_Z8_Z10_ONLY : DCN_ZSTATE_SUPPORT_ALLOW_Z10_ONLY;
+                       support = DCN_ZSTATE_SUPPORT_ALLOW_Z8_Z10_ONLY;
                else if (allow_z8)
                        support = DCN_ZSTATE_SUPPORT_ALLOW_Z8_ONLY;
 
diff --git a/drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.c 
b/drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.c
index 72cca367062e..e2489eaabb20 100644
--- a/drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.c
+++ b/drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.c
@@ -570,6 +570,7 @@ static bool dml2_validate_and_build_resource(const struct 
dc *in_dc, struct dc_s
        struct dml2_dcn_clocks out_clks;
        unsigned int result = 0;
        bool need_recalculation = false;
+       uint32_t cstate_enter_plus_exit_z8_ns;
 
        if (!context || context->stream_count == 0)
                return true;
@@ -641,6 +642,14 @@ static bool dml2_validate_and_build_resource(const struct 
dc *in_dc, struct dc_s
                
dml2_extract_watermark_set(&context->bw_ctx.bw.dcn.watermarks.d, 
&dml2->v20.dml_core_ctx);
                //copy for deciding zstate use
                context->bw_ctx.dml.vba.StutterPeriod = 
context->bw_ctx.dml2->v20.dml_core_ctx.mp.StutterPeriod;
+
+               cstate_enter_plus_exit_z8_ns = 
context->bw_ctx.bw.dcn.watermarks.a.cstate_pstate.cstate_enter_plus_exit_z8_ns;
+
+               if (context->bw_ctx.dml.vba.StutterPeriod < 
in_dc->debug.minimum_z8_residency_time &&
+                               cstate_enter_plus_exit_z8_ns < 
in_dc->debug.minimum_z8_residency_time * 1000)
+                       cstate_enter_plus_exit_z8_ns = 
in_dc->debug.minimum_z8_residency_time * 1000;
+
+               
context->bw_ctx.bw.dcn.watermarks.a.cstate_pstate.cstate_enter_plus_exit_z8_ns 
= cstate_enter_plus_exit_z8_ns;
        }
 
        return result;
-- 
2.34.1

Reply via email to