summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Lowther <victor.lowther@gmail.com>2008-05-16 19:16:00 -0500
committerVictor Lowther <victor.lowther@gmail.com>2008-05-16 19:16:00 -0500
commit8dd65d7dacc708f7320b0d362085889eb4f31f1a (patch)
treeab41631b5d0b932c55cce6cc8b4ce2311e582b04
parenta91dfd180848a8b61bcdfa966360636c820bfa7d (diff)
Added support in 99video to check for a "smart enough" kernel video driver
One that is "smart enough" knows how to handle video card reinitialization without needing any of the usual quirks. Right now that list includes: * nVidia binary driver. * fglrx ATI binary driver. * Intel i915 DRM driver on kernels at or after 2.6.26
-rwxr-xr-xpm/sleep.d/99video17
1 files changed, 17 insertions, 0 deletions
diff --git a/pm/sleep.d/99video b/pm/sleep.d/99video
index c8efd12..27c08d0 100755
--- a/pm/sleep.d/99video
+++ b/pm/sleep.d/99video
@@ -99,6 +99,21 @@ vbe_post() { vbe post; sleep 0.1; }
radeon_off() { radeon dac off; radeon light off; }
radeon_on() { radeon dac on; radeon light on; }
+# Test to see if the kernel has a video driver that is smart enough
+# to handle quirks without external assistance.
+smart_kernel_video()
+{
+ # If we are using an ATI or nVidia binary driver, do nothing.
+ [ -d /sys/module/nvidia -o -d /sys/module/fglrx ] && return 0;
+
+ local kernel_rev="$(uname -r |awk -F '[_-]' '{print $1}')"
+ # Intel can to the same thing, but only at or after kernel 2.6.26.
+ # FIXME: a more accurate way of testing this?
+ [ -d /sys/module/i915 ] && \
+ [ "$kernel_rev" >= "2.6.26" ] && return 0;
+ return 1
+}
+
suspend_video()
{
# 0=nothing, 1=s3_bios, 2=s3_mode, 3=both
@@ -106,6 +121,7 @@ suspend_video()
quirk "${QUIRK_S3_BIOS}" && acpi_flag=$(($acpi_flag + 1))
quirk "${QUIRK_S3_MODE}" && acpi_flag=$(($acpi_flag + 2))
[ 0 -ne $acpi_flag ] && sysctl -w kernel.acpi_video_flags=$acpi_flag
+ smart_kernel_video && return
quirk "${QUIRK_VBESTATE_RESTORE}" && vbe_savestate
quirk "${QUIRK_VBEMODE_RESTORE}" && vbe_savemode
@@ -116,6 +132,7 @@ suspend_video()
}
resume_video()
{
+ smart_kernel_video && return
# We might need to do one or many of these quirks
quirk "${QUIRK_VBE_POST}" && vbe_post
quirk "${QUIRK_VBESTATE_RESTORE}" && vbe_restorestate