New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[20.09][21.03] PRIME render offload doesn't work on latest builds #98942
Comments
GPU? I'm not really sure how to go about making it more resilient. I personally have a 1050 TI and have never had any problems (though I never go on stable since I'm following master so that might be where the source of issues are). It looks like you're missing |
Sorry, I have a 1050 4gb, I've been using this same configuration.nix since some months ago and never failed to work, so I'm assuming this is an issue with a recent update, here are the journalctl and journalctl -xe outputs: |
I see the following in the log:
I also see that if I enable modesetting. But have the same issue if I don't. It seems like the GPU is available and online but the GLX is not set up. For example I can see
But if I pass the
|
@kevincox just got it working at #90152 (comment). |
I had the same issue with gdm, switching to lightdm fixed it. (I'm currently searching how to fix it for gdm). |
Weird, it works fine for me with gdm. |
I've tested the solution on #90152 and doesn't work for me, the issue I'm having is that gdm fails to initialize the GPU and consequently it can't configure prime render offload, I'm pretty sure this had to be an update to something (quite probably gdm) because the days before it worked fine with the same configuration. This is basically the root of the issue:
|
@Alderaeney this may be relevant: https://forums.developer.nvidia.com/t/nvidia-driver-not-yet-supported-for-linux-kernel-5-9/157263 I am without my notebook for now, but as soon as I can I will try to test PRIME on unstable. |
@bryanasdev000 on checking the logs @Alderaeney there is some info regarding it in nvidia docs. |
@bryanasdev000 I had to enable nvidiaPersistenced to get it working.
I am also using gdm currently. |
Awesome! I didn't have a lot of time to work on it these days but I will test it as soon as possible on my laptop. Interestingly, having to force the GPU to stay on means that at some point the GDM is failing to discover/activate the GPU... |
Here's the curious thing. With wayland (not x11) everything works, except the NVIDIA settings app, with GDM. Things do not work with lightdm. I have an AMD (Renior) and NVIDIA laptop. My config: { config, pkgs, ... }:
let
nvidia-offload = pkgs.writeShellScriptBin "nvidia-offload" ''
export __NV_PRIME_RENDER_OFFLOAD=1
export __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0
export __GLX_VENDOR_LIBRARY_NAME=nvidia
export __VK_LAYER_NV_optimus=NVIDIA_only
exec -a "$0" "$@"
'';
in
{
system.autoUpgrade.channel = "https://nixos.org/channels/nixos-21.05/";
nixpkgs.config.allowUnfree = true;
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = "jono-laptop"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Set your time zone.
time.timeZone = "America/New_York";
# The global useDHCP flag is deprecated, therefore explicitly set to false here.
# Per-interface useDHCP will be mandatory in the future, so this generated config
# replicates the default behaviour.
networking.useDHCP = false;
networking.interfaces.eno1.useDHCP = true;
networking.interfaces.wlp4s0.useDHCP = true;
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Select internationalisation properties.
# i18n.defaultLocale = "en_US.UTF-8";
# console = {
# font = "Lat2-Terminus16";
# keyMap = "us";
# };
# Enable the X11 windowing system.
services.xserver.enable = true;
services.xserver.displayManager.gdm.enable = true;
services.xserver.displayManager.gdm.wayland = true;
services.xserver.displayManager.gdm.nvidiaWayland = true;
services.xserver.desktopManager.gnome.enable = true;
services.xserver.videoDrivers = [ "modeset" "nvidia" ];
hardware.nvidia = {
powerManagement.enable = true;
modesetting.enable = true;
prime = {
offload.enable = true;
amdgpuBusId = "PCI:5:0:0";
nvidiaBusId = "PCI:1:0:0";
};
};
# Configure keymap in X11
services.xserver.layout = "us";
# services.xserver.xkbOptions = "eurosign:e";
# Enable CUPS to print documents.
# services.printing.enable = true;
# Enable sound.
sound.enable = true;
hardware.pulseaudio.enable = true;
# Enable touchpad support (enabled default in most desktopManager).
services.xserver.libinput.enable = true;
# Define a user account. Don't forget to set a password with ‘passwd’.
users.users.jono = {
isNormalUser = true;
extraGroups = [
"video"
"networkmanager"
"wheel"
]; # Enable ‘sudo’ for the user.
};
environment.systemPackages = with pkgs;[
nvidia-offload
];
services.udev.packages = with pkgs; [ gnome3.gnome-settings-daemon ];
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
# List services that you want to enable:
# Enable the OpenSSH daemon.
services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. It‘s perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "21.05"; # Did you read the comment?
} |
Curious, I got access to my PRIME laptop again and did a quick test with GDM and LightDM testing only X11. In GDM I have the following error: I was using gdm only with In LightDM it works perfectly. I did these tests in the same round without rebooting. I did this to see if other DMs had the error: I'm using AwesomeWM (X11 Only) with NixOS Hardware settings for NVIDIA (https://github.com/NixOS/nixos-hardware/blob/master/common/gpu/nvidia.nix). |
Same with me AMD (Renoir) laptop with NVIDIA GPU works fine in wayland with somewhat the same config. |
Somewhat related #139354 |
I don't know if it's related, but I have faced this issue on my laptop as well. The reason was that the X server started up way too fast before the nvidia GPU was even ready. I fixed it by following this article on ArchWiki which adds a systemd service which makes the login manager wait for nvidia GPU to be ready. |
Interesting... It may be necessary to add in the NVIDIA module as well. To confirm:
|
No I am using SDDM. It worked fine on GDM since it runs on Wayland and by the time u login to the desktop, the GPU is ready anyway. And yes I added these rules manually. |
Hi, after an uncountable number of conf tries, reboots, I have found a few things that might help understand the issue: I have a Dell Inc. XPS 15 9560, with:
I know this hardware can work well with primus because it does on Ubuntu, both in On NixOS, neither with this conf:
The desktop starts in X11 mode even though I explicitly asked for wayland. However wayland still doesn't work... and it should! First, wayland doesn't fail or anything, it's just that something, somewhere tells gnome-shell explicitly to run with X11.
You'll get minimal a session, but:
Now I would love to be able to understand and fix display-manager to make it stop forcing gnome-shell to run with X11.
|
I'm still trying to figure out where this XDG_SESSION_TYPE is set to "x11".
The only thing I found is this: https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/x11/display-managers/set-session.py#L70 But even monkeypatching this to force wayland doesn't change anything |
My previous investigations might be incorrect because I assumed the choice between wayland and x11 was constant when no changes was made to the system. This is apparently not true on my system, with this conf:
I get:
So this is not random, after an
Am I the only one being cursed by this? EDIT: |
To get back to the first issue, here's my method to get nvidia offloading: Start a session with a conf without nvidia, like:
when logged in, change the conf to add the nvidia drivers, like so:
then run: sudo nixos-rebuild test
sudo modprobe -r nouveau
sudo nvidia-smi
nvidia-offload glxgears -info |
Hello, I understood a few more things today:
other programs using the nvidia libs will also try to open
|
New findings:
It feels cursed but that's what I found! |
I just updated to latest nixos-unstable today with a turing GPU, and have power management and finegrained power management both enabled. The card will completely power off when not in use in this circumstance and become invisible to the kernel unless you also enable the nvidia persistence daemon, which I found in the Nvidia docs. After doing this, offload works fine for X11, so unless I'm missing something, I think we can probably close this. Actually, it might be better to reopen #90152 since the only thing not working is wayland native applications. I can offload xwayland programs just fine though, although Unigine Superposition still thought it was using the Intel card in this case, but based on the benchmark score, it was definitely using the Nvidia card. This is probably an upstream issue though, and we'll probably have to wait for a driver level fix before we can offload wayland apps unfortunately. |
NICE! I haven't used my PRIME for some time now (on NVIDIA desktop for now), but I think we need to just give a update in the docs, especially a note about the Wayland thing, and we are ready to go :P |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/hdmi-output-not-working-on-nvidia-laptop/16911/1 |
|
I agree with everything that @nrdxp said. W.r.t. Wayland, I am getting very good and consistent results with everything working perfectly except for
or else it would always crash on load, and fallback to X11. I've found that if you log in to a Wayland Gnome session, and it has |
Issue description
PRIME render offload stopped working on the latest update both on 20.09 channel and unstable channel, I've found that changing the bootloader and removing nvidia-drm.modeset=1 sometimes makes it work and sometimes don't, but maybe it's something else I changed.
xrandr --listproviders
nvidia-offload glxinfo
nvidia-smi
Steps to reproduce
1.- Install 20.09 or 21.03
2.- Run nixos-rebuild boot --upgrade
3.- Reboot
Technical details
configuration.nix
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result."x86_64-linux"
Linux 5.8.10, NixOS, 21.03pre244416.daaa0e33505 (Okapi)
yes
yes
nix-env (Nix) 2.3.7
"nixos-21.03pre244416.daaa0e33505"
/nix/var/nix/profiles/per-user/root/channels/nixos
The text was updated successfully, but these errors were encountered: