Bug 454755 - Screen cycles 22 seconds off, 4 seconds on, only with Wayland
Summary: Screen cycles 22 seconds off, 4 seconds on, only with Wayland
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (other bugs)
Version First Reported In: 5.24.5
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-06-02 15:57 UTC by cantabile
Modified: 2024-06-07 20:25 UTC (History)
2 users (show)

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


Attachments
drm debug messages (3.83 MB, text/plain)
2022-06-10 08:35 UTC, cantabile
Details
messages from kwin_wayland (3.18 KB, text/plain)
2022-06-10 08:36 UTC, cantabile
Details

Note You need to log in before you can comment on or make changes to this bug.
Description cantabile 2022-06-02 15:57:57 UTC
SUMMARY
When powerdevil turns off the screen after X minutes of inactivity, the screen constantly turns back on for ~4 seconds, then stays off for ~22 seconds, then turns on again for ~4 seconds, and so on indefinitely. The backlight stays off, though.

This only happens in the Wayland session. The screen stays off solidly in the X11 session.

This suspicious message appears in journalctl every 30 seconds, but not all the time, and not just when the screen is off:
Jun 02 18:32:52 home xdg-desktop-portal-kde[203852]: xdp-kde-background: GetAppState called: no parameters


STEPS TO REPRODUCE
1. Pick the Wayland session when you log in
2. Wait for the screen to turn off, or turn it off with this command I found at askubuntu.com:
sleep 1 && dbus-send --session --print-reply --dest=org.kde.kglobalaccel  /component/org_kde_powerdevil org.kde.kglobalaccel.Component.invokeShortcut string:'Turn Off Screen' 
3. Turn the screen towards a light source, otherwise the difference is not really visible
4. Wait

OBSERVED RESULT
The screen continuously turns on and off.

EXPECTED RESULT
The screen should stay off.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Arch Linux
(available in About System)
KDE Plasma Version: 5.24.5
KDE Frameworks Version: 5.94.0
Qt Version: 5.15.4+kde+r146-1
Kernel version: 5.18.0-arch1-1

ADDITIONAL INFORMATION
The computer is a laptop, HP 250 G7.
The CPU is Intel Core i3 7020u, with Intel 620 graphics.
The screen is a cheap TN type made by BOE, connected through eDP. It's the internal screen, and I don't have any external ones connected.
Comment 1 Nate Graham 2022-06-03 17:24:29 UTC
That's a WTF bug for sure.
Comment 2 cantabile 2022-06-07 19:34:26 UTC
I found this kinda similar Gnome bug, which they fixed: https://gitlab.gnome.org/GNOME/mutter/-/issues/1991

I don't know if it's useful. It might have been fixed by accident, since no commit is mentioned.
Comment 3 Zamundaaa 2022-06-09 20:43:27 UTC
In order to show what KWin and the kernel are doing, you can execute
> kwriteconfig5 --file startkderc --group General --key systemdBoot true
then reboot, then execute
> echo 0xFF | sudo tee /sys/module/drm/parameters/debug
and
> sudo dmesg -w > dmesg.log
(leave it running)
then turn the screen off, let it happen once and cancel the dmesg command.
Then upload that dmesg.log and also the output of
> journalctl --boot 0 --user-unit plasma-kwin_wayland

Also, if you put KWIN_DRM_NO_AMS=1 into /etc/environment, does the behavior change?
Comment 4 cantabile 2022-06-10 08:35:40 UTC
Created attachment 149591 [details]
drm debug messages
Comment 5 cantabile 2022-06-10 08:36:28 UTC
Created attachment 149592 [details]
messages from kwin_wayland
Comment 6 cantabile 2022-06-10 08:37:23 UTC
I put KWIN_DRM_NO_AMS=1 in /etc/environment and rebooted. The behaviour didn't change, so I removed it and rebooted again.

Then I obtained journalctl.log and dmesg.log as you instructed. They are attached.
Comment 7 Zamundaaa 2022-06-12 12:10:58 UTC
hmm, the driver is reporting hotplugs when the screen has been turned off for a bit. While I have never heard of it happening with eDP, it is somewhat common with external monitors.
I think this one can be sanely worked around in KWin though
Comment 8 Zamundaaa 2022-06-12 12:23:59 UTC
However, in the 4 seconds in between two hotplugs, I don't see KWin doing anything... So it might not be KWin's doing after all.

Do you have the Xorg driver xf86-video-intel installed? If so, if you remove it, does it still work correctly on Xorg?
Comment 9 cantabile 2022-06-12 17:38:40 UTC
I don't have xf86-video-intel. I removed it a long time ago because of some other bug(s).
Comment 10 cantabile 2022-08-30 14:43:41 UTC
Updating everything did not magically fix it.

KDE Plasma Version: 5.25.4
KDE Frameworks Version: 5.97.0
Qt Version: 5.15.5+kde+r174-1 / 6.3.1
Wayland version: 1.21.0
Kernel version: 5.19.3-arch1-1
Comment 11 Zamundaaa 2024-06-07 20:25:38 UTC
Plasma 6 ships with a workaround for such buggy hotplug notifications, so this should no longer happen