Bug 422455

Summary: Monitor power saving won't work when using DisplayPort cable
Product: [Plasma] Powerdevil Reporter: Mircea Kitsune <sonichedgehog_hyperblast00>
Component: generalAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED DOWNSTREAM    
Severity: major CC: aagaande, buddha, ecc_2000, florian, inkbottle007, julien.dlq, nate, postix, poultrymanager, pqwoerituytrueiwoq, rommy, rptreat, rushpl, sonichedgehog_hyperblast00, ts+kde, tuomas, wannabetheguy, xaver.hugl
Priority: NOR    
Version: 5.18.5   
Target Milestone: ---   
Platform: Other   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=426609
https://bugs.kde.org/show_bug.cgi?id=413618
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Mircea Kitsune 2020-06-04 16:23:21 UTC
I recently bought an 1080p / 144 Hz Viewsonic monitor which I run on my AMD Radeon (amdgpu) card: https://www.viewsonic.com/us/products/shop/monitors/vx2458-c-mhd.html

I noticed that when using a DisplayPort cable rather than a HDMI one, the monitor refuses to go or stay into standby making it impossible to use this essential power saving feature. I was convinced this is a Kernel or driver issue and discussed it on generic Linux forums. Someone then suggested I try putting the monitor in standby in an IceWM session, which to my surprise works perfectly, revealing the bug lies with KDE most likely its PowerDevil module. Here's a list of the exact results I get with each session:

- IceWM: Tested with 'xset dpms force standby'. Monitor properly goes into standby, resumes only once a key is pressed or the mouse is moved.

- Plasma (X11): Tested with 'xset dpms force standby'. Monitor goes into standby but only stays there for about 3 seconds, powering on afterward despite not moving the mouse or pressing any key.

