Bug 462002

Summary: Mouse cursor stuttering
Product: [Plasma] kwin Reporter: gudvinr+kde
Component: wayland-genericAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED UPSTREAM    
Severity: normal CC: nate
Priority: NOR Keywords: wayland
Version: 5.26.3   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description gudvinr+kde 2022-11-18 18:21:52 UTC
SUMMARY

Sometimes I have periods when mouse cursor very noticeably stutter when you move.
I am not sure what causes this because I don't see dependence on specific windows or open applications.

However, I notice that it kinda happens more often when Night Colour is enabled. But that could be false correlation because it could also caused by e.g. increased resource consumption by plasma because Night Colour kicks in around evening.

Somewhere in bugtracker I found advice to use KWIN_DRM_NO_AMS=1.
I added it to .config/environment.d/ and it didn't help.

SOFTWARE/OS VERSIONS
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.8-zen1-1-zen (64-bit)
Graphics Platform: Wayland
Graphics Processor: AMD Radeon RX Vega M GL Graphics
Comment 1 gudvinr+kde 2022-11-18 18:51:37 UTC
Actually, it might be caused by Night Colour because I tried to turn it on and off and while it is transitioning.
But I think it is different issue because by the time I see these hiccups, it is already fully transitioned.
Comment 2 gudvinr+kde 2023-01-30 03:13:23 UTC
I noticed that I can reproduce issue more easily when I move mouse over certain windows.
E.g. discord (xwayland) or firefox (wayland native).

With discord I get almost 100% reproducibility if I launch an app and start moving mouse around in discord window.

I had same stutter right now, while writing issue in firefox. But once I opened OBS to record, it went away when I opened obs and went back to firefox.

Also sometimes that happens after I switch activities back and forth while moving cursor.
Comment 3 Vlad Zahorodnii 2023-02-07 12:52:48 UTC
Night color changes the gamma ramp which is equivalent to modesetting and it can cause stuttering. I don't think that we can do much about it on kwin side besides using atomic modesetting apis, which we already do. If there are still issues, it sounds like a kernel bug, but they probably can't do much about it either.

Another option is to perform the transition in software, but we lack the needed infrastructure and I'm not sure that the code complexity is worth it.
Comment 4 gudvinr+kde 2023-02-07 13:25:18 UTC
Night color is only one of the cases when it happens. It's not even that important tbh because I don't turn it on and off manually anyway.
So I am fine with that. And it happened before too.

But I also get stutters without night color being turned on or when it's fully transitioned (as I described in my previous message).
I haven't had these on 5.25 with wayland and X11 and I don't remember having these issues on X11 before that.

But I started having issues somewhere around 5.26 release I think. I can't pinpoint exact date or release because at first I thought it is same thing caused by night color that I was seeing before. But now I can say for sure that it isn't.

Also around that time I started to have performance issues I described in bug 463718, that may or may not be related to this one.
Comment 5 gudvinr+kde 2023-02-13 08:55:43 UTC
Nate, can you link to upstream issue?
It'd be nice to know what is causing this.

Thanks in advance.
Comment 6 Nate Graham 2023-02-13 18:10:02 UTC
As Vlad said, it could be an (as yet unreported) Kernel bug. Possibly also a GPU bug.
Comment 7 gudvinr+kde 2023-03-01 20:57:55 UTC
https://gitlab.freedesktop.org/wayland/weston/-/issues/602

I probably found upstream-ish issue about that