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

Dan Nicholson dbn.lists at gmail.com
Fri May 16 07:58:39 PDT 2008


On Fri, May 16, 2008 at 7:13 AM, Matthew Garrett <mjg59 at srcf.ucam.org> wrote:
> 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

Could we check `uname -r` then, too? Hmm, that might be kind of a PITA
to verify the version ranges correctly.

> +               # 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

It would feel more natural to me if the quirks were folded into
resume_video, but all in all it looks good to me.

--
Dan


More information about the Pm-utils mailing list