Re: wsdisplay brightness issue on amd64
Jonathan Gray <[email protected]>
| Newsgroups | gmane.os.openbsd.bugs |
|---|---|
| Message-ID | <[email protected]> |
On Sun, Aug 09, 2026 at 08:44:45PM +0100, Jason McIntyre wrote:
> On Sun, Aug 09, 2026 at 11:12:56AM +0100, Jason McIntyre wrote:
> > hi/
> >
> > when this machine boots, the screen display dims severely right about the
> > time my wsdisplay attach shows in dmesg. i can fix it manually by
> > adjusting display.brightness.
> >
> > setting display.brightness to 0 is brighter than the booted default.
> >
> > setting most display.brightness values work as normal, but 97-100 revert
> > it to this super dim state.
> >
> > i have not updated the laptop in two weeks, so hard to pin down when
> > this would have happened (it's running current).
> >
> > i confirmed this happened on a boot of stock /bsd.mp.
> >
> > can;t think of anything else!
> > jmc
> >
>
> a little progress:
>
> firstly i mis-diagnosed the issue. display.brightness=0 is not brighter
> than the booted default! i'm not exactly sure how i reached that
> conclusion.
>
> but what i do see is values 97-100 severly dimming the screen. that
> suggests a weird round up/bounds check (heh, i'm winging it here). i
> noticed because i normally set max brightness in wsconsctl.conf, so it
> dimmed my screen.
>
> i narrowed it down to a commit between
>
> Sun Aug 2 23:29:09 MDT 2026
> and
> Mon Aug 3 22:42:09 MDT 2026
>
> (thanks nick for the archive reminder)
>
> commits on those dates suggest the updates to drm. there are a lot, and
> i'm blind. i'm ccing jsg in case he sees something obvious.
>
> jmc
try this revert of 6.18.42's
drm/amd/display: Fix backlight max_brightness to match exported range
Index: sys/dev/pci/drm/amd/display/amdgpu_dm/amdgpu_dm.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/drm/amd/display/amdgpu_dm/amdgpu_dm.c,v
diff -u -p -r1.202 amdgpu_dm.c
--- sys/dev/pci/drm/amd/display/amdgpu_dm/amdgpu_dm.c 3 Aug 2026 14:53:30 -0000 1.202
+++ sys/dev/pci/drm/amd/display/amdgpu_dm/amdgpu_dm.c 10 Aug 2026 00:09:33 -0000
@@ -5220,11 +5220,11 @@ amdgpu_dm_register_backlight_device(stru
caps = &dm->backlight_caps[aconnector->bl_idx];
if (get_brightness_range(caps, &min, &max)) {
if (power_supply_is_system_supplied() > 0)
- props.brightness = DIV_ROUND_CLOSEST(max * caps->ac_level, 100);
+ props.brightness = DIV_ROUND_CLOSEST((max - min) * caps->ac_level, 100);
else
- props.brightness = DIV_ROUND_CLOSEST(max * caps->dc_level, 100);
+ props.brightness = DIV_ROUND_CLOSEST((max - min) * caps->dc_level, 100);
/* min is zero, so max needs to be adjusted */
- props.max_brightness = max;
+ props.max_brightness = max - min;
drm_dbg(drm, "Backlight caps: min: %d, max: %d, ac %d, dc %d\n", min, max,
caps->ac_level, caps->dc_level);
} else