Ubuntu 23.04 + Gnome + Nvidia 525 + Vsync = low fps in Xorg sessions

Bug #2023776 reported by Alexander
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
mutter (Ubuntu)
Expired
Undecided
Unassigned

Bug Description

Currently using Nvidia driver 525, which is the "tested" and recommended driver according to Ubuntu's additional driver tool (as of this writing).

- manually resizing "files" windows = low fps and a little bit of pixelation

- moving windows around = drop in fps every now and then

- opening the Gnome overview = sometimes buttery smooth 60fps but sometimes stuttery low fps that takes time to "catch up" to smoothness again

- resizing Chromium or Firefox window = low fps, glitchy window behaviour etc.

How to fix it? Well, this is what I found works thus far:

- disable both "vsync" and "allow flipping" in Nvidia-settings

- now everything is buttery smooth again; all animations, apps, games and more

- doing this will introduce lots of tearing on the Gnome desktop and applications though

- then force full composition pipeline to get rid of the tearing by adding this start-up line to Ubuntu's start-up applications: nvidia-settings --assign CurrentMetaMode="nvidia-auto-select +0+0 {ForceFullCompositionPipeline=On}"

- Use Wayland alternatively: Wayland doesn't have any of these issues at all, it's a buttery smooth fully vsynced experience ootb, but a bunch of new problems arise instead: Can't set global hotkeys for recording in OBS, OBS recording performance is pretty bad, Gnome folder windows start flickering somestimes, Gnome windows glitch out when trying to resize them manually, Steam flickering sometimes, browsers such as Firefox and Chromium have to be set to Wayland mode in order to solve stuttering video playback issues, Nvidia-settings is missing a bunch of settings and features when compared to X11... and more

Hard- and Software:

- Ubuntu 23.04
- Nvidia driver version 525 (tested) from Ubuntu's additional drivers tool
- Core i7 7700
- 32 GB DDR4 RAM
- Lenovo Nvidia RTX A2000 workstation GPU
- TWO fullHD monitors connected via display port

ProblemType: Bug
DistroRelease: Ubuntu 23.04
Package: gnome-shell 44.1-0ubuntu1
ProcVersionSignature: Ubuntu 6.2.0-20.20-generic 6.2.6
Uname: Linux 6.2.0-20-generic x86_64
NonfreeKernelModules: nvidia_modeset nvidia
ApportVersion: 2.26.1-0ubuntu2
Architecture: amd64
CasperMD5CheckResult: pass
CurrentDesktop: ubuntu:GNOME
Date: Wed Jun 14 14:58:08 2023
DisplayManager: gdm3
InstallationDate: Installed on 2023-05-20 (24 days ago)
InstallationMedia: Ubuntu 23.04 "Lunar Lobster" - Release amd64 (20230418)
ProcEnviron:
 LANG=de_DE.UTF-8
 PATH=(custom, no user)
 SHELL=/bin/bash
 TERM=xterm-256color
 XDG_RUNTIME_DIR=<set>
RelatedPackageVersions: mutter-common 44.1-0ubuntu1
SourcePackage: gnome-shell
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Alexander (sturmlocke86) wrote :
Revision history for this message
Alexander (sturmlocke86) wrote (last edit ):

Btw, I just noticed that some drop down windows, such as the ones in the Chromium Snap, also have a little bit of pixelation in them when vsync is active in nvidia-settings.

tags: added: nvidia performance
summary: - Ubuntu 23.04 + Gnome + Nvidia 525 + Vsync = low fps
+ Ubuntu 23.04 + Gnome + Nvidia 525 + Vsync = low fps in Xorg sessions
affects: gnome-shell (Ubuntu) → mutter (Ubuntu)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Please try each of these separately one at a time in /etc/environment and reboot after each:

  MUTTER_DEBUG_TRIPLE_BUFFERING=always
  MUTTER_DEBUG_TRIPLE_BUFFERING=never
  CLUTTER_PAINT=disable-dynamic-max-render-time

Please also run this command:

  xrandr --verbose > xrandrv.txt

