Bug 452492

Summary: external screen brightness is not restored after screen wakeup
Product: [Plasma] Powerdevil Reporter: Jos van den Oever <jos>
Component: generalAssignee: Jakob Petsovits <jpetso>
Status: ASSIGNED ---    
Severity: normal CC: aria, chermnykh2001, gudvinr+kde, gwarser, heinep, jeisom, jpetso, kde, kde, matejm98mthw, mecirt, mtjhrj, natalie_clarius, nate, phil.hord, postix, slartibart70
Priority: HI Keywords: regression
Version: 6.0.4   
Target Milestone: ---   
Platform: Other   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=489056
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Jos van den Oever 2022-04-11 08:53:16 UTC
SUMMARY
***
When the external monitor is set to turn off after a certain time of no activity, the brightness is not fully restored after wakeup. The brightness can be fixed with the the keyboard brightness buttons or with `ddcutil setvsp 10 + 65535`.
***


STEPS TO REPRODUCE
1.  run wayland session with dbus-run-session startplasma-wayland
2. set 'Screen energy savings' to 'Switch off after 3 min', press 'Apply'
3. wait 3 minutes until screen turns off
4. awaken screen by doing user input on keyboard

OBSERVED RESULT

The external monitor is on lowest brightness setting.

EXPECTED RESULT

The external monitor is on the same brightness as before it went to sleep.

SOFTWARE/OS VERSIONS
KDE Plasma Version: 5.24.3
KDE Frameworks Version: 5.91.0
Qt Version: 5.15.3
Linux Kernel: 5.15.30
Graphics platform: Wayland

ADDITIONAL INFORMATION
The graphics is embedded Intel graphics UHD Graphics 620. The monitor is LG connected via USB-C for display and power to the laptop. The laptop screen and the external monitor are active. Only the laptop monitor is restored to the initial brightness.

Related bug: https://bugs.kde.org/show_bug.cgi?id=423457
Comment 1 Jos van den Oever 2022-04-11 08:55:28 UTC
The monitor is visible like this:
```
$ ddcutil detect
Display 1
   I2C bus:  /dev/i2c-9
   EDID synopsis:
      Mfg id:               GSM
      Model:                LG HDR 4K
      Product code:         30471
      Serial number:        
      Binary serial number: [..]
      Manufacture year:     [..]
   VCP version:         2.1
```
Comment 2 Matej Mrenica 2023-07-26 05:36:13 UTC
Same issue here, since powerdevil started depending on ddcutil (Arch Linux), every time my screen turns on after it was off for a while its brightness resets to zero but the value in the battery applet remains the same.
Comment 3 Matej Mrenica 2023-07-26 05:37:55 UTC
(In reply to Matej Mrenica from comment #2)
> Same issue here, since powerdevil started depending on ddcutil (Arch Linux),
> every time my screen turns on after it was off for a while its brightness
> resets to zero but the value in the battery applet remains the same.

In my case however, I only use one screen (desktop).
Comment 4 gudvinr+kde 2023-08-19 11:39:03 UTC
I have same issue with AMD GPU and 2 external displays (DP and HDMI). Those displays also happen to be only displays I have since it's desktop.

However, for some reason brightness only gets reset to 0 only sometimes and it's not fully reproducible.

Operating System: Arch Linux 
KDE Plasma Version: 5.27.7
KDE Frameworks Version: 5.108.0
Qt Version: 5.15.10
Kernel Version: 6.1.46-1-lts (64-bit)
Graphics Platform: X11
Graphics Processor: AMD Radeon RX Vega M GL Graphics
Comment 5 postix 2024-05-18 11:08:10 UTC
*** Bug 486500 has been marked as a duplicate of this bug. ***
Comment 6 postix 2024-05-18 11:38:34 UTC
*** Bug 421492 has been marked as a duplicate of this bug. ***
Comment 7 postix 2024-05-18 11:39:53 UTC
*** Bug 423457 has been marked as a duplicate of this bug. ***
Comment 8 Jakob Petsovits 2024-09-02 09:17:03 UTC
I collected various thoughts in this developer-focused issue titled "Dimming Rework": https://invent.kde.org/plasma/powerdevil/-/issues/38

I'm still not sure if specifically dimming-related bugs such as Bug 484129 or Bug 486500 (which was closed as duplicate of this one) are indeed the same thing as what you're seeing here, but I'm confident that the eventual fix will address all of these kinds of bugs at once.
Comment 9 Phil Hord 2024-10-21 19:37:57 UTC
(In reply to Jakob Petsovits from comment #8)
> I collected various thoughts in this developer-focused issue titled "Dimming
> Rework": https://invent.kde.org/plasma/powerdevil/-/issues/38

Thanks for the attention to this, Jakob.  I am experiencing these problems on my laptop with internal and external displays since KWin 6.2 arrived.  On mine, it seems to be racy in that sometimes the persisted (30%) values are applied to the screens but the KWin applet still shows 100% for one of the displays.  I captured the persisted difference by saving the config during the failure and then after resolving it.

        $ cp ~/.config/kwinoutputconfig.json /tmp/before-kwinoutputconfig.json
        # ... resolved using issue with KWin dialog ...
        $ cp ~/.config/kwinoutputconfig.json /tmp/after-kwinoutputconfig.json
        $ diff /tmp/before-kwinoutputconfig.json /tmp/after-kwinoutputconfig.json 
        6c6
        <                 "brightness": 0.3,
        ---
        >                 "brightness": 1,
        29c29
        <                 "brightness": 0.3,
        ---
        >                 "brightness": 1,

It would be helpful to know what other information could be useful for analyzing these problems.  I tried probing with ddcutil, but it's not installed.

    $ ddcutil detect
    zsh: command not found: ddcutil

What else can we check, and should we report it here or somewhere else?

Operating System: KDE neon 6.2
KDE Plasma Version: 6.2.0
KDE Frameworks Version: 6.6.0
Qt Version: 6.7.2
Kernel Version: 6.8.0-47-generic (64-bit)
Graphics Platform: Wayland
Processors: 8 × Intel® Core™ i7-10610U CPU @ 1.80GHz
Memory: 15.3 GiB of RAM
Graphics Processor: Mesa Intel® UHD Graphics
Manufacturer: LENOVO
Product Name: 20UCS4TR00
System Version: ThinkPad X1 Yoga Gen 5
Comment 10 Jakob Petsovits 2024-11-20 05:33:04 UTC
A relevant merge request has been opened @ https://invent.kde.org/plasma/powerdevil/-/merge_requests/466

This would take care of restoring non-dimmed brightness of reconnected displays after wake-up. With an additional Wayland dimming protocol for KWin, we should be able to also restore non-dimmed brightness after a reboot (not part of this particular merge request).
Comment 11 Nate Graham 2024-11-20 15:28:16 UTC
*** Bug 495289 has been marked as a duplicate of this bug. ***
Comment 12 Nate Graham 2024-11-20 15:37:59 UTC
*** Bug 494588 has been marked as a duplicate of this bug. ***