diff options
author | Ray Strode <rstrode@redhat.com> | 2022-03-04 14:11:03 -0500 |
---|---|---|
committer | Ray Strode <halfline@gmail.com> | 2022-03-23 14:21:09 +0000 |
commit | 51181871e9db716546e9593216220389de0d8b03 (patch) | |
tree | aa8c48a4b1ad4ddf1d5981c050735e3dbc0bf386 | |
parent | 440d6f9ecc151fbcf8c852d500c5cc5add168b94 (diff) | |
download | gdm-51181871e9db716546e9593216220389de0d8b03.tar.gz |
data: Disable wayland on nvidia if suspend is broken
The vendor nvidia driver scrambles texture memory during suspend, and
only restores it under certain situations.
This commit tries to detect those situations and only use wayland
in those cases.
-rw-r--r-- | data/61-gdm.rules.in | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/data/61-gdm.rules.in b/data/61-gdm.rules.in index 6b36bcbc..02a10e9c 100644 --- a/data/61-gdm.rules.in +++ b/data/61-gdm.rules.in @@ -22,6 +22,18 @@ KERNEL!="nvidia", GOTO="gdm_nvidia_end" SUBSYSTEM!="module", GOTO="gdm_nvidia_end" ACTION!="add", GOTO="gdm_nvidia_end" RUN+="/usr/bin/touch /run/udev/gdm-machine-has-vendor-nvidia-driver" + +# Check if suspend/resume services necessary for working wayland support is available +TEST{0711}!="/usr/bin/nvidia-sleep.sh", GOTO="gdm_disable_wayland" +TEST{0711}!="/usr/lib/systemd/system-sleep/nvidia", GOTO="gdm_disable_wayland" +IMPORT{program}="/bin/sh -c \"sed -e 's/: /=/g' -e 's/\([^[:upper:]]\)\([[:upper:]]\)/\1_\2/g' -e 's/[[:lower:]]/\U&/g' -e 's/^/NVIDIA_/' /proc/driver/nvidia/params\"" +ENV{NVIDIA_PRESERVE_VIDEO_MEMORY_ALLOCATIONS}!="1", GOTO="gdm_disable_wayland" +IMPORT{program}="/bin/sh -c 'echo NVIDIA_HIBERNATE=`systemctl is-enabled nvidia-hibernate`'" +ENV{NVIDIA_HIBERNATE}!="enabled", GOTO="gdm_disable_wayland" +IMPORT{program}="/bin/sh -c 'echo NVIDIA_RESUME=`systemctl is-enabled nvidia-resume`'" +ENV{NVIDIA_RESUME}!="enabled", GOTO="gdm_disable_wayland" +IMPORT{program}="/bin/sh -c 'echo NVIDIA_SUSPEND=`systemctl is-enabled nvidia-suspend`'" +ENV{NVIDIA_SUSPEND}!="enabled", GOTO="gdm_disable_wayland" LABEL="gdm_nvidia_end" # If this machine has an internal panel, take note, since it's probably a laptop |