[Pm-utils] [PATCH] Set default quirk policy based on drivers

Matthew Garrett mjg59 at srcf.ucam.org
Fri May 16 07:13:43 PDT 2008


Some kernel drivers are able to restore graphics state on their own. 
Attempting to run quirks there can be harmful. Check whether there's a 
loaded driver which can handle suspend/resume, and if so refuse to run 
the quirks.

diff --git a/pm/sleep.d/99video b/pm/sleep.d/99video
index c8efd12..71decd5 100755
--- a/pm/sleep.d/99video
+++ b/pm/sleep.d/99video
@@ -151,7 +157,25 @@ case "$1" in
 			suspend_video
 		fi
 		;;
-	resume) resume_video ;;
+	resume) 
+		# Intel DRM can resume the graphics since 2.6.26
+		if [ -d /sys/module/i915 ]; then
+		       return 0;
+		fi
+
+		# Nvidia claim their binary driver can adequately handle 
+		# suspend/resume
+		if [ -d /sys/module/nvidia ]; then
+			return 0;
+		fi
+
+		# Ditto ATI
+		if [ -d /sys/module/fglrx ]; then
+			return 0;
+		fi
+
+		resume_video 
+		;;
 	thaw)
 		if [ "${HIBERNATE_RESUME_POST_VIDEO}" = "yes" ]; then
 			resume_video

-- 
Matthew Garrett | mjg59 at srcf.ucam.org


More information about the Pm-utils mailing list