Nvidia: Difference between revisions

imported>Vodkabot2
No edit summary
imported>Vodkabot2
No edit summary
Line 17: Line 17:


Unofficial solution.
Unofficial solution.
Use <syntaxHighlight lang="nix">hardware.bumblebee.enable = true;</syntaxHighlight> option.


* Pros:  
* Pros:  
Line 28: Line 25:
** some performance penalty
** some performance penalty
** things like Vulkan, CUDA and OpenCL are problematic to configure
** things like Vulkan, CUDA and OpenCL are problematic to configure
Use option <syntaxHighlight lang="nix">hardware.bumblebee.enable = true;</syntaxHighlight>


=== Nvidia PRIME ===
=== Nvidia PRIME ===
'''You need muxless card'''. Official solution by nvidia.
==== dynamic mode ====
Like with Bumblebee, in this mode nvidia card is only turned on by need, other time it stays in power saving mode.
* Pros:
** better performance than Bumblebee
** Vulkan, CUDA and OpenCL work, though CUDA needs an additional device creation rule https://github.com/NixOS/nixpkgs/blob/05e375d7103ac51e2da917965c37246c99f1ae4f/nixos/modules/hardware/video/nvidia.nix#L72
** pure wayland setup is supported


'''You need muxless card'''. Official solution by nvidia.
* Cons:
** there are still some rough edges noted on the top of script
** launches new X11 server (and so its preferable to run WM/DE along with running program)


'''1.''' Configure NixOS to allow Intel and Nvidia X.Org drivers coexist together (only needed because NixOS forces LD_LIBRARY_PATH variable propagation), and also to disable nvidia card by default.
'''1.''' Configure NixOS to allow Intel and Nvidia X.Org drivers coexist together (only needed because NixOS forces LD_LIBRARY_PATH variable propagation), and also to disable nvidia card by default.
Line 48: Line 59:
Like with Bumblebee, start the game via ''primerun.sh''.  
Like with Bumblebee, start the game via ''primerun.sh''.  


* Pros:  
==== static mode ====
** better performance
 
** Vulkan, CUDA and OpenCL work, though CUDA needs an additional device creation rule https://github.com/NixOS/nixpkgs/blob/05e375d7103ac51e2da917965c37246c99f1ae4f/nixos/modules/hardware/video/nvidia.nix#L72
In this mode nvidia card is turned on constantly, having impact on laptop battery and laptop health.
 
* Pros:
** better performance than Bumblebee
** out of box experience
** works under existing X11 server
 
* Cons:
** nvidia is turned on constantly
** things like Vulkan, CUDA and OpenCL are not tested
** pure wayland setup is not supported


* Cons:
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
** there are still some rough edges noted on the top of script
{
** launches new X11 server (and so its preferable to run WM/DE along with running program)
  services.xserver.videoDrivers = [ "nvidia" ];
  hardware.nvidia.optimus_prime.enable = true;
  # Bus ID of the NVIDIA GPU. You can find it using lspci
  hardware.nvidia.optimus_prime.nvidiaBusId = "PCI:1:0:0";
  # Bus ID of the Intel GPU. You can find it using lspci
  hardware.nvidia.optimus_prime.intelBusId = "PCI:0:2:0";
 
}
</nowiki>}}


== non-NixOS case ==
== non-NixOS case ==