- Plasma (Wayland): Tested with a 1 minute timeout from System Settings due to lack of alternative to xset for triggering standby on demand. Monitor goes powers down for roughly 3 seconds, after which it powers back on and reveals the login screen (the session crashes, see bug #420160 for this aspect).

It should be reiterated that my monitor properly handles energy saving on both the X11 and Wayland Plasma sessions when using a HDMI cable, this only happens over DisplayPort. I have to use DP due to HDMI only supporting up to 120 Hz of the 144 Hz allowed by the monitor. Currently I have to trade the ability to put the screen in standby, which results in extra electricity consumption as well as wearing the monitor out more rapidly. As my above test indicates the issue is KDE related, I hope we can find out what it is and have it fixed for the next Plasma release if possible.
Comment 1 Mircea Kitsune 2020-06-19 13:43:19 UTC
I can confirm that disabling hotplugging fixes this problem. After going to System Settings - Workspace - Startup and Shutdown - Background Services and disabling KScreen 2, I'm able to properly put my monitor into standby. This component is responsible for waking the monitor up immediately after it powers down even when you don't press a key or move the mouse.

Note that this only fixes monitor standby for the X11 Plasma session, not Wayland which appears to be an unrelated issue. Even with KScreen2 disabled, I still get a session crash and taken back to the login screen when my monitor goes into standby over the DP cable. Standby via HDMI works in Wayland too.
Comment 2 Mircea Kitsune 2021-05-12 14:26:35 UTC
This is unfortunately still an issue, seemingly on both X11 and Wayland. It might be specific to different types of monitors: Some only do this on a DisplayPort connection, others even over HDMI cable. When it happens the system won't allow that monitor to go into standby, waking it up right after the screen has gone to sleep. Only way to resolve is to disable the KScreen service which also turns off hot plugging... at least on X11, on Wayland even that won't let the monitor stay powered off (it also crashed KWin on WL).
Comment 3 Chris 2021-08-08 19:23:40 UTC
You can mimic `xset dpms force off` on wayland, doing:
`qdbus org.kde.kglobalaccel /component/org_kde_powerdevil invokeShortcut "Turn Off Screen"`, even if it seems a bit convoluted, since it involves "shortcut" instead of going straight to the point.

Some other issue related to "monitor power saving": https://bugs.kde.org/show_bug.cgi?id=348082 "monitor is randomly powered back on".
Comment 4 Tuomas Suutari 2021-08-19 05:27:44 UTC
This happens here too. Ubuntu 20.04, powerdevil 5.18.4.1-0ubuntu1, kscreen 5.18.4.1-0ubuntu1. External display (connected via USB-C) doesn't power off after the timeout, but the laptop's screen does. The laptop is ThinkPad T14 Gen1.

Stopping KScreen2 seems to help.

I've also had issues with the screen hot-plugging, even before stopping KScreen2: When connecting or disconnecting the external display, KDE doesn't seem to notice it at all. I found a workaround that if I run just "xrandr" without any params, it will then notice the new/removed display and the desktop is configured correctly. Could this power-off issue then be somehow related to KScreen2 being jammed or something like that?
Comment 5 Bug Janitor Service 2021-09-26 21:37:17 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/1463
Comment 6 Zamundaaa 2021-09-26 21:54:28 UTC
Sorry for the noise, I thought otherwise at first but that MR doesn't really help for this issue.

To at least add some more info about why this issue happens: Some monitors make some GPUs detect a unplug and then a hotplug event when they go into standby, making the system wake up because it thinks it detected a new monitor. It's a really annoying issue that's relevant for random combinations of hardware and software.

A possible workaround for Wayland is https://invent.kde.org/plasma/kwin/-/merge_requests/919, which makes KWin ignore all outputs until you explicitly wake it up again.
An actual fix for this is required to be at the kernel level, in the GPU drivers, on a per-hardware basis.
Comment 7 Damian Kaczmarek 2021-10-11 16:05:57 UTC
I also encountered this issue and was able to successfully workaround by disabling the KScreen 2 service.
Comment 8 Mircea Kitsune 2021-11-19 18:19:16 UTC
Got on Plasma 5.23.3 in Manjaro. Even in this release the issue hasn't been fully addressed: Tested Wayland session again on my mother's computer, it uses a common HDMI connection for the monitor. Once the monitor shut itself off, it came right back up as usual... this time however I only saw the desktop wallpaper and none of the keys worked, it's like the entire system froze as not even Alt + Shift + F# to change runlevel worked any more, though I could still move the mouse pointer around which was peculiar.
Comment 9 pqwoerituytrueiwoq 2021-12-14 14:51:50 UTC
this is interesting, with my RX 580 this is not a issues, i have matching 1080p 144hz monitors (AOC C24G1)
I am using 2 display ports, and this is not a issue

Operating System: Kubuntu 22.04
KDE Plasma Version: 5.23.4
KDE Frameworks Version: 5.89.0
Qt Version: 5.15.2
Kernel Version: 5.16.0-051600rc5-generic (64-bit)
Graphics Platform: X11
Processors: 12 × AMD Ryzen 5 3600 6-Core Processor
Memory: 15.6 GiB of RAM
Graphics Processor: Radeon RX 580 Series

$ apt-cache policy powerdevil
powerdevil:
  Installed: 4:5.23.4-0ubuntu1
  Candidate: 4:5.23.4-0ubuntu1
  Version table:
 *** 4:5.23.4-0ubuntu1 500
        500 http://us.archive.ubuntu.com/ubuntu jammy/universe amd64 Packages
        100 /var/lib/dpkg/status

-------------------

However when using my 5600G's integrated gpu via hdmi (the only video out port, oh the limitations of the itx form factor) i get this issue
though in wayland it wakes to a black screen that allows me to do nothing

on x11 i can work around this by disabling xscreen2, however in wayland this has no effect
Comment 10 pqwoerituytrueiwoq 2021-12-14 16:25:30 UTC
After testing a couple monitor on different hardware over different ports, this issue looks to only affect AMD gpus as well as some monitors, it does not matter if it is HDMI or Display port

it looks like if your monitor supports disabling auto source detection turning that off is a workaround

perhaps kscreen/powerdevil should ignore 'new' connections when entering power savings move for a few seconds (probably 5 to 10 should be good), if this behavior can be limited to connections that were in use before entering power savings mode and only target amd gpus that would be a suitable workaround this bug should only affect a small minority of users on rare occasions
Comment 11 ecc_2000 2021-12-27 20:28:28 UTC
I am also facing this issue on my triple monitor setup using DP, HDMI and DVI (I suspect my DP-Monitor is to blame here...). For me this also leads to annoying side effects such as my windows being moved around.

Operating System: Fedora Linux 35
KDE Plasma Version: 5.23.3
KDE Frameworks Version: 5.89.0
Qt Version: 5.15.2
Kernel Version: 5.15.11-200.fc35.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 8 × Intel® Core™ i7-6700 CPU @ 3.40GHz
Memory: 15.6 GiB of RAM
Graphics Processor: AMD Radeon R9 380 Series
Comment 12 pqwoerituytrueiwoq 2021-12-28 02:52:28 UTC
(In reply to ecc_2000 from comment #11)
> I am also facing this issue on my triple monitor setup using DP, HDMI and
> DVI (I suspect my DP-Monitor is to blame here...). For me this also leads to
> annoying side effects such as my windows being moved around.
disable your monitors auto-detect source feature, that is the best workaround there is
Comment 13 Mircea Kitsune 2022-01-18 14:35:27 UTC
(In reply to pqwoerituytrueiwoq from comment #12)
> disable your monitors auto-detect source feature, that is the best workaround there is

I looked everywhere for that: My monitor OSD doesn't have an option for that, at least not any I can find. For the record my screen is a ViewSonic VX2458-C-MHD: https://www.viewsonic.com/us/products/shop/monitors/vx2458-c-mhd.html
Comment 14 Chris 2022-05-29 20:17:19 UTC
The issue no longer occurs for me. Hardware configuration hasn't changed, mouse, keyboard, monitor, etc. Latest debian-sid, wayland as pure as possible.
Comment 15 pqwoerituytrueiwoq 2022-05-29 22:18:28 UTC
(In reply to Chris from comment #14)
> The issue no longer occurs for me. Hardware configuration hasn't changed,
> mouse, keyboard, monitor, etc. Latest debian-sid, wayland as pure as
> possible.

What kernel version?
the command 'uname -r' will print the version number
Comment 16 Chris 2022-05-30 04:15:37 UTC
5.17.0-2-amd64
Comment 17 Mircea Kitsune 2022-07-24 12:57:03 UTC
Kernel 5.18 and I definitely still have the problem. Sadly also on HDMI alongside DP. It occurs both in X11 and Wayland: In X11 it can be stopped by disabling the KScreen2 service, in Wayland it will do it regardless of whether that service is running so there's virtually no way to use monitor power saving (at least it no longer crashes as well). This is frustrating and very unfortunate, after so many years I wonder if this can ever be addressed.
Comment 18 Bug Janitor Service 2022-09-13 15:11:01 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/2940
Comment 19 Mircea Kitsune 2022-09-13 17:10:39 UTC
Only addition I can make is confirming the issue is heavily dependent on the monitor model. I just bought a new Samsung Odyssey to replace my Viewsonic monitor over multiple issues: Where the Viewsonic wouldn't normally stay in sleep under either X11 or Wayland, the Samsung does so in both with KScreen2 enabled and on either HDMI or DP cables.

The old monitor was moved to another computer... on it standby actually works now, despite not working on the same cable on my box. And both machines use AMD cards, I forgot if I still enable amdgpu on my mother's PC which may explain why there it's working at least in X11. Hopefully affected monitor models will also be fixed, there seem to be quite a few especially around lower end products.
Comment 20 Tim Schlotfeldt 2022-11-23 16:01:46 UTC
Hi,

I had the same problem, but with the last update it seems to be solved. 

VERSION:
Operating System: Arch Linux
KDE Plasma Version: 5.26.3
KDE Frameworks Version: 5.100.0
Qt Version: 5.15.7
Kernel Version: 6.0.9-arch1-1 (64-bit)
Graphics Platform: Wayland
Comment 21 Nick 2023-01-19 03:35:53 UTC
I'm not sure if this is exactly the right issue, but I seem to be experiencing something like this ever since upgrading from Fedora KDE 36 to Fedora KDE 37.
I have an Asus XG27AQ at 144hz using DisplayPort, and an Asus VS239 at 60hz using HDMI. Both are plugged in to a 6700XT.

The last version of KDE on Fedora KDE 36 was 5.25.5, and my monitors would stay asleep as expected.
After upgrading to Fedora KDE 37 which brought KDE 5.26.3, as long as both monitors are powered on, they immediately wake up after entering sleep.
If I turn off the HDMI monitor, the DisplayPort monitor stays asleep. If I turn off the DisplayPort monitor, the HDMI monitor wakes up after entering sleep.
This persisted with 5.26.4, and at the moment with 5.26.5.

On Wayland in all instances. Disabling kscreen2 doesn't help.
At the end of Fedora KDE 36, I had kernel 6.0.7. Fedora KDE 37 brought that to 6.0.8. I'm now on 6.1.6.
Comment 22 Mircea Kitsune 2023-01-19 15:45:09 UTC
Only reason the issue was finally resolved for me is last year I got a new monitor from Samsung due to the old one showing signs of failing. The Samsung Odyssey monitor will correctly go and stay in standby, both in X11 and Wayland on both HDMI and DisplayPort cable, also enabling or disabling automatic source detection in the monitor OSD doesn't effect it (works fine on both).

By comparison the ViewSonic will not stay powered down on either cable: It will only on X11 if I disable the KScreen2 service, on Wayland never. On the machine it's now on (also Manjaro / KDE) I just disabled monitor power saving especially since WL can still experience minor issues when there's no screen, I put the whole machine into standby / suspend which saves more power anyway.
Comment 23 Matt Keith 2023-02-19 01:14:44 UTC
(In reply to Nick from comment #21)
> I'm not sure if this is exactly the right issue, but I seem to be
> experiencing something like this ever since upgrading from Fedora KDE 36 to
> Fedora KDE 37.
> I have an Asus XG27AQ at 144hz using DisplayPort, and an Asus VS239 at 60hz
> using HDMI. Both are plugged in to a 6700XT.
> 
> The last version of KDE on Fedora KDE 36 was 5.25.5, and my monitors would
> stay asleep as expected.
> After upgrading to Fedora KDE 37 which brought KDE 5.26.3, as long as both
> monitors are powered on, they immediately wake up after entering sleep.
> If I turn off the HDMI monitor, the DisplayPort monitor stays asleep. If I
> turn off the DisplayPort monitor, the HDMI monitor wakes up after entering
> sleep.
> This persisted with 5.26.4, and at the moment with 5.26.5.
> 
> On Wayland in all instances. Disabling kscreen2 doesn't help.
> At the end of Fedora KDE 36, I had kernel 6.0.7. Fedora KDE 37 brought that
> to 6.0.8. I'm now on 6.1.6.

I am experiencing this issue as well
I have a framework laptop with the display open. a radeon rx5700 connected by a razer chroma egpu enclosure. A monitor connected to the video card by the display port.
The computer locks when idle but both the laptop and the monitor stay on all night.
=/
Are there any logs I could attach that might be relevant and useful?
Comment 24 Matt Keith 2023-02-19 01:15:50 UTC
Also to add, I am running fedora 37 kde spin with the 5.27 release of kde plasma under wayland
Comment 25 Bob Treat 2023-02-24 15:36:20 UTC
(In reply to Matt Keith from comment #24)
> Also to add, I am running fedora 37 kde spin with the 5.27 release of kde
> plasma under wayland
Running Nobara 37 (Fedora based) and switching to X11 gets my monitors to behave correctly. So my end, it's a Wayland thing.
Comment 26 Nate Graham 2023-02-24 17:25:30 UTC
Ultimately this is caused by a distro issue: the kidletime library not being build with wayland support. See Bug 462695 for more details.
Comment 27 Bob Treat 2023-02-24 18:19:10 UTC
Fedora has a patch. I tested it and it works for me. Should hit the repos soon. Details in the other bug referenced above.