and attach the resulting text file here.

Changed in mutter (Ubuntu):
status: New → Incomplete
Revision history for this message
Alexander (sturmlocke86) wrote (last edit ):

Hello Daniel,

thanks for taking a look! Not sure if I am going to be able to test this after all. I just ran Ubuntu 23.04 updates like I always do, and noticed that 23.04 now has access to Nvidia driver 530, so I ran Ubuntu updates, which unfortunately nuked my Ubuntu install.

This is what happened:

- I ran the preinstalled Ubuntu 23.04 update tool

- Ubuntu mentioned a bunch of Nvidia packages that needed to be updated and a bunch of Linux headers to be removed

- I let Ubuntu do its thing and update the system

- After a reboot I had nvidia-settings installed, but it was missing everything feature-wise and was pretty much blank, no hardware acceleration

- So I ran Ubuntu updates again and this time it had a bunch of old Nvidia 525 files and Linux headers to remove

- I proceeded and rebooted

- Nvidia-settings is still blank, no 3d acceleration whatsoever

- So I opened the driver utility tool and switched from Nvidia 525 to the Xorg Nouveau driver and rebooted

- Now Ubuntu won't boot and shows a blinking cursor on the top left corner, which freezes after a while

- So after a hard reset of the pc, I pressed and held "shift" upon boot

- I added "nomodeset" to the kernel boot options (btw, Ubuntu is now using a "low latency kernel" by default for some reason)

- Which allowed me to boot into Ubuntu

- Now I switched over to the new Nvidia 530 driver and rebooted

- Still a blank Nvidia-settings app and still no hardware acceleration

- Tried reinstalling the Nvidia driver again, to no avail

After some digging around I found:

- https://bugs.launchpad.net/ubuntu/+source/nvidia-graphics-drivers-530/+bug/2023946

- https://forums.developer.nvidia.com/t/530-doesnt-work-on-ubuntu-23-04/256721/3

- https://bugs.launchpad.net/ubuntu/+bug/2015775

Considering a downgrade back to 22.04.2 LTS at this point. Leaving this part as feedback for the 23.04 release:

- Installing a fresh copy of 23.04 was already a bit problematic to begin with because the new installer kept crashing

- Installing native Steam from the 23.04 repos wasn't possible due to unmet dependencies or something to that effect (had to use the .deb from the Steam website)

- Steam Snap can't access external hard drives

- Vsync and gui issues as mentioned above

- Ubuntu update plus Nvidia driver update nuked something randomly

- one or two other things, forgot what they were

Will try to recover the system right now, but I'll be switching back to LTS if all else fails.

Revision history for this message
Alexander (sturmlocke86) wrote (last edit ):

This is what Ubuntu wanted to download after the first update attempt messed things up

Changed in mutter (Ubuntu):
status: Incomplete → Confirmed
status: Confirmed → Incomplete
Revision history for this message
Daniel van Vugt (vanvugt) wrote (last edit ):

It sounds like the nvidia 530 kernel driver failed to build (bug 2023946), which is not uncommon if you have multiple kernels installed for example. It is a bug if you can prove that's what's happening...

Try this:

  sudo apt install --reinstall nvidia-dkms-530 nvidia-driver-530

Revision history for this message
Alexander (sturmlocke86) wrote :

Hey there Daniel,

thanks for helping out! I can confirm that what nuked my 23.04 install is bug 2023946, which I responded to a few days ago. While trying to fix the issue at hand, before I read your suggestion on how to potentially fix it, I followed a howto online, which was more or less suggesting the same thing that you asked me to try. Something went wrong while trying the potential fix and I was left with blinking cursor upon reboot again. I gave up at this point, saved my data and reverted back to 22.04.2 LTS for the machine in question. It took me an entire day to troubleshoot 23.04 and revert back to 22.04, but now everything is stable again. What I also noticed is how trying to install the proprietary Nvidia drivers during the initial install of 23.04 was causing issues, not so on 22.04.2 LTS, the latter which didn't install the proprietary Nvidia drivers at all during a fresh installation of the OS (even though the box for this was enabled / activated). I had to manually select the newest proprietary Nvidia driver for 22.04.2 after the OS was fully installed (using the preinstalled drivers tool app), and it worked like a charm. 22.04.2 is running well, no issues when resizing windows or any of the other things noticed in 23.04. The only thing that I notice on 22.04.2 LTS is that the framerate is a bit low when opening the Gnome overview initially (feels like 20-30 fps), but it gets super smooth at 60 fps when opening the overview for a second time right after the first attempt. In other words, it takes Ubuntu some time to catch up and make it smooth again, but when it does it's actually really smooth.

