diff options
author | Ionen Wolkens <ionen@gentoo.org> | 2022-03-29 11:31:18 -0400 |
---|---|---|
committer | Ionen Wolkens <ionen@gentoo.org> | 2022-03-29 11:35:00 -0400 |
commit | e66979b5cadef320ba60ecb3f92e78c244d7c7d6 (patch) | |
tree | 1bb877e0860e9d64a467795086a512885af527fd /x11-drivers | |
parent | sys-apps/sysvinit: Block against <man-pages-l10n-4.12.1-r2 (diff) | |
download | gentoo-e66979b5cadef320ba60ecb3f92e78c244d7c7d6.tar.gz gentoo-e66979b5cadef320ba60ecb3f92e78c244d7c7d6.tar.bz2 gentoo-e66979b5cadef320ba60ecb3f92e78c244d7c7d6.zip |
x11-drivers/nvidia-drivers: add 470.62.26:0/vulkan
Also EAPI=8 and sync NV_PIN with latest 470 (this is not actively
tested for masked 0/vulkan, please report if issues).
Signed-off-by: Ionen Wolkens <ionen@gentoo.org>
Diffstat (limited to 'x11-drivers')
-rw-r--r-- | x11-drivers/nvidia-drivers/Manifest | 1 | ||||
-rw-r--r-- | x11-drivers/nvidia-drivers/nvidia-drivers-470.62.26.ebuild | 445 |
2 files changed, 446 insertions, 0 deletions
diff --git a/x11-drivers/nvidia-drivers/Manifest b/x11-drivers/nvidia-drivers/Manifest index 10b90ffdb366..38caffb56bf8 100644 --- a/x11-drivers/nvidia-drivers/Manifest +++ b/x11-drivers/nvidia-drivers/Manifest @@ -4,6 +4,7 @@ DIST NVIDIA-Linux-x86-390.147.run 49303088 BLAKE2B 5a3a02b88af1ee8699b0c6c3fa222 DIST NVIDIA-Linux-x86_64-390.147.run 85930997 BLAKE2B a8085c9abc1c31251788a8f5abdc2090c9085b3028e364184244bbf24d822dc3266877c88b30f403507fa2dd511c68ec67e1f188d6b0f1f4d7d792881d5253fc SHA512 0d8bda32e916d71da2ea74bc12a4f3cb0a0c2ddda27511cf3c89bbf4aeb28db68f6b7261639d88dd1c0180b91213c09de930d233158268c5d9ab3b223510e964 DIST NVIDIA-Linux-x86_64-470.103.01.run 272484410 BLAKE2B 42a19ed990f49d4ceefc1006f3e6e4b69135ad2aaf497c648b9afe7941a81aba3a51296cb14bc419352cdf70f850484d2a55784184fdb820186193501422d742 SHA512 3dc19774a6fef5e6ec0cb9451df4268f77cb31b0a9ede253bf9cf805a048ad457a7bfec852aaeab3e3e297b3353840a3d6c9c7ddc75d57b2b000ab4e0b15530b DIST NVIDIA-Linux-x86_64-470.62.22.run 272128606 BLAKE2B 727aac085a73c4c953ddb58a5b887b70eb65b5b89cdd556d122d89d351444fbed0adfa3c34627a9ab0d13c42ac93732d9fa023e580894117dd0c06098b386208 SHA512 9e9f6a665034495bbfd438567fb9a0998adbfcc979fd1e0370d355b4f312e4c1fb5162b15e5264cc89d3aca6dcaf84ce7ebfff0885ac783dfcd8be3b99b3b96f +DIST NVIDIA-Linux-x86_64-470.62.26.run 272619538 BLAKE2B dd68260661473b5d6a10be42eac376d662e9656ab63b24442f8aab4f7bfd916f6255650f931334fedb3c3023acbd2512a9bbaf698a01a0c3ea40d7eee84014bc SHA512 13cd30cea4c7390ea7e0c0a41842258b488082b358b0d9a13c21637b79efe470ae6ee4e86902ba81d01cb6be0700449c6f545d87aca2708f62be22530d41b693 DIST NVIDIA-Linux-x86_64-510.54.run 328899755 BLAKE2B b83ebb1c978f902812d7dae2170eadfa1d52d36dc1e9ed61001c0483743ad8094268f101a4414353936339a4d064d54ad41cc229906ee7dbef3aa56af5315764 SHA512 1e65e96c1ae1cccd5cd483f2b65927e3594d28f3774459dfd094530f445f4b0f5368a3b7eebf4970bd2632438cca2cbb93af50a59a3a87a2c13d08ed5155164c DIST NVIDIA-Linux-x86_64-510.60.02.run 328284028 BLAKE2B 9165e4763a34c3cf474c18dae7d2c548bb6d4edc21507afe67d046959e9f3fb758cf507dcdffcfbc0bf70cf2b677a193429127b3fe589af329fe6a671ac51e6f SHA512 ccc459bdf5f89a37f79a1831bac8c03980deaa13082b516d5e9c74a49e1aea7f1f6b03304705a95564a390bf0ca38df10b8c8b73e3470a31444dd5ebfd981cfd DIST nvidia-installer-390.147.tar.bz2 150157 BLAKE2B 3bf5317aaa3bdb0e6dc3b3e21ad3dbacf6dc782a643b0fa9badf354361891ab25660b57dd408e346f219d469af317a4851937e1cb77ffe59a39e9d98a92f3a40 SHA512 24bd8a2959062551abf2ea039ac95eba224d58c175f59f1386a6d43459ad43b2bddf17f00b53c1c71c45eca3b7a2281dcf05cc65030f6f8bed16d0f0b9f9c282 diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-470.62.26.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-470.62.26.ebuild new file mode 100644 index 000000000000..3b539a6e7020 --- /dev/null +++ b/x11-drivers/nvidia-drivers/nvidia-drivers-470.62.26.ebuild @@ -0,0 +1,445 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +MODULES_OPTIONAL_USE="driver" +inherit desktop flag-o-matic linux-mod multilib readme.gentoo-r1 \ + systemd toolchain-funcs unpacker + +NV_KERNEL_MAX="5.15" +NV_PIN="470.103.01" + +DESCRIPTION="NVIDIA Accelerated Graphics Driver" +HOMEPAGE="https://developer.nvidia.com/vulkan-driver" +SRC_URI=" + https://developer.nvidia.com/vulkan-beta-${PV//.}-linux -> NVIDIA-Linux-x86_64-${PV}.run + $(printf "https://download.nvidia.com/XFree86/%s/%s-${NV_PIN}.tar.bz2 " \ + nvidia-{installer,modprobe,persistenced,settings,xconfig}{,})" +# nvidia-installer is unused but here for GPL-2's "distribute sources" +S="${WORKDIR}" + +LICENSE="NVIDIA-r2 BSD BSD-2 GPL-2 MIT ZLIB curl openssl" +SLOT="0/vulkan" +KEYWORDS="-* ~amd64" +IUSE="+X abi_x86_32 abi_x86_64 +driver persistenced +static-libs +tools wayland" + +COMMON_DEPEND=" + acct-group/video + sys-libs/glibc + persistenced? ( + acct-user/nvpd + net-libs/libtirpc:= + ) + tools? ( + dev-libs/atk + dev-libs/glib:2 + dev-libs/jansson:= + media-libs/harfbuzz:= + x11-libs/cairo + x11-libs/gdk-pixbuf:2 + x11-libs/gtk+:3 + x11-libs/libX11 + x11-libs/libXext + x11-libs/libXxf86vm + x11-libs/pango + )" +RDEPEND=" + ${COMMON_DEPEND} + X? ( + media-libs/libglvnd[X,abi_x86_32(-)?] + x11-libs/libX11[abi_x86_32(-)?] + x11-libs/libXext[abi_x86_32(-)?] + ) + wayland? ( + ~gui-libs/egl-wayland-1.1.7 + media-libs/libglvnd + )" +DEPEND=" + ${COMMON_DEPEND} + static-libs? ( + x11-libs/libX11 + x11-libs/libXext + ) + tools? ( + media-libs/libglvnd + sys-apps/dbus + x11-base/xorg-proto + x11-libs/libXrandr + x11-libs/libXv + x11-libs/libvdpau + )" +BDEPEND=" + sys-devel/m4 + virtual/pkgconfig" + +QA_PREBUILT="lib/firmware/* opt/bin/* usr/lib*" + +PATCHES=( + "${FILESDIR}"/nvidia-modprobe-390.141-uvm-perms.patch + "${FILESDIR}"/nvidia-settings-390.144-desktop.patch + "${FILESDIR}"/nvidia-settings-390.144-no-gtk2.patch + "${FILESDIR}"/nvidia-settings-390.144-raw-ldflags.patch +) + +pkg_setup() { + use driver || return + + local CONFIG_CHECK=" + PROC_FS + ~DRM_KMS_HELPER + ~SYSVIPC + ~!LOCKDEP + ~!SLUB_DEBUG_ON + !DEBUG_MUTEXES" + local ERROR_DRM_KMS_HELPER="CONFIG_DRM_KMS_HELPER: is not set but needed for Xorg auto-detection + of drivers (no custom config), and for wayland / nvidia-drm.modeset=1. + Cannot be directly selected in the kernel's menuconfig, and may need + selection of a DRM device even if unused, e.g. CONFIG_DRM_AMDGPU=m or + DRM_I915=y, DRM_NOUVEAU=m also acceptable if a module and not built-in." + + use amd64 && kernel_is -ge 5 8 && CONFIG_CHECK+=" X86_PAT" #817764 + + MODULE_NAMES=" + nvidia(video:kernel) + nvidia-drm(video:kernel) + nvidia-modeset(video:kernel) + nvidia-peermem(video:kernel) + nvidia-uvm(video:kernel)" + + linux-mod_pkg_setup + + [[ ${MERGE_TYPE} == binary ]] && return + + BUILD_PARAMS='NV_VERBOSE=1 IGNORE_CC_MISMATCH=yes SYSSRC="${KV_DIR}" SYSOUT="${KV_OUT_DIR}"' + BUILD_TARGETS="modules" + + if linux_chkconfig_present CC_IS_CLANG; then + ewarn "Warning: building ${PN} with a clang-built kernel is experimental" + + BUILD_PARAMS+=' CC=${CHOST}-clang' + if linux_chkconfig_present LD_IS_LLD; then + BUILD_PARAMS+=' LD=ld.lld' + if linux_chkconfig_present LTO_CLANG_THIN; then + # kernel enables cache by default leading to sandbox violations + BUILD_PARAMS+=' ldflags-y=--thinlto-cache-dir= LDFLAGS_MODULE=--thinlto-cache-dir=' + fi + fi + fi + + if kernel_is -gt ${NV_KERNEL_MAX/./ }; then + ewarn "Kernel ${KV_MAJOR}.${KV_MINOR} is either known to break this version of ${PN}" + ewarn "or was not tested with it. It is recommended to use one of:" + ewarn " <=sys-kernel/gentoo-kernel-${NV_KERNEL_MAX}.x" + ewarn " <=sys-kernel/gentoo-sources-${NV_KERNEL_MAX}.x" + ewarn "You are free to try or use /etc/portage/patches, but support will" + ewarn "not be given and issues wait until NVIDIA releases a fixed version." + ewarn + ewarn "Do _not_ file a bug report if run into issues." + ewarn + fi +} + +src_prepare() { + # make patches usable across versions + rm nvidia-modprobe && mv nvidia-modprobe{-${NV_PIN},} || die + rm nvidia-persistenced && mv nvidia-persistenced{-${NV_PIN},} || die + rm nvidia-settings && mv nvidia-settings{-${NV_PIN},} || die + rm nvidia-xconfig && mv nvidia-xconfig{-${NV_PIN},} || die + + default + + # prevent detection of incomplete kernel DRM support (bug #603818) + sed 's/defined(CONFIG_DRM/defined(CONFIG_DRM_KMS_HELPER/g' \ + -i kernel/conftest.sh || die + + sed 's/__USER__/nvpd/' \ + nvidia-persistenced/init/systemd/nvidia-persistenced.service.template \ + > "${T}"/nvidia-persistenced.service || die + + # enable nvidia-drm.modeset=1 by default with USE=wayland + cp "${FILESDIR}"/nvidia-470.conf "${T}"/nvidia.conf || die + use !wayland || sed -i '/^#.*modeset=1$/s/^#//' "${T}"/nvidia.conf || die +} + +src_compile() { + tc-export AR CC LD OBJCOPY + + NV_ARGS=( + PREFIX="${EPREFIX}"/usr + HOST_CC="$(tc-getBUILD_CC)" + HOST_LD="$(tc-getBUILD_LD)" + NV_USE_BUNDLED_LIBJANSSON=0 + NV_VERBOSE=1 DO_STRIP= MANPAGE_GZIP= OUTPUTDIR=out + ) + + use driver && linux-mod_src_compile + + emake "${NV_ARGS[@]}" -C nvidia-modprobe + use persistenced && emake "${NV_ARGS[@]}" -C nvidia-persistenced + use X && emake "${NV_ARGS[@]}" -C nvidia-xconfig + + if use tools; then + # cflags: avoid noisy logs, only use here and set first to let override + # ldflags: abi currently needed if LD=ld.lld + CFLAGS="-Wno-deprecated-declarations ${CFLAGS}" \ + RAW_LDFLAGS="$(get_abi_LDFLAGS) $(raw-ldflags)" \ + emake "${NV_ARGS[@]}" -C nvidia-settings + elif use static-libs; then + emake "${NV_ARGS[@]}" -C nvidia-settings/src out/libXNVCtrl.a + fi +} + +src_install() { + local libdir=$(get_libdir) libdir32=$(ABI=x86 get_libdir) + + NV_ARGS+=( DESTDIR="${D}" LIBDIR="${ED}"/usr/${libdir} ) + + local -A paths=( + [APPLICATION_PROFILE]=/usr/share/nvidia + [CUDA_ICD]=/etc/OpenCL/vendors + [EGL_EXTERNAL_PLATFORM_JSON]=/usr/share/egl/egl_external_platform.d + [FIRMWARE]=/lib/firmware/nvidia/${PV} + [GLVND_EGL_ICD_JSON]=/usr/share/glvnd/egl_vendor.d + [VULKAN_ICD_JSON]=/usr/share/vulkan + [WINE_LIB]=/usr/${libdir}/nvidia/wine + [XORG_OUTPUTCLASS_CONFIG]=/usr/share/X11/xorg.conf.d + + [GLX_MODULE_SHARED_LIB]=/usr/${libdir}/xorg/modules/extensions + [GLX_MODULE_SYMLINK]=/usr/${libdir}/xorg/modules + [XMODULE_SHARED_LIB]=/usr/${libdir}/xorg/modules + ) + + local skip_files=( + # nvidia_icd/layers(vulkan): skip with -X too as it uses libGLX_nvidia + $(usev !X " + libGLX_nvidia libglxserver_nvidia + libnvidia-ifr + nvidia_icd.json nvidia_layers.json") + $(usev !wayland libnvidia-vulkan-producer) + libGLX_indirect # non-glvnd unused fallback + libnvidia-gtk nvidia-{settings,xconfig} # built from source + libnvidia-egl-wayland 10_nvidia_wayland # gui-libs/egl-wayland + ) + local skip_modules=( + $(usev !X "nvfbc vdpau xdriver") + $(usev !driver gsp) + installer nvpd # handled separately / built from source + ) + local skip_types=( + GLVND_LIB GLVND_SYMLINK EGL_CLIENT.\* GLX_CLIENT.\* # media-libs/libglvnd + OPENCL_WRAPPER.\* # virtual/opencl + DOCUMENTATION DOT_DESKTOP .\*_SRC DKMS_CONF # handled separately / unused + ) + + local DOCS=( + README.txt NVIDIA_Changelog supported-gpus/supported-gpus.json + nvidia-settings/doc/{FRAMELOCK,NV-CONTROL-API}.txt + ) + local HTML_DOCS=( html/. ) + einstalldocs + + local DISABLE_AUTOFORMATTING=yes + local DOC_CONTENTS="\ +Trusted users should be in the 'video' group to use NVIDIA devices. +You can add yourself by using: gpasswd -a my-user video\ +$(usev driver " + +Like all out-of-tree kernel modules, it is necessary to rebuild +${PN} after upgrading or rebuilding the Linux kernel +by for example running \`emerge @module-rebuild\`. Alternatively, +if using a distribution kernel (sys-kernel/gentoo-kernel{,-bin}), +this can be automated by setting USE=dist-kernel globally. + +Loaded kernel modules also must not mismatch with the installed +${PN} version (excluding -r revision), meaning should +ensure \`eselect kernel list\` points to the kernel that will be +booted before building and preferably reboot after upgrading +${PN} (the ebuild will emit a warning if mismatching). + +See '${EPREFIX}/etc/modprobe.d/nvidia.conf' for modules options.")\ +$(use amd64 && usev !abi_x86_32 " + +Note that without USE=abi_x86_32 on ${PN}, 32bit applications +(typically using wine / steam) will not be able to use GPU acceleration.") + +For general information on using ${PN}, please see: +https://wiki.gentoo.org/wiki/NVIDIA/nvidia-drivers" + readme.gentoo_create_doc + + if use driver; then + linux-mod_src_install + + insinto /etc/modprobe.d + doins "${T}"/nvidia.conf + + # used for gpu verification with binpkgs (not kept, see pkg_preinst) + insinto /usr/share/nvidia + doins supported-gpus/supported-gpus.json + fi + + emake "${NV_ARGS[@]}" -C nvidia-modprobe install + fowners :video /usr/bin/nvidia-modprobe #505092 + fperms 4710 /usr/bin/nvidia-modprobe + + if use persistenced; then + emake "${NV_ARGS[@]}" -C nvidia-persistenced install + newconfd "${FILESDIR}"/nvidia-persistenced.confd nvidia-persistenced + newinitd "${FILESDIR}"/nvidia-persistenced.initd nvidia-persistenced + systemd_dounit "${T}"/nvidia-persistenced.service + fi + + if use tools; then + emake "${NV_ARGS[@]}" -C nvidia-settings install + + doicon nvidia-settings/doc/nvidia-settings.png + domenu nvidia-settings/doc/nvidia-settings.desktop + + exeinto /etc/X11/xinit/xinitrc.d + newexe "${FILESDIR}"/95-nvidia-settings-r1 95-nvidia-settings + fi + + if use static-libs; then + dolib.a nvidia-settings/src/out/libXNVCtrl.a + + insinto /usr/include/NVCtrl + doins nvidia-settings/src/libXNVCtrl/NVCtrl{Lib,}.h + fi + + use X && emake "${NV_ARGS[@]}" -C nvidia-xconfig install + + # mimic nvidia-installer by reading .manifest to install files + # 0:file 1:perms 2:type 3+:subtype/arguments -:module + local m into + while IFS=' ' read -ra m; do + ! [[ ${#m[@]} -ge 2 && ${m[-1]} =~ MODULE: ]] || + eval '[[ " ${m[0]##*/}" =~ ^(\ '${skip_files[*]/%/.*|\\}' )$ ]]' || + eval '[[ " ${m[2]}" =~ ^(\ '${skip_types[*]/%/|\\}' )$ ]]' || + has ${m[-1]#MODULE:} "${skip_modules[@]}" && continue + + case ${m[2]} in + MANPAGE) + gzip -dc ${m[0]} | newman - ${m[0]%.gz}; assert + continue + ;; + VDPAU_SYMLINK) m[4]=vdpau/; m[5]=${m[5]#vdpau/};; # .so to vdpau/ + esac + + if [[ -v paths[${m[2]}] ]]; then + into=${paths[${m[2]}]} + elif [[ ${m[2]} =~ _BINARY$ ]]; then + into=/opt/bin + elif [[ ${m[3]} == COMPAT32 ]]; then + use abi_x86_32 || continue + into=/usr/${libdir32} + elif [[ ${m[2]} =~ _LIB$|_SYMLINK$ ]]; then + into=/usr/${libdir} + else + die "No known installation path for ${m[0]}" + fi + [[ ${m[3]: -2} == ?/ ]] && into+=/${m[3]%/} + [[ ${m[4]: -2} == ?/ ]] && into+=/${m[4]%/} + + if [[ ${m[2]} =~ _SYMLINK$ ]]; then + [[ ${m[4]: -1} == / ]] && m[4]=${m[5]} + dosym ${m[4]} ${into}/${m[0]} + continue + fi + [[ ${m[0]} =~ ^libnvidia-ngx.so ]] && + dosym ${m[0]} ${into}/${m[0]%.so*}.so.1 # soname not in .manifest + + printf -v m[1] %o $((m[1] | 0200)) # 444->644 + insopts -m${m[1]} + insinto ${into} + doins ${m[0]} + done < .manifest || die + + # MODULE:installer non-skipped extras + exeinto /lib/systemd/system-sleep + doexe systemd/system-sleep/nvidia + dobin systemd/nvidia-sleep.sh + systemd_dounit systemd/system/nvidia-{hibernate,resume,suspend}.service + + dobin nvidia-bug-report.sh +} + +pkg_preinst() { + has_version "${CATEGORY}/${PN}[abi_x86_32]" && NV_HAD_ABI32= + has_version "${CATEGORY}/${PN}[wayland]" && NV_HAD_WAYLAND= + + use driver || return + linux-mod_pkg_preinst + + # set video group id based on live system (bug #491414) + local g=$(getent group video | cut -d: -f3) + [[ ${g} ]] || die "Failed to determine video group id" + sed -i "s/@VIDEOGID@/${g}/" "${ED}"/etc/modprobe.d/nvidia.conf || die + + # try to find driver mismatches using temporary supported-gpus.json + for g in $(grep -l 0x10de /sys/bus/pci/devices/*/vendor 2>/dev/null); do + g=$(grep -io "\"devid\":\"$(<${g%vendor}device)\"[^}]*branch\":\"[0-9]*" \ + "${ED}"/usr/share/nvidia/supported-gpus.json 2>/dev/null) + if [[ ${g} ]]; then + g=$((${g##*\"}+1)) + if ver_test -ge ${g}; then + NV_LEGACY_MASK=">=${CATEGORY}/${PN}-${g}" + break + fi + fi + done + rm "${ED}"/usr/share/nvidia/supported-gpus.json || die +} + +pkg_postinst() { + use driver && linux-mod_pkg_postinst + + readme.gentoo_print_elog + + if [[ -r /proc/driver/nvidia/version && + $(</proc/driver/nvidia/version) != *" ${PV} "* ]]; then + ewarn "Currently loaded NVIDIA modules do not match the newly installed" + ewarn "libraries and may prevent launching GPU-accelerated applications." + use driver && ewarn "The easiest way to fix this is usually to reboot." + fi + + if [[ $(</proc/cmdline) == *slub_debug=[!-]* ]]; then + ewarn "Detected that the current kernel command line is using 'slub_debug='," + ewarn "this may lead to system instability/freezes with this version of" + ewarn "${PN}. Bug: https://bugs.gentoo.org/796329" + fi + + if [[ -v NV_LEGACY_MASK ]]; then + ewarn + ewarn "***WARNING***" + ewarn + ewarn "You are installing a version of ${PN} known not to work" + ewarn "with a GPU of the current system. If unwanted, add the mask:" + if [[ -d ${EROOT}/etc/portage/package.mask ]]; then + ewarn " echo '${NV_LEGACY_MASK}' > ${EROOT}/etc/portage/package.mask/${PN}" + else + ewarn " echo '${NV_LEGACY_MASK}' >> ${EROOT}/etc/portage/package.mask" + fi + ewarn "...then downgrade to a legacy branch if possible. For details, see:" + ewarn "https://www.nvidia.com/object/IO_32667.html" + fi + + if use !abi_x86_32 && [[ -v NV_HAD_ABI32 ]]; then + elog + elog "USE=abi_x86_32 is disabled, 32bit applications will not be able to" + elog "use nvidia-drivers for acceleration without it (e.g. commonly used" + elog "with app-emulation/wine-* or steam). Re-enable if needed." + fi + + if use wayland && use driver && [[ ! -v NV_HAD_WAYLAND ]]; then + elog + elog "With USE=wayland, this version of ${PN} sets nvidia-drm.modeset=1" + elog "in '${EROOT}/etc/modprobe.d/nvidia.conf'. This feature is considered" + elog "experimental but is required for wayland." + elog + elog "If you experience issues, either disable wayland or edit nvidia.conf." + elog "Of note, may possibly cause issues with SLI and Reverse PRIME." + elog + elog "This version of ${PN} only supports EGLStream which is only" + elog "supported by a few wayland compositors (e.g. kwin / mutter, not sway)." + fi +} |