Bug 476550

Summary: After DDC-capable monitors become dimmed, moving the mouse raises them all to a single brightness value, not the brightness they had before being dimmed
Product: [Plasma] Powerdevil Reporter: Konstantin <jon9097>
Component: generalAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: ben, hu.repasidavid, jpetso, natalie_clarius, nate, poscat0x04
Priority: NOR    
Version: 5.27.9   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In: 6.2.1
Sentry Crash Report:
Attachments: Scr

Description Konstantin 2023-11-04 14:39:14 UTC
Created attachment 162860 [details]
Scr

The screen dimming function does not work properly.

I have 3 monitors and after the brightness of the monitor decreases, if I move the mouse, the same brightness is set on all monitors. Simply put, the brightness settings of the monitors are lost to a single value. I have 27 brightness on the first monitor, 27 on the second, and 100 on the third.

The "Screen Fading" mode is turned on and when you exit it, the brightness of all monitors becomes 27.

Operating System: Arch Linux 
KDE Plasma Version: 5.27.9
KDE Frameworks Version: 5.111.0
Qt Version: 5.15.11
Kernel Version: 6.5.9-zen2-1-zen (64-bit)
Graphics Platform: Wayland
Processors: 16 × Intel® Core™ i7-10700K CPU @ 3.80GHz
Memory: 62.7 ГиБ of RAM
Graphics Processor: NVIDIA GeForce RTX 4080/PCIe/SSE2
Manufacturer: Micro-Star International Co., Ltd.
Product Name: MS-7C80
System Version: 1.0
Comment 1 Natalie Clarius 2023-11-06 03:17:38 UTC
Am I understanding you correctly that your issue is that after waking up from dimming, the brightness that was set previously is not correctly remembered for each monitor individually?
Comment 2 Konstantin 2023-11-06 12:49:29 UTC
(In reply to Natalie Clarius from comment #1)
> Am I understanding you correctly that your issue is that after waking up
> from dimming, the brightness that was set previously is not correctly
> remembered for each monitor individually?

That's right, after the brightness is restored, the same brightness is set on all monitors.
Comment 3 Konstantin 2023-11-06 13:24:17 UTC
(In reply to Natalie Clarius from comment #1)
> Am I understanding you correctly that your issue is that after waking up
> from dimming, the brightness that was set previously is not correctly
> remembered for each monitor individually?

I have 3 monitor monitors:
Acer VG270U (Main)
Acer VG240Y
LG 2243

I set the brightness I need on each monitor separately, but after automatically reducing the brightness when I move the mouse (or do something else), the same brightness is set on all monitors. Although at first it is different.
Comment 4 Poscat 2024-05-15 12:37:16 UTC
Can reproduce on Fedora 40 KDE spin, with Philips 279c9 monitor. If I wake KDE up immediately after the screen has completely dimmed, the brightness level seems to be able to restore to the original value. If I wait too long then the resulting brightness is significantly lower than the original. My hypothesis is that this is caused by the DDC signal sent too early by KDE, when the display wasn't even prepared to receive and to react to such signal.
Comment 5 Poscat 2024-05-15 12:39:30 UTC
System Info:

Operating System: Fedora Linux 40
KDE Plasma Version: 6.0.4
KDE Frameworks Version: 6.2.0
Qt Version: 6.7.0
Kernel Version: 6.8.9-300.fc40.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 20 × 12th Gen Intel® Core™ i7-12700
Memory: 31.1 GiB of RAM
Graphics Processor: Mesa Intel® UHD Graphics 770
Manufacturer: ASUS
Comment 6 Bug Janitor Service 2024-05-20 03:22:02 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/powerdevil/-/merge_requests/360
Comment 7 Jakob Petsovits 2024-05-20 03:38:54 UTC
So as far as I understand, there are different parts to this issue:

1. The user changes monitor brightness via monitor OSD, also because Plasma doesn't provide per-display controls at the moment. DDC/CI doesn't tell us that a change was made, that's not part of the protocol. PowerDevil would have to read each monitor's current brightness manually before initially dimming, so we know what values to return to. This is essentially Bug 411050 comment #10, and not straightforward to fix. Setting brightness via Plasma brightness controls, or setting brightness before PowerDevil starts (i.e. before login), would be a workaround to not keeping up to date on the latest brightness values.

2. The current brightness setter API only takes a single brightness value, and that value is not adjusted for different monitors. I opened this MR to sidestep this legacy brightness setter API and instead control dimming with a brightness multiplier: https://invent.kde.org/plasma/powerdevil/-/merge_requests/360

3. There's also an issue in setBrightness() in that it doesn't adjust its single value to the different possible maximum brightness values of each monitor that's getting changed. I have a patch to fix that as well, no MR yet, but that's less important here because we're sidestepping setBrightness() anyway as per the previous point.
Comment 8 Répási Dávid 2024-06-09 10:40:27 UTC
There seems to be progress on this issue, I just wanted to share that I have it as well. I only have one monitor, and when moving the mouse in the dimmed state it stays with that value of 27(?).

System Info:

Operating System: Arch Linux
KDE Plasma Version: 6.0.5
KDE Frameworks Version: 6.2.0
Qt Version: 6.7.1
Kernel Version: 6.9.3-arch1-1 (64-bit)
Graphics Platform: Wayland

Monitor: S22F350FHU
Comment 9 Répási Dávid 2024-06-09 10:48:44 UTC
Also, just as a question, is this related: https://bugs.kde.org/show_bug.cgi?id=470664?
Comment 10 Jakob Petsovits 2024-11-15 18:21:30 UTC
Hi, I just went through the bug list again and realized that my earlier change for Plasma 6.2.1 would be the fix for this issue: https://invent.kde.org/plasma/powerdevil/-/merge_requests/433

Plasma 6.2.1 now has per-screen brightness controls, and will restore each monitor's brightness to the value it had configured before dimming. As long as Plasma (i.e. PowerDevil) is aware of the last configured brightness value - there is some more work to be done especially in Wayland sessions (i.e. with KWin brightness integration) to read from monitor brightness values, and not just set them to the brightness slider value in the "Brightness & Color" applet. But that's a different issue (Bug 495109, among possibly others), and I think it makes sense to mark this one as resolved.