Skip to content

Commit 350a9e8

Browse files
Flatcar Buildbottormath1
authored andcommitted
x11-drivers/nvidia-drivers: Sync with Gentoo
It's from Gentoo commit 2bfd33b1aa879a5171e2b83b99fd30936f85b832. Signed-off-by: Mathieu Tortuyaux <[email protected]>
1 parent 1c69784 commit 350a9e8

File tree

6 files changed

+71
-771
lines changed

6 files changed

+71
-771
lines changed

sdk_container/src/third_party/portage-stable/x11-drivers/nvidia-drivers/Manifest

Lines changed: 18 additions & 26 deletions
Large diffs are not rendered by default.

sdk_container/src/third_party/portage-stable/x11-drivers/nvidia-drivers/files/nvidia-drivers-570.153.02-kernel-6.15.patch

Lines changed: 0 additions & 71 deletions
This file was deleted.
Lines changed: 50 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
EAPI=8
55

66
MODULES_OPTIONAL_IUSE=+modules
7-
inherit desktop dot-a eapi9-pipestatus flag-o-matic linux-mod-r1
7+
inherit desktop dot-a eapi9-pipestatus flag-o-matic linux-mod-r1 multilib
88
inherit readme.gentoo-r1 systemd toolchain-funcs unpacker user-info
99

1010
MODULES_KERNEL_MAX=6.15
@@ -24,10 +24,7 @@ S=${WORKDIR}
2424

2525
LICENSE="NVIDIA-2023 Apache-2.0 BSD BSD-2 GPL-2 MIT ZLIB curl openssl"
2626
SLOT="0/${PV%%.*}"
27-
KEYWORDS="-* amd64 ~arm64"
28-
# TODO: enable kernel-open by default to match nvidia upstream, but should
29-
# first setup a supported-gpus.json "kernelopen" check to abort and avoid bad
30-
# surprises (should abort for legacy cards too, and have a bypass variable)
27+
KEYWORDS="-* ~amd64 ~arm64"
3128
IUSE="+X abi_x86_32 abi_x86_64 kernel-open persistenced powerd +static-libs +tools wayland"
3229
REQUIRED_USE="kernel-open? ( modules )"
3330

