All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Paulo Zanoni <przanoni@gmail.com>
Cc: Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH 12/16] drm/i915: Disable LP1+ watermarks while changing the number of active pipes
Date: Mon, 9 Jun 2014 19:51:24 +0300	[thread overview]
Message-ID: <20140609165124.GS27580@intel.com> (raw)
In-Reply-To: <CA+gsUGSdaLt-qFC8Jh60zOdR4jQHQk7Y+pBsLspCGGN4eyaxxA@mail.gmail.com>

On Wed, Jun 04, 2014 at 03:24:13PM -0300, Paulo Zanoni wrote:
> 2014-05-22 11:48 GMT-03:00  <ville.syrjala@linux.intel.com>:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >
> > When we switch between one active pipe and multiple active pipes, the
> > display FIFO gets repartitioned. Disable the LP1+ waterwarks while that
> > is happening to make sure we don't get any glitches on other active
> > pipes while doing a modeset on another other pipe.
> >
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_display.c | 45 ++++++++++++++++++++++++++++++++++
> >  drivers/gpu/drm/i915/intel_drv.h     |  2 ++
> >  drivers/gpu/drm/i915/intel_pm.c      | 47 ++++++++++++++++++++++++++++++++----
> >  3 files changed, 89 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> > index bccf414..311c0f0 100644
> > --- a/drivers/gpu/drm/i915/intel_display.c
> > +++ b/drivers/gpu/drm/i915/intel_display.c
> > @@ -3985,6 +3985,27 @@ static struct intel_crtc *get_other_active_crtc(struct intel_crtc *crtc)
> >         return other_active_crtc;
> >  }
> >
> > +static void ilk_prepare_for_num_pipes_change(struct intel_crtc *crtc)
> > +{
> > +       struct drm_device *dev = crtc->base.dev;
> > +       struct intel_crtc *other_active_crtc = get_other_active_crtc(crtc);
> > +
> > +       /*
> > +        * If we change between one pipe and multiple pipes,
> > +        * make sure the other active pipe is prepared
> > +        * for having its FIFO resized. We do that by making
> > +        * sure the pipe isn't using LP1+ watermarks when
> > +        * the second pipe gets enabled or disabled.
> > +        */
> > +       if (!other_active_crtc)
> > +               return;
> 
> But get_other_active_crtc() returns NULL in case 2 other CRTCs are
> already active. If we're the third pipe being enabled, we may still
> get an underrun.

The FIFO repartitioning happens only when going 1<->2 pipes, so the
2<->3 cases don't matter here.

> 
> > +
> > +       ilk_wm_synchronize(other_active_crtc);
> > +
> > +       if (ilk_disable_lp_wm(dev))
> > +               intel_wait_for_vblank(dev, other_active_crtc->pipe);
> > +}
> > +
> >  static void ironlake_crtc_enable(struct drm_crtc *crtc)
> >  {
> >         struct drm_device *dev = crtc->dev;
> > @@ -4023,6 +4044,9 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc)
> >
> >         intel_crtc->active = true;
> >
> > +       /* Make sure other pipes are prepared for FIFO resizing */
> > +       ilk_prepare_for_num_pipes_change(intel_crtc);
> > +
> >         intel_set_cpu_fifo_underrun_reporting(dev, pipe, true);
> >         intel_set_pch_fifo_underrun_reporting(dev, pipe, true);
> >
> > @@ -4123,6 +4147,9 @@ static void haswell_crtc_enable(struct drm_crtc *crtc)
> >
> >         intel_crtc->active = true;
> >
> > +       /* Make sure other pipes are prepared for FIFO resizing */
> > +       ilk_prepare_for_num_pipes_change(intel_crtc);
> > +
> >         intel_set_cpu_fifo_underrun_reporting(dev, pipe, true);
> >         if (intel_crtc->config.has_pch_encoder)
> >                 intel_set_pch_fifo_underrun_reporting(dev, TRANSCODER_A, true);
> > @@ -4192,6 +4219,9 @@ static void ironlake_crtc_disable(struct drm_crtc *crtc)
> >
> >         intel_crtc_disable_planes(crtc);
> >
> > +       /* Make sure other pipes are prepared for FIFO resizing */
> > +       ilk_prepare_for_num_pipes_change(intel_crtc);
> > +
> >         for_each_encoder_on_crtc(dev, crtc, encoder)
> >                 encoder->disable(encoder);
> >
> > @@ -4235,6 +4265,12 @@ static void ironlake_crtc_disable(struct drm_crtc *crtc)
> >
> >         intel_crtc->active = false;
> >
> > +       /*
> > +        * Potentially let some other pipe use the
> > +        * full FIFO, and re-enable LP1+ watermarks.
> > +        */
> > +       ilk_wm_pipe_post_disable(intel_crtc);
> > +
> >         mutex_lock(&dev->struct_mutex);
> >         intel_update_fbc(dev);
> >         intel_edp_psr_update(dev);
> > @@ -4255,6 +4291,9 @@ static void haswell_crtc_disable(struct drm_crtc *crtc)
> >
> >         intel_crtc_disable_planes(crtc);
> >
> > +       /* Make sure other pipes are prepared for FIFO resizing */
> > +       ilk_prepare_for_num_pipes_change(intel_crtc);
> > +
> >         for_each_encoder_on_crtc(dev, crtc, encoder) {
> >                 intel_opregion_notify_encoder(encoder, false);
> >                 encoder->disable(encoder);
> > @@ -4282,6 +4321,12 @@ static void haswell_crtc_disable(struct drm_crtc *crtc)
> >
> >         intel_crtc->active = false;
> >
> > +       /*
> > +        * Potentially let some other pipe use the
> > +        * full FIFO, and re-enable LP1+ watermarks.
> > +        */
> > +       ilk_wm_pipe_post_disable(intel_crtc);
> > +
> >         mutex_lock(&dev->struct_mutex);
> >         intel_update_fbc(dev);
> >         intel_edp_psr_update(dev);
> > diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> > index 5ad7ad5..98f878f 100644
> > --- a/drivers/gpu/drm/i915/intel_drv.h
> > +++ b/drivers/gpu/drm/i915/intel_drv.h
> > @@ -1022,6 +1022,8 @@ void intel_program_watermarks_pre(struct intel_crtc *crtc,
> >  void intel_program_watermarks_post(struct intel_crtc *crtc,
> >                                    const struct intel_crtc_wm_config *config);
> >  void ilk_wm_synchronize(struct intel_crtc *crtc);
> > +void ilk_wm_pipe_post_disable(struct intel_crtc *crtc);
> > +bool ilk_disable_lp_wm(struct drm_device *dev);
> >
> >
> >  /* intel_sdvo.c */
> > diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> > index 1c072cd..18ea8b1 100644
> > --- a/drivers/gpu/drm/i915/intel_pm.c
> > +++ b/drivers/gpu/drm/i915/intel_pm.c
> > @@ -2765,7 +2765,7 @@ static void ilk_write_wm_values(struct drm_i915_private *dev_priv,
> >         }
> >  }
> >
> > -static bool ilk_disable_lp_wm(struct drm_device *dev)
> > +bool ilk_disable_lp_wm(struct drm_device *dev)
> >  {
> >         struct drm_i915_private *dev_priv = dev->dev_private;
> >         bool changed;
> > @@ -2873,16 +2873,17 @@ static void ilk_program_watermarks(struct drm_device *dev)
> >         ilk_write_wm_values(dev_priv, &results);
> >  }
> >
> > -static void ilk_update_watermarks(struct drm_device *dev)
> > +static void ilk_update_watermarks(struct drm_device *dev, bool force)
> >  {
> >         bool changed;
> >
> >         changed = ilk_refresh_pending_watermarks(dev);
> >
> > -       if (changed)
> > +       if (changed || force)
> >                 ilk_program_watermarks(dev);
> >  }
> >
> > +/* Prepare the pipe to update the its watermarks on the next vblank */
> >  static void ilk_setup_pending_watermarks(struct intel_crtc *crtc,
> >                                          const struct intel_pipe_wm *pipe_wm,
> >                                          u32 vbl_count)
> > @@ -2905,7 +2906,7 @@ static void ilk_setup_pending_watermarks(struct intel_crtc *crtc,
> >         spin_unlock_irq(&crtc->wm.lock);
> >
> >         /* try to update immediately */
> > -       ilk_update_watermarks(dev);
> > +       ilk_update_watermarks(dev, false);
> >
> >         spin_lock_irq(&crtc->wm.lock);
> >
> > @@ -2999,7 +3000,7 @@ static void ilk_watermark_work(struct work_struct *work)
> >
> >         mutex_lock(&dev_priv->wm.mutex);
> >
> > -       ilk_update_watermarks(dev_priv->dev);
> > +       ilk_update_watermarks(dev_priv->dev, false);
> >
> >         mutex_unlock(&dev_priv->wm.mutex);
> >  }
> > @@ -3060,6 +3061,42 @@ void ilk_wm_synchronize(struct intel_crtc *crtc)
> >         mutex_unlock(&dev_priv->wm.mutex);
> >  }
> >
> > +void ilk_wm_pipe_post_disable(struct intel_crtc *crtc)
> > +{
> > +       struct drm_device *dev = crtc->base.dev;
> > +       struct drm_i915_private *dev_priv = dev->dev_private;
> > +       struct ilk_pipe_wm_parameters params = {};
> > +       struct intel_pipe_wm pipe_wm = {};
> > +
> > +       WARN(crtc->active, "pipe %c should be disabled\n",
> > +            pipe_name(crtc->pipe));
> > +
> > +       ilk_compute_wm_parameters(&crtc->base, &params);
> > +
> > +       intel_compute_pipe_wm(&crtc->base, &params, &pipe_wm);
> > +
> > +       mutex_lock(&dev_priv->wm.mutex);
> > +
> > +       spin_lock_irq(&crtc->wm.lock);
> > +
> > +       WARN(crtc->wm.dirty, "pipe %c disabled with dirty watermarks\n",
> > +            pipe_name(crtc->pipe));
> > +
> > +       /* clean up if something is left behind */
> > +       ilk_wm_cancel(crtc);
> > +
> > +       spin_unlock_irq(&crtc->wm.lock);
> > +
> > +       crtc->wm.active = pipe_wm;
> > +
> > +       /* pending update (if any) got cancelled */
> > +       crtc->wm.pending = crtc->wm.active;
> > +
> > +       ilk_update_watermarks(dev, true);
> > +
> > +       mutex_unlock(&dev_priv->wm.mutex);
> > +}
> > +
> >  static int ilk_update_primary_wm(struct intel_crtc *crtc,
> >                                  struct intel_crtc_wm_config *config)
> >  {
> > --
> > 1.8.5.5
> >
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
> 
> 
> -- 
> Paulo Zanoni

-- 
Ville Syrjälä
Intel OTC

  reply	other threads:[~2014-06-09 16:52 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-22 14:48 [PATCH v2 00/16] drm/i915: Two part watermark update for ILK+, part 2 ville.syrjala
2014-05-22 14:48 ` [PATCH v2 01/16] drm/i915: Keep vblank interrupts enabled while enabling/disabling planes ville.syrjala
2014-05-26 13:56   ` Daniel Vetter
2014-06-04  6:00     ` Arun Murthy
2014-06-10 16:22       ` Ville Syrjälä
2014-05-22 14:48 ` [PATCH 02/16] drm/i915: Leave interrupts enabled while disabling crtcs during suspend ville.syrjala
2014-05-22 14:48 ` [PATCH 03/16] drm/i915: Check hw vs. sw watermark state after programming ville.syrjala
2014-05-22 14:48 ` [PATCH 04/16] drm/i915: Refactor ilk_validate_pipe_wm() ville.syrjala
2014-05-22 14:48 ` [PATCH v2 05/16] drm/i915: Refactor ilk_update_wm ville.syrjala
2014-05-22 14:48 ` [PATCH 06/16] drm/i915: Add dev_priv->wm.mutex ville.syrjala
2014-05-22 14:48 ` [PATCH v2 07/16] drm/i915: Add vblank based delayed watermark update mechanism ville.syrjala
2014-06-03 18:50   ` Paulo Zanoni
2014-06-03 19:32     ` Ville Syrjälä
2014-06-04 14:01       ` Paulo Zanoni
2014-06-04 16:10         ` Daniel Vetter
2014-06-09 15:01           ` Ville Syrjälä
2014-05-22 14:48 ` [PATCH v2 08/16] drm/i915: Split watermark programming into pre and post steps ville.syrjala
2014-06-03 20:51   ` Paulo Zanoni
2014-06-04 16:22     ` Daniel Vetter
2014-06-09 17:03       ` Ville Syrjälä
2014-06-10 11:46         ` Jani Nikula
2014-05-22 14:48 ` [PATCH v2 09/16] drm/i915: Actually perform the watermark update in two phases ville.syrjala
2014-06-03 22:47   ` Paulo Zanoni
2014-06-09 18:28     ` Ville Syrjälä
2014-05-22 14:48 ` [PATCH v2 10/16] drm/i915: Wait for watermark updates to finish before disabling a pipe ville.syrjala
2014-06-04 13:54   ` Paulo Zanoni
2014-05-22 14:48 ` [PATCH 11/16] drm/i915: Refactor get_other_active_crtc() ville.syrjala
2014-06-04 16:59   ` Paulo Zanoni
2014-05-22 14:48 ` [PATCH 12/16] drm/i915: Disable LP1+ watermarks while changing the number of active pipes ville.syrjala
2014-06-04 18:24   ` Paulo Zanoni
2014-06-09 16:51     ` Ville Syrjälä [this message]
2014-05-22 14:48 ` [PATCH v2 13/16] drm/i915: Keep track of who disabled LP1+ watermarks ville.syrjala
2014-06-04 18:30   ` Paulo Zanoni
2014-05-22 14:48 ` [PATCH 14/16] drm/i915: Prefer the 5/6 DDB split when primary is disabled ville.syrjala
2014-06-04 18:34   ` Paulo Zanoni
2014-05-22 14:48 ` [PATCH 15/16] drm/i915: Add a workaround for sprite only <-> primary only switching ville.syrjala
2014-06-04 18:44   ` Paulo Zanoni
2014-05-22 14:48 ` [PATCH 16/16] drm/i915: Don't disable LP1+ watermarks for every frame when scaled ville.syrjala
2014-06-04 18:49   ` Paulo Zanoni

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=20140609165124.GS27580@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=przanoni@gmail.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.