Skip to content

Commit 84f2902

Browse files
Harold Sunalexdeucher
authored andcommitted
drm/amd/display: Added case for when RR equals panel's max RR using freesync
[WHY] Rounding error sometimes occurs when the refresh rate is equal to a panel's max refresh rate, causing HDMI compliance failures. [HOW] Added a case so that we round up to avoid v_total_min to be below a panel's minimum bound. Reviewed-by: Jun Lei <[email protected]> Signed-off-by: Harold Sun <[email protected]> Signed-off-by: Ray Wu <[email protected]> Tested-by: Daniel Wheeler <[email protected]> Signed-off-by: Alex Deucher <[email protected]> (cherry picked from commit fe7645d)
1 parent 34659c1 commit 84f2902

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

drivers/gpu/drm/amd/display/dc/dc_hw_types.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -974,6 +974,7 @@ struct dc_crtc_timing {
974974
uint32_t pix_clk_100hz;
975975

976976
uint32_t min_refresh_in_uhz;
977+
uint32_t max_refresh_in_uhz;
977978

978979
uint32_t vic;
979980
uint32_t hdmi_vic;

drivers/gpu/drm/amd/display/modules/freesync/freesync.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,14 @@ unsigned int mod_freesync_calc_v_total_from_refresh(
155155
v_total = div64_u64(div64_u64(((unsigned long long)(
156156
frame_duration_in_ns) * (stream->timing.pix_clk_100hz / 10)),
157157
stream->timing.h_total), 1000000);
158+
} else if (refresh_in_uhz >= stream->timing.max_refresh_in_uhz) {
159+
/* When the target refresh rate is the maximum panel refresh rate
160+
* round up the vtotal value to prevent off-by-one error causing
161+
* v_total_min to be below the panel's lower bound
162+
*/
163+
v_total = div64_u64(div64_u64(((unsigned long long)(
164+
frame_duration_in_ns) * (stream->timing.pix_clk_100hz / 10)),
165+
stream->timing.h_total) + (1000000 - 1), 1000000);
158166
} else {
159167
v_total = div64_u64(div64_u64(((unsigned long long)(
160168
frame_duration_in_ns) * (stream->timing.pix_clk_100hz / 10)),

0 commit comments

Comments
 (0)