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