Insane VRAM Usage with Dual Monitors on Fresh Ubuntu Install

TLDR: having two external monitors connected and having the laptop lid closed (internal display disabled) makes VRAM usage go full ape with proprietary drivers (470/495) on GTX 1650 mobile.

I’ve done several fresh installs of Ubuntu (20.04 LTS, 21.04, 21.10) on multiple machines of the same model: a Dell XPS 15 7590 with a GTX 1650 mobile.

After installing the OS, I install the proprietary NVIDIA drivers via the official Ubuntu software install mechanism. I’ve confirmed this issue on driver versions 470 and 495, but from memory I’ve seen this happen with more versions.

As I’m typing this, I have driver version 495.44.

I’ve got two identical 4k monitors which I connect to my laptop via DisplayPort. After installing the drivers and verifying that everything works properly, I keep the lid closed (thus disabling the internal monitor) and simply leave my laptop docked, utilising only my two external monitors. Things go well with the dual monitor setup until I reboot the machine: VRAM usage goes sky high filling up the whole card (3-4 GB out of 4 GB) which happens like clockwork on every install. The desktop is unusable at that point and I’m forced to remove the proprietary drivers, leaving me with significantly worse performance.

I’ve included a screenshot of nvidia-smi.

Please let me know what details would be helpful to find out what’s happening, and I’ve be happy to provide them where possible.

2 Likes

Does restarting gnome-shell free the memory? Do you have any scaling set?

(Responding on behalf of OP)

Restarting gnome-shell does not free the memory unfortunately.
I also do not have any scaling.

Here’s an interesting screenshot of the GNOME settings: while the internal monitor is supposedly off, the resolution always gets stuck at a whopping 15360x8640; this cannot be changed for some reason (settings app just bugs out and sets it back at this resolution).

I’d like to emphasise the fact that this has happened on multiple machines and multiple monitors, so this is unlikely to be a hardware issue.

Interesting find. Though this rather looks like a shortcoming in the modeseting driver and/or tthe i915 driver and Xorg. Theory:

  • installing with lid open, edid can be read, fine.
  • close lid, still works, edid has been read
  • reboot with lid closed
  • edid can’t/isn’t been read (for whatever reasons)
  • modesetting driver allows maximum xorg built-in mode (15360x8640)
  • Xorg reserves large amount of memory for turned-off display

Please post the output of
xrandr --verbose
Please check if the edid is available in general in
/sys/class/drm/card0-eDP-1/edid
Don’t know if in your setup card0-eDP-1 is the correct name, please check beforehand.

Thanks for your quick response.

I have an edid file in all card0 directories, not sure which one is relevant though (I indeed have card0-eDP-1).

Not sure if it’s important for the requested output, but I created the file sudo nano /etc/modprobe.d/zz-nvidia-modeset.conf and added the following line:

options nvidia_drm modeset=1

as it was the only way I could find that would fix some severe screen tearing issues after installing the proprietary drivers.

Below you can find the output for xrandr --verbose
xrandr_output.txt (37.7 KB)

EDIT: Just to be sure, I’ve confirmed that the same happens on a fresh install without options nvidia_drm modeset=1.

The edid is there, also picked up by the modesetting driver, just not evaluated when the display is off, it seems. Do the correct modes appear if you open the lid? Does the VRAM usage drop in that case?

Opening the lid does not reduce VRAM usage.

Here is the xrandr output with the lid open if that helps, however it’s not any different other than having different timestamps.

xrandr_output_lid_open.txt (37.7 KB)

A workaround that I’ve found to reboot without the VRAM issue is to keep the lid open during every startup, although admittedly quite annoying when you have a dock setup for your laptop.

Are the correct modes set when started with lid open? Ultimately, I guess you have to report a bug against the modesetting driver at freedesktop.org.

Sorry for my ignorance: which ‘modes’ are you referring to? How do I check it?
I see a lot of different ‘modes’ when trying to find this in my settings, config files, in nvidia-smi -q and on Google.

resolutions of your display as displayed in the monitor manager or xrandr.

The xrandr output is the same in either case, but in the case of having the lid open during startup (when the VRAM bug does not appear) the GNOME settings app shows the correct resolution for the internal display (3840x2160), even after closing the lid once the system is fully loaded.