@@ -63,9 +60,9 @@ RDEPEND="
6360
)
6461
powerd? ( sys-apps/dbus[abi_x86_32(-)?] )
6562
wayland? (
66-
>=gui-libs/egl-gbm-1.1.1-r2[abi_x86_32(-)?]
67-
>=gui-libs/egl-wayland-1.1.13.1[abi_x86_32(-)?]
68-
X? ( gui-libs/egl-x11[abi_x86_32(-)?] )
63+
gui-libs/egl-gbm
64+
>=gui-libs/egl-wayland-1.1.10
65+
media-libs/libglvnd
6966
)
7067
"
7168
DEPEND="
@@ -76,7 +73,6 @@ DEPEND="
7673
x11-libs/libXext
7774
)
7875
tools? (
79-
dev-util/vulkan-headers
8076
media-libs/libglvnd
8177
sys-apps/dbus
8278
x11-base/xorg-proto
@@ -94,22 +90,18 @@ BDEPEND="
9490
QA_PREBUILT="lib/firmware/* usr/bin/* usr/lib*"
9591

9692
PATCHES=(
93+
"${FILESDIR}"/nvidia-kernel-module-source-515.86.01-raw-ldflags.patch
9794
"${FILESDIR}"/nvidia-modprobe-390.141-uvm-perms.patch
95+
"${FILESDIR}"/nvidia-settings-390.144-raw-ldflags.patch
9896
"${FILESDIR}"/nvidia-settings-530.30.02-desktop.patch
99-
"${FILESDIR}"/nvidia-drivers-570.153.02-kernel-6.15.patch
10097
)
10198

10299
pkg_setup() {
103100
use modules && [[ ${MERGE_TYPE} != binary ]] || return
104101

105-
# do early before linux-mod-r1 so can use chkconfig to setup CONFIG_CHECK
106-
get_version
107-
require_configured_kernel
108-
109102
local CONFIG_CHECK="
110103
PROC_FS
111104
~DRM_KMS_HELPER
112-
~DRM_FBDEV_EMULATION
113105
~SYSVIPC
114106
~!LOCKDEP
115107
~!PREEMPT_RT
@@ -118,29 +110,25 @@ pkg_setup() {
118110
$(usev powerd '~CPU_FREQ')
119111
"
120112

121-
kernel_is -ge 6 11 && linux_chkconfig_present DRM_FBDEV_EMULATION &&
122-
CONFIG_CHECK+=" DRM_TTM_HELPER"
113+
local ERROR_DRM_KMS_HELPER="CONFIG_DRM_KMS_HELPER: is not set but needed for Xorg auto-detection
114+
of drivers (no custom config), and for wayland / nvidia-drm.modeset=1.
115+
Cannot be directly selected in the kernel's menuconfig, and may need
116+
selection of a DRM device even if unused, e.g. CONFIG_DRM_AMDGPU=m or
117+
DRM_I915=y, DRM_NOUVEAU=m also acceptable if a module and not built-in."
118+
119+
local ERROR_X86_KERNEL_IBT="CONFIG_X86_KERNEL_IBT: is set and, if the CPU supports the feature,
120+
this *could* lead to modules load failure with ENDBR errors, or to
121+
broken CUDA/NVENC. Please ignore if not having issues, but otherwise
122+
try to unset or pass ibt=off to the kernel's command line." #911142
123+
use kernel-open || CONFIG_CHECK+=" ~!X86_KERNEL_IBT"
123124

124125
use amd64 && kernel_is -ge 5 8 && CONFIG_CHECK+=" X86_PAT" #817764
125126

126127
use kernel-open && CONFIG_CHECK+=" MMU_NOTIFIER" #843827
127-
128-
local drm_helper_msg="Cannot be directly selected in the kernel's config menus, and may need
129-
selection of a DRM device even if unused, e.g. CONFIG_DRM_QXL=m or
130-
DRM_AMDGPU=m (among others, consult the kernel config's help), can
131-
also use DRM_NOUVEAU=m as long as built as module *not* built-in."
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-
${drm_helper_msg}"
135-
local ERROR_DRM_TTM_HELPER="CONFIG_DRM_TTM_HELPER: is not set but is needed to compile when using
136-
kernel version 6.11.x or newer while DRM_FBDEV_EMULATION is set.
137-
${drm_helper_msg}"
138-
local ERROR_DRM_FBDEV_EMULATION="CONFIG_DRM_FBDEV_EMULATION: is not set but is needed for
139-
nvidia-drm.fbdev=1 support, currently off-by-default and it could
140-
be ignored, but note that is due to change in the future."
141128
local ERROR_MMU_NOTIFIER="CONFIG_MMU_NOTIFIER: is not set but needed to build with USE=kernel-open.
142129
Cannot be directly selected in the kernel's menuconfig, and may need
143130
selection of another option that requires it such as CONFIG_KVM."
131+
144132
local ERROR_PREEMPT_RT="CONFIG_PREEMPT_RT: is set but is unsupported by NVIDIA upstream and
145133
will fail to build unless the env var IGNORE_PREEMPT_RT_PRESENCE=1 is
146134
set. Please do not report issues if run into e.g. kernel panics while
@@ -171,16 +159,24 @@ src_prepare() {
171159
use X || sed -i 's/"libGLX/"libEGL/' nvidia_{layers,icd}.json || die
172160

173161
# enable nvidia-drm.modeset=1 by default with USE=wayland
174-
cp "${FILESDIR}"/nvidia-570.conf "${T}"/nvidia.conf || die
162+
cp "${FILESDIR}"/nvidia-470.conf "${T}"/nvidia.conf || die
175163
use !wayland || sed -i '/^#.*modeset=1$/s/^#//' "${T}"/nvidia.conf || die
176164

177165
# makefile attempts to install wayland library even if not built
178166
use wayland || sed -i 's/ WAYLAND_LIB_install$//' \
179167
nvidia-settings/src/Makefile || die
168+
169+
# temporary option, nvidia will remove in the future
170+
use !kernel-open ||
171+
sed -i '/blacklist/a\
172+
\
173+
# Enable using kernel-open with workstation GPUs (experimental)\
174+
options nvidia NVreg_OpenRmEnableUnsupportedGpus=1' "${T}"/nvidia.conf || die
180175
}
181176

182177
src_compile() {
183178
tc-export AR CC CXX LD OBJCOPY OBJDUMP PKG_CONFIG
179+
local -x RAW_LDFLAGS="$(get_abi_LDFLAGS) $(raw-ldflags)" # raw-ldflags.patch
184180

185181
# extra flags for the libXNVCtrl.a static library
186182
local xnvflags=-fPIC #840389
@@ -200,6 +196,11 @@ src_compile() {
200196
if use modules; then
201197
local o_cflags=${CFLAGS} o_cxxflags=${CXXFLAGS} o_ldflags=${LDFLAGS}
202198

199+
# conftest.sh is broken with c23 due to func() changing meaning,
200+
# and then fails later due to ealier misdetections
201+
# TODO: try without now and then + drop modargs' CC= (bug #944092)
202+
KERNEL_CC+=" -std=gnu17"
203+
203204
local modlistargs=video:kernel
204205
if use kernel-open; then
205206
modlistargs+=-module-source:kernel-module-source/kernel-open
@@ -209,12 +210,11 @@ src_compile() {
209210
filter-flags -fno-plt #912949
210211
filter-lto
211212
CC=${KERNEL_CC} CXX=${KERNEL_CXX} strip-unsupported-flags
212-
213-
LDFLAGS=$(raw-ldflags)
214213
fi
215214

216215
local modlist=( nvidia{,-drm,-modeset,-peermem,-uvm}=${modlistargs} )
217216
local modargs=(
217+
CC="${KERNEL_CC}" # needed for above gnu17 workaround
218218
IGNORE_CC_MISMATCH=yes NV_VERBOSE=1
219219
SYSOUT="${KV_OUT_DIR}" SYSSRC="${KV_DIR}"
220220

@@ -259,7 +259,6 @@ src_install() {
259259
[GBM_BACKEND_LIB_SYMLINK]=/usr/${libdir}/gbm
260260
[GLVND_EGL_ICD_JSON]=/usr/share/glvnd/egl_vendor.d
261261
[OPENGL_DATA]=/usr/share/nvidia
262-
[VULKANSC_ICD_JSON]=/usr/share/vulkansc
263262
[VULKAN_ICD_JSON]=/usr/share/vulkan
264263
[WINE_LIB]=/usr/${libdir}/nvidia/wine
265264
[XORG_OUTPUTCLASS_CONFIG]=/usr/share/X11/xorg.conf.d
@@ -271,12 +270,11 @@ src_install() {
271270

272271
local skip_files=(
273272
$(usev !X "libGLX_nvidia libglxserver_nvidia")
273+
$(usev !wayland libnvidia-vulkan-producer)
274274
libGLX_indirect # non-glvnd unused fallback
275275
libnvidia-{gtk,wayland-client} nvidia-{settings,xconfig} # from source
276276
libnvidia-egl-gbm 15_nvidia_gbm # gui-libs/egl-gbm
277277
libnvidia-egl-wayland 10_nvidia_wayland # gui-libs/egl-wayland
278-
libnvidia-egl-xcb 20_nvidia_xcb.json # gui-libs/egl-x11
279-
libnvidia-egl-xlib 20_nvidia_xlib.json # gui-libs/egl-x11
280278
libnvidia-pkcs11.so # using the openssl3 version instead
281279
)
282280
local skip_modules=(
@@ -322,12 +320,6 @@ $(use amd64 && usev !abi_x86_32 "
322320
Note that without USE=abi_x86_32 on ${PN}, 32bit applications
323321
(typically using wine / steam) will not be able to use GPU acceleration.")
324322
325-
Be warned that USE=kernel-open may need to be either enabled or
326-
disabled for certain cards to function:
327-
- GTX 50xx (blackwell) and higher require it to be enabled
328-
- GTX 1650 and higher (pre-blackwell) should work either way
329-
- Older cards require it to be disabled
330-
331323
For additional information or for troubleshooting issues, please see
332324
https://wiki.gentoo.org/wiki/NVIDIA/nvidia-drivers and NVIDIA's own
333325
documentation that is installed alongside this README."
@@ -416,9 +408,8 @@ documentation that is installed alongside this README."
416408
dosym ${m[4]} ${into}/${m[0]}
417409
continue
418410
fi
419-
# avoid portage warning due to missing soname links in manifest
420-
[[ ${m[0]} =~ ^libnvidia-ngx.so ]] &&
421-
dosym ${m[0]} ${into}/${m[0]%.so*}.so.1
411+
[[ ${m[0]} =~ ^libnvidia-ngx.so|^libnvidia-egl-gbm.so ]] &&
412+
dosym ${m[0]} ${into}/${m[0]%.so*}.so.1 # soname not in .manifest
422413

423414
printf -v m[1] %o $((m[1] | 0200)) # 444->644
424415
insopts -m${m[1]}
@@ -432,13 +423,10 @@ documentation that is installed alongside this README."
432423
exeinto "${_#"${EPREFIX}"}"
433424
doexe systemd/system-sleep/nvidia
434425
dobin systemd/nvidia-sleep.sh
435-
systemd_dounit systemd/system/nvidia-{hibernate,resume,suspend,suspend-then-hibernate}.service
426+
systemd_dounit systemd/system/nvidia-{hibernate,resume,suspend}.service
436427

437428
dobin nvidia-bug-report.sh
438429

439-
insinto /usr/share/nvidia/files.d
440-
doins sandboxutils-filelist.json
441-
442430
# MODULE:powerd extras
443431
if use powerd; then
444432
newinitd "${FILESDIR}"/nvidia-powerd.initd nvidia-powerd #923117
@@ -457,8 +445,6 @@ documentation that is installed alongside this README."
457445
dosym {"${unitdir}",/etc/systemd/system/systemd-hibernate.service.wants}/nvidia-resume.service
458446
dosym {"${unitdir}",/etc/systemd/system/systemd-suspend.service.wants}/nvidia-suspend.service
459447
dosym {"${unitdir}",/etc/systemd/system/systemd-suspend.service.wants}/nvidia-resume.service
460-
dosym {"${unitdir}",/etc/systemd/system/systemd-suspend-then-hibernate.service.wants}/nvidia-suspend-then-hibernate.service
461-
dosym {"${unitdir}",/etc/systemd/system/systemd-suspend-then-hibernate.service.wants}/nvidia-resume.service
462448
# also add a custom elogind hook to do the equivalent of the above
463449
exeinto /usr/lib/elogind/system-sleep
464450
newexe "${FILESDIR}"/system-sleep.elogind nvidia
@@ -489,12 +475,12 @@ documentation that is installed alongside this README."
489475
# don't attempt to strip firmware files (silences errors)
490476
dostrip -x ${paths[FIRMWARE]}
491477

492-
# sandbox issues with /dev/nvidiactl and others (bug #904292,#921578)
478+
# sandbox issues with /dev/nvidiactl (and /dev/char wrt bug #904292)
493479
# are widespread and sometime affect revdeps of packages built with
494480
# USE=opencl/cuda making it hard to manage in ebuilds (minimal set,
495481
# ebuilds should handle manually if need others or addwrite)
496482
insinto /etc/sandbox.d
497-
newins - 20nvidia <<<'SANDBOX_PREDICT="/dev/nvidiactl:/dev/nvidia-caps:/dev/char"'
483+
newins - 20nvidia <<<'SANDBOX_PREDICT="/dev/nvidiactl:/dev/char"'
498484

499485
# dracut does not use /etc/modprobe.d if hostonly=no, but want to make sure
500486
# our settings are used for bug 932781#c8 and nouveau blacklist if either
@@ -506,7 +492,6 @@ documentation that is installed alongside this README."
506492
}
507493

508494
pkg_preinst() {
509-
has_version "${CATEGORY}/${PN}[kernel-open]" && NV_HAD_KERNEL_OPEN=
510495
has_version "${CATEGORY}/${PN}[wayland]" && NV_HAD_WAYLAND=
511496

512497
use modules || return
@@ -571,17 +556,20 @@ pkg_postinst() {
571556
ewarn "[2] https://wiki.gentoo.org/wiki/Nouveau"
572557
fi
573558

574-
if use kernel-open && [[ ! -v NV_HAD_KERNEL_OPEN ]]; then
559+
if use kernel-open; then
575560
ewarn
576-
ewarn "Open source variant of ${PN} was selected, note that it requires"
577-
ewarn "Turing/Ampere+ GPUs (aka GTX 1650+). Try disabling if run into issues."
578-
ewarn "Also see: ${EROOT}/usr/share/doc/${PF}/html/kernel_open.html"
561+
ewarn "Open source variant of ${PN} was selected, be warned it is experimental"
562+
ewarn "and only for modern GPUs (e.g. GTX 1650+). Try to disable if run into issues."
563+
ewarn "Please also see: ${EROOT}/usr/share/doc/${PF}/html/kernel_open.html"
579564
fi
580565

581566
if use wayland && use modules && [[ ! -v NV_HAD_WAYLAND ]]; then
582567
elog
583-
elog "Note that with USE=wayland, nvidia-drm.modeset=1 will be enabled"
584-
elog "in '${EROOT}/etc/modprobe.d/nvidia.conf'. *If* experience issues,"
585-
elog "either disable wayland or edit nvidia.conf."
568+
elog "With USE=wayland, this version of ${PN} sets nvidia-drm.modeset=1"
569+
elog "in '${EROOT}/etc/modprobe.d/nvidia.conf'. This feature is considered"
570+
elog "experimental but is required for wayland."
571+
elog
572+
elog "If you experience issues, either disable wayland or edit nvidia.conf."
573+
elog "Of note, may possibly cause issues with SLI and Reverse PRIME."
586574
fi
587575
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ inherit desktop dot-a eapi9-pipestatus eapi9-ver flag-o-matic linux-mod-r1
88
inherit readme.gentoo-r1 systemd toolchain-funcs unpacker user-info
99

1010
MODULES_KERNEL_MAX=6.14
11-
NV_PIN=570.153.02
11+
NV_PIN=570.169
1212

1313
DESCRIPTION="NVIDIA Accelerated Graphics Driver"
1414
HOMEPAGE="https://developer.nvidia.com/vulkan-driver"

sdk_container/src/third_party/portage-stable/x11-drivers/nvidia-drivers/nvidia-drivers-575.64.ebuild renamed to sdk_container/src/third_party/portage-stable/x11-drivers/nvidia-drivers/nvidia-drivers-570.172.08.ebuild

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,7 @@ SRC_URI="
2222
# nvidia-installer is unused but here for GPL-2's "distribute sources"
2323
S=${WORKDIR}
2424

25-
LICENSE="
26-
NVIDIA-2025 Apache-2.0 Boost-1.0 BSD BSD-2 GPL-2 MIT ZLIB
27-
curl openssl public-domain
28-
"
25+
LICENSE="NVIDIA-2025 Apache-2.0 BSD BSD-2 GPL-2 MIT ZLIB curl openssl"
2926
SLOT="0/${PV%%.*}"
3027
KEYWORDS="-* ~amd64 ~arm64"
3128
# TODO: enable kernel-open by default to match nvidia upstream, but should
@@ -89,7 +86,6 @@ DEPEND="
8986
)
9087
"
9188
BDEPEND="
92-
app-alternatives/awk
9389
sys-devel/m4
9490
virtual/pkgconfig
9591
"
@@ -285,7 +281,7 @@ src_install() {
285281
local skip_modules=(
286282
$(usev !X "nvfbc vdpau xdriver")
287283
$(usev !modules gsp)
288-
$(usev !powerd nvtopps)
284+
$(usev !powerd powerd)
289285
installer nvpd # handled separately / built from source
290286
)
291287
local skip_types=(

0 commit comments

Comments
 (0)