Bug 444001

Summary: Performance stagger in animation and rendering when hovering over grouped Icons-Only Task Manager; given that the grouped windows contain more than 3-5 windows.
Product: [Plasma] plasmashell Reporter: Quartz <thomwalker732>
Component: Task Manager and Icons-Only Task ManagerAssignee: Eike Hein <hein>
Status: RESOLVED FIXED    
Severity: normal CC: aleixpol, bharadwaj.raju777, bugs-kde, nate, plasma-bugs, qydwhotmail, vlad.zahorodnii
Priority: NOR Keywords: efficiency, usability, wayland
Version: master   
Target Milestone: 1.0   
Platform: Manjaro   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=433907
Latest Commit: Version Fixed In: 5.24
Sentry Crash Report:
Attachments: Task.qml
ToolTipDelegate.qml
ToolTipInstance.qml
ToolTipDelegate.qml
ToolTipDelegate.qml
ToolTipDelegate.qml

Description Quartz 2021-10-18 22:18:36 UTC
SUMMARY

When having more than 3-5 windows (of the same type) open on the taskbar and they get grouped together [such as 15 firefox windows minimized]...

...shine hover animation becomes evidently and noticeably impacted framerate wise and the cursor, as well as the icon itself starts to stagger.

STEPS TO REPRODUCE
1. Open 10, 20 or more windows of the same program (in my case, it was firefox)
2. Let them group.
3. While having other running programs, attempt to hover left and right between each and observe what happens when going over the program with lots of grouped windows.

OBSERVED RESULT

Slow, staggered animation, possibly even slowed cursor?
Unnatural animation transition.

Becomes an annoyance when working with multiple windows.

EXPECTED RESULT

Smooth animation transition between icons on the taskbar without staggering.

SOFTWARE/OS VERSIONS

OS: Manjaro Linux x86_64 
Host: TUF Gaming FX505DY_FX505DY 1.0 
Kernel: 5.13.19-2-MANJARO 
Uptime: 3 hours, 23 mins 
Packages: 1548 (pacman), 4 (flatpak) 
Shell: bash 5.1.8 
Resolution: 1920x1080 
DE: Plasma 5.22.5 
WM: KWin 
Theme: Breath2 2021 Light [Plasma], Breeze [GTK2/3] 
Icons: [Plasma], breath2 [GTK2/3] 
Terminal: konsole 
CPU: AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx (8) @ 2.100GHz 
GPU: AMD ATI 05:00.0 Picasso 
GPU: AMD ATI Radeon RX 460/560D / Pro 450/455/460/555/555X/560/560X 
Memory: 11126MiB / 15688MiB 

KDE Plasma Version: 5.22.5
KDE Frameworks Version: 5.87.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION

Compositor is off/disabled.

GPU drivers are installed.
Comment 1 Quartz 2021-10-18 22:30:28 UTC
Workflow, especially with multiple windows gets slowed down and gives overall poor usability and experience.
Comment 2 Quartz 2021-10-18 22:42:43 UTC
Machine is not thrashing or under performance load for this to occur. It occurs under normal circumstances.
Comment 3 Quartz 2021-10-18 23:00:01 UTC
****** This issue also occurs on the Task Manager (not just the icons only widget) taskbar widget when items are grouped.
Comment 4 Bharadwaj Raju 2021-10-20 14:53:35 UTC
What happens if you do enable the compositor? Does that improve or worsen this?
Comment 5 Fushan Wen 2021-10-20 15:11:23 UTC
The animation was made by Macro Martin according to "Desktop Effects" settings. But I think it's not about the animation, but scripts in ToolTipInstance.qml are likely to take a long time to execute if there are many windows in a group.

That's another reason why we need https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/609, to really disable tooltips to avoid the unresponsiveness caused by tooltips.
Comment 6 Nate Graham 2021-10-20 16:57:01 UTC
Git commit 80928f4344af159f58e61225a02ea7a874cb5493 by Nate Graham, on behalf of Fushan Wen.
Committed on 20/10/2021 at 16:56.
Pushed by ngraham into branch 'master'.

taskmanager: Ensure tooltips are really disabled when "Show tooltips" is unchecked

Before frameworks/plasma-framework!358, if enabled is not set (default
true), when the tooltip is disabled in the settings, plasmashell will
still crash at showing window thumbnails, which means the content in
the tooltip is just not visible, but the relevant code is still
executed.

This ensures tooltips are really disabled when "Show tooltips" is not
checked, which is beneficial for people who want to extend the battery
life or avoid the unresponsiveness caused by tooltips.
Related: bug 444015

M  +2    -1    applets/taskmanager/package/contents/ui/Task.qml

https://invent.kde.org/plasma/plasma-desktop/commit/80928f4344af159f58e61225a02ea7a874cb5493
Comment 7 Bug Janitor Service 2021-10-21 09:11:14 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/622
Comment 8 Fushan Wen 2021-10-21 15:46:26 UTC
Git commit 12373d31a0400bf5d4b7d6abdb29268c360156bf by Fushan Wen.
Committed on 21/10/2021 at 09:10.
Pushed by ngraham into branch 'master'.

taskmanager: Prevent useless component creation/destruction for grouped tooltips

The binding of "model" property of DelegateModel in ToolTipDelegate.qml
will trigger useless component creation/destruction when "rootIndex" is
changed but is not undefined. Make the ternary operator depend on
"hasRootIndex" bool property to avoid that.

