Bug 462695

Summary: Automatic DisplayPort screen dimming/sleep and system sleep stops working on Wayland
Product: [KDE Neon] neon Reporter: Patrick Silva <bugseforuns>
Component: Packages User EditionAssignee: Neon Bugs <neon-bugs>
Status: RESOLVED DOWNSTREAM    
Severity: normal CC: aleixpol, andygait, arvigeus, auxsvr, bixilon, clay, graeme.w.murray, hexagonspawn, jr, julien.dlq, kde, kotarf, me, miranda, mpolden, mycclark, nate, neon-bugs, orangewinds, p.r.worrall, rnbzilla, rob.dyck, sitter, skierpage, slartibart70, tustamido, vascom2, WilsonEPhillips, yizel7, zawertun
Priority: VHI Keywords: regression, wayland
Version: unspecified   
Target Milestone: ---   
Platform: Neon   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Patrick Silva 2022-12-06 10:11:12 UTC
SUMMARY
Power management does not work in neon unstable regardless my laptop is connected or not.

STEPS TO REPRODUCE
1. open 'Energy Saving' KCM
2. set the timeout of 'Dim screen', 'Screen Energy Saving' and 'Suspend session' (and select 'Sleep') to 1 minute
3. do not use your machine for 1 minute

OBSERVED RESULT
nothing happens

EXPECTED RESULT
the power management works

SOFTWARE/OS VERSIONS
Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.26.80
KDE Frameworks Version: 5.101.0
Qt Version: 5.15.7
Graphics Platform: Wayland
Comment 1 Nate Graham 2022-12-06 18:52:02 UTC
And powerdevil is running?
Comment 2 Patrick Silva 2022-12-06 23:37:49 UTC
A process called org_kde_powerdevil is running.
Comment 3 Paul Worrall 2022-12-14 10:29:41 UTC
I have also noticed this on Unstable.  Setting status to Confirmed.

paul@neon-dev [10:24:38]:~$ ps aux|grep power
root        1099  0.0  0.1 239860  8976 ?        Ssl  08:59   0:00 /usr/libexec/upowerd
paul        1332  0.0  0.5 561128 43444 ?        Ssl  08:59   0:00 /usr/lib/x86_64-linux-gnu/libexec/org_kde_powerdevil
paul       29765  0.0  0.0   6612  2332 pts/1    S+   10:24   0:00 grep --color=auto power
Comment 4 Paul Worrall 2022-12-23 15:08:58 UTC
The same machine, dual booted into Neon User, works OK.  Adding "regression" keyword.
Comment 5 Moritz 2023-01-31 16:22:47 UTC
*** Bug 465017 has been marked as a duplicate of this bug. ***
Comment 6 Moritz 2023-02-01 09:58:01 UTC Comment hidden (spam)
Comment 7 Nate Graham 2023-02-02 22:02:42 UTC Comment hidden (spam)
Comment 8 Patrick Silva 2023-02-15 16:51:00 UTC
*** Bug 465778 has been marked as a duplicate of this bug. ***
Comment 9 Paul Worrall 2023-02-16 10:00:12 UTC
Now reproducible on Neon User 5.27 (Summary and version updated)
Only happens in Wayland (keyword added)
Comment 10 Paul Worrall 2023-02-16 11:04:59 UTC
*** Bug 465806 has been marked as a duplicate of this bug. ***
Comment 11 Patrick Silva 2023-02-16 14:52:48 UTC
No longer reproducible on neon unstable after installing updates 2 hours ago.

Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.27.80
KDE Frameworks Version: 5.104.0
Qt Version: 5.15.8
Graphics Platform: Wayland
Comment 12 Moritz 2023-02-16 17:14:23 UTC
I can confirm, it is working again!
Comment 13 hexagonspawn 2023-02-17 00:13:24 UTC
Still not working for me with all latest updates. I also disabled bluetooth and closed out of any background programs I use (MEGASync, Nicotine+) and confirmed from Status and Notifications applet that no application is inhibiting sleep.

Image1: https://i.imgur.com/VcWMxZS.png

Image 2: https://i.imgur.com/Z4SIdyd.png
Comment 14 hexagonspawn 2023-02-17 00:15:26 UTC
Accidentally reopened, I will wait for plasma version 5.27.80 to make it into KDE Neon user edition and see if that fixes it.
Comment 15 yizel7 2023-02-17 03:41:29 UTC
Mine kind of still work on 5.27 with my laptop. It now goes into deep sleep or somethin because i cannot wake it up unless i press a button on the built in keyboard. i used to wake up my laptop by pressing on my external keyboard or moving mouse. i have hibernate and swap disabled so i do not know
Comment 16 Nate Graham 2023-02-17 18:15:44 UTC
We're getting more reports of this, so I'm re-opening it. Seems flaky rather than 100% broken for everyone, which is the worst kind of bug.

