UI performance of Nvidia cards on linux!

I believe I honestly did my part before starting this topic here but seems like I wouldn’t manage to solve this by my myself. Sometimes ago I decided to switch on Linux since CPU performance is quite impressive compared to Windows for my tasks. I’m a 3D artist and practically everything in my workflow is for 30% faster on Linux and it is serious advantage over windows for me. So I have pretty much high-end hardware and don’t think that it’s bottle-necking in this situation.
AND! The Problem! Since day one I noticed that general performance of user interface of linux desktop environment (Gnome in my case) and chrome or firefox is get some lags or stutter quite often even on practically idle stage. Sometimes it’s can be very laggy but in a few minutes it’s can be buttery smooth for while and again lag with simple opening app, minimizing or resizing windows. And it’s very noticeable after you get used to Windows when there is no such problem. and becomes very annoying after sometime. So, I started researching and tried practically everything I could found all over internet. First I tried all major distros and DEs and found that exactly the same situation in all of them. I even tried FreeBSD and Solaris for science sake. :) And of-course I used proprietary drivers since nouveau is plain horrible. So next thing what I did just for experiment, I got cheapest with UHD res. support AMD card RX 550 and put it in extra pcie slot and I couldn’t believe my eyes, everything was buttery smooth constantly, without any laggs with UI and web browsers. And this is with opensource drivers. So how is this possible that cheap AMD card is outperform my Titan RTX? And also why my 10 years old macbook air even with latest Macos, still fluid with UI or web browsing with freaking integrated intel graphics?
I refuse to accept that high end card from Nvidia can be in that situation. And I really hope for help from devs or someone more linux savvy person on this.
So please let me know where to start to evaluate this problem. Specs are attached
Thank you. Sorry if I sounds whining :)

The problem is not performance but the compositors
Writing a compositor to render the desktop in time and output images correctly without stalling is not that easy, most devs failed at this, using workarounds/assumptions/defaults available only on OS drivers, failing on the nvidia drivers. The result being, works on intel, breaks on nvidia.
The only available compositor working now with nvidia is gnome-shell/mutter 3.36 due to the work of Daniel van Vugt from Ubuntu started when Ubuntu dropped Unity in favour of Gnome.
For my part, I can only say that performance issues are fixed now, being on-par with desktop experience on intel.
If you’re still seeing issues, you should first check if Gnome is running on Xorg or on Wayland, the latter having performance issue, still being experimental.

1 Like

