Bug 479250

Summary: Brief screen freeze when opening Thumbnail Grid tabbox or Overview (anything in KWin that loads KPipeWire window thumbnails)
Product: [Plasma] kwin Reporter: hexchain <kde>
Component: screencastingAssignee: KWin default assignee <kwin-bugs-null>
Status: CONFIRMED ---    
Severity: normal CC: adam.brown, akselmo, carl.benjamin.dreyer, edwin.frank.loeffler, FishBoneEK, florian.klamer, isma.af, kde-dev, kde, marton2+kde, mbr, nate, regalia, sebastian.schrader, szotsaki, thesword53, xaver.hugl
Priority: HI Keywords: wayland
Version: 6.0.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=490178
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description hexchain 2024-01-01 14:33:11 UTC
SUMMARY
On Wayland with the latest beta, KWin randomly freezes when opening the tabbox.

STEPS TO REPRODUCE
1. Move the mouse cursor continuously (e.g. in a circle)
2. At the same time, press Alt+Tab (hold down the Alt key for a short moment before releasing to ensure the tab box displays)

OBSERVED RESULT
The screen freezes for a moment before the Tab Box shows up.

EXPECTED RESULT
The screen should not freeze at all.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 5.91.0
KDE Frameworks Version: 5.247.0
Qt Version: 6.7.0
Kernel Version: 6.6.8-arch1-1 (64-bit)
Graphics Platform: Wayland
Comment 1 Zamundaaa 2024-01-01 15:13:47 UTC
What hardware is this on?
Comment 2 hexchain 2024-01-01 15:22:24 UTC
This is on an AMD Remberant (integrated Radeon 680M) laptop.

OpenGL core profile vendor: AMD
OpenGL core profile renderer: AMD Radeon Graphics (radeonsi, rembrandt, LLVM 16.0.6, DRM 3.54, 6.6.8-arch1-1)
OpenGL core profile version: 4.6 (Core Profile) Mesa 23.3.2-arch1.1
OpenGL core profile shading language version: 4.60
Comment 3 hexchain 2024-01-01 15:32:58 UTC
The same kind of freeze can also be observed when opening the overview.
Comment 4 Bug Janitor Service 2024-01-16 03:45:32 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 5 Nate Graham 2024-01-17 02:10:18 UTC
I can reproduce this only with the new default Thumbnail Grid switcher. Large Icons, Sidebar, and others do not exhibit the issue.

GPU hardware is an Intel HD620 10th gen iGPU.

The issue in Overview is likely something different.
Comment 6 edwloef 2024-01-25 12:44:23 UTC
I can also reproduce this using Thumbnail Grid, on "Intel Raptor Lake-P [Iris Xe Graphics]"
Comment 7 Nate Graham 2024-03-07 03:42:24 UTC
*** Bug 482557 has been marked as a duplicate of this bug. ***
Comment 8 Szőts Ákos 2024-03-22 07:16:19 UTC
*** Bug 484134 has been marked as a duplicate of this bug. ***
Comment 9 Intergalactic Narwhal 2024-04-08 21:54:51 UTC
I have the same issue, for me the delay can be as high as 5 seconds sometimes. It might or might not be related, but when "Hide other windows when hovering over previews" is enabled on the tray, hovering over a thumbnail exhibits the same behavior.
Comment 10 Intergalactic Narwhal 2024-04-09 12:19:24 UTC
I wasn't able to pinpoint the exact moment yet but it seems to get worse with repeatedly plugging & unplugging monitors. E.g. in the period of 1-2 days I repeatedly use my laptop with and without an external monitor and it gets worse.
Comment 11 Akseli Lahtinen 2024-04-11 15:03:27 UTC
I can repro this on Fedora 40 beta, but not in the kdesrc-built session of Plasma. 

Also another difference is that this happens on laptop has integrated intel gpu, while the device I can't repro it on is desktop PC with AMD GPU.

System where I can repro it:

Operating System: Fedora Linux 40
KDE Plasma Version: 6.0.3
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2
Kernel Version: 6.8.4-300.fc40.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 8 × Intel® Core™ i5-8250U CPU @ 1.60GHz
Memory: 7.5 GiB of RAM
Graphics Processor: Mesa Intel® UHD Graphics 620
Manufacturer: LENOVO
Product Name: 20KF001RMX
System Version: ThinkPad X280
Comment 12 adam.brown 2024-05-21 01:21:16 UTC
This bug is plaguing me as well on my amd desktop (both cpu and gpu).

Since I have a spare computer, I used gdb when this happened, here's the slow backtrace:

