comes back with low resolution (1024x768) → most of the time
Before the suspend/resume and after reboot the display resolution works perfectly (3440x1440). I can fix this issue if I restart the display-manager service, but this restarts the session and I have to reopen all programs again.
Before sleep:
HDMI-1 connected primary 3440x1440+1920+0 (normal left inverted right x axis y axis) 800mm x 330mm
After sleep:
HDMI-1 connected 1024x768+1920+0 (normal left inverted right x axis y axis) 800mm x 330mm
I have already tested:
reboot → fixes it
restart display-manager → fixes it
happens only after suspend
Note: Wayland only (X11 is not available on Gnome 49)
Probably not, it’s likely a firmware/nvidia driver bug.
That said, if you stop using an nvidia driver that isn’t recommended for your GPU, stop using the deprecated sleep service, and stop relying on firmware to configure your primary GPU, that might help. Try this:
{ config, lib, pkgs, ... }: {
services.xserver.videoDrivers = ["nvidia" "displaylink" ];
hardware.nvidia = {
# The .latest package is pretty much useless.
#
# On stable it will be exactly as outdated as the
# default, and on unstable it makes you use the
# beta driver.
#
# Either use the default if you're on unstable, or
# specify the version manually, like this:
package = config.boot.kernelPackages.nvidiaPackages.mkDriver {
# Update this regularly, until the next NixOS
# stable release, then remove the manual
# package.
version = "595.58.03";
# These obviously all need to be replaced with
# real hashes.
sha256_64bit = lib.fakeHash;
openSha256 = lib.fakeHash;
settingsSha256 = lib.fakeHash;
usePersistenced = false;
};
# The non-open driver modules are effectively
# deprecated, and primarily exist for old GPU
# support:
# https://download.nvidia.com/XFree86/Linux-x86_64/595.58.03/README/kernel_open.html
open = true;
# This also installs a bunch of X11 config;
# slightly cleaner is just to add the udev rules
# from here to your config manually:
#
# https://download.nvidia.com/XFree86/Linux-x86_64/595.58.03/README/dynamicpowermanagement.html#AutomatedSetup803b0
powerManagement.finegrained = true;
};
# powermanagement.enable is as deprecated as
# the non-open driver:
# https://download.nvidia.com/XFree86/Linux-x86_64/595.58.03/README/powermanagement.html
#
# I have not verified this yet; it's possible you need
# to set a different tmp path for NixOS, but afaik
# /tmp should work as it's anyway persisted.
boot.extraModprobeConfig = ''
options nvidia NVreg_PreserveVideoMemoryAllocations=1
'';
# The `hardware.nvidia.prime` setting only does
# X11 config. Multi-GPU works differently on
# wayland, and the NixOS module doesn't yet
# implement that.
#
# Double check the symlink path actually points
# at your GPU.
services.udev.packages = pkgs.writeTextDir "lib/udev/rules.d/62-gnome-gpu-priority.rules" ''
SYMLINK=="dri/by-path/pci-0000:00:02.0-card", TAG+="mutter-device-preferred-primary"
'';
# I imagine this is unrelated?
systemd.services.dlm.wantedBy = ["multi-user.target" ];
}
The EDID/resolution issue after suspend seems to be resolved. The monitor now comes back with the correct resolution in 90% of cases.
However, one issue remains. All screens turn black for a short period of time. Since the change the blackout sometimes also lasts longer than before. In some cases the HDMI won’t come back anymore.
This looks like a Wayland + NVIDIA resume issue rather than EDID.
Has anyone experienced this before or found a reliable fix?
I really don’t know how you read my comment and arrived at that, but it does give useful data.
This makes you write graphics memory to persistent memory. Granted, on NixOS the default /tmp is also on persistent memory. Basically, that’s more or less a pointless thing to set.
Maybe not writing to RAM is an issue, though that depends a bit on how much RAM you have and how fast your FS is. I’d suggedt experimenting with /run instead.
This is probably what’s actually fixing your issue. Read the nvidia docs I linked to understand why. But well, you should almost certainly be replacing it with the newer suspend method.
I’m not going to bother explaining what that looks like again, though. Read my previous comment; that should be the as-designed-by-nvidia configuration for your system. If that doesn’t work, contact nvidia support.
Thanks, @TLATER, for the docs you linked in the first comment. I went through them and experimented a lot. After properly understanding what the different powerManagement options are meant for, I was able to fix the whole black-screen issue.
I also tried your example with the mkDriver. However, it did not change anything for me. But from what I can tell, the problem is only persistent on the ultrawide, all other displays work fine. Maybe I will try to contact the nvidia support as you suggested.
One important thing: The issue only appears after sleep → awake → sleep. After that, the external monitor loses the correct resolution and falls back to a low-resolution mode.
For reference, these are the graphic-related settings that provide the most stable behavior.
The change is that it makes modern sleep methods available, which deprecate the power management systemd services, as well as the NVreg_PreserveVideoMemoryAllocations=1 option.
I would recommend trying out the new sleep mode.
The prime settings are still doing nothing, for the record, since you’re using wayland.
We really need to get rid of all these placebo options.