From: Dillon Varone <dillon.var...@amd.com>

[WHY?]
After applying pipesplit flags, DML can select a different configuration upon
revalidation, despite the desired one still being valid.

[HOW?]
Check the configuration is still has mode support, and apply it.

Reviewed-by: Martin Leung <martin.le...@amd.com>
Acked-by: Tom Chung <chiahsuan.ch...@amd.com>
Signed-off-by: Dillon Varone <dillon.var...@amd.com>
---
 .../drm/amd/display/dc/dml/dcn32/dcn32_fpu.c  | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

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 0b1e721be33b..f359f3edaf36 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
@@ -1748,6 +1748,9 @@ bool dcn32_internal_validate_bw(struct dc *dc,
        }
 
        if (repopulate_pipes) {
+               int flag_max_mpc_comb = vba->maxMpcComb;
+               int flag_vlevel = vlevel;
+
                pipe_cnt = dc->res_pool->funcs->populate_dml_pipes(dc, context, 
pipes, fast_validate);
 
                /* repopulate_pipes = 1 means the pipes were either split or 
merged. In this case
@@ -1761,6 +1764,22 @@ bool dcn32_internal_validate_bw(struct dc *dc,
                if (vlevel == context->bw_ctx.dml.soc.num_states) {
                        /* failed after DET size changes */
                        goto validate_fail;
+               } else if (flag_max_mpc_comb == 0 &&
+                               flag_max_mpc_comb != 
context->bw_ctx.dml.vba.maxMpcComb) {
+                       /* check the context constructed with pipe split flags 
is still valid*/
+                       bool flags_valid = false;
+                       for (int i = flag_vlevel; i < 
context->bw_ctx.dml.soc.num_states; i++) {
+                               if (vba->ModeSupport[i][flag_max_mpc_comb]) {
+                                       vba->maxMpcComb = flag_max_mpc_comb;
+                                       vba->VoltageLevel = i;
+                                       vlevel = i;
+                                       flags_valid = true;
+                               }
+                       }
+
+                       /* this should never happen */
+                       if (!flags_valid)
+                               goto validate_fail;
                }
        }
        *vlevel_out = vlevel;
-- 
2.25.1

Reply via email to