From e2d2360e108ac340994ea1464c684fa96382c3e1 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Thu, 12 Sep 2024 02:11:25 +0100 Subject: x11-drivers/nvidia-drivers : version bump, port to EAPI 8, resync with Gentoo --- x11-drivers/nvidia-drivers/files/nouveau.conf | 3 - x11-drivers/nvidia-drivers/files/nvidia-390.conf | 23 +++++ x11-drivers/nvidia-drivers/files/nvidia-470.conf | 33 +++++++ x11-drivers/nvidia-drivers/files/nvidia-545.conf | 38 +++++++ .../files/nvidia-drivers-390.154-clang15.patch | 84 ++++++++++++++++ .../files/nvidia-drivers-470.141.03-clang15.patch | 110 +++++++++++++++++++++ .../files/nvidia-drm-outputclass-390.conf | 7 ++ .../files/nvidia-modprobe-390.141-uvm-perms.patch | 12 +++ .../nvidia-drivers/files/nvidia-persistenced.confd | 7 ++ .../nvidia-drivers/files/nvidia-persistenced.initd | 11 +++ .../nvidia-drivers/files/nvidia-powerd.initd | 11 +++ 11 files changed, 336 insertions(+), 3 deletions(-) delete mode 100644 x11-drivers/nvidia-drivers/files/nouveau.conf create mode 100644 x11-drivers/nvidia-drivers/files/nvidia-390.conf create mode 100644 x11-drivers/nvidia-drivers/files/nvidia-470.conf create mode 100644 x11-drivers/nvidia-drivers/files/nvidia-545.conf create mode 100644 x11-drivers/nvidia-drivers/files/nvidia-drivers-390.154-clang15.patch create mode 100644 x11-drivers/nvidia-drivers/files/nvidia-drivers-470.141.03-clang15.patch create mode 100644 x11-drivers/nvidia-drivers/files/nvidia-drm-outputclass-390.conf create mode 100644 x11-drivers/nvidia-drivers/files/nvidia-modprobe-390.141-uvm-perms.patch create mode 100644 x11-drivers/nvidia-drivers/files/nvidia-persistenced.confd create mode 100644 x11-drivers/nvidia-drivers/files/nvidia-persistenced.initd create mode 100644 x11-drivers/nvidia-drivers/files/nvidia-powerd.initd (limited to 'x11-drivers/nvidia-drivers/files') diff --git a/x11-drivers/nvidia-drivers/files/nouveau.conf b/x11-drivers/nvidia-drivers/files/nouveau.conf deleted file mode 100644 index 00c6f588..00000000 --- a/x11-drivers/nvidia-drivers/files/nouveau.conf +++ /dev/null @@ -1,3 +0,0 @@ -blacklist nouveau -options nouveau modeset=0 -alias nouveau off diff --git a/x11-drivers/nvidia-drivers/files/nvidia-390.conf b/x11-drivers/nvidia-drivers/files/nvidia-390.conf new file mode 100644 index 00000000..6cfc0e6a --- /dev/null +++ b/x11-drivers/nvidia-drivers/files/nvidia-390.conf @@ -0,0 +1,23 @@ +# NVIDIA drivers options +# See /usr/share/doc/nvidia-drivers-*/README.txt* for more information. + +# nvidia-drivers and nouveau cannot be used at same time. +# Comment out the following line if you wish to allow nouveau. +blacklist nouveau +options nouveau modeset=0 +alias nouveau off + +# !!! Security Warning !!! +# Do not change the DeviceFile options unless you know what you are doing. +# Only add trusted users to the 'video' group, these users may be able to +# crash, compromise, or irreparably damage the machine. +options nvidia \ + NVreg_DeviceFileGID=@VIDEOGID@ \ + NVreg_DeviceFileMode=432 \ + NVreg_DeviceFileUID=0 \ + NVreg_ModifyDeviceFiles=1 + +# Should be no need to touch anything below. +alias char-major-195 nvidia +alias /dev/nvidiactl char-major-195 +remove nvidia modprobe -r --ignore-remove nvidia-drm nvidia-modeset nvidia-uvm nvidia diff --git a/x11-drivers/nvidia-drivers/files/nvidia-470.conf b/x11-drivers/nvidia-drivers/files/nvidia-470.conf new file mode 100644 index 00000000..a20f2a19 --- /dev/null +++ b/x11-drivers/nvidia-drivers/files/nvidia-470.conf @@ -0,0 +1,33 @@ +# NVIDIA drivers options +# See /usr/share/doc/nvidia-drivers-*/README.txt* for more information. + +# nvidia-drivers and nouveau cannot be used at same time. +# Comment out the following line if you wish to allow nouveau. +blacklist nouveau +options nouveau modeset=0 +alias nouveau off + +# Kernel Mode Setting (needed for wayland but is hardly usable with legacy 470) +# Enabling may possibly cause issues with SLI and Reverse PRIME. +#options nvidia-drm modeset=1 + +# Suspend options. Allocations=0 recommended over =1 unless enable nvidia's +# systemd sleep services (nvidia-hibernate, nvidia-resume, nvidia-suspend). +options nvidia \ + NVreg_PreserveVideoMemoryAllocations=0 \ + NVreg_TemporaryFilePath=/var/tmp + +# !!! Security Warning !!! +# Do not change the DeviceFile options unless you know what you are doing. +# Only add trusted users to the 'video' group, these users may be able to +# crash, compromise, or irreparably damage the machine. +options nvidia \ + NVreg_DeviceFileGID=@VIDEOGID@ \ + NVreg_DeviceFileMode=432 \ + NVreg_DeviceFileUID=0 \ + NVreg_ModifyDeviceFiles=1 + +# Should be no need to touch anything below. +alias char-major-195 nvidia +alias /dev/nvidiactl char-major-195 +remove nvidia modprobe -r --ignore-remove nvidia-drm nvidia-modeset nvidia-uvm nvidia diff --git a/x11-drivers/nvidia-drivers/files/nvidia-545.conf b/x11-drivers/nvidia-drivers/files/nvidia-545.conf new file mode 100644 index 00000000..ecb549e1 --- /dev/null +++ b/x11-drivers/nvidia-drivers/files/nvidia-545.conf @@ -0,0 +1,38 @@ +# NVIDIA drivers options +# See /usr/share/doc/nvidia-drivers-*/README.txt* for more information. + +# nvidia-drivers and nouveau cannot be used at same time. +# Comment out the following line if you wish to allow nouveau. +blacklist nouveau +options nouveau modeset=0 +alias nouveau off + +# Kernel Mode Setting (notably needed for fbdev and wayland). +# Enabling may possibly cause issues with SLI and Reverse PRIME. +#options nvidia-drm modeset=1 + +# Enable experimental framebuffer console support (requires modeset=1 above). +# Replaces efifb, simpledrm, or similar once loaded (emphasis on being +# experimental, "may" cause issues X mode switching, sleep, or more). +#options nvidia-drm fbdev=1 + +# Suspend options. Allocations=0 recommended over =1 unless enable nvidia's +# systemd sleep services (nvidia-hibernate, nvidia-resume, nvidia-suspend). +options nvidia \ + NVreg_PreserveVideoMemoryAllocations=0 \ + NVreg_TemporaryFilePath=/var/tmp + +# !!! Security Warning !!! +# Do not change the DeviceFile options unless you know what you are doing. +# Only add trusted users to the 'video' group, these users may be able to +# crash, compromise, or irreparably damage the machine. +options nvidia \ + NVreg_DeviceFileGID=@VIDEOGID@ \ + NVreg_DeviceFileMode=432 \ + NVreg_DeviceFileUID=0 \ + NVreg_ModifyDeviceFiles=1 + +# Should be no need to touch anything below. +alias char-major-195 nvidia +alias /dev/nvidiactl char-major-195 +remove nvidia modprobe -r --ignore-remove nvidia-drm nvidia-modeset nvidia-uvm nvidia diff --git a/x11-drivers/nvidia-drivers/files/nvidia-drivers-390.154-clang15.patch b/x11-drivers/nvidia-drivers/files/nvidia-drivers-390.154-clang15.patch new file mode 100644 index 00000000..b08f3589 --- /dev/null +++ b/x11-drivers/nvidia-drivers/files/nvidia-drivers-390.154-clang15.patch @@ -0,0 +1,84 @@ +Kernel's makefiles pass -Werror=strict-prototypes which +can trigger errors depending on compiler defaults. +https://bugs.gentoo.org/870238 +https://github.com/NVIDIA/open-gpu-kernel-modules/issues/377 +--- a/kernel/nvidia/nvlink_linux.c ++++ b/kernel/nvidia/nvlink_linux.c +@@ -639 +639 @@ +-void * NVLINK_API_CALL nvlink_allocLock() ++void * NVLINK_API_CALL nvlink_allocLock(void) +--- a/kernel/nvidia/os-interface.c ++++ b/kernel/nvidia/os-interface.c +@@ -879 +879 @@ +-NV_STATUS NV_API_CALL os_flush_cpu_cache() ++NV_STATUS NV_API_CALL os_flush_cpu_cache(void) +@@ -886 +886 @@ +-NV_STATUS NV_API_CALL os_flush_cpu_cache_all() ++NV_STATUS NV_API_CALL os_flush_cpu_cache_all(void) +@@ -944 +944 @@ +-void NV_API_CALL os_flush_cpu_write_combine_buffer() ++void NV_API_CALL os_flush_cpu_write_combine_buffer(void) +@@ -1073 +1073 @@ +-NvU32 NV_API_CALL os_get_cpu_number() ++NvU32 NV_API_CALL os_get_cpu_number(void) +@@ -1080 +1080 @@ +-NvU32 NV_API_CALL os_get_cpu_count() ++NvU32 NV_API_CALL os_get_cpu_count(void) +@@ -1155 +1155 @@ +-void NV_API_CALL os_dump_stack() ++void NV_API_CALL os_dump_stack(void) +--- a/kernel/nvidia-uvm/uvm8_lock.c ++++ b/kernel/nvidia-uvm/uvm8_lock.c +@@ -312 +312 @@ +-bool __uvm_thread_check_all_unlocked() ++bool __uvm_thread_check_all_unlocked(void) +--- a/kernel/nvidia-uvm/uvm8_perf_heuristics.c ++++ b/kernel/nvidia-uvm/uvm8_perf_heuristics.c +@@ -29 +29 @@ +-NV_STATUS uvm_perf_heuristics_init() ++NV_STATUS uvm_perf_heuristics_init(void) +@@ -44 +44 @@ +-void uvm_perf_heuristics_exit() ++void uvm_perf_heuristics_exit(void) +--- a/kernel/nvidia-uvm/uvm8_perf_prefetch.c ++++ b/kernel/nvidia-uvm/uvm8_perf_prefetch.c +@@ -462 +462 @@ +-NV_STATUS uvm_perf_prefetch_init() ++NV_STATUS uvm_perf_prefetch_init(void) +@@ -500 +500 @@ +-void uvm_perf_prefetch_exit() ++void uvm_perf_prefetch_exit(void) +--- a/kernel/nvidia-uvm/uvm8_perf_thrashing.c ++++ b/kernel/nvidia-uvm/uvm8_perf_thrashing.c +@@ -1324 +1324 @@ +-NV_STATUS uvm_perf_thrashing_init() ++NV_STATUS uvm_perf_thrashing_init(void) +@@ -1401 +1401 @@ +-void uvm_perf_thrashing_exit() ++void uvm_perf_thrashing_exit(void) +--- a/kernel/nvidia-uvm/uvm8_procfs.c ++++ b/kernel/nvidia-uvm/uvm8_procfs.c +@@ -61 +61 @@ +-NV_STATUS uvm_procfs_init() ++NV_STATUS uvm_procfs_init(void) +@@ -77 +77 @@ +-void uvm_procfs_exit() ++void uvm_procfs_exit(void) +@@ -106 +106 @@ +-struct proc_dir_entry *uvm_procfs_get_gpu_base_dir() ++struct proc_dir_entry *uvm_procfs_get_gpu_base_dir(void) +--- a/kernel/nvidia-uvm/uvm8_push.c ++++ b/kernel/nvidia-uvm/uvm8_push.c +@@ -103 +103 @@ +-bool uvm_push_info_is_tracking_descriptions() ++bool uvm_push_info_is_tracking_descriptions(void) +--- a/kernel/nvidia-uvm/uvm8_tools.c ++++ b/kernel/nvidia-uvm/uvm8_tools.c +@@ -2041 +2041 @@ +-void uvm_tools_flush_events() ++void uvm_tools_flush_events(void) +--- a/kernel/nvidia-uvm/uvm_common.c ++++ b/kernel/nvidia-uvm/uvm_common.c +@@ -63 +63 @@ +-bool uvm_debug_prints_enabled() ++bool uvm_debug_prints_enabled(void) diff --git a/x11-drivers/nvidia-drivers/files/nvidia-drivers-470.141.03-clang15.patch b/x11-drivers/nvidia-drivers/files/nvidia-drivers-470.141.03-clang15.patch new file mode 100644 index 00000000..334f0d1c --- /dev/null +++ b/x11-drivers/nvidia-drivers/files/nvidia-drivers-470.141.03-clang15.patch @@ -0,0 +1,110 @@ +Kernel's makefiles pass -Werror=strict-prototypes which +can trigger errors depending on compiler defaults. +https://bugs.gentoo.org/870238 +https://github.com/NVIDIA/open-gpu-kernel-modules/issues/377 +--- a/kernel/nvidia/nvlink_linux.c ++++ b/kernel/nvidia/nvlink_linux.c +@@ -571 +571 @@ +-void * nvlink_allocLock() ++void * nvlink_allocLock(void) +--- a/kernel/nvidia/os-interface.c ++++ b/kernel/nvidia/os-interface.c +@@ -1076 +1076 @@ +-NvU32 NV_API_CALL os_get_cpu_number() ++NvU32 NV_API_CALL os_get_cpu_number(void) +@@ -1083 +1083 @@ +-NvU32 NV_API_CALL os_get_cpu_count() ++NvU32 NV_API_CALL os_get_cpu_count(void) +@@ -1136 +1136 @@ +-void NV_API_CALL os_dump_stack() ++void NV_API_CALL os_dump_stack(void) +--- a/kernel/nvidia-uvm/uvm_common.c ++++ b/kernel/nvidia-uvm/uvm_common.c +@@ -37 +37 @@ +-bool uvm_debug_prints_enabled() ++bool uvm_debug_prints_enabled(void) +--- a/kernel/nvidia-uvm/uvm_gpu_access_counters.c ++++ b/kernel/nvidia-uvm/uvm_gpu_access_counters.c +@@ -1527 +1527 @@ +-NV_STATUS uvm_perf_access_counters_init() ++NV_STATUS uvm_perf_access_counters_init(void) +@@ -1538 +1538 @@ +-void uvm_perf_access_counters_exit() ++void uvm_perf_access_counters_exit(void) +--- a/kernel/nvidia-uvm/uvm_lock.c ++++ b/kernel/nvidia-uvm/uvm_lock.c +@@ -337 +337 @@ +-bool __uvm_thread_check_all_unlocked() ++bool __uvm_thread_check_all_unlocked(void) +--- a/kernel/nvidia-uvm/uvm_migrate.c ++++ b/kernel/nvidia-uvm/uvm_migrate.c +@@ -795 +795 @@ +-NV_STATUS uvm_migrate_init() ++NV_STATUS uvm_migrate_init(void) +@@ -821 +821 @@ +-void uvm_migrate_exit() ++void uvm_migrate_exit(void) +--- a/kernel/nvidia-uvm/uvm_migrate_pageable.c ++++ b/kernel/nvidia-uvm/uvm_migrate_pageable.c +@@ -979 +979 @@ +-NV_STATUS uvm_migrate_pageable_init() ++NV_STATUS uvm_migrate_pageable_init(void) +@@ -988 +988 @@ +-void uvm_migrate_pageable_exit() ++void uvm_migrate_pageable_exit(void) +--- a/kernel/nvidia-uvm/uvm_perf_heuristics.c ++++ b/kernel/nvidia-uvm/uvm_perf_heuristics.c +@@ -31 +31 @@ +-NV_STATUS uvm_perf_heuristics_init() ++NV_STATUS uvm_perf_heuristics_init(void) +@@ -50 +50 @@ +-void uvm_perf_heuristics_exit() ++void uvm_perf_heuristics_exit(void) +--- a/kernel/nvidia-uvm/uvm_perf_prefetch.c ++++ b/kernel/nvidia-uvm/uvm_perf_prefetch.c +@@ -463 +463 @@ +-NV_STATUS uvm_perf_prefetch_init() ++NV_STATUS uvm_perf_prefetch_init(void) +@@ -501 +501 @@ +-void uvm_perf_prefetch_exit() ++void uvm_perf_prefetch_exit(void) +--- a/kernel/nvidia-uvm/uvm_perf_thrashing.c ++++ b/kernel/nvidia-uvm/uvm_perf_thrashing.c +@@ -1955 +1955 @@ +-NV_STATUS uvm_perf_thrashing_init() ++NV_STATUS uvm_perf_thrashing_init(void) +@@ -2014 +2014 @@ +-void uvm_perf_thrashing_exit() ++void uvm_perf_thrashing_exit(void) +--- a/kernel/nvidia-uvm/uvm_procfs.c ++++ b/kernel/nvidia-uvm/uvm_procfs.c +@@ -49 +49 @@ +-NV_STATUS uvm_procfs_init() ++NV_STATUS uvm_procfs_init(void) +@@ -69 +69 @@ +-void uvm_procfs_exit() ++void uvm_procfs_exit(void) +@@ -98 +98 @@ +-struct proc_dir_entry *uvm_procfs_get_gpu_base_dir() ++struct proc_dir_entry *uvm_procfs_get_gpu_base_dir(void) +@@ -103 +103 @@ +-struct proc_dir_entry *uvm_procfs_get_cpu_base_dir() ++struct proc_dir_entry *uvm_procfs_get_cpu_base_dir(void) +--- a/kernel/nvidia-uvm/uvm_push.c ++++ b/kernel/nvidia-uvm/uvm_push.c +@@ -245 +245 @@ +-bool uvm_push_info_is_tracking_descriptions() ++bool uvm_push_info_is_tracking_descriptions(void) +@@ -250 +250 @@ +-bool uvm_push_info_is_tracking_acquires() ++bool uvm_push_info_is_tracking_acquires(void) +--- a/kernel/nvidia-uvm/uvm_thread_context.c ++++ b/kernel/nvidia-uvm/uvm_thread_context.c +@@ -104 +104 @@ +-bool uvm_thread_context_wrapper_is_used() ++bool uvm_thread_context_wrapper_is_used(void) +--- a/kernel/nvidia-uvm/uvm_tools.c ++++ b/kernel/nvidia-uvm/uvm_tools.c +@@ -2144 +2144 @@ +-void uvm_tools_flush_events() ++void uvm_tools_flush_events(void) diff --git a/x11-drivers/nvidia-drivers/files/nvidia-drm-outputclass-390.conf b/x11-drivers/nvidia-drivers/files/nvidia-drm-outputclass-390.conf new file mode 100644 index 00000000..f459c69d --- /dev/null +++ b/x11-drivers/nvidia-drivers/files/nvidia-drm-outputclass-390.conf @@ -0,0 +1,7 @@ +Section "OutputClass" + Identifier "nvidia" + MatchDriver "nvidia-drm" + Driver "nvidia" + Option "AllowEmptyInitialConfiguration" + ModulePath "@LIBDIR@/extensions/nvidia" +EndSection diff --git a/x11-drivers/nvidia-drivers/files/nvidia-modprobe-390.141-uvm-perms.patch b/x11-drivers/nvidia-drivers/files/nvidia-modprobe-390.141-uvm-perms.patch new file mode 100644 index 00000000..6ffd42ff --- /dev/null +++ b/x11-drivers/nvidia-drivers/files/nvidia-modprobe-390.141-uvm-perms.patch @@ -0,0 +1,12 @@ +Create /dev/nvidia-uvm* by respecting nvidia.conf's permissions. +--- a/nvidia-modprobe/modprobe-utils/nvidia-modprobe-utils.c ++++ b/nvidia-modprobe/modprobe-utils/nvidia-modprobe-utils.c +@@ -742,6 +742,6 @@ + } + +- return mknod_helper(major, base_minor, NV_UVM_DEVICE_NAME, NULL) && +- mknod_helper(major, base_minor + 1, NV_UVM_TOOLS_DEVICE_NAME, NULL); ++ return mknod_helper(major, base_minor, NV_UVM_DEVICE_NAME, NV_PROC_REGISTRY_PATH) && ++ mknod_helper(major, base_minor + 1, NV_UVM_TOOLS_DEVICE_NAME, NV_PROC_REGISTRY_PATH); + } + diff --git a/x11-drivers/nvidia-drivers/files/nvidia-persistenced.confd b/x11-drivers/nvidia-drivers/files/nvidia-persistenced.confd new file mode 100644 index 00000000..e06d53c0 --- /dev/null +++ b/x11-drivers/nvidia-drivers/files/nvidia-persistenced.confd @@ -0,0 +1,7 @@ +# configuration file for /etc/init.d/nvidia-persistenced + +# NVPD_USER: user to run as, needs access to /dev/nvidia* (video group) +NVPD_USER="nvpd" + +# ARGS: additional arguments, see nvidia-persistenced(1) +ARGS="" diff --git a/x11-drivers/nvidia-drivers/files/nvidia-persistenced.initd b/x11-drivers/nvidia-drivers/files/nvidia-persistenced.initd new file mode 100644 index 00000000..27d8bb37 --- /dev/null +++ b/x11-drivers/nvidia-drivers/files/nvidia-persistenced.initd @@ -0,0 +1,11 @@ +#!/sbin/openrc-run +# SPDX-License-Identifier: MIT + +description="Maintain persistent software state in the NVIDIA driver" +command="nvidia-persistenced" +command_args="${NVPD_USER:+--user ${NVPD_USER}} ${ARGS}" +pidfile="/var/run/nvidia-persistenced/nvidia-persistenced.pid" + +stop_post() { + rmdir "${pidfile%/*}" 2>/dev/null || true +} diff --git a/x11-drivers/nvidia-drivers/files/nvidia-powerd.initd b/x11-drivers/nvidia-drivers/files/nvidia-powerd.initd new file mode 100644 index 00000000..5132a20c --- /dev/null +++ b/x11-drivers/nvidia-drivers/files/nvidia-powerd.initd @@ -0,0 +1,11 @@ +#!/sbin/openrc-run +# SPDX-License-Identifier: MIT + +description="Support for NVIDIA Dynamic Boost (only for use with specific laptops)" +command="nvidia-powerd" +command_background=true +pidfile="/var/run/nvidia-powerd.pid" + +depend() { + need dbus +} -- cgit v1.2.3