Bug 426609

Summary: kscreen2 kicks monitor out of power save mode
Product: [Plasma] KScreen Reporter: minson <minsonj2016>
Component: commonAssignee: kscreen-bugs-null <kscreen-bugs-null>
Status: RESOLVED UPSTREAM    
Severity: normal CC: cs, gabeklav, leandrolnh, nate, nicolas.fella, poultrymanager, pqwoerituytrueiwoq, sonichedgehog_hyperblast00
Priority: NOR    
Version: 5.19.5   
Target Milestone: ---   
Platform: Neon   
OS: Linux   
URL: https://gitlab.freedesktop.org/drm/amd/-/issues/1719
See Also: https://bugs.kde.org/show_bug.cgi?id=422455
Latest Commit: Version Fixed In:

Description minson 2020-09-16 13:48:49 UTC
SUMMARY
if kscreen2 is enabled monitor will not stay in power save mode

STEPS TO REPRODUCE
1. enable 'Screen Energy Saving' for monitor
2. ensure 'kscreen2' is enabled
3. wait 'Switch Off After' time interval

OBSERVED RESULT
monitor goes into energy saving mode the turns back on in about 3 seconds

EXPECTED RESULT
monitor should stay off until mouse/keyboard etc activity


SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
KDE Plasma Version: 
5.19.5
KDE Frameworks Version: 
5.74.0
Qt Version: 
5.15.0
ADDITIONAL INFORMATION
Kernel Version: 5.4.0-47-generic
OS Type: 64-bit
Processors: 8 × AMD Ryzen 5 2400G with Radeon Vega Graphics
Memory: 13.7 GiB of RAM
Graphics Processor: AMD RAVEN
Comment 1 poultrymanager 2021-03-03 13:46:58 UTC
This is a possible duplicate of bug 413618.
Comment 2 cs 2021-05-11 09:44:43 UTC
Same here, too. Even when the display is switched off using `xset dpms force off` it switches back on after a few seconds. After long searching I found this thread: https://www.linuxquestions.org/questions/linux-hardware-18/monitor-doesn%27t-stay-in-standby-when-using-a-dp-cable-4175672795/ with the suggestion to disable kscreen2 - et voilà, when kscreen2 is disabled it works, the screens remain off.

Operating System: Kubuntu 21.04 (but the problem was already present in 20.10)
KDE Plasma Version: 5.21.5
KDE Frameworks Version: 5.81.0
Qt Version: 5.15.2
Kernel Version: 5.11.0-16-generic
OS Type: 64-bit
Graphics Platform: X11
Processors: 16 × AMD Ryzen 7 3700X 8-Core Processor
Memory: 31.3 GiB of RAM
Graphics Processor: Radeon RX 5500 XT

Two 2k-Monitors connected, one with DP and the other with HDMI
Comment 3 pqwoerituytrueiwoq 2021-12-12 05:36:33 UTC
When using 2 display ports this problem does not appear

Operating System: Kubuntu 22.04
KDE Plasma Version: 5.23.4
KDE Frameworks Version: 5.88.0
Qt Version: 5.15.2
Kernel Version: 5.16.0-051600rc4-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 kscreen
kscreen:
  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 HDMI this problem occurs as described in X11

Operating System: Kubuntu 22.04
KDE Plasma Version: 5.23.4
KDE Frameworks Version: 5.88.0
Qt Version: 5.15.2
Kernel Version: 5.16.0-051600rc4-generic (64-bit)
Graphics Platform: Wayland
Processors: 12 × AMD Ryzen 5 5600G with Radeon Graphics
Memory: 13.6 GiB of RAM
Graphics Processor: AMD RENOIR

$ apt-cache policy kscreen
kscreen:
  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


Disabling this does not help in Wayland though and the system screen insta-wakes up to a black screen with a mouse and the system 
this is from /var/log/syslog, this starts at opening the settings manager to disable kscreen2
the system accepts no input via keyboard, not even Ctrl+Alt+F[1-9] but RESIUB will work (but for some reason B does not work on this system)
note that /proc/sys/kernel/sysrq = 16 by default, i set it to 1 to check it

