Skip to content

Commit 4a4077b

Browse files
Zhikai Zhaialexdeucher
authored andcommitted
drm/amd/display: Update Cursor request mode to the beginning prefetch always
[Why] The double buffer cursor registers is updated by the cursor vupdate event. There is a gap between vupdate and cursor data fetch if cursor fetch data reletive to cursor position. Cursor corruption will happen if we update the cursor surface in this gap. [How] Modify the cursor request mode to the beginning prefetch always and avoid wraparound calculation issues. Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com> Signed-off-by: Zhikai Zhai <zhikai.zhai@amd.com> Signed-off-by: Zaeem Mohamed <zaeem.mohamed@amd.com> Tested-by: Daniel Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 6a7fde4 commit 4a4077b

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

drivers/gpu/drm/amd/display/dc/hubp/dcn31/dcn31_hubp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ void hubp31_set_unbounded_requesting(struct hubp *hubp, bool enable)
4444
struct dcn20_hubp *hubp2 = TO_DCN20_HUBP(hubp);
4545

4646
REG_UPDATE(DCHUBP_CNTL, HUBP_UNBOUNDED_REQ_MODE, enable);
47-
REG_UPDATE(CURSOR_CONTROL, CURSOR_REQ_MODE, enable);
47+
REG_UPDATE(CURSOR_CONTROL, CURSOR_REQ_MODE, 1);
4848
}
4949

5050
void hubp31_soft_reset(struct hubp *hubp, bool reset)

drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1993,34 +1993,30 @@ static void delay_cursor_until_vupdate(struct dc *dc, struct pipe_ctx *pipe_ctx)
19931993
dc->hwss.get_position(&pipe_ctx, 1, &position);
19941994
vpos = position.vertical_count;
19951995

1996-
/* Avoid wraparound calculation issues */
1997-
vupdate_start += stream->timing.v_total;
1998-
vupdate_end += stream->timing.v_total;
1999-
vpos += stream->timing.v_total;
2000-
20011996
if (vpos <= vupdate_start) {
20021997
/* VPOS is in VACTIVE or back porch. */
20031998
lines_to_vupdate = vupdate_start - vpos;
2004-
} else if (vpos > vupdate_end) {
2005-
/* VPOS is in the front porch. */
2006-
return;
20071999
} else {
2008-
/* VPOS is in VUPDATE. */
2009-
lines_to_vupdate = 0;
2000+
lines_to_vupdate = stream->timing.v_total - vpos + vupdate_start;
20102001
}
20112002

20122003
/* Calculate time until VUPDATE in microseconds. */
20132004
us_per_line =
20142005
stream->timing.h_total * 10000u / stream->timing.pix_clk_100hz;
20152006
us_to_vupdate = lines_to_vupdate * us_per_line;
20162007

2008+
/* Stall out until the cursor update completes. */
2009+
if (vupdate_end < vupdate_start)
2010+
vupdate_end += stream->timing.v_total;
2011+
2012+
/* Position is in the range of vupdate start and end*/
2013+
if (lines_to_vupdate > stream->timing.v_total - vupdate_end + vupdate_start)
2014+
us_to_vupdate = 0;
2015+
20172016
/* 70 us is a conservative estimate of cursor update time*/
20182017
if (us_to_vupdate > 70)
20192018
return;
20202019

2021-
/* Stall out until the cursor update completes. */
2022-
if (vupdate_end < vupdate_start)
2023-
vupdate_end += stream->timing.v_total;
20242020
us_vupdate = (vupdate_end - vupdate_start + 1) * us_per_line;
20252021
udelay(us_to_vupdate + us_vupdate);
20262022
}

0 commit comments

Comments
 (0)