The ATIF custom brightness curve comes from firmware, and amdgpu uses it without checking that its points rise. Patch 1 checks the curve once at probe. It drops a curve whose signals fall, caps a luminance over 100% at 100%, and raises a luminance that falls. When it changes the curve, it warns about a firmware bug. Patch 2 adds KUnit tests. Patch 3 turns the debug message for an invalid signal range into a warning too, so users have something to report
I haven't seen a curve this would change. My laptop's curve passes, and so do 240 static curves I found in public ACPI dumps of 15 laptop models. On many Ryzen laptops the firmware builds the curve at boot, though, and a scan of the tables can't see those. The bug reports I found of an ASUS curve over 100% turned out to be a different overflow bug. Sashiko flagged a luminance over 100% while reviewing [1], and I extended the check to falling points. So this is hardening. If you'd rather not carry the check, I'm fine with dropping it It applies on top of "drm/amd/display: Stop rounding backlight levels to whole percents" [1]. Patch 2's brightness checks use the curve mapping from that series [1] https://lore.kernel.org/lkml/[email protected]/ Signed-off-by: Hugo Sales <[email protected]> --- Hugo Sales (3): drm/amd/display: Repair or drop a bad ATIF backlight curve drm/amd/display: Add KUnit tests for the ATIF backlight curve check drm/amd/display: Warn about an invalid ATIF backlight signal range .../amd/display/amdgpu_dm/amdgpu_dm_backlight.c | 50 +++++- .../amdgpu_dm/tests/amdgpu_dm_backlight_test.c | 184 +++++++++++++++++++++ 2 files changed, 232 insertions(+), 2 deletions(-) --- base-commit: ba496bb837882eb1af58f41572fc289e46c77b8c change-id: 20261103-backlight-curve-validate-243c4ce9692c prerequisite-message-id: <[email protected]> prerequisite-patch-id: 0eefd25bf4ad8f6d779c7a0b0a63f84969b67fca prerequisite-patch-id: 016515673f79f623de1e50dd513e5440587329b6 prerequisite-patch-id: ba453baf376b5410d66feacb1956eea933042ae8 prerequisite-message-id: <[email protected]> prerequisite-patch-id: ab08642e6487dac872fecb986cee493826c90ca9 prerequisite-patch-id: 615ae71fc87a132500083a791977cedffb5c5535 prerequisite-patch-id: d5f11b9531761fbfd4103cebc6f0e9403cd53772 prerequisite-patch-id: 95660ed7df12918c00809bf09d9d979c597bcbb6 prerequisite-patch-id: 4bf24c99ce3da811000e96e67ca6b93df79eb964 prerequisite-patch-id: 33257e757b334f4a8cb44b4efc24a3f3cd000307 prerequisite-patch-id: dec6b61e59750a963d14cb6905cb76a4cb76f77c prerequisite-patch-id: f1fe27995f1a36d9382674eb9951ea5fe5f18a91 Best regards, -- Hugo Sales <[email protected]>
