* [PATCH] drm/amd/display: use linear backlight curve on Linux
@ 2026-09-01 14:01 Aarav Kumar
2026-09-01 14:23 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: Aarav Kumar @ 2026-09-01 14:01 UTC (permalink / raw)
To: amd-gfx
Cc: dri-devel, linux-kernel, harry.wentland, sunpeng.li, siqueira,
alexander.deucher, christian.koenig, ray.wu, Aarav Kumar
The power module currently uses a non-linear backlight curve for the
Linux backlight path. This results in incorrect brightness levels on
affected systems.
Use the linear backlight curve instead to preserve the existing
brightness-to-PWM mapping.
Tested on an AMD laptop with an eDP panel. The regression was
reproduced with commit 3c108046e1d6 ("drm/amd/display: Add power
module on Linux"), and the brightness behavior was restored with this
change.
Fixes: 3c108046e1d6 ("drm/amd/display: Add power module on Linux")
Link: https://gitlab.freedesktop.org/drm/amd/-/work_items/5723
Signed-off-by: Aarav Kumar <aarav.240604@gmail.com>
---
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 8d690468d..cd10a5d45 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -1913,7 +1913,7 @@ static int amdgpu_dm_init_power_module(struct amdgpu_display_manager *dm)
!(amdgpu_dc_feature_mask & DC_DISABLE_FRACTIONAL_PWM_MASK);
init_data[i].use_custom_backlight_caps = false;
init_data[i].custom_backlight_caps_config_no = 0;
- init_data[i].use_linear_backlight_curve = false;
+ init_data[i].use_linear_backlight_curve = true;
init_data[i].def_varibright_enable = 0;
init_data[i].varibright_level = 0;
/*
--
2.55.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] drm/amd/display: use linear backlight curve on Linux
2026-09-01 14:01 [PATCH] drm/amd/display: use linear backlight curve on Linux Aarav Kumar
@ 2026-09-01 14:23 ` sashiko-bot
0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-09-01 14:23 UTC (permalink / raw)
To: Aarav Kumar; +Cc: dri-devel
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
New issues:
- [High] Enabling use_linear_backlight_curve creates an asymmetry between the backlight set and get operations, breaking readbacks.
Pre-existing issues:
- [High] Incorrect millipercent calculation adds the minimum brightness offset twice, artificially doubling the minimum backlight level.
--
commit d81c87ee8304f9423dd46886dacd5118c129a998
Author: Aarav Kumar <aarav.240604@gmail.com>
drm/amd/display: use linear backlight curve on Linux
This commit switches the power module to use a linear backlight curve
on Linux to preserve the existing brightness-to-PWM mapping. This fixes
incorrect brightness levels observed on affected systems.
Link: https://gitlab.freedesktop.org/drm/amd/-/work_items/5723
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index eb00c62c6f724..1ba74924859dc 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -418,7 +418,7 @@ static int amdgpu_dm_init_power_module(struct amdgpu_display_manager *dm)
> !(amdgpu_dc_feature_mask & DC_DISABLE_FRACTIONAL_PWM_MASK);
> init_data[i].use_custom_backlight_caps = false;
> init_data[i].custom_backlight_caps_config_no = 0;
> - init_data[i].use_linear_backlight_curve = false;
> + init_data[i].use_linear_backlight_curve = true;
[Severity: High]
Does enabling this flag create an asymmetry between the backlight set and get
operations?
When the write path uses the linear curve, the read path in
backlight_pwm_to_millipercent_legacy() in power_abm.c lacks support for this
flag and unconditionally performs a binary search on the non-linear ACPI LUT.
Can this cause sysfs readbacks to return incorrect values?
[Severity: High]
This isn't a bug introduced by this patch, but using the linear curve strictly
exposes an issue in the millipercent calculation in
amdgpu_dm_backlight_set_level() in amdgpu_dm_backlight.c.
In amdgpu_dm_backlight_set_level():
brightness = convert_brightness_from_user(caps, dm->brightness[bl_idx]);
...
get_brightness_range(caps, &min, &max);
brightness = DIV_ROUND_CLOSEST(brightness * 100, (max - min)) * 1000;
Since convert_brightness_from_user() returns an absolute value scaled between
min and max, computing the percentage without subtracting min first causes the
millipercent value to already contain the minimum offset.
When this is passed to backlight_millipercent_to_pwm_legacy(), which computes:
min_backlight_pwm + (millipercent * range)
Does this artificially double the minimum backlight level and prevent the
screen from dimming properly?
> init_data[i].def_varibright_enable = 0;
> init_data[i].varibright_level = 0;
> /*
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260901140155.19129-1-aarav.240604@gmail.com?part=1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-03 7:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-01 14:01 [PATCH] drm/amd/display: use linear backlight curve on Linux Aarav Kumar
2026-09-01 14:23 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox