Gentoo Archives: gentoo-commits

From: Ionen Wolkens <ionen@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: x11-drivers/nvidia-drivers/
Date: Tue, 29 Mar 2022 15:45:47
Message-Id: 1648568100.e66979b5cadef320ba60ecb3f92e78c244d7c7d6.ionen@gentoo
1 commit: e66979b5cadef320ba60ecb3f92e78c244d7c7d6
2 Author: Ionen Wolkens <ionen <AT> gentoo <DOT> org>
3 AuthorDate: Tue Mar 29 15:31:18 2022 +0000
4 Commit: Ionen Wolkens <ionen <AT> gentoo <DOT> org>
5 CommitDate: Tue Mar 29 15:35:00 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e66979b5
7
8 x11-drivers/nvidia-drivers: add 470.62.26:0/vulkan
9
10 Also EAPI=8 and sync NV_PIN with latest 470 (this is not actively
11 tested for masked 0/vulkan, please report if issues).
12
13 Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org>
14
15 x11-drivers/nvidia-drivers/Manifest | 1 +
16 .../nvidia-drivers/nvidia-drivers-470.62.26.ebuild | 445 +++++++++++++++++++++
17 2 files changed, 446 insertions(+)
18
19 diff --git a/x11-drivers/nvidia-drivers/Manifest b/x11-drivers/nvidia-drivers/Manifest
20 index 10b90ffdb366..38caffb56bf8 100644
21 --- a/x11-drivers/nvidia-drivers/Manifest
22 +++ b/x11-drivers/nvidia-drivers/Manifest
23 @@ -4,6 +4,7 @@ DIST NVIDIA-Linux-x86-390.147.run 49303088 BLAKE2B 5a3a02b88af1ee8699b0c6c3fa222
24 DIST NVIDIA-Linux-x86_64-390.147.run 85930997 BLAKE2B a8085c9abc1c31251788a8f5abdc2090c9085b3028e364184244bbf24d822dc3266877c88b30f403507fa2dd511c68ec67e1f188d6b0f1f4d7d792881d5253fc SHA512 0d8bda32e916d71da2ea74bc12a4f3cb0a0c2ddda27511cf3c89bbf4aeb28db68f6b7261639d88dd1c0180b91213c09de930d233158268c5d9ab3b223510e964
25 DIST NVIDIA-Linux-x86_64-470.103.01.run 272484410 BLAKE2B 42a19ed990f49d4ceefc1006f3e6e4b69135ad2aaf497c648b9afe7941a81aba3a51296cb14bc419352cdf70f850484d2a55784184fdb820186193501422d742 SHA512 3dc19774a6fef5e6ec0cb9451df4268f77cb31b0a9ede253bf9cf805a048ad457a7bfec852aaeab3e3e297b3353840a3d6c9c7ddc75d57b2b000ab4e0b15530b
26 DIST NVIDIA-Linux-x86_64-470.62.22.run 272128606 BLAKE2B 727aac085a73c4c953ddb58a5b887b70eb65b5b89cdd556d122d89d351444fbed0adfa3c34627a9ab0d13c42ac93732d9fa023e580894117dd0c06098b386208 SHA512 9e9f6a665034495bbfd438567fb9a0998adbfcc979fd1e0370d355b4f312e4c1fb5162b15e5264cc89d3aca6dcaf84ce7ebfff0885ac783dfcd8be3b99b3b96f
27 +DIST NVIDIA-Linux-x86_64-470.62.26.run 272619538 BLAKE2B dd68260661473b5d6a10be42eac376d662e9656ab63b24442f8aab4f7bfd916f6255650f931334fedb3c3023acbd2512a9bbaf698a01a0c3ea40d7eee84014bc SHA512 13cd30cea4c7390ea7e0c0a41842258b488082b358b0d9a13c21637b79efe470ae6ee4e86902ba81d01cb6be0700449c6f545d87aca2708f62be22530d41b693
28 DIST NVIDIA-Linux-x86_64-510.54.run 328899755 BLAKE2B b83ebb1c978f902812d7dae2170eadfa1d52d36dc1e9ed61001c0483743ad8094268f101a4414353936339a4d064d54ad41cc229906ee7dbef3aa56af5315764 SHA512 1e65e96c1ae1cccd5cd483f2b65927e3594d28f3774459dfd094530f445f4b0f5368a3b7eebf4970bd2632438cca2cbb93af50a59a3a87a2c13d08ed5155164c
29 DIST NVIDIA-Linux-x86_64-510.60.02.run 328284028 BLAKE2B 9165e4763a34c3cf474c18dae7d2c548bb6d4edc21507afe67d046959e9f3fb758cf507dcdffcfbc0bf70cf2b677a193429127b3fe589af329fe6a671ac51e6f SHA512 ccc459bdf5f89a37f79a1831bac8c03980deaa13082b516d5e9c74a49e1aea7f1f6b03304705a95564a390bf0ca38df10b8c8b73e3470a31444dd5ebfd981cfd
30 DIST nvidia-installer-390.147.tar.bz2 150157 BLAKE2B 3bf5317aaa3bdb0e6dc3b3e21ad3dbacf6dc782a643b0fa9badf354361891ab25660b57dd408e346f219d469af317a4851937e1cb77ffe59a39e9d98a92f3a40 SHA512 24bd8a2959062551abf2ea039ac95eba224d58c175f59f1386a6d43459ad43b2bddf17f00b53c1c71c45eca3b7a2281dcf05cc65030f6f8bed16d0f0b9f9c282
31
32 diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-470.62.26.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-470.62.26.ebuild
33 new file mode 100644
34 index 000000000000..3b539a6e7020
35 --- /dev/null
36 +++ b/x11-drivers/nvidia-drivers/nvidia-drivers-470.62.26.ebuild
37 @@ -0,0 +1,445 @@
38 +# Copyright 1999-2022 Gentoo Authors
39 +# Distributed under the terms of the GNU General Public License v2
40 +
41 +EAPI=8
42 +
43 +MODULES_OPTIONAL_USE="driver"
44 +inherit desktop flag-o-matic linux-mod multilib readme.gentoo-r1 \
45 + systemd toolchain-funcs unpacker
46 +
47 +NV_KERNEL_MAX="5.15"
48 +NV_PIN="470.103.01"
49 +
50 +DESCRIPTION="NVIDIA Accelerated Graphics Driver"
51 +HOMEPAGE="https://developer.nvidia.com/vulkan-driver"
52 +SRC_URI="
53 + https://developer.nvidia.com/vulkan-beta-${PV//.}-linux -> NVIDIA-Linux-x86_64-${PV}.run
54 + $(printf "https://download.nvidia.com/XFree86/%s/%s-${NV_PIN}.tar.bz2 " \
55 + nvidia-{installer,modprobe,persistenced,settings,xconfig}{,})"
56 +# nvidia-installer is unused but here for GPL-2's "distribute sources"
57 +S="${WORKDIR}"
58 +
59 +LICENSE="NVIDIA-r2 BSD BSD-2 GPL-2 MIT ZLIB curl openssl"
60 +SLOT="0/vulkan"
61 +KEYWORDS="-* ~amd64"
62 +IUSE="+X abi_x86_32 abi_x86_64 +driver persistenced +static-libs +tools wayland"
63 +
64 +COMMON_DEPEND="
65 + acct-group/video
66 + sys-libs/glibc
67 + persistenced? (
68 + acct-user/nvpd
69 + net-libs/libtirpc:=
70 + )
71 + tools? (
72 + dev-libs/atk
73 + dev-libs/glib:2
74 + dev-libs/jansson:=
75 + media-libs/harfbuzz:=
76 + x11-libs/cairo
77 + x11-libs/gdk-pixbuf:2
78 + x11-libs/gtk+:3
79 + x11-libs/libX11
80 + x11-libs/libXext
81 + x11-libs/libXxf86vm
82 + x11-libs/pango
83 + )"
84 +RDEPEND="
85 + ${COMMON_DEPEND}
86 + X? (
87 + media-libs/libglvnd[X,abi_x86_32(-)?]
88 + x11-libs/libX11[abi_x86_32(-)?]
89 + x11-libs/libXext[abi_x86_32(-)?]
90 + )
91 + wayland? (
92 + ~gui-libs/egl-wayland-1.1.7
93 + media-libs/libglvnd
94 + )"
95 +DEPEND="
96 + ${COMMON_DEPEND}
97 + static-libs? (
98 + x11-libs/libX11
99 + x11-libs/libXext
100 + )
101 + tools? (
102 + media-libs/libglvnd
103 + sys-apps/dbus
104 + x11-base/xorg-proto
105 + x11-libs/libXrandr
106 + x11-libs/libXv
107 + x11-libs/libvdpau
108 + )"
109 +BDEPEND="
110 + sys-devel/m4
111 + virtual/pkgconfig"
112 +
113 +QA_PREBUILT="lib/firmware/* opt/bin/* usr/lib*"
114 +
115 +PATCHES=(
116 + "${FILESDIR}"/nvidia-modprobe-390.141-uvm-perms.patch
117 + "${FILESDIR}"/nvidia-settings-390.144-desktop.patch
118 + "${FILESDIR}"/nvidia-settings-390.144-no-gtk2.patch
119 + "${FILESDIR}"/nvidia-settings-390.144-raw-ldflags.patch
120 +)
121 +
122 +pkg_setup() {
123 + use driver || return
124 +
125 + local CONFIG_CHECK="
126 + PROC_FS
127 + ~DRM_KMS_HELPER
128 + ~SYSVIPC
129 + ~!LOCKDEP
130 + ~!SLUB_DEBUG_ON
131 + !DEBUG_MUTEXES"
132 + local ERROR_DRM_KMS_HELPER="CONFIG_DRM_KMS_HELPER: is not set but needed for Xorg auto-detection
133 + of drivers (no custom config), and for wayland / nvidia-drm.modeset=1.
134 + Cannot be directly selected in the kernel's menuconfig, and may need
135 + selection of a DRM device even if unused, e.g. CONFIG_DRM_AMDGPU=m or
136 + DRM_I915=y, DRM_NOUVEAU=m also acceptable if a module and not built-in."
137 +
138 + use amd64 && kernel_is -ge 5 8 && CONFIG_CHECK+=" X86_PAT" #817764
139 +
140 + MODULE_NAMES="
141 + nvidia(video:kernel)
142 + nvidia-drm(video:kernel)
143 + nvidia-modeset(video:kernel)
144 + nvidia-peermem(video:kernel)
145 + nvidia-uvm(video:kernel)"
146 +
147 + linux-mod_pkg_setup
148 +
149 + [[ ${MERGE_TYPE} == binary ]] && return
150 +
151 + BUILD_PARAMS='NV_VERBOSE=1 IGNORE_CC_MISMATCH=yes SYSSRC="${KV_DIR}" SYSOUT="${KV_OUT_DIR}"'
152 + BUILD_TARGETS="modules"
153 +
154 + if linux_chkconfig_present CC_IS_CLANG; then
155 + ewarn "Warning: building ${PN} with a clang-built kernel is experimental"
156 +
157 + BUILD_PARAMS+=' CC=${CHOST}-clang'
158 + if linux_chkconfig_present LD_IS_LLD; then
159 + BUILD_PARAMS+=' LD=ld.lld'
160 + if linux_chkconfig_present LTO_CLANG_THIN; then
161 + # kernel enables cache by default leading to sandbox violations
162 + BUILD_PARAMS+=' ldflags-y=--thinlto-cache-dir= LDFLAGS_MODULE=--thinlto-cache-dir='
163 + fi
164 + fi
165 + fi
166 +
167 + if kernel_is -gt ${NV_KERNEL_MAX/./ }; then
168 + ewarn "Kernel ${KV_MAJOR}.${KV_MINOR} is either known to break this version of ${PN}"
169 + ewarn "or was not tested with it. It is recommended to use one of:"
170 + ewarn " <=sys-kernel/gentoo-kernel-${NV_KERNEL_MAX}.x"
171 + ewarn " <=sys-kernel/gentoo-sources-${NV_KERNEL_MAX}.x"
172 + ewarn "You are free to try or use /etc/portage/patches, but support will"
173 + ewarn "not be given and issues wait until NVIDIA releases a fixed version."
174 + ewarn
175 + ewarn "Do _not_ file a bug report if run into issues."
176 + ewarn
177 + fi
178 +}
179 +
180 +src_prepare() {
181 + # make patches usable across versions
182 + rm nvidia-modprobe && mv nvidia-modprobe{-${NV_PIN},} || die
183 + rm nvidia-persistenced && mv nvidia-persistenced{-${NV_PIN},} || die
184 + rm nvidia-settings && mv nvidia-settings{-${NV_PIN},} || die
185 + rm nvidia-xconfig && mv nvidia-xconfig{-${NV_PIN},} || die
186 +
187 + default
188 +
189 + # prevent detection of incomplete kernel DRM support (bug #603818)
190 + sed 's/defined(CONFIG_DRM/defined(CONFIG_DRM_KMS_HELPER/g' \
191 + -i kernel/conftest.sh || die
192 +
193 + sed 's/__USER__/nvpd/' \
194 + nvidia-persistenced/init/systemd/nvidia-persistenced.service.template \
195 + > "${T}"/nvidia-persistenced.service || die
196 +
197 + # enable nvidia-drm.modeset=1 by default with USE=wayland
198 + cp "${FILESDIR}"/nvidia-470.conf "${T}"/nvidia.conf || die
199 + use !wayland || sed -i '/^#.*modeset=1$/s/^#//' "${T}"/nvidia.conf || die
200 +}
201 +
202 +src_compile() {
203 + tc-export AR CC LD OBJCOPY
204 +
205 + NV_ARGS=(
206 + PREFIX="${EPREFIX}"/usr
207 + HOST_CC="$(tc-getBUILD_CC)"
208 + HOST_LD="$(tc-getBUILD_LD)"
209 + NV_USE_BUNDLED_LIBJANSSON=0
210 + NV_VERBOSE=1 DO_STRIP= MANPAGE_GZIP= OUTPUTDIR=out
211 + )
212 +
213 + use driver && linux-mod_src_compile
214 +
215 + emake "${NV_ARGS[@]}" -C nvidia-modprobe
216 + use persistenced && emake "${NV_ARGS[@]}" -C nvidia-persistenced
217 + use X && emake "${NV_ARGS[@]}" -C nvidia-xconfig
218 +
219 + if use tools; then
220 + # cflags: avoid noisy logs, only use here and set first to let override
221 + # ldflags: abi currently needed if LD=ld.lld
222 + CFLAGS="-Wno-deprecated-declarations ${CFLAGS}" \
223 + RAW_LDFLAGS="$(get_abi_LDFLAGS) $(raw-ldflags)" \
224 + emake "${NV_ARGS[@]}" -C nvidia-settings
225 + elif use static-libs; then
226 + emake "${NV_ARGS[@]}" -C nvidia-settings/src out/libXNVCtrl.a
227 + fi
228 +}
229 +
230 +src_install() {
231 + local libdir=$(get_libdir) libdir32=$(ABI=x86 get_libdir)
232 +
233 + NV_ARGS+=( DESTDIR="${D}" LIBDIR="${ED}"/usr/${libdir} )
234 +
235 + local -A paths=(
236 + [APPLICATION_PROFILE]=/usr/share/nvidia
237 + [CUDA_ICD]=/etc/OpenCL/vendors
238 + [EGL_EXTERNAL_PLATFORM_JSON]=/usr/share/egl/egl_external_platform.d
239 + [FIRMWARE]=/lib/firmware/nvidia/${PV}
240 + [GLVND_EGL_ICD_JSON]=/usr/share/glvnd/egl_vendor.d
241 + [VULKAN_ICD_JSON]=/usr/share/vulkan
242 + [WINE_LIB]=/usr/${libdir}/nvidia/wine
243 + [XORG_OUTPUTCLASS_CONFIG]=/usr/share/X11/xorg.conf.d
244 +
245 + [GLX_MODULE_SHARED_LIB]=/usr/${libdir}/xorg/modules/extensions
246 + [GLX_MODULE_SYMLINK]=/usr/${libdir}/xorg/modules
247 + [XMODULE_SHARED_LIB]=/usr/${libdir}/xorg/modules
248 + )
249 +
250 + local skip_files=(
251 + # nvidia_icd/layers(vulkan): skip with -X too as it uses libGLX_nvidia
252 + $(usev !X "
253 + libGLX_nvidia libglxserver_nvidia
254 + libnvidia-ifr
255 + nvidia_icd.json nvidia_layers.json")
256 + $(usev !wayland libnvidia-vulkan-producer)
257 + libGLX_indirect # non-glvnd unused fallback
258 + libnvidia-gtk nvidia-{settings,xconfig} # built from source
259 + libnvidia-egl-wayland 10_nvidia_wayland # gui-libs/egl-wayland
260 + )
261 + local skip_modules=(
262 + $(usev !X "nvfbc vdpau xdriver")
263 + $(usev !driver gsp)
264 + installer nvpd # handled separately / built from source
265 + )
266 + local skip_types=(
267 + GLVND_LIB GLVND_SYMLINK EGL_CLIENT.\* GLX_CLIENT.\* # media-libs/libglvnd
268 + OPENCL_WRAPPER.\* # virtual/opencl
269 + DOCUMENTATION DOT_DESKTOP .\*_SRC DKMS_CONF # handled separately / unused
270 + )
271 +
272 + local DOCS=(
273 + README.txt NVIDIA_Changelog supported-gpus/supported-gpus.json
274 + nvidia-settings/doc/{FRAMELOCK,NV-CONTROL-API}.txt
275 + )
276 + local HTML_DOCS=( html/. )
277 + einstalldocs
278 +
279 + local DISABLE_AUTOFORMATTING=yes
280 + local DOC_CONTENTS="\
281 +Trusted users should be in the 'video' group to use NVIDIA devices.
282 +You can add yourself by using: gpasswd -a my-user video\
283 +$(usev driver "
284 +
285 +Like all out-of-tree kernel modules, it is necessary to rebuild
286 +${PN} after upgrading or rebuilding the Linux kernel
287 +by for example running \`emerge @module-rebuild\`. Alternatively,
288 +if using a distribution kernel (sys-kernel/gentoo-kernel{,-bin}),
289 +this can be automated by setting USE=dist-kernel globally.
290 +
291 +Loaded kernel modules also must not mismatch with the installed
292 +${PN} version (excluding -r revision), meaning should
293 +ensure \`eselect kernel list\` points to the kernel that will be
294 +booted before building and preferably reboot after upgrading
295 +${PN} (the ebuild will emit a warning if mismatching).
296 +
297 +See '${EPREFIX}/etc/modprobe.d/nvidia.conf' for modules options.")\
298 +$(use amd64 && usev !abi_x86_32 "
299 +
300 +Note that without USE=abi_x86_32 on ${PN}, 32bit applications
301 +(typically using wine / steam) will not be able to use GPU acceleration.")
302 +
303 +For general information on using ${PN}, please see:
304 +https://wiki.gentoo.org/wiki/NVIDIA/nvidia-drivers"
305 + readme.gentoo_create_doc
306 +
307 + if use driver; then
308 + linux-mod_src_install
309 +
310 + insinto /etc/modprobe.d
311 + doins "${T}"/nvidia.conf
312 +
313 + # used for gpu verification with binpkgs (not kept, see pkg_preinst)
314 + insinto /usr/share/nvidia
315 + doins supported-gpus/supported-gpus.json
316 + fi
317 +
318 + emake "${NV_ARGS[@]}" -C nvidia-modprobe install
319 + fowners :video /usr/bin/nvidia-modprobe #505092
320 + fperms 4710 /usr/bin/nvidia-modprobe
321 +
322 + if use persistenced; then
323 + emake "${NV_ARGS[@]}" -C nvidia-persistenced install
324 + newconfd "${FILESDIR}"/nvidia-persistenced.confd nvidia-persistenced
325 + newinitd "${FILESDIR}"/nvidia-persistenced.initd nvidia-persistenced
326 + systemd_dounit "${T}"/nvidia-persistenced.service
327 + fi
328 +
329 + if use tools; then
330 + emake "${NV_ARGS[@]}" -C nvidia-settings install
331 +
332 + doicon nvidia-settings/doc/nvidia-settings.png
333 + domenu nvidia-settings/doc/nvidia-settings.desktop
334 +
335 + exeinto /etc/X11/xinit/xinitrc.d
336 + newexe "${FILESDIR}"/95-nvidia-settings-r1 95-nvidia-settings
337 + fi
338 +
339 + if use static-libs; then
340 + dolib.a nvidia-settings/src/out/libXNVCtrl.a
341 +
342 + insinto /usr/include/NVCtrl
343 + doins nvidia-settings/src/libXNVCtrl/NVCtrl{Lib,}.h
344 + fi
345 +
346 + use X && emake "${NV_ARGS[@]}" -C nvidia-xconfig install
347 +
348 + # mimic nvidia-installer by reading .manifest to install files
349 + # 0:file 1:perms 2:type 3+:subtype/arguments -:module
350 + local m into
351 + while IFS=' ' read -ra m; do
352 + ! [[ ${#m[@]} -ge 2 && ${m[-1]} =~ MODULE: ]] ||
353 + eval '[[ " ${m[0]##*/}" =~ ^(\ '${skip_files[*]/%/.*|\\}' )$ ]]' ||
354 + eval '[[ " ${m[2]}" =~ ^(\ '${skip_types[*]/%/|\\}' )$ ]]' ||
355 + has ${m[-1]#MODULE:} "${skip_modules[@]}" && continue
356 +
357 + case ${m[2]} in
358 + MANPAGE)
359 + gzip -dc ${m[0]} | newman - ${m[0]%.gz}; assert
360 + continue
361 + ;;
362 + VDPAU_SYMLINK) m[4]=vdpau/; m[5]=${m[5]#vdpau/};; # .so to vdpau/
363 + esac
364 +
365 + if [[ -v paths[${m[2]}] ]]; then
366 + into=${paths[${m[2]}]}
367 + elif [[ ${m[2]} =~ _BINARY$ ]]; then
368 + into=/opt/bin
369 + elif [[ ${m[3]} == COMPAT32 ]]; then
370 + use abi_x86_32 || continue
371 + into=/usr/${libdir32}
372 + elif [[ ${m[2]} =~ _LIB$|_SYMLINK$ ]]; then
373 + into=/usr/${libdir}
374 + else
375 + die "No known installation path for ${m[0]}"
376 + fi
377 + [[ ${m[3]: -2} == ?/ ]] && into+=/${m[3]%/}
378 + [[ ${m[4]: -2} == ?/ ]] && into+=/${m[4]%/}
379 +
380 + if [[ ${m[2]} =~ _SYMLINK$ ]]; then
381 + [[ ${m[4]: -1} == / ]] && m[4]=${m[5]}
382 + dosym ${m[4]} ${into}/${m[0]}
383 + continue
384 + fi
385 + [[ ${m[0]} =~ ^libnvidia-ngx.so ]] &&
386 + dosym ${m[0]} ${into}/${m[0]%.so*}.so.1 # soname not in .manifest
387 +
388 + printf -v m[1] %o $((m[1] | 0200)) # 444->644
389 + insopts -m${m[1]}
390 + insinto ${into}
391 + doins ${m[0]}
392 + done < .manifest || die
393 +
394 + # MODULE:installer non-skipped extras
395 + exeinto /lib/systemd/system-sleep
396 + doexe systemd/system-sleep/nvidia
397 + dobin systemd/nvidia-sleep.sh
398 + systemd_dounit systemd/system/nvidia-{hibernate,resume,suspend}.service
399 +
400 + dobin nvidia-bug-report.sh
401 +}
402 +
403 +pkg_preinst() {
404 + has_version "${CATEGORY}/${PN}[abi_x86_32]" && NV_HAD_ABI32=
405 + has_version "${CATEGORY}/${PN}[wayland]" && NV_HAD_WAYLAND=
406 +
407 + use driver || return
408 + linux-mod_pkg_preinst
409 +
410 + # set video group id based on live system (bug #491414)
411 + local g=$(getent group video | cut -d: -f3)
412 + [[ ${g} ]] || die "Failed to determine video group id"
413 + sed -i "s/@VIDEOGID@/${g}/" "${ED}"/etc/modprobe.d/nvidia.conf || die
414 +
415 + # try to find driver mismatches using temporary supported-gpus.json
416 + for g in $(grep -l 0x10de /sys/bus/pci/devices/*/vendor 2>/dev/null); do
417 + g=$(grep -io "\"devid\":\"$(<${g%vendor}device)\"[^}]*branch\":\"[0-9]*" \
418 + "${ED}"/usr/share/nvidia/supported-gpus.json 2>/dev/null)
419 + if [[ ${g} ]]; then
420 + g=$((${g##*\"}+1))
421 + if ver_test -ge ${g}; then
422 + NV_LEGACY_MASK=">=${CATEGORY}/${PN}-${g}"
423 + break
424 + fi
425 + fi
426 + done
427 + rm "${ED}"/usr/share/nvidia/supported-gpus.json || die
428 +}
429 +
430 +pkg_postinst() {
431 + use driver && linux-mod_pkg_postinst
432 +
433 + readme.gentoo_print_elog
434 +
435 + if [[ -r /proc/driver/nvidia/version &&
436 + $(</proc/driver/nvidia/version) != *" ${PV} "* ]]; then
437 + ewarn "Currently loaded NVIDIA modules do not match the newly installed"
438 + ewarn "libraries and may prevent launching GPU-accelerated applications."
439 + use driver && ewarn "The easiest way to fix this is usually to reboot."
440 + fi
441 +
442 + if [[ $(</proc/cmdline) == *slub_debug=[!-]* ]]; then
443 + ewarn "Detected that the current kernel command line is using 'slub_debug=',"
444 + ewarn "this may lead to system instability/freezes with this version of"
445 + ewarn "${PN}. Bug: https://bugs.gentoo.org/796329"
446 + fi
447 +
448 + if [[ -v NV_LEGACY_MASK ]]; then
449 + ewarn
450 + ewarn "***WARNING***"
451 + ewarn
452 + ewarn "You are installing a version of ${PN} known not to work"
453 + ewarn "with a GPU of the current system. If unwanted, add the mask:"
454 + if [[ -d ${EROOT}/etc/portage/package.mask ]]; then
455 + ewarn " echo '${NV_LEGACY_MASK}' > ${EROOT}/etc/portage/package.mask/${PN}"
456 + else
457 + ewarn " echo '${NV_LEGACY_MASK}' >> ${EROOT}/etc/portage/package.mask"
458 + fi
459 + ewarn "...then downgrade to a legacy branch if possible. For details, see:"
460 + ewarn "https://www.nvidia.com/object/IO_32667.html"
461 + fi
462 +
463 + if use !abi_x86_32 && [[ -v NV_HAD_ABI32 ]]; then
464 + elog
465 + elog "USE=abi_x86_32 is disabled, 32bit applications will not be able to"
466 + elog "use nvidia-drivers for acceleration without it (e.g. commonly used"
467 + elog "with app-emulation/wine-* or steam). Re-enable if needed."
468 + fi
469 +
470 + if use wayland && use driver && [[ ! -v NV_HAD_WAYLAND ]]; then
471 + elog
472 + elog "With USE=wayland, this version of ${PN} sets nvidia-drm.modeset=1"
473 + elog "in '${EROOT}/etc/modprobe.d/nvidia.conf'. This feature is considered"
474 + elog "experimental but is required for wayland."
475 + elog
476 + elog "If you experience issues, either disable wayland or edit nvidia.conf."
477 + elog "Of note, may possibly cause issues with SLI and Reverse PRIME."
478 + elog
479 + elog "This version of ${PN} only supports EGLStream which is only"
480 + elog "supported by a few wayland compositors (e.g. kwin / mutter, not sway)."
481 + fi
482 +}