diff --git a/profiles/pci/graphic_drivers/profiles.toml b/profiles/pci/graphic_drivers/profiles.toml index 1fc3198..b4eb6a3 100644 --- a/profiles/pci/graphic_drivers/profiles.toml +++ b/profiles/pci/graphic_drivers/profiles.toml @@ -16,17 +16,81 @@ # Or set of devices depending on the generation: # device_name_pattern = '(AD)\w+' -[nvidia-dkms.40xxcards] -desc = 'Closed source NVIDIA drivers(40xx series) for Linux (Latest)' -priority = 9 -device_name_pattern = '(AD)\w+' +[nvidia-open-dkms] +desc = 'Open source NVIDIA drivers for Linux (Latest)' +nonfree = true +class_ids = "0300 0302 0380" +vendor_ids = "10de" +priority = 10 +packages = 'nvidia-utils egl-wayland nvidia-settings opencl-nvidia lib32-opencl-nvidia lib32-nvidia-utils libva-nvidia-driver vulkan-icd-loader lib32-vulkan-icd-loader' +conditional_packages = """ + kernels="$(pacman -Qqs "^linux-cachyos")" + modules="" + + for kernel in $kernels; do + case "$kernel" in + *-nvidia-open) modules+=" ${kernel}";; + *-headers|*-zfs|*-nvidia|*-dbg);; + *) modules+=" ${kernel}-nvidia-open";; + esac + done + + # Fallback if there are no kernels with pre-built modules + [ -z "$modules" ] && modules="nvidia-open-dkms" + + echo "$modules" + +""" +post_install = """ + cat </etc/mkinitcpio.conf.d/10-chwd.conf +# This file is automatically generated by chwd. PLEASE DO NOT EDIT IT. +MODULES+=(nvidia nvidia_modeset nvidia_uvm nvidia_drm) +EOF + mkinitcpio -P + + # Add libva-nvidia-driver to profile + echo "export LIBVA_DRIVER_NAME=nvidia" > /etc/profile.d/nvidia-vaapi.sh +""" +post_remove = """ + rm -f /etc/mkinitcpio.conf.d/10-chwd.conf + rm -f /etc/profile.d/nvidia-vaapi.sh + mkinitcpio -P +""" +device_name_pattern = "([A-Z]+[0-9]+[^M]*)[[:blank:]].*" + +[nvidia-open-dkms.prime] +desc = 'Open source NVIDIA drivers for Linux (Latest)' +class_ids = "0300 0302 0380" +device_name_pattern = "([A-Z]+[0-9]+[A-Z]*M)[[:blank:]].*" +priority = 11 +packages = 'nvidia-utils egl-wayland nvidia-settings opencl-nvidia lib32-opencl-nvidia lib32-nvidia-utils libva-nvidia-driver vulkan-icd-loader lib32-vulkan-icd-loader nvidia-prime switcheroo-control' +post_install = """ + cat </etc/mkinitcpio.conf.d/10-chwd.conf +# This file is automatically generated by chwd. PLEASE DO NOT EDIT IT. +MODULES+=(nvidia nvidia_modeset nvidia_uvm nvidia_drm) +EOF + mkinitcpio -P + systemctl enable switcheroo-control + + # Workaround to fix broken RTD3 on GNOME, which keeps taking up 1MB of VRAM + # without letting the dGPU fully sleep or keeping it running for long + # periods of time. + # See: https://gitlab.gnome.org/GNOME/mutter/-/issues/2969 + echo "export __EGL_VENDOR_LIBRARY_FILENAMES=/usr/share/glvnd/egl_vendor.d/50_mesa.json" > /etc/profile.d/nvidia-rt3d-workaround.sh +""" +post_remove = """ + rm -f /etc/mkinitcpio.conf.d/10-chwd.conf + rm -f /etc/profile.d/nvidia-rt3d-workaround.sh + mkinitcpio -P +""" + [nvidia-dkms] desc = 'Closed source NVIDIA drivers for Linux (Latest)' nonfree = true class_ids = "0300 0302 0380" vendor_ids = "10de" -priority = 8 +priority = 12 packages = 'nvidia-utils egl-wayland nvidia-settings opencl-nvidia lib32-opencl-nvidia lib32-nvidia-utils libva-nvidia-driver vulkan-icd-loader lib32-vulkan-icd-loader' conditional_packages = """ kernels="$(pacman -Qqs "^linux-cachyos")" @@ -34,7 +98,7 @@ conditional_packages = """ for kernel in $kernels; do case "$kernel" in - *-headers|*-zfs);; + *-headers|*-zfs|*-nvidia-open|*-dbg);; *-nvidia) modules+=" ${kernel}";; *) modules+=" ${kernel}-nvidia";; esac @@ -61,13 +125,13 @@ post_remove = """ rm -f /etc/profile.d/nvidia-vaapi.sh mkinitcpio -P """ -device_name_pattern = "([A-Z]+[0-9]+[^M]*)[[:blank:]].*" +device_name_pattern = "(GM|GP[0-9]+[^M]*)[[:blank:]].*" [nvidia-dkms.prime] desc = 'Closed source NVIDIA drivers for Linux (Latest)' class_ids = "0300 0302 0380" -device_name_pattern = "([A-Z]+[0-9]+[A-Z]*M)[[:blank:]].*" -priority = 10 +device_name_pattern = "(GM|GP[0-9]+[A-Z]*M)[[:blank:]].*" +priority = 13 packages = 'nvidia-utils egl-wayland nvidia-settings opencl-nvidia lib32-opencl-nvidia lib32-nvidia-utils libva-nvidia-driver vulkan-icd-loader lib32-vulkan-icd-loader nvidia-prime switcheroo-control' post_install = """ cat </etc/mkinitcpio.conf.d/10-chwd.conf @@ -91,7 +155,7 @@ post_remove = """ [nvidia-dkms-470xx] desc = 'Closed source NVIDIA drivers for Linux (470xx branch, only for Kepler GPUs)' -priority = 8 +priority = 14 nonfree = true class_ids = "0300 0380" vendor_ids = "10de" @@ -107,7 +171,7 @@ post_remove = """ [nvidia-dkms-470xx.prime] desc = 'Closed source NVIDIA drivers for Linux (470xx branch, only for Kepler GPUs)' -priority = 9 +priority = 15 class_ids = "0302" packages = 'nvidia-470xx-dkms nvidia-470xx-utils nvidia-470xx-settings opencl-nvidia-470xx vulkan-icd-loader lib32-nvidia-470xx-utils lib32-opencl-nvidia-470xx lib32-vulkan-icd-loader libva-nvidia-driver switcheroo-control nvidia-prime' device_name_pattern = '(GK)\w+' @@ -117,7 +181,7 @@ post_install = """ [nvidia-dkms-390xx] desc = 'Closed source NVIDIA drivers for Linux (390xx branch, only for Fermi GPUs)' -priority = 10 +priority = 16 nonfree = true vendor_ids = "10de" class_ids = "0300 0302 0380"