]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/amd/display: Add min clock init for DML21 mode programming
authorOvidiu Bunea <ovidiu.bunea@amd.com>
Tue, 10 Feb 2026 20:26:18 +0000 (15:26 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 11 Mar 2026 14:53:27 +0000 (10:53 -0400)
[WHY & HOW]
0 stream cases do not go through any DML validation which leaves DCN
clocks in unoptimized states.

If requesting DML validation or programming with 0 streams, program
DCN clocks to lowest DPM state.

Reviewed-by: Dillon Varone <dillon.varone@amd.com>
Signed-off-by: Ovidiu Bunea <ovidiu.bunea@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Tested-by: Dan Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/dml21_translation_helper.c
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/dml21_translation_helper.h
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/dml21_wrapper.c

index 75a27999796156e7e64e36b0ccab3e9ef86582df..cd12b7a6da6577a4f9c6152940c5c539da4dbe8d 100644 (file)
@@ -931,3 +931,28 @@ void dml21_set_dc_p_state_type(
        }
 }
 
+void dml21_init_min_clocks_for_dc_state(struct dml2_context *in_ctx, struct dc_state *context)
+{
+       unsigned int lowest_dpm_state_index = 0;
+       struct dc_clocks *min_clocks = &context->bw_ctx.bw.dcn.clk;
+
+       min_clocks->dispclk_khz = in_ctx->v21.dml_init.soc_bb.clk_table.dispclk.clk_values_khz[lowest_dpm_state_index];
+       min_clocks->dppclk_khz = in_ctx->v21.dml_init.soc_bb.clk_table.dppclk.clk_values_khz[lowest_dpm_state_index];
+       min_clocks->dcfclk_khz = in_ctx->v21.dml_init.soc_bb.clk_table.dcfclk.clk_values_khz[lowest_dpm_state_index];
+       min_clocks->dramclk_khz = in_ctx->v21.dml_init.soc_bb.clk_table.uclk.clk_values_khz[lowest_dpm_state_index];
+       min_clocks->fclk_khz = in_ctx->v21.dml_init.soc_bb.clk_table.fclk.clk_values_khz[lowest_dpm_state_index];
+       min_clocks->idle_dramclk_khz = 0;
+       min_clocks->idle_fclk_khz = 0;
+       min_clocks->dcfclk_deep_sleep_khz = 0;
+       min_clocks->fclk_p_state_change_support = true;
+       min_clocks->p_state_change_support = true;
+       min_clocks->dtbclk_en = false;
+       min_clocks->ref_dtbclk_khz = 0;
+       min_clocks->socclk_khz = in_ctx->v21.dml_init.soc_bb.clk_table.socclk.clk_values_khz[lowest_dpm_state_index];
+       min_clocks->subvp_prefetch_dramclk_khz = 0;
+       min_clocks->subvp_prefetch_fclk_khz = 0;
+       min_clocks->phyclk_khz = in_ctx->v21.dml_init.soc_bb.clk_table.phyclk.clk_values_khz[lowest_dpm_state_index];
+       min_clocks->stutter_efficiency.base_efficiency = 1;
+       min_clocks->stutter_efficiency.low_power_efficiency = 1;
+}
+
index 9880d3e0398e2f8603c947b9819d18bb2d86ad46..f51d3d8a52c3f82a6fa32fc62ce437898d8d45cc 100644 (file)
@@ -25,4 +25,5 @@ void dml21_map_hw_resources(struct dml2_context *dml_ctx);
 void dml21_get_pipe_mcache_config(struct dc_state *context, struct pipe_ctx *pipe_ctx, struct dml2_per_plane_programming *pln_prog, struct dml2_pipe_configuration_descriptor *mcache_pipe_config);
 void dml21_set_dc_p_state_type(struct pipe_ctx *pipe_ctx, struct dml2_per_stream_programming *stream_programming, bool sub_vp_enabled);
 unsigned int map_plane_to_dml21_display_cfg(const struct dml2_context *dml_ctx, unsigned int stream_id, const struct dc_plane_state *plane, const struct dc_state *context);
+void dml21_init_min_clocks_for_dc_state(struct dml2_context *in_ctx, struct dc_state *context);
 #endif
index 798abb2b2e676c41a842ce13e5e5a3d768586e3e..96c62bd6a37b2a959187c57a89b6af65104f4205 100644 (file)
@@ -215,6 +215,7 @@ static bool dml21_mode_check_and_programming(const struct dc *in_dc, struct dc_s
                return true;
 
        if (context->stream_count == 0) {
+               dml21_init_min_clocks_for_dc_state(dml_ctx, context);
                dml21_build_fams2_programming(in_dc, context, dml_ctx);
                return true;
        }