drm/amd/display: allow self-refresh exit while entry is blocked
Subsystems (3)
cover drm/amd/display: allow self-refresh exit while entry is blocked
Hi,
I have a ThinkPad T14s Gen 4 with a Ryzen 5 PRO 7540U and Radeon 740M (Phoenix1, DCN 3.1.4). Its internal eDP panel advertises PSR version 3, but the driver configures it for PSR1. This system has experienced PSR-related instability for a long time.
While testing patches for:
https://gitlab.freedesktop.org/drm/amd/-/work_items/4141
I had the idea of developing a PSR stress test suite to make these problems easier to reproduce and patches easier to test. Another goal was to provide a larger test suite that could detect regressions in new kernel releases.
The project is still experimental and the code needs considerable cleanup, but if you are interested, its README is available here:
https://gitlab.com/weber.aulendorf/amdgpu-psr-stress/-/blob/psr-coverage-clean/README.md?ref_type=heads
I can now reproduce a flip timeout quite reliably with it.
Branch: psr-coverage-clean
Leave SDDM running, switch to another VT, and run:
./quiet_tty.sh; ./freeze-vt-handoff.sh
The script repeatedly switches between the SDDM login screen and a text console, modifies the console framebuffer, and immediately lets a direct-KMS program take control of the display.
On Linux 7.2-rc5 with de665f07 ("drm/amd/display: Exit idle optimizations before programming") applied, the timeout usually occurs after a few minutes.
dmesg:
https://paste.sh/w_knebDa#uKedDECw3b8aasEdb1YBHHaR
Tail of the stress log:
https://paste.sh/VoRFHrUM#G1MRjBQ97JD9u4TGK_-_SopI
I used Claude Opus 5 and Codex GPT-5.6 SOL extensively to analyze the failure and develop this patch. With the patch applied, I have not been able to reproduce the timeout using freeze-vt-handoff.sh.
My understanding of the AMD display code is limited, so careful review of the analysis and fix would be particularly welcome. I have tested the resulting behavior on this system.
I am not yet convinced that I can maintain the stress suite as a side
project: it is very time-consuming, and I only have one system on which to develop and test it. However, some of its ideas might still be useful for future IGT tests.
David Weber (1):
drm/amd/display: allow self-refresh exit while entry is blocked
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
Signature · 1 line
2.54.0
PATCH 1/1 drm/amd/display: allow self-refresh exit while entry is blocked
amdgpu_dm_crtc_set_static_screen_optimze() maps sso_enable to the Replay and PSR1 vsync events. allow_sr_entry is an entry gate, but the helper currently applies it to both directions.
A non-fast update clears allow_sr_entry. During a modeset, a separate hardware-programming event keeps self-refresh blocked while the stream is reprogrammed. If vblank is enabled before the entry delay expires, the ISM calls the helper with sso_enable false. The early return drops the disable request, so the vsync events are not set.
After enough fast commits, allow_sr_entry becomes true and the hardware-programming event can be cleared. Since the vblank reference remains held, there is no further zero-to-one vblank transition to restore the missing vsync events. Replay or PSR1 can then become active while vblank is still enabled.
Gate only requests that enable static-screen optimization. Always process disable requests so a vblank requestor keeps Replay and PSR1 blocked.
On a Phoenix system, repeated SDDM-to-VT handoffs produced stuck flips followed by flip_done and commit-wait timeouts. The timeout was not observed with this change applied.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c +5 -1
@@ -119,7 +119,11 @@ void amdgpu_dm_crtc_set_static_screen_optimze(struct dc_link *link = stream->link;bool set_vsync_event = !sso_enable; -if (!allow_sr_entry) +/* +* allow_sr_entry gates only entry. A disable request must still set +* the vsync events to force Replay and PSR1 out and keep them blocked. +*/ +if (sso_enable && !allow_sr_entry)return ; amdgpu_dm_replay_set_event(dm, stream,
Signature · 1 line
2.54.0
Quoted 18 lines · David Weber
[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
amdgpu_dm_crtc_set_static_screen_optimze()mapssso_enableto the Replay and PSR1 vsync events.allow_sr_entryis an entry gate, but the helper currently applies it to both directions.A non-fast update clears
allow_sr_entry. During a modeset, a separate hardware-programming event keeps self-refresh blocked while the stream is reprogrammed. If vblank is enabled before the entry delay expires, the ISM calls the helper withsso_enablefalse. The early return drops the disable request, so the vsync events are not set.After enough fast commits,
allow_sr_entrybecomes true and the hardware-programming event can be cleared. Since the vblank reference remains held, there is no further zero-to-one vblank transition to restore the missing vsync events. Replay or PSR1 can then become active while vblank is still enabled.
Quoted 8 lines
Gate only requests that enable static-screen optimization. Always process disable requests so a vblank requestor keeps Replay and PSR1 blocked.
On a Phoenix system, repeated SDDM-to-VT handoffs produced stuck flips followed by
flip_doneand commit-wait timeouts. The timeout was not observed with this change applied.
Thanks!
Quoted 28 lines
Fixes 3c108046e1d6 ("drm/amd/display: Add power module on Linux")Assisted-by Codex:gpt-5.6-solAssisted-by Claude:opus-5Signed-off-by David Weber <[email protected]>--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c +5
-2@@ -119,7 +119,11 @@ void amdgpu_dm_crtc_set_static_screen_optimze(struct dc_link *link = stream->link;bool set_vsync_event = !sso_enable; -if (!allow_sr_entry) +/* +* allow_sr_entry gates only entry. A disable request must still set +* the vsync events to force Replay and PSR1 out and keep them blocked. +*/ +if (sso_enable && !allow_sr_entry)return ; amdgpu_dm_replay_set_event(dm, stream, --2.54.0