NVIDIA: Difference between revisions

imported>User
deprecate bumblebee
imported>User
m swap sections
Line 17: Line 17:
Official solution by nvidia.
Official solution by nvidia.


==== sync mode ====
==== offload mode ====


Old solution by nvidia. In this mode nvidia card is turned on constantly, having impact on laptop battery and health.
Recent solution by nvidia. In this mode nvidia card is only activated on demand when you run program with following environment variables set <syntaxHighlight lang="nix">__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME="nvidia" __VK_LAYER_NV_optimus="NVIDIA_only"</syntaxHighlight>
 
Possible issues:
* Hangs of applications after resume from suspend
* Wrong DPI calculation (in this case provide dpi manually <syntaxHighlight lang="nix">services.xserver.dpi = 96;</syntaxHighlight>)
* Black screen after system upgrade


Firstly you need to enable the proprietary nvidia driver
Firstly you need to enable the proprietary nvidia driver
Line 63: Line 58:
<nowiki>PCI:9:31:0</nowiki>
<nowiki>PCI:9:31:0</nowiki>


An example of a final configuration is below  
An example of a final configuration is below


{{file|/etc/nixos/configuration.nix|nix|<nowiki>
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
{
{
   services.xserver.videoDrivers = [ "intel" "nvidia" ];
   services.xserver.videoDrivers = [ "intel" "nvidia" ];
   hardware.nvidia.prime.sync.enable = true;
   hardware.nvidia.prime.offload.enable = true;
   # Bus ID of the NVIDIA GPU. You can find it using lspci, either under 3D or VGA
   # Bus ID of the NVIDIA GPU. You can find it using lspci, either under 3D or VGA
   hardware.nvidia.prime.nvidiaBusId = "PCI:1:0:0";
   hardware.nvidia.prime.nvidiaBusId = "PCI:1:0:0";
Line 76: Line 71:
</nowiki>}}
</nowiki>}}


==== offload mode ====
==== sync mode ====
 
Old solution by nvidia. In this mode nvidia card is turned on constantly, having impact on laptop battery and health.


Recent solution by nvidia. In this mode nvidia card is only activated on demand when you run program with following environment variables set <syntaxHighlight lang="nix">__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME="nvidia" __VK_LAYER_NV_optimus="NVIDIA_only"</syntaxHighlight>
Possible issues:
* Hangs of applications after resume from suspend
* Wrong DPI calculation (in this case provide dpi manually <syntaxHighlight lang="nix">services.xserver.dpi = 96;</syntaxHighlight>)
* Black screen after system upgrade


An example of a final configuration is below  
An example of a final configuration is below  
Line 85: Line 85:
{
{
   services.xserver.videoDrivers = [ "intel" "nvidia" ];
   services.xserver.videoDrivers = [ "intel" "nvidia" ];
   hardware.nvidia.prime.offload.enable = true;
   hardware.nvidia.prime.sync.enable = true;
   # Bus ID of the NVIDIA GPU. You can find it using lspci, either under 3D or VGA
   # Bus ID of the NVIDIA GPU. You can find it using lspci, either under 3D or VGA
   hardware.nvidia.prime.nvidiaBusId = "PCI:1:0:0";
   hardware.nvidia.prime.nvidiaBusId = "PCI:1:0:0";