Bug 475468

Summary: On X11 with NVIDIA GPU, window and panel resizing is very laggy when any panels are set to Floating or Adapting transparency
Product: [Plasma] kwin Reporter: ratijas <me>
Component: performanceAssignee: ratijas <me>
Status: RESOLVED UPSTREAM    
Severity: normal CC: admin, andreas.d.korb, cagankota, developer54000, dmatteo002, dnl7, erfan.qeui, evgeniyharchenko.dev, gregorplanet, justin, kde, kde, kevsn91, mutasik170300, nate, niccolo.venerandi, oguilherme, pepko94, postix, rickard, s_chriscollins, zellox
Priority: HI Keywords: regression
Version: git master   
Target Milestone: ---   
Platform: Other   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=483680
https://bugs.kde.org/show_bug.cgi?id=475872
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description ratijas 2023-10-11 14:12:36 UTC
SUMMARY

The lag and jitter during panel floating and defloating has gotten much worse recently. Not sure whether to attribute it to panels refactoring or a random NVIDIA driver update. The lag makes fullscreen effects such Desktop Grid and Overview open practically without animation; everything is a slideshow running in seconds per frame when a panel or window resizes.

Note that in case or maximizing a window in a way that does not involve panel (de-)floating (say, horizontally with a bottom panel) only skips first couple of frames due to a window being resized only once, and then simply cross-fading inside compositing.

STEPS TO REPRODUCE
1. Run Plasma 6 on X11 with NVIDIA
2. Set panels floating to auto.
3. Move windows around, touching panels borders, so they float/defloat; add virtual desktops, have a window that touches a panel on one of them, the other is empty, and Slide between them.

OBSERVED RESULT
LL..aaag  g   gggggg

EXPECTED RESULT
No lag

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 5.27.80
KDE Frameworks Version: 5.240.0
Qt Version: 6.5.3
Kernel Version: 6.5.5-arch1-1 (64-bit)
Graphics Platform: X11
Processors: 8 × Intel® Core™ i7-6700HQ CPU @ 2.60GHz
Memory: 15.6 GiB of RAM
Graphics Processor: NVIDIA GeForce GTX 970M/PCIe/SSE2

ADDITIONAL INFORMATION

Screen recording on YouTube: https://www.youtube.com/watch?v=uDtBd3sOm5I
Comment 1 Nate Graham 2023-10-12 20:50:50 UTC
Is it just floating panels, or does the lag happen for anything else? Like notifications appearing, panel pop-ups opening, etc
Comment 2 Nate Graham 2023-10-12 20:51:10 UTC
Also do you see it on Wayland too, or just X11?
Comment 3 Justin Zobel 2023-11-29 09:35:18 UTC
Setting to NEEDSINFO.
Comment 4 ratijas 2023-11-29 11:36:44 UTC
This is X11. The lag happens on any window resize. Less for Qt Widgets apps, more for QtQuick apps. Since panels are QtQuick views, and they animate by interpolating their window size, they lag a lot to the point where it is a complete slideshow at seconds per frames.

On Wayland window resizing is 60fps smooth for Qt Widgets & QtQuick apps and Plasma panels.

I think we should be able to detect if animation takes too long to draw a frame, and when it does — fall back to a different strategy, like changing size once and animating panel internally, or not animating at all.
Comment 5 Jianqing Liu 2023-12-06 23:02:01 UTC
Also observed this problem on intel integrated graphics

Operating System: Arch Linux 
KDE Plasma Version: 5.90.0
KDE Frameworks Version: 5.246.0
Qt Version: 6.6.1
Kernel Version: 6.6.4-zen1-1-zen (64-bit)
Graphics Platform: X11
Processors: 20 × 12th Gen Intel® Core™ i7-12700K
Memory: 62.5 GiB of RAM
Graphics Processor: Mesa Intel® UHD Graphics 770
Comment 6 David Edmundson 2024-02-22 15:48:30 UTC
> random NVIDIA driver update

Please confirm if this issue still persists
Comment 7 ratijas 2024-02-24 05:30:52 UTC
Can confirm this issue still persists on a fresh installation of Arch Linux with a fresh build of packages from git master.
Comment 8 ratijas 2024-03-19 12:12:03 UTC
How to brig back UI smoothness if you have a laggy panel on Plasma 6:

