[Pm-utils] [PATCH 1/1] Handle kernel modesetting correctly.

Dan Nicholson dbn.lists at gmail.com
Tue Mar 24 09:23:46 PDT 2009


On Mon, Mar 23, 2009 at 7:42 PM, Victor Lowther
<victor.lowther at gmail.com> wrote:
> Now that KMS is finally going to be included in mainstream, we need to handle
> it. This patch does so by folding 90chvt into 99video, checking to see if we
> are using a KMS capable framebuffer, and if so removing all HAL-passed video
> quirks and adding a quirk that allows 99video to skip changing to vt63.
>
> My testing with the nvidia driver indicates that it does something vaguely
> approximating the Right Thing with vt handling, so it gets to ignore
> chvt handling in 99video too.
>
> Comments?

Seems pretty good. I cc'd Kristian since I know he has an intel kms
setup and can maybe see if this does the right thing.

Couple comments below.

> diff --git a/pm/sleep.d/98smart-kernel-video b/pm/sleep.d/98smart-kernel-video
> index 1043e94..997dc3e 100755
> --- a/pm/sleep.d/98smart-kernel-video
> +++ b/pm/sleep.d/98smart-kernel-video
> @@ -31,6 +31,7 @@ smart_kernel_nvidia()
>        --quirk-radeon-off \
>        --quirk-no-fb \
>        --quirk-pci-save
> +    add_parameters --quirk-no-chvt
>  }

Nitpick, but I'd like this to be in a separate commit since it deals
with nvidia rather than kms. Or maybe smart_kernel_modesetting could
be a separate commit from the chvt stuff.

> +smart_kernel_modesetting() {
> +    [ -d /sys/class/drm/card0/device/graphics/fb0 ] || return 1

At some point we'll probably have to think about dealing with systems
that have multiple cards and/or different drivers with/without kms.
But that can be punted on for now.

> +    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
> +    add_parameters --quirk-no-chvt
> +}
> +
>  smart_kernel_video()
>  {
> -        smart_kernel_nvidia || smart_kernel_fglrx || smart_kernel_intel || \
> -       return $NA
> +        smart_kernel_modesetting || smart_kernel_nvidia || \
> +           smart_kernel_fglrx || smart_kernel_intel || return $NA
>  }
>
>  case $1 in
> diff --git a/pm/sleep.d/99video b/pm/sleep.d/99video
> index 1fe54c2..01da7c7 100755
> --- a/pm/sleep.d/99video
> +++ b/pm/sleep.d/99video
> @@ -28,6 +28,7 @@ for opt in $PM_CMDLINE; do
>                vga-mode3)         QUIRK_VGA_MODE_3="true" ;;
>                no-fb)             QUIRK_NOFB="true" ;;
>                pci-save)          QUIRK_PCI_SAVE="true" ;;
> +               no-chvt)           QUIRK_NO_CHVT="true" ;;
>                none)              QUIRK_NONE="true" ;;
>                *) continue ;;
>        esac
> @@ -63,6 +64,17 @@ die_if_framebuffer()
>        exit 1
>  }
>
> +maybe_to_vt63() {
> +    [ "$QUIRK_NO_CHVT" = "true" ] && return
> +    fgconsole |savestate console
> +    chvt 63
> +}
> +
> +maybe_from_vt63() {
> +    state_exists console || return
> +    chvt $(restorestate console)
> +    deallocvt 63
> +}

Maybe these should be maybe_chvt/maybe_deallocvt? to/from_vt63 doesn't
jump out to me as to what's going on. Not a big deal, though.

Rest looks good. Thanks, Victor.

--
Dan


More information about the Pm-utils mailing list