That said, I have a secondary machine here with 23.04 and an Nvidia gpu with proprietary drivers installed. I will be testing the suggestions that you wrote on 2023-06-16 later tonight, if I am able to bypass the issue in bug report 2023946 for the secondary machine. Will report back by tomorrow night with my findings - - - WIP.

Revision history for this message
Alexander (sturmlocke86) wrote :
Download full text (3.6 KiB)

Hello Daniel, I apologize for the huge delay, but I have been experiencing a number of show stopping issues that I have yet to recover from.

As written above: After all the issues that I had with Ubuntu 23.04, I decided to "downgrade" to Ubuntu 22.04.2, which was working just fine at first, see comment above. I was using the recommended and "tested" Nvidia driver 525, which was the one that the Ubuntu additional drivers tool suggested. Recently Nvidia released the proprietary Nvidia driver version 535, which was made available via Ubuntu 22.04.2. So I ran the Ubuntu system updates utility like I usually would, in the hopes of Ubuntu picking up the newest Nvidia driver automatically, like it has always done in the past. Ubuntu did find and suggest to install the new Nvidia driver, but...

Just like on Ubuntu 23.04, Ubuntu 22.04.2 also mentioned something about a "partial upgrade", see attached screenshots below. Trying to click on "continue" instead didn't offer any updates, so I went back to the "partial upgrade" option, because my system wasn't getting any updates whatsoever ever since this "issue" appeared out of nowhere. In the middle of the "partial upgrade" my 22.04.2 system went black, meaning all of my screens turned off randomly, and the computer would not react to any user input whatsoever. After being forced to perform a hard reboot, the computer did not want to boot, spitting out several "journal errors" during the boot process.

I would like to mention that this was a fresh install of 22.04.2 - not a single ppa etc. was added manually - just a handful of native apps installed as Snap via the official Ubuntu Software Center (including Steam, also installed via the Ubuntu Software Center). I hardly used the system, because I was still in the process of transferring over the data that I had to recover from my busted 23.04 install.

A few notes here:

- this happened totally randomly
- previous system updates were completed without any issues whatsoever
- there were no issues whatsoever before the new Nvidia driver 535
- the partial upgrade option mentioned a bunch of Nvidia 535 modules to be installed
- and the old 530 driver to be removed
- and it also mentioned a ton of other things to be updated as well, including the kernel and a bunch of Ubuntu desktop files

Digging around I found out that both this and the low latency kernel subject is a common and repeating issue:

- https://askubuntu.com/questions/1443779/why-doesnt-this-software-updater-warning-tell-me-what-is-going-to-be-installed

- https://www.reddit.com/r/Kubuntu/comments/14ndb7a/why_do_i_keep_getting_these_oracle_and_lowlatency/

- https://askubuntu.com/questions/1334791/not-all-updates-can-be-installed-in-software-updater

- https://askubuntu.com/questions/725481/ubuntu-software-updater-not-all-updates-can-be-installed

- https://www.google.com/search?channel=fs&client=ubuntu-sn&q=ubuntu+nvidia+partial+upgrade

Verdict:

Now I have to recover my freshly installed 22.04.2 system again, just like I did with 23.04 a few days ago. Since I don't have the time to troubleshoot this yet again, I am now forced to go for a clean install again, but I will be using a different d...

Read more...

Revision history for this message
Alexander (sturmlocke86) wrote :

Screenshots: Ubuntu 22.04.2 LTS, partial upgrade option after Nvidia driver 535 went live.

