Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

profiles/graphic_drivers: Separate nvidia profiles for PRIME and desktop cards #107

Merged
merged 4 commits into from
Jun 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 66 additions & 16 deletions profiles/pci/graphic_drivers/profiles.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
# VENDOR AMD=1002 INTEL=8086 NVIDIA=10de
# CLASSID 03=Display controller
# 00=VGA compatible controller 02=3D controller 80=Display controller

# NVIDIA cards
#CLASSIDS="0300 0302"
#VENDORIDS="10de"
#DEVICEIDS=">/var/lib/mhwd/ids/pci/nvidia.ids"

# Intel Or Amd cards
#CLASSIDS="0300"
#VENDORIDS="8086 1002"
#DEVICEIDS="*"
#CONKMOD="nvidia-dkms"
# chwd has a sequential search for the desired profile. First it goes through
# all class_ids that indicate a device type, like GPU or network adapter. Then
# the profile specifies which manufacturer's driver we need via vendor_id,
# after which chwd select specific device in device_id or device_pattern, which
# is how much wider and includes devices of the same generation. For example:
#
# Searched for 3D controllers
# class_ids = "0302"
#
# Filters only NVIDIA GPUs
# vendor_ids = "10de"
#
# A certain device or set of ids:
# device_ids = "25a2"
#
# 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)'
Expand Down Expand Up @@ -50,7 +53,7 @@ device_name_pattern = '(AD)\w+'
[nvidia-dkms]
desc = 'Closed source NVIDIA drivers for Linux (Latest)'
nonfree = true
class_ids = "0300 0380 0302"
class_ids = "0300 0380"
vendor_ids = "10de"
priority = 8
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'
Expand Down Expand Up @@ -84,12 +87,59 @@ post_remove = """
"""
device_ids = '*'

[nvidia-dkms-prime]
desc = 'Closed source NVIDIA drivers for Linux (Latest)'
nonfree = true
class_ids = "0302"
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 nvidia-prime switcheroo-control'
conditional_packages = """
kernels="$(pacman -Qqs "^linux-cachyos")"
modules=""

for kernel in $kernels; do
case "$kernel" in
*-headers|*-zfs);;
*-nvidia) modules+=" ${kernel}";;
*) modules+=" ${kernel}-nvidia";;
esac
done

# Fallback if there are no kernels with pre-built modules
[ -z "$modules" ] && modules="nvidia-dkms"

echo "$modules"
"""
post_install = """
cat <<EOF >/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
"""
post_remove = """
rm -f /etc/mkinitcpio.conf.d/10-chwd.conf
mkinitcpio -P
"""
device_ids = '*'

[nvidia-dkms.470xx]
desc = 'Closed source NVIDIA drivers for Linux (470xx branch, only for Kepler GPUs)'
priority = 9
priority = 8
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'
device_name_pattern = '(GK)\w+'

[nvidia-dkms-prime.470xx]
desc = 'Closed source NVIDIA drivers for Linux (470xx branch, only for Kepler GPUs)'
priority = 9
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+'
post_install = """
systemctl enable switcheroo-control
"""

[nvidia-dkms.390xx]
desc = 'Closed source NVIDIA drivers for Linux (390xx branch, only for Fermi GPUs)'
priority = 10
Expand Down
Loading