#0  0x000070d995a46b4d in clock_gettime ()                                                                                                                                                               
#1  0x000070d9922f2e2d in __GI___clock_gettime (clock_id=<optimized out>, tp=<optimized out>) at ../sysdeps/unix/sysv/linux/clock_gettime.c:42                                                           
#2  0x000070d9924d2dd8 in std::chrono::_V2::steady_clock::now () at /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/chrono.cc:87                                                                           
#3  0x000070d99294b456 in QElapsedTimer::durationElapsed (this=0x70d99574bc10 <KWin::AnimationEffect::s_clock>) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qelapsedtimer.cpp:278               
#4  QElapsedTimer::elapsed (this=this@entry=0x70d99574bc10 <KWin::AnimationEffect::s_clock>) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qelapsedtimer.cpp:312                                  
#5  0x000070d9951c1698 in KWin::AnimationEffect::clock () at /usr/src/debug/kwin/kwin-6.0.4.1/src/effect/animationeffect.h:347                                                                           
#6  KWin::AnimationEffect::updateLayerRepaints (this=this@entry=0x55ad5de0d9c0) at /usr/src/debug/kwin/kwin-6.0.4.1/src/effect/animationeffect.cpp:858                                                   
#7  0x000070d9951c22eb in KWin::AnimationEffect::triggerRepaint (this=0x55ad5de0d9c0) at /usr/src/debug/kwin/kwin-6.0.4.1/src/effect/animationeffect.cpp:815                                             
#8  0x000070d9951c5bfb in KWin::AnimationEffect::p_animate (this=this@entry=0x55ad5de0d9c0, w=w@entry=0x55ad5e889a00, a=a@entry=KWin::AnimationEffect::Opacity, meta=<optimized out>,                    
    meta@entry=0, ms=150, to=..., curve=..., delay=0, from=..., keepAtTarget=true, fullScreenEffect=false, keepAlive=false, shader=0x0) at /usr/src/debug/kwin/kwin-6.0.4.1/src/effect/animationeffect.cp
p:283                                                                                                                                                                                                    
#9  0x000055ad31836079 in KWin::AnimationEffect::set                                                                                                                                                     
    (to=<optimized out>, from=<optimized out>, a=KWin::AnimationEffect::Opacity, meta=0, delay=0, fullScreen=false, keepAlive=false, shader=0x0, curve=..., ms=<optimized out>, w=0x55ad5e889a00, this=0x
55ad5de0d9c0)
    at /usr/src/debug/kwin/kwin-6.0.4.1/src/effect/animationeffect.h:411                                                                                                                                 
#10 KWin::HighlightWindowEffect::startGhostAnimation (this=this@entry=0x55ad5de0d9c0, window=<optimized out>, window@entry=0x55ad5e889a00) at /usr/src/debug/kwin/kwin-6.0.4.1/src/plugins/highlightwindo
w/highlightwindow.cpp:219
#11 0x000055ad31836265 in KWin::HighlightWindowEffect::prepareHighlighting (this=this@entry=0x55ad5de0d9c0) at /usr/src/debug/kwin/kwin-6.0.4.1/src/plugins/highlightwindow/highlightwindow.cpp:170
#12 0x000055ad31839c3a in KWin::HighlightWindowEffect::highlightWindows (this=this@entry=0x55ad5de0d9c0, windows=...) at /usr/src/debug/kwin/kwin-6.0.4.1/src/plugins/highlightwindow/highlightwindow.cpp
:209
#13 0x000055ad31839f13 in KWin::HighlightWindowEffect::highlightWindows (windows=..., this=0x55ad5de0d9c0) at /usr/src/debug/kwin/kwin-6.0.4.1/src/plugins/highlightwindow/highlightwindow.cpp:198
#14 KWin::HighlightWindowEffect::perform (feature=<optimized out>, arguments=<optimized out>, this=0x55ad5de0d9c0) at /usr/src/debug/kwin/kwin-6.0.4.1/src/plugins/highlightwindow/highlightwindow.cpp:27
3
#15 KWin::HighlightWindowEffect::perform (this=0x55ad5de0d9c0, feature=<optimized out>, arguments=<optimized out>) at /usr/src/debug/kwin/kwin-6.0.4.1/src/plugins/highlightwindow/highlightwindow.cpp:26
5
#16 0x000070d9951d758e in KWin::EffectsHandler::highlightWindows (this=<optimized out>, windows=<optimized out>) at /usr/src/debug/kwin/kwin-6.0.4.1/src/effect/effecthandler.cpp:1418
#17 0x000070d9954ef4fc in KWin::TabBox::TabBoxHandlerImpl::highlightWindows (this=<optimized out>, window=<optimized out>, controller=0x55ad5e695a10) at /usr/src/debug/kwin/kwin-6.0.4.1/src/tabbox/tabb
ox.cpp:274
#18 0x000070d9929a1e3e in QtPrivate::QSlotObjectBase::call (this=<optimized out>, r=0x55ad5d1fa280, a=0x7ffe2bac8d98, this=<optimized out>, r=<optimized out>, a=<optimized out>)
    at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qobjectdefs_impl.h:469                                                                                                                          
