drm/amd/display: Add ODM check during pipe split/merge validation
authorRelja Vojvodic <relja.vojvodic@amd.com>
Fri, 1 Dec 2023 13:24:59 +0000 (06:24 -0700)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 6 Dec 2023 20:22:32 +0000 (15:22 -0500)
[why]
When querying DML for a vlevel after pipes have been split or merged the
ODM policy would revert to a default policy, which could cause the query
to use the incorrect ODM status. In this case ODM 2to1 was validated,
but the last DML query would assume no ODM and return the incorrect
vlevel.

[how]
Added ODM check to apply the correct ODM policy before querying DML.

Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Reviewed-by: Alvin Lee <alvin.lee2@amd.com>
Acked-by: Rodrigo Siqueira <rodrigo.siqueira@amd.com>
Signed-off-by: Relja Vojvodic <relja.vojvodic@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource_helpers.c
drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c
drivers/gpu/drm/amd/display/dc/resource/dcn32/dcn32_resource.h

index 389ac7ae1154fe5e28c084b107a671970597cf48..e8159a459bcef2fea898577219452c6ad82e2a94 100644 (file)
@@ -806,3 +806,29 @@ bool dcn32_subvp_vblank_admissable(struct dc *dc, struct dc_state *context, int
 
        return result;
 }
+
+void dcn32_update_dml_pipes_odm_policy_based_on_context(struct dc *dc, struct dc_state *context,
+               display_e2e_pipe_params_st *pipes)
+{
+       int i, pipe_cnt;
+       struct resource_context *res_ctx = &context->res_ctx;
+       struct pipe_ctx *pipe = NULL;
+
+       for (i = 0, pipe_cnt = 0; i < dc->res_pool->pipe_count; i++) {
+               int odm_slice_count = 0;
+
+               if (!res_ctx->pipe_ctx[i].stream)
+                       continue;
+               pipe = &res_ctx->pipe_ctx[i];
+               odm_slice_count = resource_get_odm_slice_count(pipe);
+
+               if (odm_slice_count == 1)
+                       pipes[pipe_cnt].pipe.dest.odm_combine_policy = dm_odm_combine_policy_dal;
+               else if (odm_slice_count == 2)
+                       pipes[pipe_cnt].pipe.dest.odm_combine_policy = dm_odm_combine_policy_2to1;
+               else if (odm_slice_count == 4)
+                       pipes[pipe_cnt].pipe.dest.odm_combine_policy = dm_odm_combine_policy_4to1;
+
+               pipe_cnt++;
+       }
+}
index 26411d4e97300da240c8b30760ab7824933e9cf1..de209ca0cf8cc5bace9d4e428970bb50d13ad291 100644 (file)
@@ -2192,6 +2192,7 @@ bool dcn32_internal_validate_bw(struct dc *dc,
                int i;
 
                pipe_cnt = dc->res_pool->funcs->populate_dml_pipes(dc, context, pipes, fast_validate);
+               dcn32_update_dml_pipes_odm_policy_based_on_context(dc, context, pipes);
 
                /* repopulate_pipes = 1 means the pipes were either split or merged. In this case
                 * we have to re-calculate the DET allocation and run through DML once more to
@@ -2200,7 +2201,9 @@ bool dcn32_internal_validate_bw(struct dc *dc,
                 * */
                context->bw_ctx.dml.soc.allow_for_pstate_or_stutter_in_vblank_final =
                                        dm_prefetch_support_uclk_fclk_and_stutter_if_possible;
+
                vlevel = dml_get_voltage_level(&context->bw_ctx.dml, pipes, pipe_cnt);
+
                if (vlevel == context->bw_ctx.dml.soc.num_states) {
                        /* failed after DET size changes */
                        goto validate_fail;
index b2f20e6cfb38fe8a7707ed1d81f8aee7bed00fd5..9ca799da1a56e0e38466440c14251fa25ec64ca1 100644 (file)
@@ -193,6 +193,8 @@ bool dcn32_subvp_drr_admissable(struct dc *dc, struct dc_state *context);
 
 bool dcn32_subvp_vblank_admissable(struct dc *dc, struct dc_state *context, int vlevel);
 
+void dcn32_update_dml_pipes_odm_policy_based_on_context(struct dc *dc, struct dc_state *context, display_e2e_pipe_params_st *pipes);
+
 /* definitions for run time init of reg offsets */
 
 /* CLK SRC */