Skip to content

Commit ed6445f

Browse files
ChunTao Tsoalexdeucher
authored andcommitted
drm/amd/display: set minimum of VBlank_nom
[Why] If VBlank_nom is too small, it will cause VStartUP_Start smaller than VBackPorch + VSync width which is an invalid case for VStartUP_Start and where to send AS-SDP. [How] Setup a minimum value to VBlank_nom Reviewed-by: Reza Amini <reza.amini@amd.com> Acked-by: Wayne Lin <wayne.lin@amd.com> Signed-off-by: ChunTao Tso <chuntao.tso@amd.com> Tested-by: Daniel Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 8f31c7b commit ed6445f

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

drivers/gpu/drm/amd/display/dc/dml/dcn314/dcn314_fpu.c

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,17 @@ static unsigned int micro_sec_to_vert_lines(unsigned int num_us, struct dc_crtc_
293293
return num_lines;
294294
}
295295

296+
static unsigned int get_vertical_back_porch(struct dc_crtc_timing *timing)
297+
{
298+
unsigned int v_active = 0, v_blank = 0, v_back_porch = 0;
299+
300+
v_active = timing->v_border_top + timing->v_addressable + timing->v_border_bottom;
301+
v_blank = timing->v_total - v_active;
302+
v_back_porch = v_blank - timing->v_front_porch - timing->v_sync_width;
303+
304+
return v_back_porch;
305+
}
306+
296307
int dcn314_populate_dml_pipes_from_context_fpu(struct dc *dc, struct dc_state *context,
297308
display_e2e_pipe_params_st *pipes,
298309
bool fast_validate)
@@ -310,6 +321,7 @@ int dcn314_populate_dml_pipes_from_context_fpu(struct dc *dc, struct dc_state *c
310321
for (i = 0, pipe_cnt = 0; i < dc->res_pool->pipe_count; i++) {
311322
struct dc_crtc_timing *timing;
312323
unsigned int num_lines = 0;
324+
unsigned int v_back_porch = 0;
313325

314326
if (!res_ctx->pipe_ctx[i].stream)
315327
continue;
@@ -323,9 +335,16 @@ int dcn314_populate_dml_pipes_from_context_fpu(struct dc *dc, struct dc_state *c
323335
else
324336
pipes[pipe_cnt].pipe.dest.vtotal = timing->v_total;
325337

338+
v_back_porch = get_vertical_back_porch(timing);
339+
326340
pipes[pipe_cnt].pipe.dest.vblank_nom = timing->v_total - pipes[pipe_cnt].pipe.dest.vactive;
327341
pipes[pipe_cnt].pipe.dest.vblank_nom = min(pipes[pipe_cnt].pipe.dest.vblank_nom, num_lines);
328-
pipes[pipe_cnt].pipe.dest.vblank_nom = max(pipes[pipe_cnt].pipe.dest.vblank_nom, timing->v_sync_width);
342+
// vblank_nom should not smaller than (VSync (timing->v_sync_width + v_back_porch) + 2)
343+
// + 2 is because
344+
// 1 -> VStartup_start should be 1 line before VSync
345+
// 1 -> always reserve 1 line between start of vblank to vstartup signal
346+
pipes[pipe_cnt].pipe.dest.vblank_nom =
347+
max(pipes[pipe_cnt].pipe.dest.vblank_nom, timing->v_sync_width + v_back_porch + 2);
329348
pipes[pipe_cnt].pipe.dest.vblank_nom = min(pipes[pipe_cnt].pipe.dest.vblank_nom, max_allowed_vblank_nom);
330349

331350
if (pipe->plane_state &&

0 commit comments

Comments
 (0)