Bug 448557 - kwin_wayland constantly consuming 20-60% of a CPU core recently when using AMS cursor
Summary: kwin_wayland constantly consuming 20-60% of a CPU core recently when using AM...
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (show other bugs)
Version: git master
Platform: Other Linux
: HI major (vote)
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: efficiency
Depends on:
Blocks:
 
Reported: 2022-01-15 22:00 UTC by Nate Graham
Modified: 2022-01-22 20:42 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.24


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nate Graham 2022-01-15 22:00:48 UTC
I build all KDE stuff from git master every day, and for at least the last two days, kwin_wayland has been consuming between 20 and 60% of a CPU core at idle. It causes input lag and makes the system nearly unusable.

I attempted to bisect but was unable to due to tight coupling between KWin and its dependencies.

The journal log doesn't have anything fishy-looking in it.

I'm not sure how to debug this but can provide any logs.
Comment 1 Nate Graham 2022-01-15 22:11:27 UTC
kwin_x11 is unaffected. I've temporarily gone back to X11 to have a usable system.
Comment 2 Nate Graham 2022-01-16 15:39:02 UTC
This seems to have been fixed with a mesa update today.
Comment 3 Nate Graham 2022-01-17 19:40:20 UTC
Never mind, it turned out that that didn't fix it.

However, after some investigation in #kwin, setting `KWIN_DRM_NO_AMS=1` *did* fix it. So it looks like this isue is related to eprformance issues with the AMS cursor. Re-opening.
Comment 4 Keith Calvelli 2022-01-17 19:55:01 UTC
(In reply to Nate Graham from comment #3)
> Never mind, it turned out that that didn't fix it.
> 
> However, after some investigation in #kwin, setting `KWIN_DRM_NO_AMS=1`
> *did* fix it. So it looks like this isue is related to eprformance issues
> with the AMS cursor. Re-opening.

I am also impacted by this.  Nate's workaround seems to work for me.

Note that previous to the workaround, in addition to the CPU consumption from kwin_wayland, I was unable to create new desktops and switch between existing desktops using the overview effect.  The workaround seems to have fixed that issue as well.
Comment 5 Bug Janitor Service 2022-01-18 10:23:10 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/1904
Comment 6 Bug Janitor Service 2022-01-18 21:52:29 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/1907
Comment 7 Zamundaaa 2022-01-19 10:52:00 UTC
Git commit 50c167c94b33702f3f026e007bda424ec1af047d by Xaver Hugl.
Committed on 19/01/2022 at 10:31.
Pushed by zamundaaa into branch 'master'.

backends/drm: fix reallocation check

When no modifiers are used at all, we shouldn't check them.

M  +2    -1    src/backends/drm/egl_gbm_backend.cpp

https://invent.kde.org/plasma/kwin/commit/50c167c94b33702f3f026e007bda424ec1af047d
Comment 8 Vlad Zahorodnii 2022-01-19 17:25:11 UTC
Git commit 547bb52c6c3833d76bbffef46fa9b3f3ae51dccf by Vlad Zahorodnii, on behalf of Xaver Hugl.
Committed on 19/01/2022 at 17:25.
Pushed by vladz into branch 'Plasma/5.24'.

backends/drm: fix reallocation check

When no modifiers are used at all, we shouldn't check them.


(cherry picked from commit 50c167c94b33702f3f026e007bda424ec1af047d)

M  +2    -1    src/backends/drm/egl_gbm_backend.cpp

https://invent.kde.org/plasma/kwin/commit/547bb52c6c3833d76bbffef46fa9b3f3ae51dccf
Comment 9 Nate Graham 2022-01-19 18:26:50 UTC
That completely fixes the problem for me, hooray! kwin_wayland is once again down to 0% CPU most of the time, with occasional spikes to 10%.
Comment 10 postix 2022-01-22 20:42:48 UTC
Do you know if these changes are already in KDE Neon Testing?