summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Lowther <victor.lowther@gmail.com>2009-04-03 13:39:55 -0500
committerVictor Lowther <victor.lowther@gmail.com>2009-04-03 13:39:55 -0500
commita79d16300c662080caf1775f1cf68f1be4049716 (patch)
treecd9248e5f0adf87e711efced06fc56fc5c196450
parent584f08dc12fada69dbe1948a61cfc4b179b40eda (diff)
Add KMS support to 98-smart-kernel-video
Also factor some things out to make 98-smart-kernel-video shorter.
-rwxr-xr-xpm/sleep.d/98smart-kernel-video52
1 files changed, 25 insertions, 27 deletions
diff --git a/pm/sleep.d/98smart-kernel-video b/pm/sleep.d/98smart-kernel-video
index 1043e94..af1b721 100755
--- a/pm/sleep.d/98smart-kernel-video
+++ b/pm/sleep.d/98smart-kernel-video
@@ -9,15 +9,8 @@
. "${PM_FUNCTIONS}"
-
-# Test to see if the kernel has a video driver that is smart enough to
-# handle quirks without external assistance. If it is, remove the quirks.
-smart_kernel_nvidia()
+remove_all_video_quirks()
{
- # despite the bad rep the nvidia driver has, it is miles better than
- # any other video driver when it comes to handling power managment and
- # suspend/resume in a quirk-free manner.
- [ -d /sys/module/nvidia ] || return 1
remove_parameters --quirk-dpms-on \
--quirk-dpms-suspend \
--quirk-s3-mode \
@@ -33,32 +26,38 @@ smart_kernel_nvidia()
--quirk-pci-save
}
-smart_kernel_fglrx()
+# Test to see if the kernel has a video driver that is smart enough to
+# handle quirks without external assistance. If it is, remove the quirks.
+have_kms()
+{
+ # if we are running with a KMS-enabled video driver, we should not
+ # attempt to run any quirks
+ [ -d /sys/class/drm/card0/device/graphics/fb0 ] || return 1
+ remove_all_video_quirks
+}
+
+have_nvidia()
+{
+ # despite the bad rep the nvidia driver has, it is miles better than
+ # any other video driver when it comes to handling power managment and
+ # suspend/resume in a quirk-free manner.
+ [ -d /sys/module/nvidia ] || return 1
+ remove_all_video_quirks
+}
+
+have_fglrx()
{
# the ATI driver is pretty good about it, too.
[ -d /sys/module/fglrx ] || return 1
- remove_parameters --quirk-dpms-on \
- --quirk-dpms-suspend \
- --quirk-s3-mode \
- --quirk-s3-bios \
- --quirk-vbe-post \
- --quirk-vbe-post \
- --quirk-vga-mode3 \
- --quirk-vbemode-restore \
- --quirk-vbestate-restore \
- --quirk-reset-brightness \
- --quirk-radeon-off \
- --quirk-no-fb \
- --quirk-pci-save
+ remove_all_video_quirks
}
-smart_kernel_intel()
+have_smart_intel()
{
# currently, intel kernel modesetting is not quite smart enough
# we still need acpi s3 kernel modesetting hooks, so don't remove those
# options if they were passed.
- [ -d /sys/module/i915 ] || return 1
-
+ [ -d /sys/module/i915 ] || return 1
local kernel_rev="$(uname -r |awk -F '[_-]' '{print $1}')"
[ "$kernel_rev" \> "2.6.26" -o "$kernel_rev" = "2.6.26" ] || return 1
remove_parameters --quirk-dpms-on \
@@ -76,8 +75,7 @@ smart_kernel_intel()
smart_kernel_video()
{
- smart_kernel_nvidia || smart_kernel_fglrx || smart_kernel_intel || \
- return $NA
+ have_kms || have_nvidia || have_fglrx || have_smart_intel || return $NA
}
case $1 in