- For each Plasma panel out there:
- Floating: OFF
- Opacity: either always opaque or always translucent.
Comment 9 Nate Graham 2024-03-19 19:12:04 UTC
*** Bug 482717 has been marked as a duplicate of this bug. ***
Comment 10 Nate Graham 2024-03-19 19:12:15 UTC
*** Bug 483015 has been marked as a duplicate of this bug. ***
Comment 11 rickard 2024-03-19 20:10:38 UTC
(In reply to Nate Graham from comment #1)
> Is it just floating panels, or does the lag happen for anything else? Like
> notifications appearing, panel pop-ups opening, etc

I have only checked moving windows and switching desktops. Can't say I've noticed anything else but I did a quick check and popups etc didn't lag. 

Floating panels needs to be OFF, otherwise the stutter will always occur if a window is close to the panel, even if you set it to opaque.

I don't think the bug is present with the nouveau driver, I ran it for a while to test out NVK. So it could be a proprietary driver issue, don't quote me on that tho'.
Comment 12 Nate Graham 2024-03-27 16:42:16 UTC
*** Bug 482193 has been marked as a duplicate of this bug. ***
Comment 13 Nate Graham 2024-03-27 16:42:20 UTC
*** Bug 482100 has been marked as a duplicate of this bug. ***
Comment 14 Andy B 2024-04-09 16:55:39 UTC
Chiming in to say that I'm experiencing this issue too:

- I am using X11, on Arch Linux, using latest Nvidia drivers (550.67-1)
- It seems to affect most animations (or it could be anything that involves transparency, not sure).
- For me, it affects nearly all popups, modals and windows, not just the panel. Anything that fades/animates in/out of view stutters like crazy
- Stuttering causes the entire desktop to lag, including the cursor
- Disabling compositing doesn't help
- I'm unable to test with animations fully disabled as there is no option to disable "Window Open/Close Animation", it only lets me choose between "Fade", "Glide" and "Scale"
- Last time I tried Wayland it was not affected and was buttery smooth. However, I am no longer able to test Wayland as it seems to have broken itself recently somehow. This is probably related to my multi-GPU setup, but I haven't been able to fix it yet.
- Disabling transparency on the panel seems to have fixed the issue on the panel, however other animations are still affected.
Comment 15 Andy B 2024-04-09 18:06:27 UTC
Sorry for the additional comment, but I have managed to disable all the animations by setting the animation speed in "General Behavior" to "Instant" and unchecking all the animations in "Desktop Effects" (the radio buttons were a bit confusing). There still seems to be animations playing though, for example, the tooltips in the icon tray still "morph" and this causes large stutters.

Even with animations off though, there is stuttering all over the place, so not sure what's going on. For example, if I enable the "Show FPS" "Desktop Effect", every time I maximize a window there's a big red spike in the "Paint Duration" graph. Strangely enough, shrinking the window doesn't cause any stuttering. This happens even with "simple" applications like "Konsole" and "System Settings".
Comment 16 Nate Graham 2024-04-09 18:47:49 UTC
*** Bug 485254 has been marked as a duplicate of this bug. ***
Comment 17 Nate Graham 2024-04-09 19:49:09 UTC
*** Bug 485254 has been marked as a duplicate of this bug. ***
Comment 18 rickard 2024-04-22 09:19:35 UTC
Seems like there's more to this, I noticed having 2 windows on top of eachother can cause stutter too. In my case it was Firefox.
Window 1 had many tabs opened.
Window 2 had 1 tab opened.
If window 1 was over window 2 - Stutter.
If window 2 was over window 1 - Smooth
If I closed window 2 - Smooth
Comment 19 Bug Janitor Service 2024-04-25 19:02:33 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/4265
Comment 20 Gregorplanet 2024-04-26 14:21:27 UTC
I am having the same issue with window resizing and panel set to floating on Fedora 40 (X11) with Nvidia Driver 550.76. Before the upgrade (Fedora 39 with Plasma 5.27.11) and with the same configuration, it was smooth.
Comment 21 rickard 2024-04-27 03:48:52 UTC
kwin 6.0.4.1
nvidia vulkan dev 550.40.61

I can't reproduce this anymore so it seems like it's fixed?

The nvidia changelog:

    Fixed crash in vkLatencySleepNV that happened under some circumstances
    Fixed performance drop when NVIDIA Reflex was enabled under some circumstances
    Fixed HEVC decode scaling list and made them universal
    Fixed indexed draws after executing secondary command buffer with index type change
    Fixed reconvergence hang with partitioned subgroup operations
    Fixed inconsistency between vkGetPhysicalDeviceSurfaceSupportKHR and vkGetPhysicalDevicePresentRectanglesKHR on certain displays
Comment 22 retired 2024-05-24 22:40:04 UTC
I can reproduce it on Plasma 6.1 beta. Moving windows with adaptive transparency causes stutters and input lag. Increasing animation speed to immediate works as a workaround.
After switching taskbar to solid color windows are no longer stuttering on "snapping to taskbar" and I can use slower animations.
Works fine with transparent taskbar as well.
Wayland doesn't seem to be affected.

Nvidia 555.42.02

Operating System: Arch Linux 
KDE Plasma Version: 6.0.90
KDE Frameworks Version: 6.2.0
Qt Version: 6.7.1
Kernel Version: 6.8.10-273-tkg-eevdf (64-bit)
Graphics Platform: X11
Processors: 16 × AMD Ryzen 7 7800X3D 8-Core Processor
Memory: 93.9 GiB of RAM
Graphics Processor: NVIDIA GeForce RTX 4060 Ti/PCIe/SSE2
Manufacturer: ASRock
Product Name: B650I Lightning WiFi
Comment 23 ratijas 2024-05-26 08:54:48 UTC
Git commit da26b03076aaff5ca51039d700ad9daabdd5d80b by ivan tkachenko.
Committed on 26/05/2024 at 08:37.
Pushed by ratijas into branch 'master'.

PanelView: Add framework for dealing with unsupported configurations

This quick primarily targets NVIDIA & X11 combination, which is known to
lag hard when resizing. More may be added in the future, but hopefully
not.  Properties and methods names are intentionally generic enough to
not imply any particular vendor or technology.

M  +71   -2    shell/panelview.cpp
M  +21   -0    shell/panelview.h

https://invent.kde.org/plasma/plasma-workspace/-/commit/da26b03076aaff5ca51039d700ad9daabdd5d80b
Comment 24 retired 2024-05-26 14:53:53 UTC
So as I understand it, the commit adds warning when user wants to use settings which cause performance issues. Correct?

Is anyone with AMD GPU affected? I am seriously considering selling my GeForce. Although I would miss CUDA.
I can reliably cause frame drops in glxgears just by cycling through kicker menu. Basic stuff like launching applications can cause stutters on my PC.
Comment 25 retired 2024-05-26 19:39:38 UTC
Well, it's super smooth with AMD iGPU, so that's rather disappointing.
Comment 26 evgeniyharchenko.dev 2024-05-26 20:13:35 UTC
It seems, it is because of upgrading to Qt 6, so maybe we have a small chance that it can be fixed.
Comment 27 ratijas 2024-05-27 20:34:15 UTC
Git commit 258774f2d832500be542afb0298d6477a84c251e by ivan tkachenko.
Committed on 27/05/2024 at 10:10.
Pushed by ratijas into branch 'master'.

desktoppackage: Add UI to warn about and fix unsupported configurations

Requires https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/4265

M  +32   -0    desktoppackage/contents/configuration/PanelConfiguration.qml

https://invent.kde.org/plasma/plasma-desktop/-/commit/258774f2d832500be542afb0298d6477a84c251e
Comment 28 ratijas 2024-05-29 12:30:14 UTC
> It seems, it is because of upgrading to Qt 6, so maybe we have a small chance that it can be fixed.

This is caused by the constant resizes and redraw calls in Plasma panels. Seems like fixing it not possible due to the way the Panels work in Plasma 6 (they change size during transitions). Another interesting data point is that the Pager applet contributes to the stutter just by being there: https://bugs.kde.org/show_bug.cgi?id=475872
Comment 29 zellox 2024-06-01 00:34:51 UTC
I have the same problem with Wayland and AMD gpu. It only started happening with plasma 6.
Comment 30 Nate Graham 2024-06-07 21:12:56 UTC
We now have a thing that warns people about this. At the moment there's nothing else we can do on our side as it's an upstream issue.
Comment 31 MaxProPlus 2024-06-13 01:38:42 UTC Comment hidden (spam)
Comment 32 dev54 2024-09-29 15:16:28 UTC Comment hidden (spam)
Comment 33 Nate Graham 2024-09-29 15:32:46 UTC
As has been written, it's an NVIDIA driver bug. There are multiple painless software workarounds available:
- Use the Wayland session
- On the X11 session, disable adaptive transparency
- On the X11 session, disable panel floating

There's also of course the nuclear option of using a different GPU from AMD or Intel that isn't so buggy in Plasma.
Comment 34 dev54 2024-09-29 17:19:47 UTC
(In reply to Nate Graham from comment #33)
I have done the following two tasks:

> - On the X11 session, disable adaptive transparency
> - On the X11 session, disable panel floating

But the issue still persists.

I’m experiencing this lag issue everywhere, even with YouTube videos!
I’ve had this problem for several months and have reinstalled my operating system multiple times!
Comment 35 dev54 2024-09-29 17:34:18 UTC
(In reply to dev54 from comment #34)
> (In reply to Nate Graham from comment #33)
I've been using a wallpaper type called "Smart Video Wallpaper Reborn" for several months. Just now, I switched to "Active Blur" as a test, and unbelievably, the lag decreased by 90%!

I couldn't believe that for all this time, most of my issue was due to this ridiculous animated wallpaper!
Comment 36 dev54 2024-09-29 17:37:21 UTC Comment hidden (spam)
Comment 37 Nate Graham 2024-09-30 13:42:07 UTC
This sounds like a completely different issue; please discuss it elsewhere. If the wallpaper's source image file is a GIF, It's probably Bug 483602.