Bug 501446 - Powerdevil cannot request/set brightness on integrated laptop screen and crashes
Summary: Powerdevil cannot request/set brightness on integrated laptop screen and crashes
Status: ASSIGNED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Power management & brightness (show other bugs)
Version: 6.3.2
Platform: Other Linux
: NOR crash
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2025-03-13 12:01 UTC by thibaulltt
Modified: 2025-03-22 20:17 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description thibaulltt 2025-03-13 12:01:57 UTC
SUMMARY
It seems a recent update to Powerdevil broke the connection to the Wayland compositors used to set brightness on displays. I have a Framework Laptop (AMD 7840U processor) and the Powerdevil service fails to connect to the Wayland compositor to request/set the display's brightness, and I thus lose all access to brightness control *as well as battery information*, even though the two are unrelated enough.

STEPS TO REPRODUCE
1. Start a user session in Plasma.
2. See the brightness isn't modifiable. Check `systemctl --user status plasma-powerdevil.service` and see it has an exit code of 255 (exception).
3. Try to "replace" it using `/usr/libexec/org_kde_powerdevil --replace`
4. Notice the error message is specifically pointing out an error in the `kde_external_brightness_device` protocol, specifically this message:
```
wl_display#1: error 1: invalid method 5, object kde_external_brightness_device_v1#39
The Wayland connection experienced a fatal error: Invalid argument
```

OBSERVED RESULT
The brightness is non-controllable, and the battery reporting as well as the "Power management" KCM are unavailable.

EXPECTED RESULT
The process should fail "gracefully", and still allow for charge reporting to work when the brightness cannot be controlled for some reason.

SOFTWARE/OS VERSIONS
Operating System: Fedora Linux 41
KDE Plasma Version: 6.3.2
KDE Frameworks Version: 6.11.0
Qt Version: 6.8.2
Kernel Version: 6.13.6-200.fc41.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 7840U w/ Radeon  780M Graphics
Memory: 30.6 GiB of RAM
Graphics Processor: AMD Radeon 780M

ADDITIONAL INFORMATION
It seems to have happened around ~4 weeks ago, maybe the regression happened with Plasma 6.3? I do not know how I could bisect the commits to find the issue without having to recompile all Plasma components depending on Powerdevil, I'd appreciate some guidance.
Comment 1 Jakob Petsovits 2025-03-14 02:02:41 UTC
Weird question, but could you confirm that the kwin, libkscreen and powerdevil packages were all updated to a 6.3.x version? If I look into the generated file powerdevil/daemon/wayland-kde-external-brightness-v1-client-protocol.h, it defines the constant KDE_EXTERNAL_BRIGHTNESS_DEVICE_V1_SET_OBSERVED_BRIGHTNESS as 5 and I think this might be your "invalid method 5" from the logs.

The set_observed_brightness() Wayland request (method) was added in Plasma 6.3, so if one of the involved packages is still on 6.2, I could see things going wrong somewhere. I'm also not an expert on Wayland tooling though, and I don't have the experience to tell under which exact conditions you'd see the pasted error. You're right though that this is where the problem is going to be.

Then again, it's Fedora and I wouldn't expect them to hold back one of the packages either. So I'm not quite sure where to start looking.
Comment 2 thibaulltt 2025-03-14 08:14:55 UTC
Ah, it seems you've found the problem. Kwin was still at version 6.2.5, because the window decorations I was using (klassy) were not updated to 6.3.x, and thus required the old libkdecorations2 shared lib. Removed klassy, and force-upgraded kwin to the latest version and it all works now. Thanks for the help.

While that's fixed, my original bug report still seems valid in the sense that powerdevil should not unconditionally fail when the Wayland connection cannot be established. For example, it handles just fine the fact my battery has no charge thresholds that can be user-settable. But losing battery information because of a conflict of my window manager seems a bit unrelated...
Comment 3 Jakob Petsovits 2025-03-14 22:26:13 UTC
(In reply to thibaulltt from comment #2)
> While that's fixed, my original bug report still seems valid in the sense
> that powerdevil should not unconditionally fail when the Wayland connection
> cannot be established.

Yeah, that's fair. Thanks for pointing this out, or I would have probably marked the bug as resolved :)
Comment 4 Bug Janitor Service 2025-03-22 20:17:48 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/powerdevil/-/merge_requests/539