Graphics: Difference between revisions

point to new renamed option
DHCP (talk | contribs)
m style fixes
 
(3 intermediate revisions by 3 users not shown)
Line 18: Line 18:


The kernel module can also be added to the initrd itself ("early KMS") by adding the kernel module for your hardware to <code>boot.initrd.kernelModules</code>. Early KMS is especially desirable when using something like Plymouth for flicker-free fancy graphics during boot. If you don't use Plymouth, early KMS might actually make the boot sequence worse, because the flicker might heppen during encryption password entry.
The kernel module can also be added to the initrd itself ("early KMS") by adding the kernel module for your hardware to <code>boot.initrd.kernelModules</code>. Early KMS is especially desirable when using something like Plymouth for flicker-free fancy graphics during boot. If you don't use Plymouth, early KMS might actually make the boot sequence worse, because the flicker might heppen during encryption password entry.


== OpenGL ==
== OpenGL ==
Line 28: Line 27:
The OpenGL implementation used on Linux is the [[Mesa|Mesa graphics library]]. Mesa contains drivers for various hardware, the exact driver is selected automatically. Note that Mesa also supports software rendering if no compatible hardware driver is available, but this is very slow.
The OpenGL implementation used on Linux is the [[Mesa|Mesa graphics library]]. Mesa contains drivers for various hardware, the exact driver is selected automatically. Note that Mesa also supports software rendering if no compatible hardware driver is available, but this is very slow.


Mesa can installed using the option <code>hardware.graphics.enable</code>, but note that most desktop environment modules set this themselves anyway. This option writes the driver files to <code>/run/opengl-driver</code>. Additional graphics drivers packages can be added using <code>hardware.graphics.extraPackages</code>.
Mesa can be installed using the option <code>hardware.graphics.enable</code>, but note that most desktop environment modules set this themselves anyway. This option writes the driver files to <code>/run/opengl-driver</code>. Additional graphics drivers packages can be added using <code>hardware.graphics.extraPackages</code>.
 
To verify which Mesa driver is used: <code>nix shell nixpkgs#glxinfo -c glxinfo</code>


To verify which Mesa driver is used: <code>nix shell nixpkgs#mesa-demos -c glxinfo</code>


== Vulkan ==
== Vulkan ==
Line 38: Line 36:


For the installed Vulkan drivers, see <code>/run/opengl-driver/share/vulkan/icd.d/</code>. To verify which driver is used: <code>nix shell nixpkgs#vulkan-tools -c vulkaninfo</code>
For the installed Vulkan drivers, see <code>/run/opengl-driver/share/vulkan/icd.d/</code>. To verify which driver is used: <code>nix shell nixpkgs#vulkan-tools -c vulkaninfo</code>


== OpenCL ==
== OpenCL ==


Computing things on the GPU is supported through the OpenCL API. To enable OpenCL support, add the right packages for your hardware to <code>hardware.graphics.extraPackages</code>. See also [https://wiki.archlinux.org/title/GPGPU the Arch Wiki].
Computing things on the GPU is supported through the OpenCL API. To enable OpenCL support, add the right packages for your hardware to <code>hardware.graphics.extraPackages</code> (note that despite Mesa being present by default, its OpenCL drivers are placed in a separate <code>opencl</code> output that must be manually added). See also [https://wiki.archlinux.org/title/GPGPU the Arch Wiki].


To verify OpenCL support: <code>nix shell nixpkgs#clinfo -c clinfo</code>
To verify OpenCL support: <code>nix shell nixpkgs#clinfo -c clinfo</code>


== Hardware Video Acceleration ==
== Hardware Video Acceleration ==