Bug 409040 - Framerate decreases rapidly in Wayland on nVidia with proprietary drivers
Summary: Framerate decreases rapidly in Wayland on nVidia with proprietary drivers
Status: RESOLVED DUPLICATE of bug 452219
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (show other bugs)
Version: 5.16.1
Platform: Kubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-06-22 15:13 UTC by Luca Carlon
Modified: 2023-02-28 09:05 UTC (History)
8 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Luca Carlon 2019-06-22 15:13:51 UTC
Performance of kwin on Wayland on nVidia GM107GLM [Quadro M1200 Mobile] (proprietary drivers) is much worse than performance on X11. Animations seem to have a lower framerate and seem to degrade more severely with the number of open applications.

STEPS TO REPRODUCE
It is very simple to notice. Just move around a window and you should see the difference. However this is a test I made to quantificate.
1. Enable some effects like wobbling windows and animations on minimize/maximize.
2. Enable the overlay with the framerate chart.
3. Open a window with many widgets, like System Settings -> Desktop Behavior -> Desktop Effects.
4. Move the window around, the window should deform and become semi-transparent.

OBSERVED RESULT
In X11, framerate is typically 60fps. While moving the window as reported above, the framerate remains properly at 60fps. Result is excellent.
In Wayland, framerate quickly decreases and is around 30fps or lower while moving the window. Actually, I don't even need to move the window: just move the pointer over the window and framerate decreases.

EXPECTED RESULT
I'd expect Wayland to be no worse than X11, and of course not to halve the framerate.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Kubuntu 19.04
KDE Plasma Version: 5.6.1
KDE Frameworks Version: 5.59.0
Qt Version: 5.12.2

ADDITIONAL INFORMATION
I guess this is not related, but I had to patch both kwin and Qt because of this bug: https://bugs.kde.org/show_bug.cgi?id=406180. So my current setup includes those two patches.
Also I had to set:

export __GL_MaxFramesAllowed=1
export PLASMA_USE_QT_SCALING=1

because of other kwin bugs.
Comment 1 Luca Carlon 2022-01-07 13:49:33 UTC
I recently started to use Wayland on the same machine more seriously. It seems the problem mostly solved by blacklisting nvidia and nouveau drivers and switching the latency setup to "force smoothest animations". If this is somehow expected, maybe it should be somehow notified to the user?
Comment 2 Zamundaaa 2022-01-11 11:07:37 UTC
The main cause of this problem is that the NVidia driver doesn't report time stamps for page flips, so KWin assumes the time stamp is whenever KWin processes the callback.
Ultimately NVidia has to implement the relevant functionality but I think it would be reasonable to add a small negative offset to the assumed timestamps, to add a few ms of latency by default and make this issue less severe.
Comment 3 Bug Janitor Service 2022-01-11 11:13:40 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/1861
Comment 4 Zamundaaa 2022-01-22 15:28:11 UTC
*** Bug 448918 has been marked as a duplicate of this bug. ***
Comment 5 Luca Carlon 2022-03-12 16:45:39 UTC
I recently saw a new update from nVidia (driver version 510.54) and I tried to remove the nVidia driver from the blacklist. I see no more performance related problems anymore on the same machine of the first report (and I can render offload some applications too). Also I'd say that the performance of animations in Plasma has increased to the point that it is hard to tell the difference from what I see on X11.

I tried to enable the fps measurement in X11 but the framerate suddenly dropped (bug?), so I cannot provide precise measurements. On Wayland instead, moving wobbly windows around (in a multiscreen environment) makes the fps counter grow from 60 to 100. It was < 30 according to the report.

I have to say I do not trust that fps counter much. I suspect it only counts the number of page swaps, but animations are slower than that. In any case, performance on Wayland seems to be pretty much similar to X11 now. In some cases it is even better maybe. I would probably close this report.
Please note that my current software setup is clearly no more the one of the report.
Comment 6 fw.smit01 2022-11-10 11:19:50 UTC
I also noticed a big performance decrease using the proprietary nvidia drivers on wayland. The performance is even worse than on nouveau. When watching a 1080p video, about half of the frames get dropped.