In Task.qml, only assign different values to "parentTask" and "rootIndex"
to avoid unnecessary component creation/destruction for the second time
hovering on the same task.
Related: bug 433907

M  +10   -2    applets/taskmanager/package/contents/ui/Task.qml
M  +4    -1    applets/taskmanager/package/contents/ui/ToolTipDelegate.qml

https://invent.kde.org/plasma/plasma-desktop/commit/12373d31a0400bf5d4b7d6abdb29268c360156bf
Comment 9 Nate Graham 2021-10-21 15:47:38 UTC
Git commit 2f27fc9f05462076a77254c0df17fa07ee8228a8 by Nate Graham, on behalf of Fushan Wen.
Committed on 21/10/2021 at 15:47.
Pushed by ngraham into branch 'Plasma/5.23'.

taskmanager: Prevent useless component creation/destruction for grouped tooltips

The binding of "model" property of DelegateModel in ToolTipDelegate.qml
will trigger useless component creation/destruction when "rootIndex" is
changed but is not undefined. Make the ternary operator depend on
"hasRootIndex" bool property to avoid that.

In Task.qml, only assign different values to "parentTask" and "rootIndex"
to avoid unnecessary component creation/destruction for the second time
hovering on the same task.
Related: bug 433907


(cherry picked from commit 12373d31a0400bf5d4b7d6abdb29268c360156bf)

M  +10   -2    applets/taskmanager/package/contents/ui/Task.qml
M  +4    -1    applets/taskmanager/package/contents/ui/ToolTipDelegate.qml

https://invent.kde.org/plasma/plasma-desktop/commit/2f27fc9f05462076a77254c0df17fa07ee8228a8
Comment 10 Bug Janitor Service 2021-10-22 15:04:24 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/631
Comment 11 Fushan Wen 2021-10-24 13:42:31 UTC
Created attachment 142819 [details]
Task.qml
Comment 12 Fushan Wen 2021-10-24 13:47:23 UTC
Created attachment 142820 [details]
ToolTipDelegate.qml

The bug seems different from bug 433907, because on a 1080p screen a tooltip can show up to 7 windows. But it says when a tooltip contains more than 3-5 windows the performance starts staggering.

Could you help me test https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/631 ? 

I have uploaded patched Task.qml and ToolTipDelegate.qml, so after you download the two files, copy them into 

/usr/share/plasma/plasmoids/org.kde.plasma.taskmanager/contents/ui/

(or if Task.qml and ToolTipDelegate.qml do not exist in the folder, run `find /usr -name ToolTipDelegate.qml` to locate the folder)

and run `plasmashell --replace` to see if the bug is fixed.

Thank you in advance.
Comment 13 Fushan Wen 2021-10-24 13:51:25 UTC
Change the status to NEEDSINFO
Comment 14 Fushan Wen 2021-10-24 13:54:01 UTC
Created attachment 142821 [details]
ToolTipInstance.qml

If the bug is not fixed by the two files, please also copy ToolTipInstance.qml to the same folder to test again.
Comment 15 Fushan Wen 2021-10-25 01:44:52 UTC
Created attachment 142839 [details]
ToolTipDelegate.qml

Update ToolTipDelegate.qml, please use the latest version.
Comment 16 Fushan Wen 2021-10-25 02:50:49 UTC
Created attachment 142843 [details]
ToolTipDelegate.qml

Update again
Comment 17 Fushan Wen 2021-10-25 04:31:14 UTC
Created attachment 142844 [details]
ToolTipDelegate.qml
Comment 18 Fushan Wen 2021-10-25 04:32:19 UTC
I can reproduce the bug on Wayland even with these files. Are you using Wayland? Please also try X11 to see if the bug still persist.
Comment 19 Fushan Wen 2021-10-25 07:59:02 UTC
The problem is in PipeWireThumbnail.qml and its library.

Should ScreencastingRequest::create run in a new thread?
Comment 20 Fushan Wen 2021-10-25 08:53:35 UTC
Can the tooltip use KWinComponents.WindowThumbnailItem? It seems much faster than PipeWireThumbnail.
Comment 21 Nate Graham 2021-10-26 19:16:37 UTC
Git commit b63a6c9b16f261ecac99e5d1abbd72c52349cb95 by Nate Graham, on behalf of Fushan Wen.
Committed on 26/10/2021 at 19:15.
Pushed by ngraham into branch 'master'.

taskmanager: Replace Repeater with ListView for task group list

Unlike Repeater ListView loads only visible items. This behaviour
leads to huge performance improvement.
Related: bug 433907

M  +2    -14   applets/taskmanager/package/contents/ui/Task.qml
M  +30   -33   applets/taskmanager/package/contents/ui/ToolTipDelegate.qml

https://invent.kde.org/plasma/plasma-desktop/commit/b63a6c9b16f261ecac99e5d1abbd72c52349cb95
Comment 22 Vlad Zahorodnii 2021-10-26 19:21:36 UTC
(In reply to qydwhotmail from comment #20)
> Can the tooltip use KWinComponents.WindowThumbnailItem? It seems much faster
> than PipeWireThumbnail.

Huh, a shot in the dark: it's because window thumbnails are not shared using dma-buf anymore due to recent pipewire shenanigans.
Comment 23 Nate Graham 2021-10-28 16:19:38 UTC
Should be pretty much fixed now with those changes.
Comment 24 Nate Graham 2021-10-28 16:22:11 UTC
*** Bug 429502 has been marked as a duplicate of this bug. ***