Skip to contentSkip to conversation

drm/amd/display: Keep the nominal vtotal while VRR is inactive

PATCH In review Matthew Schwartz 2 participants 2 messages Oct 20 – Oct 30

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amd/display: Keep the nominal vtotal while VRR is inactive

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")
---
 drivers/gpu/drm/amd/display/modules/freesync/freesync.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/modules/freesync/freesync.c +2 -4
index 4bd060e30799..f154a619b533 100644
@@ -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;
 	}
 }
Signature · 1 line
2.56.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Matthew Schwartz

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.

Quoted 5 lines

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")
Quoted 22 lines
---
  drivers/gpu/drm/amd/display/modules/freesync/freesync.c | 6 ++----
  1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/modules/freesync/freesync.c +2 -4
index 4bd060e30799..f154a619b533 100644
@@ -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;
  	}
  }
Signature · 2 lines
Thanks,
Ivan Lipski