[gdm/disable-hybrid-nvidia: 26/26] data: Disable wayland on nvidia if suspend is broken




commit 3255df0123b06806ccf3c3931d8ed6cf21c4001f
Author: Ray Strode <rstrode redhat com>
Date:   Fri Mar 4 14:11:03 2022 -0500

    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.

 data/61-gdm.rules.in | 12 ++++++++++++
 1 file changed, 12 insertions(+)
---
diff --git a/data/61-gdm.rules.in b/data/61-gdm.rules.in
index a9052985f..0b1168c58 100644
--- a/data/61-gdm.rules.in
+++ b/data/61-gdm.rules.in
@@ -57,6 +57,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}="/usr/bin/sed 's/: /=/g' /proc/driver/nvidia/params"
+ENV{NVreg_PreserveVideoMemoryAllocations}!="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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]