Bug 494408 - Monitor brightness resets to 100% on every monitor wakeup
Summary: Monitor brightness resets to 100% on every monitor wakeup
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: output configuration (show other bugs)
Version: 6.2.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Jakob Petsovits
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-10-10 11:14 UTC by Tomi
Modified: 2024-12-20 07:14 UTC (History)
14 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.3.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tomi 2024-10-10 11:14:05 UTC
SUMMARY
Monitor brightness keeps constantly resetting back to 100%

STEPS TO REPRODUCE
1. Turning monitor off and then on again
2. Just by launching some apps for example firefox
3. By having freesync enabled

OBSERVED RESULT
Brightness goes back to 100% with every monitor

EXPECTED RESULT
It should stay as that value i set it in OSD.

Linux/KDE Plasma: 
KDE Plasma Version: 6.2.0
KDE Frameworks Version: 6.6.0
Qt Version: 6.7.3

ADDITIONAL INFORMATION
 Anyways i have sensitive eyes so white backgrounds at 100% brightness almost get my eyes to watering. If this is some setting that can be changed then it should be in display configuration so it can be easily found
Comment 1 Tomi 2024-10-10 12:24:01 UTC
Managed to fix this issue by installing power-profiles-daemon from arch repo since it was missing from original plasma install now i can change brightness from taskbar. Still it might be better to let users decide between changing monitor brightness from plasma itself or monitor osd. So adding option in monitor configuration page would be ideal in my opinion
Comment 2 Nate Graham 2024-10-10 18:36:43 UTC
Did you not have powerdevil installed as well? I can't see how installing only power-profiles-daemon would have resolved this.
Comment 3 Tomi 2024-10-11 10:03:50 UTC
apparently i didnt have it installed i guess. When i installed arch i installed plasma-meta package but it still was missing power-profiles-daemon. My kde plasma basically let me know i was missing that package when i did some digging. After i installed that package i can set my monitor brightness from taskbar "brightness and color". I guess it defaulted to 100% when i was missing that package so it got resolved that way
Comment 4 Jakob Petsovits 2024-10-11 14:23:48 UTC
KWin defaults the brightness of every monitor to 100% and that's a bug that I can confirm. It happens on session startup, monitor wake-up, and possibly other KWin output configuration change events, until the default brightness is changed. I have seen reports of this on Reddit and Lemmy.

To reproduce:
* Log out of Plasma
* Delete the "brightness" property from your monitor entry in .config/kwinoutputconfig.json
* Manually reduce hardware brightness for your display
* Start a new Plasma Wayland session.

KWin will ask PowerDevil to max out the brightness for any display without this entry, even if hardware brightness is currently lower than max.

The power-profile-daemon installation seems like a red herring, because monitor brightness controls should be available with just PowerDevil by itself. (Without PowerDevil, hardware screen brightness would not be raised.) But the point is that the user needs to change the brightness default to get back to their previously configured monitor brightness, and they shouldn't have to do that.

The bad news is that a fix will require an addition to plasma-wayland-protocols, plus matching patches in PowerDevil (to announce the initial monitor brightness) and KWin (to use it if it was announced). While I know that this can be done in a backwards-compatible way, I'm not sure if the existing guidelines around Wayland protocol versioning will allow me to make it so that PowerDevil will keep working with KWin from 6.2.0. That's a discussion topic for the merge review though.
Comment 5 Zamundaaa 2024-10-12 17:13:40 UTC
I don't think this can be solved nicely... if your monitor resets its brightness on power off (which some do!), you really want KWin to ignore what it says.