Thank you for your replay! Appreciated. Yes I’m on x11 for sure.
And on latest gnome, 3.36.2 since fedora is always up to date. Also I use gnome-with-patches repo that gives you latest patches even not added officially yet. https://copr.fedorainfracloud.org/coprs/pp3345/gnome-with-patches/ It helps but not fully fixing it.
I tried Ubuntu 20.04 few days ago, same thing :( Not comparable like with AMD card.
Is there anything else I can do?

Create bug reports for gnome-shell or mutter for small specific problems, showing differences between mesa(amd) and nvidia, updating them continuously when new version get released.
or switch to latest Ubuntu and create those bug reports in Ubuntu’s bug tracker and hope Daniel van Vugt picks them up.
If you’re not talking about the problems in the correct places, nothing will ever get fixed. So talking about it here is as efficient as telling it to your hairdresser.

I see. Thanks so much! Will definitely do. So I can presume that nothing wrong on Nvidia side?

Unlikely. At least not regarding DE performance.

I have exactly the same problem, but I’m not sure this is a compositing problem.
Windows 10 and Gentoo are installed on my computer, and for testing Xubuntu 20.04. Geforce-1650 Super, Nvidia-drivers-440.82.
Sometimes Gentoo and Xubuntu load and work without lags in Firefox and Chrome. Sometimes i have microlags in browser scrolling.
In Gentoo i have 3 compositors: latest’s picom and xcompmgr with openbox, and xfwm4-4.14.0-r1 with Xfce. But with all the same result.

It seems to me that the video card sometimes works in deep ondemand (powersave) mode and does not have time to quickly work out when scrolling starts. Lags are only after 5-6 seconds of rest and always this is the first scroll. PowerMizer set to Auto. But setting PowerMizer to Maximum Performance is the same result.

Rebooting does not help. But sometimes, maybe this is a coincidence, after playing games in Windows 10 and loading Linux, there are no lags.

Something strange. Moreover, it started in March, when I bought the Geforce-1650 Super instead of the Geforce-1050. But then in early March, Gentoo switched to the 5.4 and 440th Nvidia driver branch.

In Windows 10, everything is always fast and without lags: both in browsers and in heavy games.

I agree with you @alpir . Yes sometimes it’s like perfectly fine but in a minute it is lagging again. I tried performance mode in nvidia settings and in a beginning frequency stay high but after sometime goes back to lowest.
Some observation.
https://streamable.com/c3feeq Here I captured vsync test and as you can see in windows, which is on a right, vsync is consistent all the time. On a left is linux and vsync laging in first few seconds after any changes in screen composition. Vsync on or off makes no difference. Also I tried web basemark test and surprisingly in linux chrome and firefox get higher score but visually you can clearly see lagging in every test. In windows all test run super smoothly but you get lower score. Wierd.
So for now I don’t have any screen tearing which is nice but lags instead.
Also for science sake I tried ordinary 20 inches hd ready monitor and it was practically lag free. Seems that using UHD monitors, higher resolutions, worsening situation.

That’s a very useable point to start a bug report with Ubuntu/Mutter/Gnome-shell. I’m only using FHD monitors and have a lag-free experience even on my very old gt740m. So looks like the compositor doesn’t get timing right with larger screen estate.

I probably agree that the lags are related to compositors, because If you turn them off, there are no lags in the browsers. But why do all 3 compositors give the same lags: xfwm, picom, xcompmgr?
Perhaps something happens with drivers sometimes? It is as if the video card is loading in some kind of strong energy saving mode and is not capable of immediately giving the desired performance when scrolling.
My monitor is 23", FHD.

Can I somehow help find the cause, run any special tests, enable debugging mode?

I don’t know for me animation on or off make no difference. Could you please try this web page and tell me if it is lag free for you?

I did find few tricks to improve browsers performance though. For chrome in chrome://flags/ change to yes in GPU rasterization And it’s significant change, not fully like in windows but somewhere around. In firefox gfx.webrender.all and layers.acceleration.force-enabled to true

With picom first scroll is laggy, others is no. When i stop scroll for 5-10 seconds and start again - first scroll is laggy. Without compositors all is ok.

I have included these options for a long time.

Yes exactly same with me.

May be I’m not disabling gnome animation fully.
I just doing it in gnome tweak app.

I installed fresh Fedora today on my office computer with vega 64 and 28" 1440p monitor. And I can say now that there is still some lags too. Yes less but still there. Firefox performs a bit better but not like in windows yet. Tomorrow will try Chrome.

In this case this is not nvidia problem and may be xorg or kernel problem? In Fedora which kernel version and xorg are installed?
For me it starting when Gentoo switch stable kernel tree from 4.19 to 5.4 version. Later i tryied switched back to 4.9 tree, but without success, may be changes has already backported to this tree.

Wow! That’s really surprising! I opened issue on gnome github and Daniel van Vugt answered me. Now I believe in fairies :)

Fedora is always on the edge so latest stable are there. 5.6.17 for now.

Interesting. The second patch is equivalent to just setting
in system env. Had to be used previously to get mutter running on hybrid graphics.

This issue isn’t even remotely a compositing issue. In my testing, this absurd stuttering happens anytime a surface is spawned (example: popup shows up, a menu opens, a window opens, anything that creates a new surface to render to).

How do I know it’s not a compositor issue?

Easy. I put in a card from some other company - even a low-end card - and the issue stops completely. Spawning new render surfaces causes zero dropped frames, no frame latency spikes in GPU monitoring utilities such as MangoHud.

I’ve eliminated all other possibilities; this occurs in any scenario under any desktop environment, with any compositor, with either X11 or wayland backends, regardless of any performance-related settings such as Vsync on/off, triple buffering on/off, any composition pipeline settings, etc. Use Nvidia, you get this problem. Use anyone else, you don’t.

This problem might not be fixed for Nvidia anytime soon, but it’s going to be fixed real soon for me personally. 😌

Edit: Oh! Forgot to mention it even happens with the compositor completely off. Even with no compositor running (as in terminated). I can set a program to repeatedly send notifications and it will stutter with every notification with no compositor, while a fullscreen game is in front where the notifications can’t even be seen. Stop pretending this is anyone else’s fault Nvidia.