Skip to content

drm/amd/display: Rebuild the VRR vtotal limits on a modeset

Matthew Schwartz amd-gfx 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2drm/amd/display: Rebuild the VRR vtotal limits on a modesetdrivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_freesync.c+10 -00 replies
2/2drm/amd/display: Test VRR vtotal limits across a modesetdrivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_freesync_test.c+52 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] drm/amd/display: Rebuild the VRR vtotal limits on a modeset

A modeset between two modes with the same refresh rate keeps the previous mode's v_total_min/max when VRR stays enabled across it, since mod_freesync_build_vrr_params() only rebuilds them when the VRR state or refresh range changes. Commit 33c995709121 handled this for the inactive state. With VRR active and no BTR, the old limits stay in use for as long as the client keeps flipping at the refresh rate.

This came up with gamescope, which keeps VRR_ENABLED set across mode changes and, with its adaptive_sync_idle_hold option, presents on every vblank while the Steam UI is focused. Switching from 1080p60 to 4K60 in Steam's display settings then gave no picture on a number of HDMI displays, a Dell S2721QS (40-60 Hz) and an LG CX among them. In the Dell's log the atomic commit intervals after the switch were 8.3 ms, 12.5 ms and 20.8 ms. Those are 1125, 1687 and 1125 + 1687 lines of the 4K timing, the 1080p limits for 60 and 40 Hz. Without the hold the idle UI flips slowly enough to reach the fixed refresh path, which rebuilds the limits, so the problem stayed hidden.

Tested on an ASUS ROG Xbox Ally X20 (internal panel, 30-120 Hz) with a 7.3.1-based kernel and a small KMS test. It sets two 50 Hz modes with vtotals of 2764 and 2592, turns VRR on in the first and flips at full rate across a modeset to the second. Without patch 1 the second mode flips every 21.33 ms, which is the first mode's v_total_min, until VRR is toggled. With it the interval is 20.1 ms.

Patch 1 clears the saved VRR params on a modeset so they are rebuilt from the new stream. Patch 2 adds KUnit cases for it.

Matthew Schwartz (2):
drm/amd/display: Rebuild the VRR vtotal limits on a modeset drm/amd/display: Test VRR vtotal limits across a modeset

 .../display/amdgpu_dm/amdgpu_dm_freesync.c    | 10 ++++
 .../amdgpu_dm/tests/amdgpu_dm_freesync_test.c | 52 +++++++++++++++++++
 2 files changed, 62 insertions(+)

base-commit: da37959f4a22c6bb25a337fcc7946101c8a10f7b

Signature · 1 line
2.54.0 (Apple Git-157)