Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <jun.lei@amd.com>
Signed-off-by: Harold Sun <Harold.Sun@amd.com>
Signed-off-by: Ray Wu <ray.wu@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Harold Sun and committed by
Alex Deucher
fe7645d2 660a467a

+9
+1
drivers/gpu/drm/amd/display/dc/dc_hw_types.h
··· 974 974 uint32_t pix_clk_100hz; 975 975 976 976 uint32_t min_refresh_in_uhz; 977 + uint32_t max_refresh_in_uhz; 977 978 978 979 uint32_t vic; 979 980 uint32_t hdmi_vic;
+8
drivers/gpu/drm/amd/display/modules/freesync/freesync.c
··· 155 155 v_total = div64_u64(div64_u64(((unsigned long long)( 156 156 frame_duration_in_ns) * (stream->timing.pix_clk_100hz / 10)), 157 157 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); 158 166 } else { 159 167 v_total = div64_u64(div64_u64(((unsigned long long)( 160 168 frame_duration_in_ns) * (stream->timing.pix_clk_100hz / 10)),