This happens only on my external display, which is only connected to my Quadro P1000. The internal display is connected to the iGPU as well and doesn't suffer from performance issues.

I have the following relevant packages installed:
akmod-nvidia.x86_64                                  3:520.56.06-1.fc36                  @rpmfusion-nonfree-updates
kmod-nvidia-5.19.15-201.fc36.x86_64.x86_64           3:520.56.06-1.fc36                  @@commandline             
kmod-nvidia-5.19.16-200.fc36.x86_64.x86_64           3:520.56.06-1.fc36                  @@commandline             
kmod-nvidia-6.0.5-200.fc36.x86_64.x86_64             3:520.56.06-1.fc36                  @@commandline             
nvidia-gpu-firmware.noarch                           20221012-141.fc36                   @updates                  
nvidia-persistenced.x86_64                           3:520.56.06-1.fc36                  @rpmfusion-nonfree-updates
nvidia-settings.x86_64                               3:520.56.06-1.fc36                  @rpmfusion-nonfree-updates
nvidia-vaapi-driver.x86_64                           0.0.7-2.fc36                        @rpmfusion-nonfree-updates
xorg-x11-drv-nvidia.x86_64                           3:520.56.06-1.fc36                  @rpmfusion-nonfree-updates
xorg-x11-drv-nvidia-cuda.x86_64                      3:520.56.06-1.fc36                  @rpmfusion-nonfree-updates
xorg-x11-drv-nvidia-cuda-libs.x86_64                 3:520.56.06-1.fc36                  @rpmfusion-nonfree-updates
xorg-x11-drv-nvidia-kmodsrc.x86_64                   3:520.56.06-1.fc36                  @rpmfusion-nonfree-updates
xorg-x11-drv-nvidia-libs.x86_64                      3:520.56.06-1.fc36                  @rpmfusion-nonfree-updates
xorg-x11-drv-nvidia-power.x86_64                     3:520.56.06-1.fc36                  @rpmfusion-nonfree-updates      
egl-wayland.x86_64                                   1.1.11-1.fc36                       @updates                  
libglvnd-egl.x86_64                                  1:1.4.0-4.fc36                      @updates     

Operating System: Fedora Linux 36
KDE Plasma Version: 5.25.5
KDE Frameworks Version: 5.99.0
Qt Version: 5.15.6
Kernel Version: 6.0.5-200.fc36.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 12 × Intel® Core™ i7-8750H CPU @ 2.20GHz
Memory: 15,4 GiB of RAM
Graphics Processor: Mesa Intel® UHD Graphics 630 and Quadro P1000
Manufacturer: HP
Product Name: HP ZBook Studio G5
Comment 7 Lucas Lima 2023-02-27 15:12:43 UTC
I'm also facing the same behavior. I've noticed this happens when moving any windows to the monitor connected to the Nvidia GPU.
 
I've made a simple video to show the behavior: https://www.youtube.com/shorts/somseC1x1zQ. Notice how the CPU usage of kwin increases when there's a window in the external monitor.

This is on a Zephyrus G15 (GA503QS), with a RTX 3080 and a Ryzen 9 5900HS with a integrated GPU also.

However, I found that if I disable the amd GPU (using "blacklist amdgpu" on "/etc/modprobe.d/10-blacklist.conf"), the frame drops do not happen (If you want to use this as an workaround, please keep in mind that only the external monitor outputs an image and the laptop screen will be blank), so maybe this is related to the sync between them?
Comment 8 SR_team 2023-02-27 17:36:57 UTC
> maybe this is related to the sync between them?

Maybe. When I run something on an external GPU, but with window on built-in screen, I also have CPU overhead in kwin_wayland.

P.S. It not nvidia-specific bug. I have this bug on laptop with a GTX1650 and a Ryzen 5 3750H, and on laptop with a RX6600 and a Ryzen 7 5800H
Comment 9 Zamundaaa 2023-02-27 18:05:22 UTC

*** This bug has been marked as a duplicate of bug 452219 ***