Dec 11 23:36:52 kde-test-system systemd[1303]: Started System Settings - System Settings.
Dec 11 23:37:01 kde-test-system PackageKit: get-updates transaction /960_eecbbaed from uid 1000 finished with success after 201ms
Dec 11 23:37:09 kde-test-system systemd[1]: systemd-localed.service: Deactivated successfully.
Dec 11 23:38:34 kde-test-system dbus-daemon[943]: [system] Activating service name='org.kde.powerdevil.backlighthelper' requested by ':1.134' (uid=1000 pid=5091 comm="/usr/lib/x86_64-linux-gnu/libexec/org_kde_powerdev") (using servicehelper)
Dec 11 23:38:34 kde-test-system dbus-daemon[943]: [system] Successfully activated service 'org.kde.powerdevil.backlighthelper'
Dec 11 23:39:01 kde-test-system CRON[6407]: (root) CMD (  [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Dec 11 23:39:01 kde-test-system systemd[1]: Starting Clean php session files...
Dec 11 23:39:01 kde-test-system systemd[1]: phpsessionclean.service: Deactivated successfully.
Dec 11 23:39:01 kde-test-system systemd[1]: Finished Clean php session files.
Dec 11 23:39:19 kde-test-system dbus-daemon[943]: [system] Activating service name='org.kde.powerdevil.backlighthelper' requested by ':1.134' (uid=1000 pid=5091 comm="/usr/lib/x86_64-linux-gnu/libexec/org_kde_powerdev") (using servicehelper)
Dec 11 23:39:19 kde-test-system dbus-daemon[943]: [system] Successfully activated service 'org.kde.powerdevil.backlighthelper'
Dec 11 23:41:42 kde-test-system PackageKit: refresh-cache transaction /961_daedceaa from uid 1000 finished with success after 1637ms
Dec 11 23:41:43 kde-test-system PackageKit: get-updates transaction /962_acadccbb from uid 1000 finished with success after 538ms
Dec 11 23:41:44 kde-test-system PackageKit: get-updates transaction /963_ccbaeccc from uid 1000 finished with success after 190ms
Dec 11 23:42:10 kde-test-system kactivitymanagerd[5108]: qt.qpa.wayland: Creating a fake screen in order for Qt not to crash
Dec 11 23:42:53 kde-test-system systemd[1]: Started Session 11 of User chad.
Comment 4 pqwoerituytrueiwoq 2021-12-14 17:44:10 UTC
This seems to be related to the monitor looking for new input sources before it enters the power saving mode, disabling this on the monitor solves the issue

this does not seem to affect intel gpus (sandy bridge/ i3-2100 / HD 2000) 
this does not seem to affect nvidia gpus (nouveau; GT 520) 
this does not seem to affect nvidia gpus (nvidia-390; GT 520)
I have confirmed this affects AMD GPUs (5600G Cezanne && RX 580 Polaris)

as long as a single monitor is running through it's auto detect process it wakes the system as if a new monitor was connected
Comment 5 Nicolas Fella 2021-12-15 00:21:36 UTC
This sounds like it would be explained by https://gitlab.freedesktop.org/drm/amd/-/issues/1719
Comment 6 pqwoerituytrueiwoq 2022-01-03 15:26:01 UTC
It is probably worth putting a workaround in place till the upstream issue is fixed, for anyone who does not know what the workaround for this bug it is can me a show stopper if they use wayland

The only hardware you need to reproduce this is a AMD GPU and a monitor that supports multiple inputs (never seen any that did not default to auto search source) and with the exception of some ancient LCD monitors from the early 2000s (and CRTs) that only have a VGA port that is every monitor you can find will have some combination of HDMI, DVI, VGA, and Display port

at the very least there should be a note in the UI in screen saver settings that shows up if you have a AMD GPU that notes the bug and the workaround, it is not like a user will just stumble upon changing monitor settings can fix the issue
Comment 7 Mircea Kitsune 2022-01-03 16:30:29 UTC
Is this issue truly resolved? I'm on Plasma 5.23.4 and the problem persists on multiple monitors and connectors: My mother's screen is plugged in via HDMI and affected, I connect mine on both HDMI and DisplayPort and now I get it on both. I'm having to disable kscreen2 once more, which this has the downside of waking up from standby being slower and I need to manually set the monitor from 60 Hz to 120 Hz each time I log in (the refresh rate setting won't be persisted without this service).
Comment 8 pqwoerituytrueiwoq 2022-01-03 16:33:24 UTC
The resolution is blame the upstream bug, so in other words 'not our problem'

* https://gitlab.freedesktop.org/drm/amd/-/issues/1719
Comment 9 pqwoerituytrueiwoq 2022-01-03 16:36:15 UTC
Again the best workaround is disabling your monitors auto source detect setting
Comment 10 Mircea Kitsune 2022-01-03 16:47:26 UTC
(In reply to pqwoerituytrueiwoq from comment #9)

My monitor doesn't even have such a setting as far as I'm aware: I played with the options in its OSD countless times, never found any additional settings that could be helpful.
Comment 11 pqwoerituytrueiwoq 2022-01-03 16:52:31 UTC
The auto source detect feature/setting is for this use
user gets new monitor manuf. does know what input port will be used, better detect what port is in use to prevent RMA
if you have 2 computer hooked into 1 dialysis and you turn one off the it will switch to the other automatically
if you disable this feature when you set the input ti HDMI 1 it will stay on HDMI 1 till you change it to VGA or whatever other port it offers
Comment 12 Leandro 2022-01-03 21:18:13 UTC
(In reply to pqwoerituytrueiwoq from comment #11)

Unfortulately my monitor MSI MAG272QR doesn't have the option to turn off input polling, it may be hardcoded into the firmware, and the upstream bug is still opened.
Do you have any other workaround?

SYSTEM INFO
Operating System: Gentoo Linux
KDE Plasma Version: 5.23.4
KDE Frameworks Version: 5.88.0
Qt Version: 5.15.2
Kernel Version: 5.15.12-gentoo-clang-lto-prjc-cpufreq (64-bit)
Graphics Platform: X11
Processors: 16 × AMD Ryzen 7 3800X 8-Core Processor
Memory: 15.6 GiB of RAM
Graphics Processor: Radeon RX Vega
Comment 13 pqwoerituytrueiwoq 2022-01-04 02:14:14 UTC
(In reply to Leandro from comment #12)
On my AOC G24C1 it is under extra and is called input select
very surprising that your fancy monitor lacks suck a basic feature

also just noticed one of my monitors is set to auto and does not trigger this issue, my old HP 2009m ( https://support.hp.com/us-en/document/c01694120 ) does trigger it