Both backlight paths in amdgpu_dm_backlight.c map the 16-bit user level through the ATIF custom brightness curve, whose points pair an 8-bit signal with a whole-percent luminance. Both round the level to one of those signals and the luminance to a whole percent first. That hurts most at the dim end, where one percent is a large share of the light. With the curve of an ASUS ROG Flow X13 GV301QH, minimum 12 and 49 points:
- On PWM, the lowest level asks for 2% of full brightness, and the first 2% of the scale steps from there to 3%, 4% and 5%. Each step is 50%, 33% and 25% brighter than the one before. The bottom 10% of the scale has 18 different brightness values - On AUX, with amdgpu.backlight=1 to force the unsupported AUX path, the 1..512 nits fallback range stays at 1 nit for the bottom 6.1% of the scale, and the next steps go to 3, 5 and 7 nits. The bottom 10% of the scale has 4 different values, and the top stops at 496 nits This series interpolates on the unrounded level and rounds once at the end. On PWM, the power module also interpolates between its LUT entries now, from millipercent to PWM and back. The bottom 10% of the scale then has 6018 different values on PWM instead of 18, and 33311 on AUX instead of 4. Level 0 still gives the panel's minimum and the top level gives its maximum. On AUX only levels 0 and 1 now sit at the minimum, instead of the bottom 6.1% of the scale - Patch 1 renames the min and max of the user range to user_min and user_max, to avoid confusion with the curve's signal_max and the output_max that patch 4 adds. No functional change - Patches 2 and 3 interpolate between the power module's LUT entries, from millipercent to PWM and back - Patch 4 stops rounding the PWM path - Patches 5 and 6 test the PWM path and the LUT with the GV301QH curve - Patch 7 maps AUX through the same curve code as PWM, which reaches max at the top, and removes convert_custom_brightness() - Patch 8 tests the AUX path Patch 7 changes what an AUX panel gets. Until now an AUX level asked for the curve's luminance percentage times the level, so the level went in twice. Now it asks for min plus that percentage of the range above min, the same luminance the PWM path asks the power module for. On the fallback range, half the scale goes from 159 nits to 315 nits. I found no reason for the old product, but I may be missing the intent. I also can't test it meaningfully, as I don't have a panel with an AUX backlight The series applies on top of "drm/amd/display: Fix the doubled AUX backlight minimum on the custom curve" [1]. That series fixes the minimum going in twice on AUX, and asks whether the ATIF curve is meant for AUX at all. Patch 7 keeps applying the curve on AUX, as the code always has. Since it changes what AUX panels get, it has no Fixes: tags One question for you: on PWM, above the last point the curve still runs to 100% at max_input_signal, as backlight_signal_to_luminance() did, while the level maps to the 0..255 signal scale over the whole user range. With max_input_signal below 255 the top of the PWM scale is flat at full brightness. AUX keeps ending the curve at 255, as it did before. Should PWM end at 255 too? This is also a request for testing. My laptop drives its panel over PWM, and the panel ignores AMD's AUX brightness, so I tested the AUX path only with KUnit and with the amdgpu_dm_brightness trace on a forced AUX path. If you have a panel with an AUX backlight and an ATIF custom curve, a Tested-by on patches 7 and 8 would help. The middle of the scale should get brighter, the bottom should no longer sit at the minimum and the top should reach full brightness. Patches 1 to 6 don't depend on them, so they can go in without the AUX half [1] https://lore.kernel.org/r/[email protected] Signed-off-by: Hugo Sales <[email protected]> --- Hugo Sales (8): drm/amd/display: Rename the user brightness range to user_min and user_max drm/amd/display: Interpolate between backlight LUT entries drm/amd/display: Interpolate when reading PWM back as a percentage drm/amd/display: Stop rounding PWM brightness to whole percents drm/amd/display: Add KUnit tests for the custom brightness curve drm/amd/display: Add KUnit tests for backlight LUT interpolation drm/amd/display: Map AUX brightness through the custom curve like PWM drm/amd/display: Add KUnit tests for the AUX custom brightness curve .../amd/display/amdgpu_dm/amdgpu_dm_backlight.c | 218 ++--- .../amd/display/amdgpu_dm/amdgpu_dm_backlight.h | 6 +- .../amdgpu_dm/tests/amdgpu_dm_backlight_test.c | 923 +++++++++++++++------ .../gpu/drm/amd/display/modules/power/power_abm.c | 72 +- .../drm/amd/display/modules/power/power_helpers.h | 4 + 5 files changed, 784 insertions(+), 439 deletions(-) --- base-commit: ba496bb837882eb1af58f41572fc289e46c77b8c change-id: 20261102-backlight-curve-rfc-1bb4b6dee24c prerequisite-message-id: <[email protected]> prerequisite-patch-id: 0eefd25bf4ad8f6d779c7a0b0a63f84969b67fca prerequisite-patch-id: 016515673f79f623de1e50dd513e5440587329b6 prerequisite-patch-id: ba453baf376b5410d66feacb1956eea933042ae8 Best regards, -- Hugo Sales <[email protected]>
