FAILED: patch "[PATCH] drm/amd/display: Hold the VRR vblank reference only on active" failed to apply to 7.3-stable tree
[email protected]
maintainerThe patch below does not apply to the 7.3-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-7.3.y
git checkout FETCH_HEAD
git cherry-pick -x ad40065dc8bd5a5e16b13523d9fef6ac94cf2b66
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026120245-early-dyslexia-23e5@gregkh' --subject-prefix 'PATCH 7.3.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From ad40065dc8bd5a5e16b13523d9fef6ac94cf2b66 Mon Sep 17 00:00:00 2001
From: Hugo Sales <[email protected]>
Date: Sat, 31 Oct 2026 14:33:51 +0000
Subject: [PATCH] drm/amd/display: Hold the VRR vblank reference only on active
CRTCs
amdgpu_dm_handle_vrr_transition() takes a vblank reference when a CRTC state turns VRR on and drops it when a later state turns it off. It only looks at freesync_config.state, and disabling a CRTC keeps that state, so a suspend or DPMS off with VRR active keeps the reference
On resume, drm_atomic_helper_resume() first calls drm_mode_config_reset(), which swaps the CRTC state for a zeroed one. The restored state then goes from VRR_STATE_UNSUPPORTED to active and takes a second reference, and the first is never dropped. The vblank irq stays on for good, so the CRTC never idles and PSR is never entered
A VRR change on a disabled CRTC can't take the reference at all, since vblank is off there and drm_crtc_vblank_get() fails with a WARN
On a Cezanne laptop with VRR always on, each suspend added one to the eDP CRTC's vblank refcount, and it stayed at 1 rather than 0 after VRR was turned off again
Treat VRR as active for the reference only while the CRTC is active too. Disabling the CRTC then drops it and enabling it takes it again, which balances suspend, resume and DPMS, and the get only happens once manage_dm_interrupts() has turned vblank on
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_freesync.c +10 -2
@@ -400,8 +400,16 @@ void amdgpu_dm_handle_vrr_transition(struct amdgpu_display_manager *dm, struct dm_crtc_state *new_state) {struct amdgpu_device *adev = dm->adev; -bool old_vrr_active =amdgpu_dm_crtc_vrr_active (old_state); -bool new_vrr_active =amdgpu_dm_crtc_vrr_active (new_state); +/* +* A disabled CRTC keeps its freesync state, but drm_crtc_vblank_get() +* fails there because vblank is off. Hold the reference only while +* the CRTC is active as well, which also covers resume, where the +* reset state lost track of the reference taken before suspend +*/ +bool old_vrr_active = old_state->base.active && +amdgpu_dm_crtc_vrr_active (old_state); +bool new_vrr_active = new_state->base.active && +amdgpu_dm_crtc_vrr_active (new_state);/* Only DCE gates vupdate on VRR, keep it enabled for DCN */ bool vrr_gates_vupdate =amdgpu_ip_version (adev,DCE_HWIP ,0 ) ==0 ;
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_freesync_test.c +98 -0
118 lines not on this page · raw message
PATCH 1/1 drm/amd/display: Hold the VRR vblank reference only on active CRTCs
amdgpu_dm_handle_vrr_transition() takes a vblank reference when a CRTC state turns VRR on and drops it when a later state turns it off. It only looks at freesync_config.state, and disabling a CRTC keeps that state, so a suspend or DPMS off with VRR active keeps the reference
On resume, drm_atomic_helper_resume() first calls drm_mode_config_reset(), which swaps the CRTC state for a zeroed one. The restored state then goes from VRR_STATE_UNSUPPORTED to active and takes a second reference, and the first is never dropped. The vblank irq stays on for good, so the CRTC never idles and PSR is never entered
A VRR change on a disabled CRTC can't take the reference at all, since vblank is off there and drm_crtc_vblank_get() fails with a WARN
On a Cezanne laptop with VRR always on, each suspend added one to the eDP CRTC's vblank refcount, and it stayed at 1 rather than 0 after VRR was turned off again
Treat VRR as active for the reference only while the CRTC is active too. Disabling the CRTC then drops it and enabling it takes it again, which balances suspend, resume and DPMS, and the get only happens once manage_dm_interrupts() has turned vblank on
[ Hugo: dropped the changes to dm_test_handle_vrr_transition_round_trip,
which this tree doesn't have ]
--- .../display/amdgpu_dm/amdgpu_dm_freesync.c | 12 ++- .../amdgpu_dm/tests/amdgpu_dm_freesync_test.c | 99 +++++++++++++++++++ 2 files changed, 109 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_freesync.c +10 -2
@@ -338,8 +338,16 @@ void amdgpu_dm_handle_vrr_transition(struct amdgpu_display_manager *dm, struct dm_crtc_state *new_state) {struct amdgpu_device *adev = dm->adev; -bool old_vrr_active =amdgpu_dm_crtc_vrr_active (old_state); -bool new_vrr_active =amdgpu_dm_crtc_vrr_active (new_state); +/* +* A disabled CRTC keeps its freesync state, but drm_crtc_vblank_get() +* fails there because vblank is off. Hold the reference only while +* the CRTC is active as well, which also covers resume, where the +* reset state lost track of the reference taken before suspend +*/ +bool old_vrr_active = old_state->base.active && +amdgpu_dm_crtc_vrr_active (old_state); +bool new_vrr_active = new_state->base.active && +amdgpu_dm_crtc_vrr_active (new_state);/* Only DCE gates vupdate on VRR, keep it enabled for DCN */ bool vrr_gates_vupdate =amdgpu_ip_version (adev,DCE_HWIP ,0 ) ==0 ;
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_freesync_test.c +99 -0
117 lines not on this page · raw message
Signature · 1 line
2.56.0
Sasha Levin
maintainerRe: [PATCH 7.3.y] drm/amd/display: Hold the VRR vblank reference only on active CRTCs
Quoted 1 line
.../amdgpu_dm/tests/amdgpu_dm_freesync_test.c | 99 +++++++++++++++++++
The new KUnit cases call amdgpu_dm_handle_vrr_transition(), which 7.3 doesn't export: its EXPORT_IF_KUNIT() came with 7f50f13108a4 ("drm/amd/display: test VRR transitions"), which 7.3 doesn't have. With the test built as a module, modpost fails. Could you send a v2 that adds the export or drops the test hunk?
Also, how do you want the IPS follow-up handled on 7.3? With only the driver change, disabling a CRTC that has VRR active reaches dc_exit_ips_for_hw_access() in the on->off branch, and IPS stays off with all displays off on DCN 3.5+. Your RFT <[email protected]> fixes that, but it isn't merged anywhere yet.
The 6.18, 6.12, 6.6 and 6.1 backports look fine; they'll be queued together with the 7.3 v2.
Signature · 2 lines
Thanks, Sasha
PATCH v2 1/1 drm/amd/display: Hold the VRR vblank reference only on active CRTCs
amdgpu_dm_handle_vrr_transition() takes a vblank reference when a CRTC state turns VRR on and drops it when a later state turns it off. It only looks at freesync_config.state, and disabling a CRTC keeps that state, so a suspend or DPMS off with VRR active keeps the reference
On resume, drm_atomic_helper_resume() first calls drm_mode_config_reset(), which swaps the CRTC state for a zeroed one. The restored state then goes from VRR_STATE_UNSUPPORTED to active and takes a second reference, and the first is never dropped. The vblank irq stays on for good, so the CRTC never idles and PSR is never entered
A VRR change on a disabled CRTC can't take the reference at all, since vblank is off there and drm_crtc_vblank_get() fails with a WARN
On a Cezanne laptop with VRR always on, each suspend added one to the eDP CRTC's vblank refcount, and it stayed at 1 rather than 0 after VRR was turned off again
Treat VRR as active for the reference only while the CRTC is active too. Disabling the CRTC then drops it and enabling it takes it again, which balances suspend, resume and DPMS, and the get only happens once manage_dm_interrupts() has turned vblank on
[ Hugo: dropped the KUnit changes, since this tree doesn't export
amdgpu_dm_handle_vrr_transition() to the test module ]
---
Changes in v2:
- Drop the KUnit hunk. The new tests call amdgpu_dm_handle_vrr_transition(), which 7.3 doesn't export, so modpost failed with the test built as a module
On IPS: 7.3 already has an IPS problem on DCN 3.5+ without this patch. After a suspend with VRR on, the leaked vblank reference keeps vblank enabled, so the CRTC never goes idle and neither IPS nor PSR is entered while the display is on, until reboot. With this patch, IPS is lost only while all displays are off with VRR active. The follow-up fixes that case, but it needs review first before I'm comfortable with it going to stable
v1: https://lore.kernel.org/r/[email protected]
IPS follow-up: https://lore.kernel.org/r/[email protected]
.../drm/amd/display/amdgpu_dm/amdgpu_dm_freesync.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_freesync.c +10 -2
@@ -338,8 +338,16 @@ void amdgpu_dm_handle_vrr_transition(struct amdgpu_display_manager *dm, struct dm_crtc_state *new_state) {struct amdgpu_device *adev = dm->adev; -bool old_vrr_active =amdgpu_dm_crtc_vrr_active (old_state); -bool new_vrr_active =amdgpu_dm_crtc_vrr_active (new_state); +/* +* A disabled CRTC keeps its freesync state, but drm_crtc_vblank_get() +* fails there because vblank is off. Hold the reference only while +* the CRTC is active as well, which also covers resume, where the +* reset state lost track of the reference taken before suspend +*/ +bool old_vrr_active = old_state->base.active && +amdgpu_dm_crtc_vrr_active (old_state); +bool new_vrr_active = new_state->base.active && +amdgpu_dm_crtc_vrr_active (new_state);/* Only DCE gates vupdate on VRR, keep it enabled for DCN */ bool vrr_gates_vupdate =amdgpu_ip_version (adev,DCE_HWIP ,0 ) ==0 ;
Signature · 1 line
2.56.0
Sasha Levin
maintainerRe: [PATCH 7.3.y v2] drm/amd/display: Hold the VRR vblank reference only on active CRTCs
Quoted 2 lines
[ Hugo: dropped the KUnit changes, since this tree doesn't export
amdgpu_dm_handle_vrr_transition()to the test module ]
Queued for 7.3, together with your 6.18, 6.12, 6.6 and 6.1 backports, thanks.
Signature · 2 lines
Thanks, Sasha