OSDN Git Service

drm/amd/display: Check context constructed for pipe split flags is still valid
authorDillon Varone <Dillon.Varone@amd.com>
Mon, 31 Oct 2022 23:08:23 +0000 (19:08 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 15 Nov 2022 18:35:14 +0000 (13:35 -0500)
[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.Leung@amd.com>
Acked-by: Tom Chung <chiahsuan.chung@amd.com>
Signed-off-by: Dillon Varone <Dillon.Varone@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c

index 0b1e721..f359f3e 100644 (file)
@@ -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;