rendeko
October 15, 2022, 11:25pm
1
I’m using a Thinkpad P50 and set my Nvidia PRIME mode to offload as the wiki says sync is harmful to the GPU and seems to be being retired.
services.xserver.videoDrivers = [ "nvidia" ];
hardware.nvidia = {
modesetting.enable = true;
prime = {
sync.enable = false; # gpu always
offload.enable = true; # gpu on demand
#nvidiaBusId = "PCI:10:0:0"; #epgu
nvidiaBusId = "PCI:1:0:0"; # dedicated gpu
intelBusId = "PCI:0:2:0";
};
};
# required for external monitor usage on nvidia offload
specialisation = {
external-display.configuration = {
system.nixos.tags = [ "external-display" ];
hardware.nvidia.prime.offload.enable = lib.mkForce false;
hardware.nvidia.powerManagement.enable = lib.mkForce false;
};
};
However, I suspect that my laptop is one of the special conditions where external display ports are only exposed to the dedicated GPU. As such, I can either use only the internal monitor or only an external monitor.
Has there been any progress in fixing usecases like this, or should I revert to sync? Is sync significantly harmful to the dGPU or is it just not ideal?
NickCao
October 16, 2022, 12:51am
2
The feature you are looking for is called reverse PRIME, PRIME - ArchWiki
Interesting, apparently there is progress in getting it implemented. I suppose I’ll just have to wait for now. Thank you for clarifying.
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).
Actually calling the xrandr command alone is already enough for me, without configuration changes, you can also have a try.
Very interesting, I didn’t think it’d be that simple.
I got it working by grabbing the source output provider number from
xrandr --listproviders
and running
xrandr --setprovideroutputsource NVIDIA-G0 modesetting
xrandr --auto
It seems this method is just displaying a framebuffer on the external screen? Regardless, it works and I’m happy of that. Thank you again.
1 Like