From: "Ionen Wolkens" <ionen@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: x11-drivers/nvidia-drivers/, x11-drivers/nvidia-drivers/files/
Date: Sat, 14 Sep 2024 10:52:41 +0000 (UTC) [thread overview]
Message-ID: <1726310966.a0f953fc4720a191288b7e28c1df4ab50eb9a598.ionen@gentoo> (raw)
commit: a0f953fc4720a191288b7e28c1df4ab50eb9a598
Author: Ionen Wolkens <ionen <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 6 09:13:41 2024 +0000
Commit: Ionen Wolkens <ionen <AT> gentoo <DOT> org>
CommitDate: Sat Sep 14 10:49:26 2024 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a0f953fc
x11-drivers/nvidia-drivers: use PreserveVideoMemoryAllocations=1
(Disclaimer: I do not have the right setup to test any of this, but
doing it blind given the increasing amount of affected users -- call
for testing has shown that it should work as expected albeit users
with more custom setups such as suspend without elogind/systemd will
need to pay attention to warnings given breakage *is* expected).
Was formerly disabled because it broke sleep with elogind, systemd if
the units were not enabled, and other custom methods to enable sleep.
However, =0 is limited and is seemingly broken with wayland (typically
resulting in graphical corruption after resume). GDM straight up refuse
to show a wayland session if it's not set wrt bug #873160, and several
Plasma 6 users been reporting issues and its upstream also instructs
distributions to set this.
So this adds a elogind hook, enables systemd units by default (much
like it is for the elogind hook), and at least warn for the last case
which is considered semi-unsupported.
elogind does have its own HandleNvidiaSleep option, but it is intended
for old drivers which did not ship a nvidia-sleep.sh and reports seem to
show that it may not be working properly. Ebuild warns that it should be
disabled instead, and also tries to warn if there is old custom scripts
installed by the user.
One downside of hook vs the option is that hooks are not told if using
suspend or hibernate and this sends the wrong message to the drivers
(albeit not known to be an issue at the moment).
May not fix everything wrt bug #693384, but believe this is the best
we can do downstream unless someone knows better, and so closing it.
There are plenty of issues unrelated to elogind too, ideally would
need users to compare with systemd before filing more elogind sleep
bugs unless know exactly what is causing issues in elogind.
wrt bug #873160, this only fix *one* thing that the gdm udev rules
check and so may not mean will necessarily start seeing wayland in
gdm. Rules currently need =1, systemd-only, and a non-hybrid setup
(aka just nvidia, no offloading). See also the general bug #939201.
Straight-to-stable may not be the best idea, but wanted to simplify
and not revbump the 3 .conf, duplicate them, and adjust every ebuilds
further for this (believe it *should* be ok, or at least not make
things worse for typical users). Also want to deliver the fix early
to plasma 6 users newly using wayland by default.
Closes: https://bugs.gentoo.org/693384
Closes: https://bugs.gentoo.org/873160
Closes: https://github.com/gentoo/gentoo/pull/38482
Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org>
x11-drivers/nvidia-drivers/files/nvidia-470.conf | 8 ++--
x11-drivers/nvidia-drivers/files/nvidia-545.conf | 8 ++--
x11-drivers/nvidia-drivers/files/nvidia-555.conf | 8 ++--
.../nvidia-drivers/files/system-sleep.elogind | 7 +++
....ebuild => nvidia-drivers-470.256.02-r1.ebuild} | 56 ++++++++++++++++++++++
....ebuild => nvidia-drivers-525.147.05-r1.ebuild} | 56 ++++++++++++++++++++++
....ebuild => nvidia-drivers-535.183.01-r1.ebuild} | 56 ++++++++++++++++++++++
....ebuild => nvidia-drivers-550.107.02-r1.ebuild} | 56 ++++++++++++++++++++++
...1.ebuild => nvidia-drivers-550.40.71-r1.ebuild} | 56 ++++++++++++++++++++++
...3.ebuild => nvidia-drivers-560.35.03-r1.ebuild} | 56 ++++++++++++++++++++++
10 files changed, 358 insertions(+), 9 deletions(-)
diff --git a/x11-drivers/nvidia-drivers/files/nvidia-470.conf b/x11-drivers/nvidia-drivers/files/nvidia-470.conf
index 2b87b67602e0..4dd0badfb271 100644
--- a/x11-drivers/nvidia-drivers/files/nvidia-470.conf
+++ b/x11-drivers/nvidia-drivers/files/nvidia-470.conf
@@ -9,10 +9,12 @@ blacklist nouveau
# 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 d5be9b654091..7c399e0c9490 100644
--- a/x11-drivers/nvidia-drivers/files/nvidia-545.conf
+++ b/x11-drivers/nvidia-drivers/files/nvidia-545.conf
@@ -14,10 +14,12 @@ blacklist nouveau
# 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/nvidia-555.conf b/x11-drivers/nvidia-drivers/files/nvidia-555.conf
index 98bd87c43080..7f83ba752025 100644
--- a/x11-drivers/nvidia-drivers/files/nvidia-555.conf
+++ b/x11-drivers/nvidia-drivers/files/nvidia-555.conf
@@ -20,10 +20,12 @@ blacklist nouveau
# Cannot be disabled if using USE="kernel-open".
#options nvidia NVreg_EnableGpuFirmware=0
-# 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 000000000000..d36e2697b86c
--- /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.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-470.256.02-r1.ebuild
similarity index 82%
rename from x11-drivers/nvidia-drivers/nvidia-drivers-470.256.02.ebuild
rename to x11-drivers/nvidia-drivers/nvidia-drivers-470.256.02-r1.ebuild
index 72647eb64cb8..5223357f1af2 100644
--- a/x11-drivers/nvidia-drivers/nvidia-drivers-470.256.02.ebuild
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-470.256.02-r1.ebuild
@@ -358,6 +358,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
@@ -435,4 +451,44 @@ pkg_postinst() {
ewarn "[1] https://www.nvidia.com/object/IO_32667.html"
ewarn "[2] https://wiki.gentoo.org/wiki/Nouveau"
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
}
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-525.147.05.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-525.147.05-r1.ebuild
similarity index 85%
rename from x11-drivers/nvidia-drivers/nvidia-drivers-525.147.05.ebuild
rename to x11-drivers/nvidia-drivers/nvidia-drivers-525.147.05-r1.ebuild
index 69c715a9288b..de085dd0ad2b 100644
--- a/x11-drivers/nvidia-drivers/nvidia-drivers-525.147.05.ebuild
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-525.147.05-r1.ebuild
@@ -422,6 +422,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
@@ -518,4 +534,44 @@ pkg_postinst() {
elog "If you experience issues, either disable wayland or edit nvidia.conf."
elog "Of note, may possibly cause issues with SLI and Reverse PRIME."
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 525.147.05-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
}
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-535.183.01.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-535.183.01-r1.ebuild
similarity index 85%
rename from x11-drivers/nvidia-drivers/nvidia-drivers-535.183.01.ebuild
rename to x11-drivers/nvidia-drivers/nvidia-drivers-535.183.01-r1.ebuild
index b6e7ae3c70c1..340237b6525e 100644
--- a/x11-drivers/nvidia-drivers/nvidia-drivers-535.183.01.ebuild
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-535.183.01-r1.ebuild
@@ -422,6 +422,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
@@ -518,4 +534,44 @@ pkg_postinst() {
elog "If you experience issues, either disable wayland or edit nvidia.conf."
elog "Of note, may possibly cause issues with SLI and Reverse PRIME."
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 535.183.01-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
}
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-550.107.02.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-550.107.02-r1.ebuild
similarity index 84%
rename from x11-drivers/nvidia-drivers/nvidia-drivers-550.107.02.ebuild
rename to x11-drivers/nvidia-drivers/nvidia-drivers-550.107.02-r1.ebuild
index 42c25308f23a..430c45687498 100644
--- a/x11-drivers/nvidia-drivers/nvidia-drivers-550.107.02.ebuild
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-550.107.02-r1.ebuild
@@ -400,6 +400,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
@@ -497,4 +513,44 @@ pkg_postinst() {
elog "If you experience issues, either disable wayland or edit nvidia.conf."
elog "Of note, may possibly cause issues with SLI and Reverse PRIME."
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 550.107.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
}
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-550.40.71.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-550.40.71-r1.ebuild
similarity index 84%
rename from x11-drivers/nvidia-drivers/nvidia-drivers-550.40.71.ebuild
rename to x11-drivers/nvidia-drivers/nvidia-drivers-550.40.71-r1.ebuild
index 0b678cefa151..de02b58759b9 100644
--- a/x11-drivers/nvidia-drivers/nvidia-drivers-550.40.71.ebuild
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-550.40.71-r1.ebuild
@@ -402,6 +402,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
@@ -499,4 +515,44 @@ pkg_postinst() {
elog "If you experience issues, either disable wayland or edit nvidia.conf."
elog "Of note, may possibly cause issues with SLI and Reverse PRIME."
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 550.40.71-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
}
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-560.35.03.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-560.35.03-r1.ebuild
similarity index 85%
rename from x11-drivers/nvidia-drivers/nvidia-drivers-560.35.03.ebuild
rename to x11-drivers/nvidia-drivers/nvidia-drivers-560.35.03-r1.ebuild
index 7201283bfb9f..31a3eab6d6e2 100644
--- a/x11-drivers/nvidia-drivers/nvidia-drivers-560.35.03.ebuild
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-560.35.03-r1.ebuild
@@ -405,6 +405,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
@@ -512,4 +528,44 @@ pkg_postinst() {
elog "enables the use of the GSP firmware by default. *If* experience regressions,"
elog "please see '${EROOT}/etc/modprobe.d/nvidia.conf' to optionally disable."
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 560.35.03-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
}
next reply other threads:[~2024-09-14 10:52 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-14 10:52 Ionen Wolkens [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-11-18 9:06 [gentoo-commits] repo/gentoo:master commit in: x11-drivers/nvidia-drivers/, x11-drivers/nvidia-drivers/files/ Ionen Wolkens
2024-02-26 13:23 Ionen Wolkens
2024-02-01 21:06 Ionen Wolkens
2024-01-15 23:03 Ionen Wolkens
2023-06-18 1:53 Ionen Wolkens
2023-02-28 17:00 Ionen Wolkens
2022-12-02 18:13 Ionen Wolkens
2022-09-16 6:15 Ionen Wolkens
2022-05-31 19:11 Ionen Wolkens
2021-07-21 19:44 Ionen Wolkens
2021-04-21 12:22 David Seifert
2021-03-21 15:53 David Seifert
2021-03-21 15:53 David Seifert
2020-12-07 12:57 David Seifert
2020-08-25 17:44 Matt Turner
2019-11-29 1:59 Mike Gilbert
2019-03-03 13:11 Jeroen Roovers
2019-01-16 10:00 Jeroen Roovers
2018-06-30 8:17 Jeroen Roovers
2017-10-31 11:26 Jeroen Roovers
2017-10-07 9:44 Jeroen Roovers
2017-09-27 16:11 Jeroen Roovers
2017-05-06 10:59 Jeroen Roovers
2017-03-30 7:29 Jeroen Roovers
2017-02-15 6:53 Jeroen Roovers
2016-11-27 10:46 Jeroen Roovers
2016-11-02 7:53 Jeroen Roovers
2016-08-17 5:49 Jeroen Roovers
2016-07-24 11:37 Jeroen Roovers
2016-01-31 19:19 Jeroen Roovers
2016-01-31 9:23 Jeroen Roovers
2015-12-06 5:32 Jeroen Roovers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1726310966.a0f953fc4720a191288b7e28c1df4ab50eb9a598.ionen@gentoo \
--to=ionen@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox