The Reverse PRIME on NVIDIA sync mode is a much anticipated feature for hybrid setups, like Intel/AMD+NVIDIA laptops. The good news — the implementation PR is already here, and it is functioning.
NixOS:master
← GoogleBot42:master
opened 12:24AM - 22 Mar 22 UTC
###### Description of changes
Adds Reverse Prime Sync support for NVIDIA. Te… sted on an AMD+NVIDIA setup but should work on Intel+NVIDIA as well (*someone who can test this setup would be appreciated!*)
With Reverse Prime the primary rendering device is the device's APU and the NVIDIA GPU acts as an offload device. This is done while also allowing to use the video outputs connected to the NVIDIA device. Additionally, this might use less power than Prime Sync since the more power efficient APU does most of the rendering, thus, allowing the NVIDIA card to sleep where possible. I haven't confirmed this actually uses less power though. (Consider also using `hardware.nvidia.powerManagement.finegrained`)
Note that Reverse Prime Sync is a fairly new feature so this will likely be buggy. Intel devices have had support for a longer time so they are probably more stable. [Issues others have had are discussed here.](https://forums.developer.nvidia.com/t/the-all-new-outputsink-feature-aka-reverse-prime/129828) Bugs are being actively fixed so staying on a recent NVIDIA driver is probably a good idea.
Using an external GPU with Reverse Prime Sync *should* work but I have not tested it since I don't have an eGPU.
Added options
- `hardware.nvidia.prime.reverse_sync.enable` Turns on Reverse Prime Sync
- `hardware.nvidia.prime.offload.enableOffloadCmd` Adds convenient `nvidia-offload` offloading script to `environment.systemPackages`
**Future work**: Removing the need to define `intelBusId`, `nvidiaBusId`, and `amdgpuBusId` for more portable NixOS config files. Xorg supports this but it will change the `nvidia.nix` file quite a bit so I think an incremental change is better.
###### Things done
- Built on platform(s)
- [x] x86_64-linux
- [ ] aarch64-linux
- [ ] x86_64-darwin
- [ ] aarch64-darwin
- [ ] For non-Linux: Is `sandbox = true` set in `nix.conf`? (See [Nix manual](https://nixos.org/manual/nix/stable/command-ref/conf-file.html))
- [ ] Tested, as applicable:
- [NixOS test(s)](https://nixos.org/manual/nixos/unstable/index.html#sec-nixos-tests) (look inside [nixos/tests](https://github.com/NixOS/nixpkgs/blob/master/nixos/tests))
- and/or [package tests](https://nixos.org/manual/nixpkgs/unstable/#sec-package-tests)
- or, for functions and "core" functionality, tests in [lib/tests](https://github.com/NixOS/nixpkgs/blob/master/lib/tests) or [pkgs/test](https://github.com/NixOS/nixpkgs/blob/master/pkgs/test)
- made sure NixOS tests are [linked](https://nixos.org/manual/nixpkgs/unstable/#ssec-nixos-tests-linking) to the relevant packages
- [x] Tested compilation of all packages that depend on this change using `nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"`. Note: all changes have to be committed, also see [nixpkgs-review usage](https://github.com/Mic92/nixpkgs-review#usage)
- [ ] Tested basic functionality of all binary files (usually in `./result/bin/`)
- [22.05 Release Notes (or backporting 21.11 Release notes)](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md#generating-2205-release-notes)
- [ ] (Package updates) Added a release notes entry if the change is major or breaking
- [ ] (Module updates) Added a release notes entry if the change is significant
- [ ] (Module addition) Added a release notes entry if adding a new NixOS module
- [ ] (Release notes changes) Ran `nixos/doc/manual/md-to-db.sh` to update generated release notes
- [x] Fits [CONTRIBUTING.md](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md).
The bad news is some Xorg bug which makes it crash and dump core when changing external monitor settings. It needs testing, so I’m doing a signal boost thread here.
I’m asking for help with testing and (possibly) Xorg debugging for the bug which causes the crash. Advice for debugging Xorg in NixOS is welcome. The error also seemingly exists in 21.1.3 version, which is not in release
yet, so unstable channel users and advice for pinning fresher Xorg version are much welcome.
UPD: I’ll leave “Reverse PRIME on Linux” thread link here, just in case.
3 Likes