FWIW I cannot reproduce this issue by setting the Tim Screen, Screen Energy Saving, and Suspend Session options to trigger after 1 minute, as in the original report.
Comment 17 Nate Graham 2023-02-17 18:15:54 UTC
Are y'all sure that nothing was blocking sleep at the time? The battery & Brightness widget will tell you.
Comment 18 Moritz 2023-02-18 01:16:45 UTC
> Are y'all sure that nothing was blocking sleep at the time? The battery & Brightness widget will tell you.
No it was not. The screen turned into the lockscreen and eventually locked at some time, but it was not turning off.

I think 5.27.0 has no fix included, it is fixed on unstable only. Probably in 5.27.1
Comment 19 slartibart70 2023-02-18 20:02:48 UTC
same here, wayland with plasma 5.27.0 on fedora 37

Setting screen-dim to 1 minute, sreen energy saving to 2 min and waiting:
- after 1 min, neither laptop screen nor the display-port attached 2nd 4k monitor are getting dim (in x11, only the laptop was dimmed, not the dp-attached monitor)
- after 2 min, no poweroff of laptop nor dp-attached screen.
- sometime later, the screen-lock comes active.

I found no combination of settings that really turn off both displays as they did in 5.26.x

Operating System: Fedora Linux 37
KDE Plasma Version: 5.27.0
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8
Kernel Version: 6.1.12-200.fc37.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 8 × Intel® Core™ i7-7820HQ CPU @ 2.90GHz
Memory: 31,1 GiB of RAM
Graphics Processor: Mesa Intel® HD Graphics 630
Manufacturer: LENOVO
Comment 20 yizel7 2023-02-19 14:29:19 UTC
(In reply to Nate Graham from comment #17)
> Are y'all sure that nothing was blocking sleep at the time? The battery &
> Brightness widget will tell you.

yes 100 percent. The screen blocking was unchecked. I can only wake up my computer now by pressing something on my latop built in keyboard. Mouse click or external keyboard no longer wakes it
Comment 21 Patrick Silva 2023-02-20 16:48:26 UTC
*** Bug 466147 has been marked as a duplicate of this bug. ***
Comment 22 Roger Noble 2023-02-20 20:10:32 UTC
Same here with Fedora 37, 5.27.0, 5.103.0, Wayland. Desktop with Radeon RX 6700 XT graphics, None of my three displays will turn off.
Comment 23 slartibart70 2023-02-21 08:41:19 UTC
interestingly, the functionality of powerdevil seems to work as expected:

1) screen lock
enter screen-lock manually (meta-L) and press ESC. 
Laptop screen and DP-monitor get powered off

2) use krunner and give the command
'dim half'
ok, this affects only the laptop screen, but it works
(never seen this on my external monitor to work, so my expectations are low :-) )

It seems to have troubles only if the 'screen locking' kicks in after the timeout or if powerdevil needs to apply the settings of 'systemsettings5 > energy saving'
Comment 24 Nate Graham 2023-02-21 14:56:43 UTC
Is everyone here using multiple screens?

And is at least one of them a DisplayPort screen?
Comment 25 Roger Noble 2023-02-21 16:27:05 UTC
In my case, yes. All three are DisplayPort.
Comment 26 Martin Polden 2023-02-21 16:31:11 UTC
(In reply to Nate Graham from comment #24)
> Is everyone here using multiple screens?
> 
> And is at least one of them a DisplayPort screen?

I’m experiencing this bug with a single DisplayPort screen. Using the non-free Nvidia driver.
Comment 27 rob.dyck 2023-02-21 16:34:34 UTC
My report 466147 was marked as a duplicate. I my case there is no display port or multi monitor involved.
Comment 28 Graeme Murray 2023-02-21 22:26:50 UTC Comment hidden (spam)
Comment 29 Patrick Silva 2023-02-22 01:23:59 UTC
*** Bug 466215 has been marked as a duplicate of this bug. ***
Comment 30 Nate Graham 2023-02-22 02:13:48 UTC
We're getting a lot of reports of power management not working properly in Plasma 5.27, but there appear to be a few root causes. I'll untangle this and find the distinct issues, then make them parent bugs for duplicates.

In the meantime, it would be appreciated if people could avoid posting, "me too!" comments. Instead, filing a new bug report for your specific issue would be more helpful, and I'll mark it as a duplicate of the correct one.
Comment 31 Nate Graham 2023-02-22 19:10:33 UTC Comment hidden (spam)
Comment 32 Aleix Pol 2023-02-23 17:06:38 UTC
I've been trying to reproduce this issue and I have not been able to. I'm using wayland and display ports, using the ddc backend. I think it would be useful to try to tell the different variables apart before we can put together a fix.

Would somebody please be able to test the following for me?
- set the time to Dim screen or "screen energy saving" to 1 minute (so that you can wait without getting too bored).
- Run "/usr/lib/org_kde_powerdevil --replace" on a terminal
- Share here the output you get

Maybe that way we can find something complaining that it doesn't work.
Comment 33 Roger Noble 2023-02-23 17:18:02 UTC
$ /usr/libexec/org_kde_powerdevil --replace
org.kde.powerdevil: org.kde.powerdevil.chargethresholdhelper.getthreshold failed "Charge thresholds are not supported by the kernel for this hardware"
org.kde.powerdevil: org.kde.powerdevil.backlighthelper.brightness failed
kf.idletime: Could not find any system poller plugin
QObject::connect(AbstractSystemPoller, KIdleTime): invalid nullptr parameter
QObject::connect(AbstractSystemPoller, KIdleTime): invalid nullptr parameter
org.kde.powerdevil: Handle button events action could not check for screen configuration
org.kde.powerdevil: The profile  "AC" tried to activate "DimDisplay" a non-existent action. This is usually due to an installation problem, a configuration problem, or because the action is not supported
org.kde.powerdevil: org.kde.powerdevil.chargethresholdhelper.getthreshold failed "Charge thresholds are not supported by the kernel for this hardware"
Comment 34 Aleix Pol 2023-02-23 17:40:31 UTC
Okay, then it seems like a packaging problem in neon, it's fixed in unstable but not stable:
https://invent.kde.org/neon/kde/kidletime/-/commit/716c5b3f7b74aaa69d3f6bf7827b7f03c95e769c

You can double-check by seeing whether the following file is available:
/usr/lib/*/qt5/plugins/kf5/org.kde.kidletime.platforms/KF5IdleTimeWaylandPlugin.so

Moving to neon, if somebody can reproduce this problem outside of KDE Neon, please say so and we'll check if either your distro has the same problem or there's a different problem on top.
Comment 35 rob.dyck 2023-02-23 18:02:50 UTC
Seems to be missing on Fedora
```
[root@blacky org.kde.kidletime.platforms]# ls
KF5IdleTimeXcbPlugin0.so  KF5IdleTimeXcbPlugin1.so
```
Comment 36 Roger Noble 2023-02-23 18:04:23 UTC
I ran it on Fedora 37 but the plugin doesn't appear to be there either. No package appears to provide it either.
Comment 37 rob.dyck 2023-02-23 18:05:14 UTC
I don't know if this is related but on both my machines logout clears the screen then hangs forever. Touching the power button shuts down the machine.
Comment 38 Jonathan Riddell 2023-02-23 18:53:14 UTC
I've added this now to KDE neon, please upgrade
Comment 39 Aleix Pol 2023-02-23 19:03:08 UTC
I've confirmed with the Fedora team that they also had this problem and they're looking into addressing it.
Comment 40 Marc Deop 2023-02-23 19:29:52 UTC
(In reply to Aleix Pol from comment #39)
> I've confirmed with the Fedora team that they also had this problem and
> they're looking into addressing it.

This has been fixed on Fedora here: https://src.fedoraproject.org/rpms/kf5-kidletime/c/2a096ad8d7e9ab9a838156021991d86e76971117?branch=rawhide

It will take a few minutes/hours to reach the stable servers.

For those who want it **now**, you can use our COPR: https://copr.fedorainfracloud.org/coprs/g/kdesig/kde/
Comment 41 Aleix Pol 2023-02-23 20:17:18 UTC
Closing as a downstream issue.
Comment 42 Paul Worrall 2023-02-24 07:47:57 UTC
*** Bug 466267 has been marked as a duplicate of this bug. ***
Comment 43 Wilson Phillips 2023-02-26 12:59:04 UTC
I don't understand why this is marked as closed when the problem has not been fixed.

Running openSUSE Tumbleweed/KDE 5.27.1 and the problem still exists. I can switch to X11 and it works just fine. It only fails to work in Wayland. This is on a laptop with no external screen attached.
Comment 44 Marc Deop 2023-02-26 13:31:23 UTC
(In reply to Wilson Phillips from comment #43)
> I don't understand why this is marked as closed when the problem has not
> been fixed.
> 

It's been fixed on KDE side. Nothing they can do about it.

> Running openSUSE Tumbleweed/KDE 5.27.1 and the problem still exists. I can
> switch to X11 and it works just fine. It only fails to work in Wayland. This
> is on a laptop with no external screen attached.

This is something openSUSE needs to fix the same way Neon or we (Fedora) did.

Again, everything is fine on the KDE side of things.
Comment 45 Nikolay Stoynov 2023-02-26 20:09:22 UTC
I have the same issue with Nobara (Fedora based). I reported it [here](https://gitlab.com/GloriousEggroll/nobara-images/-/issues/96)

TLDR;

```sh
kf.idletime: Could not find any system poller plugin
QObject::connect(AbstractSystemPoller, KIdleTime): invalid nullptr parameter
QObject::connect(AbstractSystemPoller, KIdleTime): invalid nullptr parameter
org.kde.powerdevil: Handle button events action could not check for screen configuration
```

Appears not to be a bug from KDE itself.
Comment 46 Nate Graham 2023-03-01 15:53:54 UTC
*** Bug 466428 has been marked as a duplicate of this bug. ***