Revision history for this message
Alexander (sturmlocke86) wrote :
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Sorry to hear you're still having problems.

Since the new issue has different symptoms on a different Ubuntu release we should track it in a different bug. If you are still willing to use Ubuntu then please open a new bug about the new issue. If the machine is not booting (black screen) then try accessing the grub menu (tap Escape or hold Shift during early boot) and select recovery mode. In recovery mode please then run:

  journalctl -b-1 > prevboot1.txt
  journalctl -b-2 > prevboot2.txt

and attach the resulting text files to the new bug, not this one.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Please also try to keep each bug report concise and on a single topic. You can log as many different bugs as you like.

Revision history for this message
Alexander (sturmlocke86) wrote :

Hi Daniel,

I will follow your suggestion and try to find the time to create a new bug report for the additional issues that occured. That said, since the drive on this machine suffered from what I wrote above, I decided to quickly format and perform the steps that you suggested on a fresh Ubuntu 23.04 install. First of all, I am happy to report that checking the checkbox for "additional drivers" (proprietary gpu and wifi drivers) during the installation of 23.04 did in fact successfully and flawlessly install the proprietary Nvidia drivers this time around - namely the Nvidia driver 535 that killed my 22.04 installation. This was not the case the first two times that I installed 23.04, so it seems that we have already made some progress in this regard.

That said, back to the initial issue:

  MUTTER_DEBUG_TRIPLE_BUFFERING=always
  MUTTER_DEBUG_TRIPLE_BUFFERING=never
  CLUTTER_PAINT=disable-dynamic-max-render-time

I tried all of these under 23.04 separately per reboot, sadly no change. 23.04 still shows signs of sluggish or low fps when resizing windows and also when opening the overview with a few programs open (Firefox, Software Center, text editor etc). Sometimes the overview is buttery smooth, but at some point it drops in performance and loses a few fps, just like mentioned in my initial post. For example, opening the overview while writing this text I can clearly see an fps-drop, but after repeating the process two or three times it becomes buttery smooth all of a sudden. The only thing that makes everything super fast all the time is when disabling vsync in nvidia-settings -> opengl. Doing this results in buttery smooth 60+ fps animations all the time - and no lag when resizing windows either.

I attached the xrandrv.txt that you requested further below.

Please note: I will be formatting this Nvidia powered machine tonight in order to install another distro onto it, so I won't be able to further test these things on this particular machine. That said, I want to reiterate that I will still continue to use Ubuntu on many of my other computers that are equipped with AMD and Intel gpu hardware. Your triple buffering vsync patches work beautifully on Amd and even on super low-end Intel igpu hardware. I love Ubuntu, and I highly appreciate your personal efforts for everything related to triple buffering / vsync and more, which is why I am going to be donating a couple of bucks to you guys this weekend in order to contribute my fair share since troubleshooting these Nvidia specific issues is too time consuming for me right now.

Thanks Dan, appreciate all the help!

Revision history for this message
Alexander (sturmlocke86) wrote :

xrandrv.txt as requested by Dan

Revision history for this message
Alexander (sturmlocke86) wrote (last edit ):

PS: Before I forget, I also tested something else, see attached screenshot. Going into nvidia-settings and manually setting the PowerMizer mode to "prefer maximum performance" makes all animations, the overview and everything related to it super smooth fps-wise. You can make this permanent by adding these changes to the startup applications / commands so that it sticks upon reboot. I opened the overview 30 times in a row right now, not a single fps-drop. However, this does not fix the low fps-rate and sluggish behaviour when trying to resize individual windows (files). The latter only gets a performance boost when turning off vsync in nvidia-settings. The downside to this is of course the higher power consumption, but it does indicate that the lag might be connected to the lower power modes. Iirc sluggish 3d animations on the desktop with Nvidia was also an issue all the way back on Ubuntu during the good old Compiz days, and I remember fixing it by adjusting the PowerMizer mode to prefer a higher performance mode.

Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for mutter (Ubuntu) because there has been no activity for 60 days.]

Changed in mutter (Ubuntu):
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.