#19 doActivate<false> (sender=<optimized out>, signal_index=<optimized out>, argv=<optimized out>) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qobject.cpp:4078
#20 0x000070d9928d34d4 in QSingleShotTimer::timeout (this=0x55ad5de29e10) at /usr/src/debug/qt6-base/build/src/corelib/Core_autogen/7GB2EGQPHR/moc_qsingleshottimer_p.cpp:139
#21 QSingleShotTimer::timerEvent (this=0x55ad5de29e10) at /usr/src/debug/qt6-base/build/src/corelib/Core_autogen/7GB2EGQPHR/../../../../../qtbase/src/corelib/kernel/qsingleshottimer_p.h:116
#22 0x000070d99298c809 in QObject::event (this=0x55ad5de29e10, e=0x7ffe2bac8f70) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qobject.cpp:1423
#23 0x000070d993afc4dc in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x55ad5de29e10, e=0x7ffe2bac8f70) at /usr/src/debug/qt6-base/qtbase/src/widgets/kernel/qapplication.cpp:3287
#24 0x000070d992945678 in QCoreApplication::notifyInternal2 (receiver=0x55ad5de29e10, event=0x7ffe2bac8f70) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qcoreapplication.cpp:1142
#25 0x000070d992ac4998 in QCoreApplication::sendEvent (receiver=<optimized out>, event=0x7ffe2bac8f70) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qcoreapplication.cpp:1583
#26 QTimerInfoList::activateTimers (this=this@entry=0x55ad5cde4068) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qtimerinfo_unix.cpp:436
#27 0x000070d992ac70c8 in QEventDispatcherUNIXPrivate::activateTimers (this=0x55ad5cde3f90) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qeventdispatcher_unix.cpp:196
#28 QEventDispatcherUNIX::processEvents (this=<optimized out>, flags=..., flags@entry=...) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qeventdispatcher_unix.cpp:472
#29 0x000070d9935f8353 in QUnixEventDispatcherQPA::processEvents (this=<optimized out>, flags=...) at /usr/src/debug/qt6-base/qtbase/src/gui/platform/unix/qunixeventdispatcher.cpp:27
#30 0x000070d99294f94e in QEventLoop::processEvents (this=0x7ffe2bac9160, flags=...) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qeventloop.cpp:100
#31 QEventLoop::exec (this=0x7ffe2bac9160, flags=...) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qeventloop.cpp:182
#32 0x000070d992949c9d in QCoreApplication::exec () at /usr/src/debug/qt6-base/qtbase/src/corelib/global/qflags.h:74                                                                                     
#33 0x000070d993af837a in QApplication::exec () at /usr/src/debug/qt6-base/qtbase/src/widgets/kernel/qapplication.cpp:2555
#34 0x000055ad317e6dee in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/kwin/kwin-6.0.4.1/src/main_wayland.cpp:609

From the backtrace I could read that it has something with previewing windows. When I disabled previews in the window switcher in settings, the alt+tab was swift again, however, this bug is not limited to that. The lag also occurs when I hover over certain windows in the taskbar (you have to actually hover the thumbnail, simply hovering the task bar is not enough). In my case the culprit is brave that runs on wayland, as well as jetbrains products that use xwayland.
Comment 13 Intergalactic Narwhal 2024-05-21 08:23:26 UTC
I'm using Jetbrains products as well so that might be related.
Comment 14 adam.brown 2024-05-21 10:41:48 UTC
I can confirm, that for some reason, sometimes, jetbrains products trigger this and the problem remains after they are closed and the delay accumulates over time.

I've seen no problem with their flagship intellij ultimate, but opening clion triggered the lags when previewing windows and remained even after closing it.
Comment 15 Nate Graham 2024-07-01 13:20:00 UTC
*** Bug 489355 has been marked as a duplicate of this bug. ***
Comment 16 Flo 2024-10-30 16:12:26 UTC
I'm getting the same/similar behavior on my machine. 
I'm also using PHPStorm, but I have not checked if not using PHPStorm prevents this behavior. 

Observations:
When the machine is freshly booted everything is fine.
After a few hours and a lot of "alt tabbing", "alt tabbing" gets slower and slower. When "alt tabbing" quickly though, meaning not waiting for the task switcher to open,  it still works perfectly.
Only when I want the task switcher to show up, meaning holding alt after "alt tabbing", my desktop freezes for a second.

