drm/amd/display: Restore PSR-SU guard in power module
Subsystems (3)
PATCH 1/1 drm/amd/display: Restore PSR-SU guard in power module
Commit a5ce8695d6d1 ("drm/amd/display: Avoid configuring PSR granularity if PSR-SU not supported") restricted DSC slice-height configuration to PSR-SU. The power-module integration removed that guarded caller. Its replacement in mod_power_psr_notify_mode_change() calls psr_su_set_dsc_slice_height() unconditionally and ignores its return value.
On PSR1 links with a DSC slice configuration, this applies a PSR-SU-only alignment check even though selective update is not enabled. If the calculated DSC slice height is not a multiple of the nonzero advertised SU Y granularity, the helper triggers an assertion. It also sets dsc_slice_height before failing the check, so the caller passes this SU-specific value into PSR1 setup despite the failure.
Restore the PSR version guard and failure handling in the new caller. PSR1 proceeds with the zero-initialized DSC slice height, while PSR-SU retains its alignment validation and stops setup if that validation fails.
---
Tested on a Xiaomi Redmi Book Pro 15 2023 (TM2209), Ryzen 7 7840HS / Radeon 780M, BIOS RMAPH5B0P0909, with Linux 7.3.0 on NixOS.
The tested panel uses PSR1. Its 2000-line mode has 16 vertical DSC slices, giving a slice height of 125, which is not a multiple of its advertised SU Y granularity of 4.
Before the patch, boot produced:
WARNING: .../display/modules/power/power_psr.c:666
psr_su_set_dsc_slice_height+0x7e/0xa0 [amdgpu]
mod_power_psr_notify_mode_change+0x1b7/0x270 [amdgpu]
mod_power_notify_mode_change+0x160/0x1d0 [amdgpu]After rebuilding and booting with the patch, that warning is absent. With VRR disabled, repeated debugfs reads report psr_state=6 (PSR_STATE3) both with and without the patch. PSR remains functional in both cases.
The older dsc2_disable warning in #3027 is no longer reproduced on this kernel. This patch addresses the remaining psr_su_set_dsc_slice_height warning; it does not modify the dsc2_disable path.
The patch is based on the mainline v7.3 release:
c03c1a14507dfaf8b856c2608f9ac216021fc222
This matches the kernel release used for hardware testing. The original power_psr.c is identical to the Linux 7.3 source used for the hardware-tested patch.
The patch also applies to drm-next-2026-10-31:
f94ed3d7cba3c83eef50b1a96d630d63cf54f69c
Additional validation covered eight cases in an isolated C harness using the actual setup and slice-height functions with hardware calls stubbed. The original PSR1 warning was reproduced; the patch avoids it, retains valid PSR-SU setup, and prevents setup after failed SU alignment validation.
The patched translation unit was also compiled against Linux 7.3 headers. PSR-SU behavior has not been tested on PSR-SU-capable hardware.
LLM assistance: source history tracing; stubbed software tests; submission checks.
drivers/gpu/drm/amd/display/modules/power/power_psr.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/modules/power/power_psr.c +6 -3
@@ -94,9 +94,12 @@ bool mod_power_psr_notify_mode_change(struct mod_power *mod_power,* The value of DSC slice height is determined in DSC Driver but it does not * propagated out here, so we need to calculate it as below 'slice_height'. */ -psr_su_set_dsc_slice_height (dc, link, - (struct dc_stream_state *) stream, - &psr_config); +if (link->psr_settings.psr_version ==DC_PSR_VERSION_SU_1 ) { +if (!psr_su_set_dsc_slice_height (dc, link, + (struct dc_stream_state *)stream, + &psr_config)) +return false; + }dc_link_setup_psr (link, stream, &psr_config, &psr_context);
base-commit: c03c1a14507dfaf8b856c2608f9ac216021fc222 --
2.56.0
Quoted 93 lines · Egor Perevoshchikov
[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
Commit
a5ce8695d6d1("drm/amd/display: Avoid configuring PSR granularity if PSR-SU not supported") restricted DSC slice-height configuration to PSR-SU. The power-module integration removed that guarded caller. Its replacement inmod_power_psr_notify_mode_change()callspsr_su_set_dsc_slice_height()unconditionally and ignores its return value.On PSR1 links with a DSC slice configuration, this applies a PSR-SU-only alignment check even though selective update is not enabled. If the calculated DSC slice height is not a multiple of the nonzero advertised SU Y granularity, the helper triggers an assertion. It also sets
dsc_slice_heightbefore failing the check, so the caller passes this SU-specific value into PSR1 setup despite the failure.Restore the PSR version guard and failure handling in the new caller. PSR1 proceeds with the zero-initialized DSC slice height, while PSR-SU retains its alignment validation and stops setup if that validation fails.
Fixes 3c108046e1d6 ("drm/amd/display: Add power module on Linux")Assisted-by LLMSigned-off-by Egor Perevoshchikov <[email protected]>---
Tested on a Xiaomi Redmi Book Pro 15 2023 (TM2209), Ryzen 7 7840HS / Radeon 780M, BIOS RMAPH5B0P0909, with Linux 7.3.0 on NixOS.The tested panel uses PSR1. Its 2000-line mode has 16 vertical DSC slices, giving a slice height of 125, which is not a multiple of its advertised SU Y granularity of 4.
Before the patch, boot produced:
WARNING: .../display/modules/power/power_psr.c:666 psr_su_set_dsc_slice_height+0x7e/0xa0 [amdgpu] mod_power_psr_notify_mode_change+0x1b7/0x270 [amdgpu] mod_power_notify_mode_change+0x160/0x1d0 [amdgpu]After rebuilding and booting with the patch, that warning is absent. With VRR disabled, repeated debugfs reads report psr_state=6 (
PSR_STATE3) both with and without the patch. PSR remains functional in both cases.The older
dsc2_disablewarning in #3027 is no longer reproduced on this kernel. This patch addresses the remainingpsr_su_set_dsc_slice_heightwarning; it does not modify thedsc2_disablepath.The patch is based on the mainline v7.3 release:
c03c1a14507dfaf8b856c2608f9ac216021fc222This matches the kernel release used for hardware testing. The original
power_psr.cis identical to the Linux 7.3 source used for the hardware-tested patch.
The patch also applies to drm-next-2026-10-31:f94ed3d7cba3c83eef50b1a96d630d63cf54f69cAdditional validation covered eight cases in an isolated C harness using the actual setup and slice-height functions with hardware calls stubbed. The original PSR1 warning was reproduced; the patch avoids it, retains valid PSR-SU setup, and prevents setup after failed SU alignment validation.
The patched translation unit was also compiled against Linux 7.3 headers. PSR-SU behavior has not been tested on PSR-SU-capable hardware.LLM assistance: source history tracing; stubbed software tests; submission checks.
drivers/gpu/drm/amd/display/modules/power/power_psr.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/display/modules/power/power_psr.c +6
-3@@ -94,9 +94,12 @@ bool mod_power_psr_notify_mode_change(struct mod_power *mod_power,* The value of DSC slice height is determined in DSC Driver but it does not * propagated out here, so we need to calculate it as below 'slice_height'. */ -psr_su_set_dsc_slice_height (dc, link, - (struct dc_stream_state *) stream, - &psr_config); +if (link->psr_settings.psr_version ==DC_PSR_VERSION_SU_1 ) { +if (!psr_su_set_dsc_slice_height (dc, link, + (struct dc_stream_state *)stream, + &psr_config)) +return false; + }dc_link_setup_psr (link, stream, &psr_config, &psr_context);base-commit:
c03c1a14507dfaf8b856c2608f9ac216021fc222--
2.56.0