Bug 491605

Summary: backlighthelper.brightness display probe fails on Wayland
Product: [Plasma] Powerdevil Reporter: Debayan Sutradhar <debayansutradhar3>
Component: generalAssignee: Plasma Bugs List <plasma-bugs>
Status: REPORTED ---    
Severity: normal CC: debayansutradhar3, jpetso, kdedev, natalie_clarius, nate, postix
Priority: NOR Keywords: qt6, regression, wayland
Version: 6.1.4   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=482713
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: sudo journalctl --boot (after applying delay)
sudo journalctl --boot -2 (after apply 3s delay)

Description Debayan Sutradhar 2024-08-12 05:06:53 UTC
Created attachment 172529 [details]
sudo journalctl --boot (after applying delay)

SUMMARY

Sometimes, the `org.kde.powerdevil.backlighthelper.brightness` display probe fails on Nvidia cards + Wayland, hence preventing the user to set monitor brightness from the plasma taskbar applet.

The frequency is random, which makes me think there is some race condition or similar situation. On X11, however, this issue is non existent and the display brightness feature always works.

I am able to workaround the issue by adding a slight delay of 3 seconds in powerdevil service:

override.conf:

```
    /home/rnayabed/.config/systemd/user/plasma-powerdevil.service.d/.#override.conf7e6e1614f2ba2121             
### Editing /home/rnayabed/.config/systemd/user/plasma-powerdevil.service.d/override.conf
### Anything between here and the comment below will become the contents of the drop-in file

[Service]
ExecStartPre=/bin/sleep 3
Environment="QT_LOGGING_RULES=org.kde.powerdevil=true"

### Edits below this comment will be discarded


### /usr/lib/systemd/user/plasma-powerdevil.service
# [Unit]
# Description=Powerdevil
# PartOf=graphical-session.target
# After=plasma-core.target
# 
# [Service]
# ExecStart=/usr/libexec/org_kde_powerdevil
# Type=dbus
# BusName=org.kde.Solid.PowerManagement
# TimeoutStopSec=5sec
# Slice=background.slice
# Restart=on-failure
```

I have attached full system logs with and without the delay:






STEPS TO REPRODUCE
1. Enable wayland

OBSERVED RESULT
The brightness mod feature is not shown when using wayland at random times.

EXPECTED RESULT
The brightness feature should work in wayland at all times

SOFTWARE/OS VERSIONS
Linux: 6.10.3-1-default
openSUSE snapshot: 20240808
KDE Plasma Version: 6.1.4
KDE Frameworks Version: 6.4.0
Qt Version: 6.7.2

ADDITIONAL INFORMATION
GPU: Nvidia RTX 3060 w/ proprietary drivers 550.100

I am using a desktop PC with LG IPS 1080p monitor (22mp68vq) over HDMI.
Comment 1 Debayan Sutradhar 2024-08-12 05:07:38 UTC
Created attachment 172530 [details]
sudo journalctl --boot -2 (after apply 3s delay)
Comment 2 Nate Graham 2024-08-12 17:16:31 UTC
Possibly the same as Bug 482713?
Comment 3 Debayan Sutradhar 2024-08-12 18:29:39 UTC
> Possibly the same as Bug 482713?

Could be.. i am not sure.
Comment 4 Jakob Petsovits 2024-08-12 20:10:35 UTC
Comment #0 is confusing, because backlighthelper is only for internal (i.e. laptop) displays, but the actual bug report is clearly about an external monitor - connected to a desktop PC, which doesn't have an internal backlight display. So backlighthelper failing is entirely expected. We're interested in DDC happenings here.

The attached log from Comment #0 shows that the monitor named "LG IPS FULLHD" is indeed found by PowerDevil with a brightness of 60 out of 100. The log from Comment #1 shows an error instead, the relevant lines are these (removing time, hostname & powerdevil unit prefix):

> busno=2, sleep-multiplier =  2.00. Testing for supported feature 0x10 returned Error_Info[DDCRC_RETRIES in ddc_write_read_with_retry, causes: DDCRC_DDC_DATA(10)]
> Library initialization complete.
> org.kde.powerdevil: [DDCutilDetector]: Failed to initialize callback
> org.kde.powerdevil: [DDCutilDetector]: Check for monitors using ddca_get_display_refs()...
> org.kde.powerdevil: [DDCutilDetector]: 0 display(s) were detected

The first line looks the most relevant, it's printed by libddcutil itself and talks about an error involving the brightness feature (0x10) before any other stuff starts failing. I'd have to get more familiar with DDC/CI and this part of libddcutil in order to analyze this any further.

(In reply to Nate Graham from comment #2)
> Possibly the same as Bug 482713?

Possibly. The symptoms look the same, although without a better idea about the root cause it's hard to tell.