Can we somehow detect that the user actually used the OSD to change the brightness level? Or detect that the OSD is open when the brightness gets changed, and only accept the change then?
Comment 6 Jakob Petsovits 2024-10-12 17:25:08 UTC
(In reply to Zamundaaa from comment #5)
> Can we somehow detect that the user actually used the OSD to change the
> brightness level? Or detect that the OSD is open when the brightness gets
> changed, and only accept the change then?

No. The best we can do is poll the monitor semi-regularly (perhaps every 30 seconds) and assume that any observed changes during the KWin session, while the monitor is on, were intentional. That's what the externalBrightnessChangeObserved signal within PowerDevil is meant to do, minus the polling part which is not currently being done for DDC/CI devices (but could be added).
Comment 7 quintus 2024-10-13 11:06:26 UTC
I see this as well on ArchLinux without power-profiles-daemon. powerdevil is installed in version 6.2.0. I did not have this problem before version 6.2.0. Now I can set on my monitor's OSD whatever value I want, as soon as the dimming timeout configured in KDE's power saving settings is reached, or after wakeup from suspend, the monitor's brightness is always set to 100%, which hurts my eyes (just as with the OP).

This only happens on my external monitor (BenQ PD2700U-B), which I use with my laptop's lid closed in a vertical stand (“clamshell” style).
Comment 8 Steven McDougall 2024-10-13 18:52:50 UTC
Monitor brightness resets to 100% on every monitor wake-up.

Software
KDE Plasma Version: 6.2.0
KDE Frameworks Version: 6.7.0
Qt Version 6.7.2
Kernel Version 6.10.12-300.fc40.x84_64 (64-bit)
Graphics Platform: Wayland

Hardware
Processors: 4 x Intel Core i5-4590 CPU @3.30GZ
Memory 7.6 GiB RAM
Graphics Processor: Mesa Intel HD Graphics 4600
Manufacturere: ASUS

I upgraded to the latest KDE yesterday.
The previous KDE version behaved a bit differently: on every monitor wake-up, the brightness reverted to the value that it had at the last system boot.
Comment 9 Steven McDougall 2024-10-14 00:33:10 UTC
Huh...I did a few reboots and a factory reset of the monitor (Dell U3023E) and the problem seems to have gone away.
Comment 10 Bart Povojnic 2024-10-14 04:28:05 UTC
If using external monitor, workaround is to disable DCC/CI on monitor OSD.
Comment 11 Gavin Liddell 2024-10-15 00:25:02 UTC
I found that on both my Dell S2721DGF and my BenQ GW2480 that disabling DDC/CI worked for me. I don't like controlling my monitors via software anyways (except for some color correction), so that was the fix that works best for me.

Might not be the best solution for those who like controlling their monitor's settings via software or who have no choice but control them via software (laptops being the primary example). Don't know if laptops are affected by this bug, but something worth pointing out.
Comment 12 Bug Janitor Service 2024-10-19 16:28:24 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/6667
Comment 13 quintus 2024-10-20 07:09:38 UTC
I have now installed `power-profiles-daemon'. This gets me a new
widget for setting monitor brightness in my task bar, and if I use
that one to set the brightness, the problem goes away.
Comment 14 Junakreiter 2024-10-23 18:15:38 UTC
Here the same problem. On arch linux.
Although the "change brightness" option is disabled, after wakeup it is 100%
and overrides my hardware setting on the monitor.
For me it is weird that the monitor brightness control is in the power section AND
that it is not available for all monitors independently.
Comment 15 Bug Janitor Service 2024-11-03 22:27:25 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/powerdevil/-/merge_requests/455
Comment 16 Junakreiter 2024-11-28 07:20:54 UTC
This is still a problem for me having two different calibrated monitors.
All i need is to switch off the software brightness settings, but i fail to do so.
Comment 17 Jakob Petsovits 2024-12-18 19:26:16 UTC
Git commit b799470e6edef0dd5e26bc6d7ae4d7c47ec64b50 by Jakob Petsovits.
Committed on 18/12/2024 at 19:10.
Pushed by jpetso into branch 'master'.

Initially adopt current brightness of external brightness device

This prevents KWin from amping up every display's brightness
to 100% after a 6.2 update. Subsequent changes through a monitor's
OSD menu or another software's DDC/CI commands are still ignored.

Depends on an interface addition to external-brightness-v1
from plasma-wayland-protocols.
Related: bug 494497

M  +10   -0    src/backends/drm/drm_output.cpp
M  +2    -0    src/core/brightnessdevice.h
M  +18   -1    src/wayland/externalbrightness_v1.cpp
M  +4    -1    src/wayland/externalbrightness_v1.h
M  +1    -0    src/workspace.cpp

https://invent.kde.org/plasma/kwin/-/commit/b799470e6edef0dd5e26bc6d7ae4d7c47ec64b50
Comment 18 Jakob Petsovits 2024-12-18 19:37:41 UTC
Note that the fix (coming to 6.3.0) is for people who encounter this issue on a new setup without pre-existing KWin output configuration. For everyone in here for whom KWin/Wayland has already set brightness to 100%, please remember to use the Brightness and Color applet to permanently change your monitor brightness.
Comment 19 Tom 2024-12-18 20:15:57 UTC
In the past, we did not have to use the Brightness and Color applet, we could just use our monitor's brightness controls and KDE would leave it alone. Is there a way to support that workflow?
Comment 20 Jakob Petsovits 2024-12-18 21:15:34 UTC
(In reply to Tom from comment #19)
> In the past, we did not have to use the Brightness and Color applet, we
> could just use our monitor's brightness controls and KDE would leave it
> alone. Is there a way to support that workflow?

We have Bug 494497 still open to resolve that issue for Wayland. What's left to do on this front is code to manually read the current brightness from the monitor before making any change to it, so that we can restore brightness to the last configured level again later. As mentioned elsewhere (e.g. at https://discuss.kde.org/t/powerdevil-is-re-setting-my-display-brightness-after-the-display-wakes-up/23079/9), this is complicated by the fact that monitors don't send brightness change notifications to the OS but KWin has to get its brightness value from somewhere. It's doable to make it work without giving up on brightness control altogether. Still not quite there yet though.

Imho the next step should be to add a checkbox to KWin's Display Configuration page in System Settings that specifically excludes a given display from brightness controls. That would go a long way for giving Wayland users a way out.

On X11, Plasma 6.3 improves its behavior to avoid restoring the last known (but possibly wrong) brightness value after the monitor sleeps and wakes up again.
Comment 21 Junakreiter 2024-12-20 07:14:44 UTC
(In reply to Jakob Petsovits from comment #20)

> Imho the next step should be to add a checkbox to KWin's Display
> Configuration page in System Settings that specifically excludes a given
> display from brightness controls. That would go a long way for giving
> Wayland users a way out.

That sounds great !