7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Matthew Schwartz [ Upstream commit f2853a06e4b923c77a8cba69d76d2222b198256b ] Commit 33c995709121 ("drm/amd/display: Allow VRR params change if unsynced with the stream") derives the inactive vtotal from max_refresh_in_uhz and rounds it up. The round trip through integer rates can add a line even with VRR off. The ASUS ROG Xbox Ally X20's 120.0004 Hz mode exceeds its 120 Hz EDID maximum, so 1152 lines become 1153 and the CRTC vblank counter measures 119.89 Hz. Take both limits from stream->timing.v_total, as mod_freesync_build_vrr_params() does, which keeps the resync to the stream's timing. Active VRR keeps the helper's rounding. Fixes: 33c995709121 ("drm/amd/display: Allow VRR params change if unsynced with the stream") Signed-off-by: Matthew Schwartz Reviewed-by: Ivan Lipski Signed-off-by: Alex Deucher (cherry picked from commit 428c95d380f07694cbbd9ebe3450214404f57b5a) Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/modules/freesync/freesync.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c index 4bd060e30799a..f154a619b5339 100644 --- a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c +++ b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c @@ -1281,10 +1281,8 @@ void mod_freesync_handle_v_update(struct mod_freesync *mod_freesync, * If VRR is inactive, set vtotal min and max to nominal vtotal */ if (in_out_vrr->state == VRR_STATE_INACTIVE) { - in_out_vrr->adjust.v_total_min = - mod_freesync_calc_v_total_from_refresh(stream, - in_out_vrr->max_refresh_in_uhz); - in_out_vrr->adjust.v_total_max = in_out_vrr->adjust.v_total_min; + in_out_vrr->adjust.v_total_min = stream->timing.v_total; + in_out_vrr->adjust.v_total_max = stream->timing.v_total; return; } } -- 2.53.0