Skip to content

Commit ad6dc33

Browse files
Timur KristófSasha Levin
authored andcommitted
drm/amd/display: Find first CRTC and its line time in dce110_fill_display_configs
commit 669f73a upstream. dce110_fill_display_configs is shared between DCE 6-11, and finding the first CRTC and its line time is relevant to DCE 6 too. Move the code to find it from DCE 11 specific code. Signed-off-by: Timur Kristóf <[email protected]> Acked-by: Alex Deucher <[email protected]> Reviewed-by: Rodrigo Siqueira <[email protected]> Reviewed-by: Alex Hung <[email protected]> Signed-off-by: Alex Deucher <[email protected]> (cherry picked from commit 4ab09785f8d5d03df052827af073d5c508ff5f63) Cc: [email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 0181ef0 commit ad6dc33

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

drivers/gpu/drm/amd/display/dc/clk_mgr/dce110/dce110_clk_mgr.c

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,12 @@ void dce110_fill_display_configs(
120120
const struct dc_state *context,
121121
struct dm_pp_display_configuration *pp_display_cfg)
122122
{
123+
struct dc *dc = context->clk_mgr->ctx->dc;
123124
int j;
124125
int num_cfgs = 0;
125126

127+
pp_display_cfg->crtc_index = dc->res_pool->res_cap->num_timing_generator;
128+
126129
for (j = 0; j < context->stream_count; j++) {
127130
int k;
128131

@@ -164,6 +167,23 @@ void dce110_fill_display_configs(
164167
cfg->v_refresh /= stream->timing.h_total;
165168
cfg->v_refresh = (cfg->v_refresh + stream->timing.v_total / 2)
166169
/ stream->timing.v_total;
170+
171+
/* Find first CRTC index and calculate its line time.
172+
* This is necessary for DPM on SI GPUs.
173+
*/
174+
if (cfg->pipe_idx < pp_display_cfg->crtc_index) {
175+
const struct dc_crtc_timing *timing =
176+
&context->streams[0]->timing;
177+
178+
pp_display_cfg->crtc_index = cfg->pipe_idx;
179+
pp_display_cfg->line_time_in_us =
180+
timing->h_total * 10000 / timing->pix_clk_100hz;
181+
}
182+
}
183+
184+
if (!num_cfgs) {
185+
pp_display_cfg->crtc_index = 0;
186+
pp_display_cfg->line_time_in_us = 0;
167187
}
168188

169189
pp_display_cfg->display_count = num_cfgs;
@@ -232,16 +252,6 @@ void dce11_pplib_apply_display_requirements(
232252

233253
dce110_fill_display_configs(context, pp_display_cfg);
234254

235-
/* TODO: is this still applicable?*/
236-
if (pp_display_cfg->display_count == 1) {
237-
const struct dc_crtc_timing *timing =
238-
&context->streams[0]->timing;
239-
240-
pp_display_cfg->crtc_index =
241-
pp_display_cfg->disp_configs[0].pipe_idx;
242-
pp_display_cfg->line_time_in_us = timing->h_total * 10000 / timing->pix_clk_100hz;
243-
}
244-
245255
if (memcmp(&dc->current_state->pp_display_cfg, pp_display_cfg, sizeof(*pp_display_cfg)) != 0)
246256
dm_pp_apply_display_requirements(dc->ctx, pp_display_cfg);
247257
}

0 commit comments

Comments
 (0)