AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ray Wu <ray.wu@amd.com>
To: Matthew Schwartz <matthew.schwartz@linux.dev>,
	"Wentland, Harry" <Harry.Wentland@amd.com>,
	"Li, Sun peng (Leo)" <Sunpeng.Li@amd.com>,
	"Deucher, Alexander" <Alexander.Deucher@amd.com>
Cc: "Limonciello, Mario" <Mario.Limonciello@amd.com>,
	"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH RESEND 2/2] drm/amd/display: Keep backlight precision in millipercent
Date: Tue, 29 Sep 2026 09:37:16 +0800	[thread overview]
Message-ID: <cfba3d1e-5311-434e-be7e-d11523901565@amd.com> (raw)
In-Reply-To: <20260916191102.1195881-2-matthew.schwartz@linux.dev>

Hi Mathew,

Same as your other patch, a similar change has already been merged into 
asdn DC 3.2.400 release.
     commit: drm/amd/display: map PWM brightness through custom 
backlight curve

Please give it a try, and if you still see any other issues, feel free 
to send an updated patch.

Thanks,
Ray

On 9/17/2026 3:11 AM, Matthew Schwartz wrote:
> The power module takes the backlight level in millipercent, but DM
> rounds the 16-bit level to a whole percent before multiplying by 1000,
> collapsing the range to 101 steps. It also divides the absolute level,
> which already includes the panel minimum, by the min to max span, so
> panels with a nonzero minimum PWM overshoot the top of the range.
>
> Scale the offset from the minimum to millipercent directly so the full
> resolution reaches the power module and the minimum is only added once.
>
> Fixes: 3c108046e1d6 ("drm/amd/display: Add power module on Linux")
> Signed-off-by: Matthew Schwartz <matthew.schwartz@linux.dev>
> ---
>   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_backlight.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_backlight.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_backlight.c
> index 45e1732a5b04..079277d47b3f 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_backlight.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_backlight.c
> @@ -326,7 +326,8 @@ void amdgpu_dm_backlight_set_level(struct amdgpu_display_manager *dm,
>   	} else {
>   		/* power module uses millipercent */
>   		get_brightness_range(caps, &min, &max);
> -		brightness = DIV_ROUND_CLOSEST(brightness * 100, (max - min)) * 1000;
> +		brightness = DIV_ROUND_CLOSEST_ULL((u64)(brightness - min) * 100000,
> +						   max - min);
>   		rc = mod_power_set_backlight_percent(dm->power_module, stream,
>   						     brightness, 0, false);
>   	}

  reply	other threads:[~2026-09-29  1:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-16 19:11 [PATCH RESEND 1/2] drm/amd/display: Use linear backlight curve in power module Matthew Schwartz
2026-09-16 19:11 ` [PATCH RESEND 2/2] drm/amd/display: Keep backlight precision in millipercent Matthew Schwartz
2026-09-29  1:37   ` Ray Wu [this message]
2026-09-29  1:35 ` [PATCH RESEND 1/2] drm/amd/display: Use linear backlight curve in power module Ray Wu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cfba3d1e-5311-434e-be7e-d11523901565@amd.com \
    --to=ray.wu@amd.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Harry.Wentland@amd.com \
    --cc=Mario.Limonciello@amd.com \
    --cc=Sunpeng.Li@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=matthew.schwartz@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox