summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIonen Wolkens <ionen@gentoo.org>2024-09-06 05:13:41 -0400
committerIonen Wolkens <ionen@gentoo.org>2024-09-14 06:49:26 -0400
commita0f953fc4720a191288b7e28c1df4ab50eb9a598 (patch)
tree32b784b41cfc3bca44e55d43e4527f820c4f55b0 /x11-drivers
parentdev-ruby/timeout: Stabilize 0.4.1 sparc, #939609 (diff)
downloadgentoo-a0f953fc4720a191288b7e28c1df4ab50eb9a598.tar.gz
gentoo-a0f953fc4720a191288b7e28c1df4ab50eb9a598.tar.bz2
gentoo-a0f953fc4720a191288b7e28c1df4ab50eb9a598.zip
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@gentoo.org>
Diffstat (limited to 'x11-drivers')
-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/nvidia-555.conf8
-rw-r--r--x11-drivers/nvidia-drivers/files/system-sleep.elogind7
-rw-r--r--x11-drivers/nvidia-drivers/nvidia-drivers-470.256.02-r1.ebuild (renamed from x11-drivers/nvidia-drivers/nvidia-drivers-470.256.02.ebuild)56
-rw-r--r--x11-drivers/nvidia-drivers/nvidia-drivers-525.147.05-r1.ebuild (renamed from x11-drivers/nvidia-drivers/nvidia-drivers-525.147.05.ebuild)56
-rw-r--r--x11-drivers/nvidia-drivers/nvidia-drivers-535.183.01-r1.ebuild (renamed from x11-drivers/nvidia-drivers/nvidia-drivers-535.183.01.ebuild)56
-rw-r--r--x11-drivers/nvidia-drivers/nvidia-drivers-550.107.02-r1.ebuild (renamed from x11-drivers/nvidia-drivers/nvidia-drivers-550.107.02.ebuild)56
-rw-r--r--x11-drivers/nvidia-drivers/nvidia-drivers-550.40.71-r1.ebuild (renamed from x11-drivers/nvidia-drivers/nvidia-drivers-550.40.71.ebuild)56
-rw-r--r--x11-drivers/nvidia-drivers/nvidia-drivers-560.35.03-r1.ebuild (renamed from x11-drivers/nvidia-drivers/nvidia-drivers-560.35.03.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
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
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
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
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
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
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
}