Intel-GFX Archive on lore.kernel.org
 help / color / Atom feed
From: Paulo Zanoni <przanoni@gmail.com>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH 1/3] drm/i915: don't save/restore DP regs for kms
Date: Wed, 17 Oct 2012 16:52:28 -0300
Message-ID: <CA+gsUGTzdurAeAFG_URmgKYMnxTwPyztnbjbujmhhWpqWXV+1g@mail.gmail.com> (raw)
In-Reply-To: <1350466377-19382-1-git-send-email-daniel.vetter@ffwll.ch>

Hi

2012/10/17 Daniel Vetter <daniel.vetter@ffwll.ch>:
> We completely compute these anew in each modeset, hence we don't rely
> on them containing anything valid after resume.
>
> To avoid breaking any ums setup due to reordering of the reads/writes
> simply don't reorder anything, but bracket the reads/writes into if
> (!kms) conditionals. More churn, but safer.
>
> v2: Fixup the logic, noticed by Paulo Zanoni.
>
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>

For the 3 patches:
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Tested-by: Paulo Zanoni <paulo.r.zanoni@intel.com>

Tested only on HSW: S3 and S4 suspend still works.

> ---
>  drivers/gpu/drm/i915/i915_suspend.c | 68 ++++++++++++++++++++-----------------
>  1 file changed, 37 insertions(+), 31 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c
> index 6e398a8..3d12147 100644
> --- a/drivers/gpu/drm/i915/i915_suspend.c
> +++ b/drivers/gpu/drm/i915/i915_suspend.c
> @@ -660,21 +660,23 @@ static void i915_save_display(struct drm_device *dev)
>                 dev_priv->savePP_DIVISOR = I915_READ(PP_DIVISOR);
>         }
>
> -       /* Display Port state */
> -       if (SUPPORTS_INTEGRATED_DP(dev)) {
> -               dev_priv->saveDP_B = I915_READ(DP_B);
> -               dev_priv->saveDP_C = I915_READ(DP_C);
> -               dev_priv->saveDP_D = I915_READ(DP_D);
> -               dev_priv->savePIPEA_GMCH_DATA_M = I915_READ(_PIPEA_GMCH_DATA_M);
> -               dev_priv->savePIPEB_GMCH_DATA_M = I915_READ(_PIPEB_GMCH_DATA_M);
> -               dev_priv->savePIPEA_GMCH_DATA_N = I915_READ(_PIPEA_GMCH_DATA_N);
> -               dev_priv->savePIPEB_GMCH_DATA_N = I915_READ(_PIPEB_GMCH_DATA_N);
> -               dev_priv->savePIPEA_DP_LINK_M = I915_READ(_PIPEA_DP_LINK_M);
> -               dev_priv->savePIPEB_DP_LINK_M = I915_READ(_PIPEB_DP_LINK_M);
> -               dev_priv->savePIPEA_DP_LINK_N = I915_READ(_PIPEA_DP_LINK_N);
> -               dev_priv->savePIPEB_DP_LINK_N = I915_READ(_PIPEB_DP_LINK_N);
> -       }
> -       /* FIXME: save TV & SDVO state */
> +       if (!drm_core_check_feature(dev, DRIVER_MODESET)) {
> +               /* Display Port state */
> +               if (SUPPORTS_INTEGRATED_DP(dev)) {
> +                       dev_priv->saveDP_B = I915_READ(DP_B);
> +                       dev_priv->saveDP_C = I915_READ(DP_C);
> +                       dev_priv->saveDP_D = I915_READ(DP_D);
> +                       dev_priv->savePIPEA_GMCH_DATA_M = I915_READ(_PIPEA_GMCH_DATA_M);
> +                       dev_priv->savePIPEB_GMCH_DATA_M = I915_READ(_PIPEB_GMCH_DATA_M);
> +                       dev_priv->savePIPEA_GMCH_DATA_N = I915_READ(_PIPEA_GMCH_DATA_N);
> +                       dev_priv->savePIPEB_GMCH_DATA_N = I915_READ(_PIPEB_GMCH_DATA_N);
> +                       dev_priv->savePIPEA_DP_LINK_M = I915_READ(_PIPEA_DP_LINK_M);
> +                       dev_priv->savePIPEB_DP_LINK_M = I915_READ(_PIPEB_DP_LINK_M);
> +                       dev_priv->savePIPEA_DP_LINK_N = I915_READ(_PIPEA_DP_LINK_N);
> +                       dev_priv->savePIPEB_DP_LINK_N = I915_READ(_PIPEB_DP_LINK_N);
> +               }
> +               /* FIXME: save TV & SDVO state */
> +       }
>
>         /* Only save FBC state on the platform that supports FBC */
>         if (I915_HAS_FBC(dev)) {
> @@ -709,16 +711,18 @@ static void i915_restore_display(struct drm_device *dev)
>         /* Display arbitration */
>         I915_WRITE(DSPARB, dev_priv->saveDSPARB);
>
> -       /* Display port ratios (must be done before clock is set) */
> -       if (SUPPORTS_INTEGRATED_DP(dev)) {
> -               I915_WRITE(_PIPEA_GMCH_DATA_M, dev_priv->savePIPEA_GMCH_DATA_M);
> -               I915_WRITE(_PIPEB_GMCH_DATA_M, dev_priv->savePIPEB_GMCH_DATA_M);
> -               I915_WRITE(_PIPEA_GMCH_DATA_N, dev_priv->savePIPEA_GMCH_DATA_N);
> -               I915_WRITE(_PIPEB_GMCH_DATA_N, dev_priv->savePIPEB_GMCH_DATA_N);
> -               I915_WRITE(_PIPEA_DP_LINK_M, dev_priv->savePIPEA_DP_LINK_M);
> -               I915_WRITE(_PIPEB_DP_LINK_M, dev_priv->savePIPEB_DP_LINK_M);
> -               I915_WRITE(_PIPEA_DP_LINK_N, dev_priv->savePIPEA_DP_LINK_N);
> -               I915_WRITE(_PIPEB_DP_LINK_N, dev_priv->savePIPEB_DP_LINK_N);
> +       if (!drm_core_check_feature(dev, DRIVER_MODESET)) {
> +               /* Display port ratios (must be done before clock is set) */
> +               if (SUPPORTS_INTEGRATED_DP(dev)) {
> +                       I915_WRITE(_PIPEA_GMCH_DATA_M, dev_priv->savePIPEA_GMCH_DATA_M);
> +                       I915_WRITE(_PIPEB_GMCH_DATA_M, dev_priv->savePIPEB_GMCH_DATA_M);
> +                       I915_WRITE(_PIPEA_GMCH_DATA_N, dev_priv->savePIPEA_GMCH_DATA_N);
> +                       I915_WRITE(_PIPEB_GMCH_DATA_N, dev_priv->savePIPEB_GMCH_DATA_N);
> +                       I915_WRITE(_PIPEA_DP_LINK_M, dev_priv->savePIPEA_DP_LINK_M);
> +                       I915_WRITE(_PIPEB_DP_LINK_M, dev_priv->savePIPEB_DP_LINK_M);
> +                       I915_WRITE(_PIPEA_DP_LINK_N, dev_priv->savePIPEA_DP_LINK_N);
> +                       I915_WRITE(_PIPEB_DP_LINK_N, dev_priv->savePIPEB_DP_LINK_N);
> +               }
>         }
>
>         /* This is only meaningful in non-KMS mode */
> @@ -761,13 +765,15 @@ static void i915_restore_display(struct drm_device *dev)
>                 I915_WRITE(PP_CONTROL, dev_priv->savePP_CONTROL);
>         }
>
> -       /* Display Port state */
> -       if (SUPPORTS_INTEGRATED_DP(dev)) {
> -               I915_WRITE(DP_B, dev_priv->saveDP_B);
> -               I915_WRITE(DP_C, dev_priv->saveDP_C);
> -               I915_WRITE(DP_D, dev_priv->saveDP_D);
> +       if (!drm_core_check_feature(dev, DRIVER_MODESET)) {
> +               /* Display Port state */
> +               if (SUPPORTS_INTEGRATED_DP(dev)) {
> +                       I915_WRITE(DP_B, dev_priv->saveDP_B);
> +                       I915_WRITE(DP_C, dev_priv->saveDP_C);
> +                       I915_WRITE(DP_D, dev_priv->saveDP_D);
> +               }
> +               /* FIXME: restore TV & SDVO state */
>         }
> -       /* FIXME: restore TV & SDVO state */
>
>         /* only restore FBC info on the platform that supports FBC*/
>         intel_disable_fbc(dev);
> --
> 1.7.11.7
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx



-- 
Paulo Zanoni

  parent reply index

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-11 18:08 [PATCH 0/6] reduce register save/restoring accross suspend/resume Daniel Vetter
2012-10-11 18:08 ` [PATCH 1/6] drm/i915/crt: don't set HOTPLUG bits on !PCH Daniel Vetter
2012-10-12  2:47   ` Paulo Zanoni
2012-10-12  8:45     ` Daniel Vetter
2012-10-12 17:17       ` Paulo Zanoni
2012-10-12 17:26         ` Daniel Vetter
2012-10-17 21:31           ` Paulo Zanoni
2012-10-11 18:08 ` [PATCH 2/6] drm/i915/crt: explicitly set up HOTPLUG_BITS on resume Daniel Vetter
2012-10-17 21:42   ` Paulo Zanoni
2012-10-11 18:08 ` [PATCH 3/6] drm/i915: don't save/restor ADPA for kms Daniel Vetter
2012-10-17 21:49   ` Paulo Zanoni
2012-10-18 12:34     ` Daniel Vetter
2012-10-11 18:08 ` [PATCH 4/6] drm/i915: don't save/restore DP regs " Daniel Vetter
2012-10-11 18:08 ` [PATCH 5/6] drm/i915: don't save/restore irq " Daniel Vetter
2012-10-11 18:08 ` [PATCH 6/6] drm/i915: don't save/restore HWS_PGA reg " Daniel Vetter
2012-10-17  9:32   ` [PATCH 1/3] drm/i915: don't save/restore DP regs " Daniel Vetter
2012-10-17  9:32     ` [PATCH 2/3] drm/i915: don't save/restore irq " Daniel Vetter
2012-10-17  9:32     ` [PATCH 3/3] drm/i915: don't save/restore HWS_PGA reg " Daniel Vetter
2012-10-17 19:52     ` Paulo Zanoni [this message]
2012-10-17 20:39       ` [PATCH 1/3] drm/i915: don't save/restore DP regs " Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CA+gsUGTzdurAeAFG_URmgKYMnxTwPyztnbjbujmhhWpqWXV+1g@mail.gmail.com \
    --to=przanoni@gmail.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Intel-GFX Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/intel-gfx/0 intel-gfx/git/0.git
	git clone --mirror https://lore.kernel.org/intel-gfx/1 intel-gfx/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 intel-gfx intel-gfx/ https://lore.kernel.org/intel-gfx \
		intel-gfx@lists.freedesktop.org
	public-inbox-index intel-gfx

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.freedesktop.lists.intel-gfx


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git