From: Alvin Lee <[email protected]>

[Description]
- To reduce vlevel further, we can try to apply subvp on
  configs that already support p-state since the natural
  p-state support may not allow for DPM0.
- Add code to try subvp to reduce UCLK DPM level further
  if already supported, but don't use subvp if it does not
  optimize the DPM level even lower

Reviewed-by: Samson Tam <[email protected]>
Acked-by: Hamza Mahfooz <[email protected]>
Signed-off-by: Alvin Lee <[email protected]>
---
 drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c 
b/drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c
index c4ffb4b92b56..26411d4e9730 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c
@@ -1416,6 +1416,7 @@ static void dcn32_full_validate_bw_helper(struct dc *dc,
        unsigned int dc_pipe_idx = 0;
        int i = 0;
        bool found_supported_config = false;
+       int vlevel_temp = 0;
 
        dc_assert_fp_enabled();
 
@@ -1448,13 +1449,15 @@ static void dcn32_full_validate_bw_helper(struct dc *dc,
         */
        if (!dc->debug.force_disable_subvp && !dc->caps.dmub_caps.gecc_enable 
&& dcn32_all_pipes_have_stream_and_plane(dc, context) &&
            !dcn32_mpo_in_use(context) && !dcn32_any_surfaces_rotated(dc, 
context) && !is_test_pattern_enabled(context) &&
-               (*vlevel == context->bw_ctx.dml.soc.num_states ||
+               (*vlevel == context->bw_ctx.dml.soc.num_states || 
(vba->DRAMSpeedPerState[*vlevel] != vba->DRAMSpeedPerState[0] &&
+                               
vba->DRAMClockChangeSupport[*vlevel][vba->maxMpcComb] != 
dm_dram_clock_change_unsupported) ||
            vba->DRAMClockChangeSupport[*vlevel][vba->maxMpcComb] == 
dm_dram_clock_change_unsupported ||
            dc->debug.force_subvp_mclk_switch)) {
 
                dcn32_merge_pipes_for_subvp(dc, context);
                memset(merge, 0, MAX_PIPES * sizeof(bool));
 
+               vlevel_temp = *vlevel;
                /* to re-initialize viewport after the pipe merge */
                for (i = 0; i < dc->res_pool->pipe_count; i++) {
                        struct pipe_ctx *pipe_ctx = 
&context->res_ctx.pipe_ctx[i];
@@ -1523,6 +1526,9 @@ static void dcn32_full_validate_bw_helper(struct dc *dc,
                        }
                }
 
+               if (vba->DRAMSpeedPerState[*vlevel] >= 
vba->DRAMSpeedPerState[vlevel_temp])
+                       found_supported_config = false;
+
                // If SubVP pipe config is unsupported (or cannot be used for 
UCLK switching)
                // remove phantom pipes and repopulate dml pipes
                if (!found_supported_config) {
-- 
2.42.0

Reply via email to