Bug 412924 - [kwin_wayland] High CPU usage with Qt 5.14 and mouse cursor artifacts
Summary: [kwin_wayland] High CPU usage with Qt 5.14 and mouse cursor artifacts
Status: RESOLVED WORKSFORME
Alias: None
Product: kwin
Classification: Plasma
Component: platform-wayland-nested (show other bugs)
Version: git master
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: regression, wayland
: 412760 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-10-13 21:00 UTC by Elvis Angelaccio
Modified: 2021-09-24 08:38 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Picture of the issue (1.24 MB, image/jpeg)
2019-10-13 21:00 UTC, Elvis Angelaccio
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Elvis Angelaccio 2019-10-13 21:00:42 UTC
Created attachment 123174 [details]
Picture of the issue

SUMMARY

Since I upgraded to Qt 5.14 beta1, I have kwin_wayland using 25% of my CPU and artifacts while rendering the mouse cursor (see attached picture).

STEPS TO REPRODUCE
1. Start plasma wayland session

OBSERVED RESULT
Mouse cursor artifacts and kwin_wayland process using 25% of available CPU.


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: archlinux
KDE Plasma Version: 5.16.90
KDE Frameworks Version: 5.63
Qt Version: 5.14 beta1

ADDITIONAL INFORMATION
The issue stops happening:
- if the mouse cursor is hovering the window title bar
- if the mouse is hovering an xwayland window
- if the screen is locked
Comment 1 Elvis Angelaccio 2019-10-13 21:02:19 UTC
Forgot to say this happens on a laptop with Intel graphics.
Comment 2 Elvis Angelaccio 2019-10-20 09:42:25 UTC
It seems flatpak Qt apps are also not affected.
Comment 3 Patrick Silva 2019-10-21 17:57:30 UTC
related to bug 412760
Comment 4 Elvis Angelaccio 2019-10-21 19:44:14 UTC
*** Bug 412760 has been marked as a duplicate of this bug. ***
Comment 5 Fabian Vogt 2019-11-04 19:01:10 UTC
Anything suspicious in the output of an affected application with WAYLAND_DEBUG=1?
Comment 6 Elvis Angelaccio 2019-11-04 19:35:12 UTC
(In reply to Fabian Vogt from comment #5)
> Anything suspicious in the output of an affected application with
> WAYLAND_DEBUG=1?

Yes, thanks for the hint:

$ WAYLAND_DEBUG=1 dolphin
...
[1647729.535] wl_callback@44.done(1578247)
[1647729.547]  -> wl_surface@43.set_buffer_scale(1)
[1647729.557]  -> wl_surface@43.attach(wl_buffer@42, 0, 0)
[1647729.577]  -> wl_surface@43.damage(0, 0, 32, 32)
[1647729.605]  -> wl_surface@43.frame(new id wl_callback@44)
[1647729.619]  -> wl_surface@43.commit()
[1647729.742] wl_display@1.delete_id(44)
[1647729.764] wl_callback@44.done(1578247)
[1647729.777]  -> wl_surface@43.set_buffer_scale(1)
[1647729.786]  -> wl_surface@43.attach(wl_buffer@42, 0, 0)
[1647729.809]  -> wl_surface@43.damage(0, 0, 32, 32)
[1647729.833]  -> wl_surface@43.frame(new id wl_callback@44)
[1647729.848]  -> wl_surface@43.commit()
[1647729.965] wl_display@1.delete_id(44)
[1647729.987] wl_callback@44.done(1578247)
[1647730.000]  -> wl_surface@43.set_buffer_scale(1)
[1647730.009]  -> wl_surface@43.attach(wl_buffer@42, 0, 0)
[1647730.025]  -> wl_surface@43.damage(0, 0, 32, 32)
[1647730.048]  -> wl_surface@43.frame(new id wl_callback@44)
[1647730.062]  -> wl_surface@43.commit()
[1647730.184] wl_display@1.delete_id(44)
[1647730.207] wl_callback@44.done(1578247)
[1647730.220]  -> wl_surface@43.set_buffer_scale(1)
[1647730.229]  -> wl_surface@43.attach(wl_buffer@42, 0, 0)
[1647730.245]  -> wl_surface@43.damage(0, 0, 32, 32)
[1647730.270]  -> wl_surface@43.frame(new id wl_callback@44)
[1647730.282]  -> wl_surface@43.commit()
[1647730.392] wl_display@1.delete_id(44)
[1647730.409] wl_callback@44.done(1578248)
[1647730.421]  -> wl_surface@43.set_buffer_scale(1)
[1647730.433]  -> wl_surface@43.attach(wl_buffer@42, 0, 0)
[1647730.456]  -> wl_surface@43.damage(0, 0, 32, 32)
[1647730.483]  -> wl_surface@43.frame(new id wl_callback@44)
[1647730.504]  -> wl_surface@43.commit()

... and so on. These functions are repeated in a loop while reproducing the issue.
Comment 7 Matej Mrenica 2019-11-04 19:39:32 UTC
Also here, exactly as above.
Comment 8 Elvis Angelaccio 2019-11-09 10:14:22 UTC
(In reply to Elvis Angelaccio from comment #2)
> It seems flatpak Qt apps are also not affected.

Possibly because the org.kde.Platform 5.13 runtime ships Qt 5.13.x
Comment 9 Patrick Silva 2019-12-04 14:29:46 UTC
This problem persists after update to Qt 5.14 RC1.

Operating System: Arch Linux 
KDE Plasma Version: 5.17.4
KDE Frameworks Version: 5.64.0
Qt Version: 5.14.0 RC1
Comment 11 Patrick Silva 2019-12-12 15:47:07 UTC
(In reply to David Edmundson from comment #10)
> Fixed.
> 
> https://code.qt.io/cgit/qt/qtwayland.git/commit/?h=5.
> 14&id=36974955d13578071387695adb13a47be33e4d32

does Qt 5.14 include the fix?
This problem persists after upgrade to Qt 5.14 on Arch Linux.
Comment 12 Elvis Angelaccio 2019-12-15 12:01:31 UTC
(In reply to Patrick Silva from comment #11)
> (In reply to David Edmundson from comment #10)
> > Fixed.
> > 
> > https://code.qt.io/cgit/qt/qtwayland.git/commit/?h=5.
> > 14&id=36974955d13578071387695adb13a47be33e4d32
> 
> does Qt 5.14 include the fix?
> This problem persists after upgrade to Qt 5.14 on Arch Linux.

The package from the testing repo includes the fix. I confirm that it fixes the issue.
Comment 13 Patrick Silva 2019-12-15 12:11:59 UTC
yes, yesterday I installed qt5-wayland 5.14.0-2 package including the fix. \o/
Comment 14 Matej Mrenica 2020-09-17 18:17:00 UTC
This issue is still/again present.
Comment 15 David Edmundson 2020-09-17 22:43:09 UTC
>This issue is still/again present.

As in the issue of generic high CPU or the specific issue of mouse cursor frames going at infinite fps?
Comment 16 Matej Mrenica 2020-09-18 06:21:09 UTC
(In reply to David Edmundson from comment #15)
> >This issue is still/again present.
> 
> As in the issue of generic high CPU or the specific issue of mouse cursor
> frames going at infinite fps?

Mouse cursor shadow has a breathing effect like it was described in the duplicate. I don't know about high CPU usage but my wayland session does run at 30fps or less (https://bugs.kde.org/show_bug.cgi?id=424398).
Comment 17 Leszek Lesner 2020-10-13 05:57:40 UTC
Can confirm relatively high CPU usage (showing 6% instead of nothing in systemmonitor. 
Also framerate breaks down from 120 frames to under 100 with sometimes even under 50 fps which is clearly visible mostly when using the virtual desktop overview with 4 virtual desktops showing side by side.
Comment 18 Leszek Lesner 2020-10-13 06:10:48 UTC
Looks like a memory leak to me. The process gradually uses more CPU and more and more memory on my system. 
So 120 fps at the beginning of a session and the more RAM it uses the slower the framerate gets.
Comment 19 Vlad Zahorodnii 2021-09-24 08:38:35 UTC
It's been almost a year and no new similar bug reports, so it seems like the issue is gone. If you're still able to reproduce the bug, please reopen this bug report.