My machine: 
Fedora 40
KDE 6.2.2
CPU: AMD Ryzen 7 7735HS
GPU: AMD Radeon 680M
Wayland
Kernel Version: 6.11.4-201.fc40.x86_64 (64-bit)
Comment 17 FishBoneEK 2024-10-31 14:06:56 UTC
*** Bug 494682 has been marked as a duplicate of this bug. ***
Comment 18 FishBoneEK 2024-10-31 14:08:48 UTC
(In reply to Flo from comment #16)
> I'm getting the same/similar behavior on my machine. 
> I'm also using PHPStorm, but I have not checked if not using PHPStorm
> prevents this behavior. 
> 
> Observations:
> When the machine is freshly booted everything is fine.
> After a few hours and a lot of "alt tabbing", "alt tabbing" gets slower and
> slower. When "alt tabbing" quickly though, meaning not waiting for the task
> switcher to open,  it still works perfectly.
> Only when I want the task switcher to show up, meaning holding alt after
> "alt tabbing", my desktop freezes for a second.

I'm having this exact same syndrome!
Comment 19 FishBoneEK 2024-11-01 09:53:15 UTC
(In reply to Flo from comment #16)
> I'm getting the same/similar behavior on my machine. 

You can try working around it by switching your Task Switcher to Cover Switch and Flip Switch. I don't have this issue with these 2. 
I'm not using PHPStorm by the way.

Providing sys info here:
Operating System: Arch Linux 
KDE Plasma Version: 6.2.2
KDE Frameworks Version: 6.7.0
Qt Version: 6.8.0
Kernel Version: 6.11.5-arch1-1 (64-bit)
Graphics Platform: Wayland
Processors: 12 × AMD Ryzen 5 5500U with Radeon Graphics
Memory: 37.1 GiB of RAM
Graphics Processor: AMD Radeon Graphics
Comment 20 Nate Graham 2024-11-27 20:20:41 UTC
*** Bug 494763 has been marked as a duplicate of this bug. ***
Comment 21 Ismael Asensio 2024-11-28 00:41:33 UTC
> You can try working around it by switching your Task Switcher to Cover
> Switch and Flip Switch. I don't have this issue with these 2. 
> I'm not using PHPStorm by the way.

This and the backtrace might indicate some issue with the Highlight effect 
(the one that hides all the windows but the selected one). Flip and Cover switches
make use of thumbnails but disable this effect, as the desktop is already fully covered

Another workaround/datapoint can be to de-select the "Show selected window" 
to disable this effect and check whether the issue persists.
Comment 22 regalia 2024-11-29 16:53:58 UTC
I think I'm affected by this, my screen noticeably freezes when alt tabbing. Same happens when I hover over the preview of the window in the task manager. This disappears entirely for the task switcher when I disable "Show selected window".

For what it's worth, I do have Jetbrains products but don't have one running at the moment besides toolbox.

Sysinfo:
Operating System: Arch Linux 
KDE Plasma Version: 6.2.4
KDE Frameworks Version: 6.8.0
Qt Version: 6.8.0
Kernel Version: 6.12.1-arch1-1 (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 5800X3D 8-Core Processor
Memory: 31,3 GiB of RAM
Graphics Processor: NVIDIA GeForce RTX 3080/PCIe/SSE2
Product Name: X570 Phantom Gaming 4
Comment 23 FishBoneEK 2024-11-30 08:46:33 UTC
I can also confirm that unchecking "Show selected window" decreases the lag. 

I first switched to "Thumbnail" switcher, checked "Show selected window". After some hours the lag is noticeable. Then uncheck "Show selected window", the lag is gone. 

Wayland.
Comment 24 FishBoneEK 2024-12-04 14:42:33 UTC
Bad news, I can confirm there's lag even if "Show selected window" is unchecked. 
I can also confirm that the lag is a bit longer if "Show selected window" is checked.
Comment 25 FishBoneEK 2024-12-09 14:41:52 UTC
It's strange that there's no lag in this desktop session I'm currently in ("Show selected window" unchecked), uptime is 3 days. I will test more and report if there's anything new.
Comment 26 FishBoneEK 2024-12-17 11:47:00 UTC
Well it seems there's lag when "Show selected window" is checked after I play Stalker: Anomaly with Proton, and the lag disappears after short minutes. Probably either Proton or the game engine or some other stuff messed with something, not related to the issue we are talking about.
Comment 27 thesword 2024-12-31 19:31:35 UTC
I can also reproduce the issue by opening the color picker in Gimp