summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2024-09-15 12:43:19 +0100
committerV3n3RiX <venerix@koprulu.sector>2024-09-15 12:43:19 +0100
commitf9b4edae85ab8d924dc0c537962502f188e95ea9 (patch)
tree1304dc6757e63e6117bde0082d29e693c9f3ded0
parent9484dba70d365375550e69d84f180d68b2a8a08d (diff)
x11-drivers/nvidia-drivers : use PreserveVideoMemoryAllocations=1
* https://gitweb.gentoo.org/repo/gentoo.git/commit/x11-drivers/nvidia-drivers?id=a0f953fc4720a191288b7e28c1df4ab50eb9a598 * https://bugs.gentoo.org/693384 * https://bugs.gentoo.org/873160 * https://github.com/gentoo/gentoo/pull/38482
-rw-r--r--metadata/md5-cache/x11-drivers/nvidia-drivers-470.256.02-r2 (renamed from metadata/md5-cache/x11-drivers/nvidia-drivers-470.256.02-r1)2
-rw-r--r--metadata/md5-cache/x11-drivers/nvidia-drivers-550.107.02-r2 (renamed from metadata/md5-cache/x11-drivers/nvidia-drivers-550.107.02-r1)2
-rw-r--r--metadata/pkg_desc_index2
-rw-r--r--x11-drivers/nvidia-drivers/files/nvidia-470.conf8
-rw-r--r--x11-drivers/nvidia-drivers/files/nvidia-545.conf8
-rw-r--r--x11-drivers/nvidia-drivers/files/system-sleep.elogind7
-rw-r--r--x11-drivers/nvidia-drivers/nvidia-drivers-470.256.02-r2.ebuild (renamed from x11-drivers/nvidia-drivers/nvidia-drivers-470.256.02-r1.ebuild)56
-rw-r--r--x11-drivers/nvidia-drivers/nvidia-drivers-550.107.02-r2.ebuild (renamed from x11-drivers/nvidia-drivers/nvidia-drivers-550.107.02-r1.ebuild)56
8 files changed, 132 insertions, 9 deletions
diff --git a/metadata/md5-cache/x11-drivers/nvidia-drivers-470.256.02-r1 b/metadata/md5-cache/x11-drivers/nvidia-drivers-470.256.02-r2
index 4e2b2425..549a932b 100644
--- a/metadata/md5-cache/x11-drivers/nvidia-drivers-470.256.02-r1
+++ b/metadata/md5-cache/x11-drivers/nvidia-drivers-470.256.02-r2
@@ -14,4 +14,4 @@ RESTRICT=strip
SLOT=4
SRC_URI=https://download.nvidia.com/XFree86/Linux-x86_64/470.256.02/NVIDIA-Linux-x86_64-470.256.02.run https://download.nvidia.com/XFree86/nvidia-installer/nvidia-installer-470.256.02.tar.bz2 https://download.nvidia.com/XFree86/nvidia-modprobe/nvidia-modprobe-470.256.02.tar.bz2 https://download.nvidia.com/XFree86/nvidia-persistenced/nvidia-persistenced-470.256.02.tar.bz2 https://download.nvidia.com/XFree86/nvidia-xconfig/nvidia-xconfig-470.256.02.tar.bz2
_eclasses_=desktop 56973babb9c5f19cab0eeb53ece644c6 flag-o-matic fa33e3696fe4689dda7e9affe92e2c94 multilib 7e1347c006a76bb812f3a9f663b79991 multiprocessing e644caa6eb7ce7e5ab0864383ac13ad9 readme.gentoo-r1 32b48460d813533d85f082897cec1b80 systemd 0f241b5c9f3758c3d3423df59a7f655a toolchain-funcs 948855ec7ad9f11351edf9066708dfa9 unpacker fb4b84181244b3b9990fa0bf40232dd2 user-info 9951b1a0e4f026d16c33a001fd2d5cdf
-_md5_=dd2d87a41eb50bc254fba9d8ef0c354c
+_md5_=70de39a0fba000e2c2ef9fe19db0bcfe
diff --git a/metadata/md5-cache/x11-drivers/nvidia-drivers-550.107.02-r1 b/metadata/md5-cache/x11-drivers/nvidia-drivers-550.107.02-r2
index 229790d4..5ff54dac 100644
--- a/metadata/md5-cache/x11-drivers/nvidia-drivers-550.107.02-r1
+++ b/metadata/md5-cache/x11-drivers/nvidia-drivers-550.107.02-r2
@@ -14,4 +14,4 @@ RESTRICT=strip
SLOT=5
SRC_URI=https://download.nvidia.com/XFree86/Linux-x86_64/550.107.02/NVIDIA-Linux-x86_64-550.107.02.run https://download.nvidia.com/XFree86/nvidia-installer/nvidia-installer-550.107.02.tar.bz2 https://download.nvidia.com/XFree86/nvidia-modprobe/nvidia-modprobe-550.107.02.tar.bz2 https://download.nvidia.com/XFree86/nvidia-persistenced/nvidia-persistenced-550.107.02.tar.bz2 https://download.nvidia.com/XFree86/nvidia-xconfig/nvidia-xconfig-550.107.02.tar.bz2
_eclasses_=desktop 56973babb9c5f19cab0eeb53ece644c6 flag-o-matic fa33e3696fe4689dda7e9affe92e2c94 multilib 7e1347c006a76bb812f3a9f663b79991 multiprocessing e644caa6eb7ce7e5ab0864383ac13ad9 readme.gentoo-r1 32b48460d813533d85f082897cec1b80 systemd 0f241b5c9f3758c3d3423df59a7f655a toolchain-funcs 948855ec7ad9f11351edf9066708dfa9 unpacker fb4b84181244b3b9990fa0bf40232dd2 user-info 9951b1a0e4f026d16c33a001fd2d5cdf
-_md5_=bf119f76a6d58bb353ff7bb17f2cda66
+_md5_=1472d5f5a218447aed41a0fa0de056be
diff --git a/metadata/pkg_desc_index b/metadata/pkg_desc_index
index 55aa59a7..10a5e962 100644
--- a/metadata/pkg_desc_index
+++ b/metadata/pkg_desc_index
@@ -82,7 +82,7 @@ virtual/tmpfiles 1.314.1337-r1: Virtual to select between different tmpfiles.d h
virtual/udev 314.1337-r1: Virtual to select between different udev daemon providers
www-client/ungoogled-chromium 128.0.6613.84: Modifications to Chromium for removing Google integration and enhancing privacy
x11-base/xorg-drivers 21.1-r100: Meta package containing deps on all xorg drivers (dummy package)
-x11-drivers/nvidia-drivers 390.157-r10 470.256.02-r1 550.107.02-r1: NVIDIA Accelerated Graphics Driver
+x11-drivers/nvidia-drivers 390.157-r10 470.256.02-r2 550.107.02-r2: NVIDIA Accelerated Graphics Driver
x11-libs/gtk+ 2.24.33-r5 3.24.41-r5: Gimp ToolKit +
x11-misc/nvidia-prime 314: NVIDIA Prime Render Offload configuration and utilities
x11-misc/nvidia-settings 390.157-r7 470.256.02 550.107.02-r1: NVIDIA Linux X11 Settings Utility
diff --git a/x11-drivers/nvidia-drivers/files/nvidia-470.conf b/x11-drivers/nvidia-drivers/files/nvidia-470.conf
index a20f2a19..1ba489dd 100644
--- a/x11-drivers/nvidia-drivers/files/nvidia-470.conf
+++ b/x11-drivers/nvidia-drivers/files/nvidia-470.conf
@@ -11,10 +11,12 @@ alias nouveau off
# 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).
+# Suspend options. Note that Allocations=1 requires suspend hooks currently
+# only used when either systemd or elogind is used to suspend. If using
+# neither or have issues, try Allocations=0 (revert if it does not help
+# as =0 is not recommended).
options nvidia \
- NVreg_PreserveVideoMemoryAllocations=0 \
+ NVreg_PreserveVideoMemoryAllocations=1 \
NVreg_TemporaryFilePath=/var/tmp
# !!! Security Warning !!!
diff --git a/x11-drivers/nvidia-drivers/files/nvidia-545.conf b/x11-drivers/nvidia-drivers/files/nvidia-545.conf
index ecb549e1..e8ca7805 100644
--- a/x11-drivers/nvidia-drivers/files/nvidia-545.conf
+++ b/x11-drivers/nvidia-drivers/files/nvidia-545.conf
@@ -16,10 +16,12 @@ alias nouveau off
# 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).
+# Suspend options. Note that Allocations=1 requires suspend hooks currently
+# only used when either systemd or elogind is used to suspend. If using
+# neither or have issues, try Allocations=0 (revert if it does not help
+# as =0 is not recommended).
options nvidia \
- NVreg_PreserveVideoMemoryAllocations=0 \
+ NVreg_PreserveVideoMemoryAllocations=1 \
NVreg_TemporaryFilePath=/var/tmp
# !!! Security Warning !!!
diff --git a/x11-drivers/nvidia-drivers/files/system-sleep.elogind b/x11-drivers/nvidia-drivers/files/system-sleep.elogind
new file mode 100644
index 00000000..d36e2697
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/files/system-sleep.elogind
@@ -0,0 +1,7 @@
+#!/bin/sh
+case ${1-} in
+ pre) nvidia-sleep.sh suspend;;
+ # run in background given resume is flaky if elogind did not finish
+ post) nvidia-sleep.sh resume &;;
+ *) exit 1;;
+esac
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-470.256.02-r1.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-470.256.02-r2.ebuild
index 6f731093..ff22d171 100644
--- a/x11-drivers/nvidia-drivers/nvidia-drivers-470.256.02-r1.ebuild
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-470.256.02-r2.ebuild
@@ -273,6 +273,22 @@ documentation that is installed alongside this README."
dobin nvidia-bug-report.sh
+ # enabling is needed for sleep to work properly and little reason not to do
+ # it unconditionally for a better user experience
+ : "$(systemd_get_systemunitdir)"
+ local unitdir=${_#"${EPREFIX}"}
+ # not using relative symlinks to match systemd's own links
+ dosym {"${unitdir}",/etc/systemd/system/systemd-hibernate.service.wants}/nvidia-hibernate.service
+ dosym {"${unitdir}",/etc/systemd/system/systemd-hibernate.service.wants}/nvidia-resume.service
+ dosym {"${unitdir}",/etc/systemd/system/systemd-suspend.service.wants}/nvidia-suspend.service
+ dosym {"${unitdir}",/etc/systemd/system/systemd-suspend.service.wants}/nvidia-resume.service
+ # also add a custom elogind hook to do the equivalent of the above
+ exeinto /usr/lib/elogind/system-sleep
+ newexe "${FILESDIR}"/system-sleep.elogind nvidia
+ # <elogind-255.5 used a different path (bug #939216), keep a compat symlink
+ # TODO: cleanup after 255.5 been stable for a few months
+ dosym {/usr/lib,/"${libdir}"}/elogind/system-sleep/nvidia
+
# symlink non-versioned so nvidia-settings can use it even if misdetected
dosym nvidia-application-profiles-${PV}-key-documentation \
${paths[APPLICATION_PROFILE]}/nvidia-application-profiles-key-documentation
@@ -313,6 +329,46 @@ pkg_postinst() {
ewarn "this may lead to system instability/freezes with this version of"
ewarn "${PN}. Bug: https://bugs.gentoo.org/796329"
fi
+
+ # these can be removed after some time, only to help the transition
+ # given users are unlikely to do further custom solutions if it works
+ # (see also https://github.com/elogind/elogind/issues/272)
+ if grep -riq "^[^#]*HandleNvidiaSleep=yes" "${EROOT}"/etc/elogind/sleep.conf.d/ 2>/dev/null
+ then
+ ewarn
+ ewarn "!!! WARNING !!!"
+ ewarn "Detected HandleNvidiaSleep=yes in ${EROOT}/etc/elogind/sleep.conf.d/."
+ ewarn "This 'could' cause issues if used in combination with the new hook"
+ ewarn "installed by the ebuild to handle sleep using the official upstream"
+ ewarn "script. It is recommended to disable the option."
+ fi
+ if [[ $(realpath "${EROOT}"{/etc,{/usr,}/lib*}/elogind/system-sleep | sort | uniq | \
+ xargs -d'\n' grep -Ril nvidia 2>/dev/null | wc -l) -gt 2 ]]
+ then
+ ewarn
+ ewarn "!!! WARNING !!!"
+ ewarn "Detected a custom script at ${EROOT}{/etc,{/usr,}/lib*}/elogind/system-sleep"
+ ewarn "referencing NVIDIA. This version of ${PN} has installed its own"
+ ewarn "hook at ${EROOT}/usr/lib/elogind/system-sleep/nvidia and it is recommended"
+ ewarn "to remove the custom one to avoid potential issues."
+ ewarn
+ ewarn "Feel free to ignore this warning if you know the other NVIDIA-related"
+ ewarn "scripts can be used together. The warning will be removed in the future."
+ fi
+ if [[ ${REPLACING_VERSIONS##* } ]] &&
+ ver_test ${REPLACING_VERSIONS##* } -lt 470.256.02-r1 # may get repeated
+ then
+ elog
+ elog "For suspend/sleep, 'NVreg_PreserveVideoMemoryAllocations=1' is now default"
+ elog "with this version of ${PN}. This is recommended (or required) by"
+ elog "major DEs especially with wayland but, *if* experience regressions with"
+ elog "suspend, try reverting to =0 in '${EROOT}/etc/modprobe.d/nvidia.conf'."
+ elog
+ elog "May notably be an issue when using neither systemd nor elogind to suspend."
+ elog
+ elog "Also, the systemd suspend/hibernate/resume services are now enabled by"
+ elog "default, and for openrc+elogind a similar hook has been installed."
+ fi
}
pkg_postrm() {
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-550.107.02-r1.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-550.107.02-r2.ebuild
index a17310c0..bad49990 100644
--- a/x11-drivers/nvidia-drivers/nvidia-drivers-550.107.02-r1.ebuild
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-550.107.02-r2.ebuild
@@ -293,6 +293,22 @@ documentation that is installed alongside this README."
doins nvidia-dbus.conf
fi
+ # enabling is needed for sleep to work properly and little reason not to do
+ # it unconditionally for a better user experience
+ : "$(systemd_get_systemunitdir)"
+ local unitdir=${_#"${EPREFIX}"}
+ # not using relative symlinks to match systemd's own links
+ dosym {"${unitdir}",/etc/systemd/system/systemd-hibernate.service.wants}/nvidia-hibernate.service
+ dosym {"${unitdir}",/etc/systemd/system/systemd-hibernate.service.wants}/nvidia-resume.service
+ dosym {"${unitdir}",/etc/systemd/system/systemd-suspend.service.wants}/nvidia-suspend.service
+ dosym {"${unitdir}",/etc/systemd/system/systemd-suspend.service.wants}/nvidia-resume.service
+ # also add a custom elogind hook to do the equivalent of the above
+ exeinto /usr/lib/elogind/system-sleep
+ newexe "${FILESDIR}"/system-sleep.elogind nvidia
+ # <elogind-255.5 used a different path (bug #939216), keep a compat symlink
+ # TODO: cleanup after 255.5 been stable for a few months
+ dosym {/usr/lib,/"${libdir}"}/elogind/system-sleep/nvidia
+
# symlink non-versioned so nvidia-settings can use it even if misdetected
dosym nvidia-application-profiles-${PV}-key-documentation \
${paths[APPLICATION_PROFILE]}/nvidia-application-profiles-key-documentation
@@ -333,6 +349,46 @@ pkg_postinst() {
ewarn "this may lead to system instability/freezes with this version of"
ewarn "${PN}. Bug: https://bugs.gentoo.org/796329"
fi
+
+ # these can be removed after some time, only to help the transition
+ # given users are unlikely to do further custom solutions if it works
+ # (see also https://github.com/elogind/elogind/issues/272)
+ if grep -riq "^[^#]*HandleNvidiaSleep=yes" "${EROOT}"/etc/elogind/sleep.conf.d/ 2>/dev/null
+ then
+ ewarn
+ ewarn "!!! WARNING !!!"
+ ewarn "Detected HandleNvidiaSleep=yes in ${EROOT}/etc/elogind/sleep.conf.d/."
+ ewarn "This 'could' cause issues if used in combination with the new hook"
+ ewarn "installed by the ebuild to handle sleep using the official upstream"
+ ewarn "script. It is recommended to disable the option."
+ fi
+ if [[ $(realpath "${EROOT}"{/etc,{/usr,}/lib*}/elogind/system-sleep | sort | uniq | \
+ xargs -d'\n' grep -Ril nvidia 2>/dev/null | wc -l) -gt 2 ]]
+ then
+ ewarn
+ ewarn "!!! WARNING !!!"
+ ewarn "Detected a custom script at ${EROOT}{/etc,{/usr,}/lib*}/elogind/system-sleep"
+ ewarn "referencing NVIDIA. This version of ${PN} has installed its own"
+ ewarn "hook at ${EROOT}/usr/lib/elogind/system-sleep/nvidia and it is recommended"
+ ewarn "to remove the custom one to avoid potential issues."
+ ewarn
+ ewarn "Feel free to ignore this warning if you know the other NVIDIA-related"
+ ewarn "scripts can be used together. The warning will be removed in the future."
+ fi
+ if [[ ${REPLACING_VERSIONS##* } ]] &&
+ ver_test ${REPLACING_VERSIONS##* } -lt 470.256.02-r1 # may get repeated
+ then
+ elog
+ elog "For suspend/sleep, 'NVreg_PreserveVideoMemoryAllocations=1' is now default"
+ elog "with this version of ${PN}. This is recommended (or required) by"
+ elog "major DEs especially with wayland but, *if* experience regressions with"
+ elog "suspend, try reverting to =0 in '${EROOT}/etc/modprobe.d/nvidia.conf'."
+ elog
+ elog "May notably be an issue when using neither systemd nor elogind to suspend."
+ elog
+ elog "Also, the systemd suspend/hibernate/resume services are now enabled by"
+ elog "default, and for openrc+elogind a similar hook has been installed."
+ fi
}
pkg_postrm() {