public inbox for intel-gfx@lists.freedesktop.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 13/35] drm/i915: Store the watermark latency values in dev_priv
Date: Wed, 31 Jul 2013 12:43:57 +0300	[thread overview]
Message-ID: <20130731094357.GY5004@intel.com> (raw)
In-Reply-To: <CA+gsUGQd6jO6Lc1ry_yaUtOouJWzJGwUEGKGXWazn4WE65kETA@mail.gmail.com>

On Tue, Jul 30, 2013 at 06:42:45PM -0300, Paulo Zanoni wrote:
> I forgot to add intel-gfx in the review email...
> 
> 2013/7/30 Paulo Zanoni <przanoni@gmail.com>:
> > 2013/7/5  <ville.syrjala@linux.intel.com>:
> >> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >>
> >> Rather than having to read the latency values out every time, just
> >> store them in dev_priv.
> >>
> >> On ILK and IVB there is a difference between some of the latency
> >> values for different planes, so store the latency values for each
> >> plane type separately, and apply the necesary fixups during init.
> >>
> >> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >> ---
> >>  drivers/gpu/drm/i915/i915_drv.h |  9 ++++++
> >>  drivers/gpu/drm/i915/intel_pm.c | 62 +++++++++++++++++++++++++++++++++++------
> >>  2 files changed, 62 insertions(+), 9 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> >> index 99eb980..60f9437 100644
> >> --- a/drivers/gpu/drm/i915/i915_drv.h
> >> +++ b/drivers/gpu/drm/i915/i915_drv.h
> >> @@ -1184,6 +1184,15 @@ typedef struct drm_i915_private {
> >>
> >>         struct i915_suspend_saved_registers regfile;
> >>
> >> +       struct {
> >> +               /* watermark latency values for primary */
> >> +               uint16_t pri_latency[5];
> >> +               /* watermark latency values for sprite */
> >> +               uint16_t spr_latency[5];
> >> +               /* watermark latency values for cursor */
> >> +               uint16_t cur_latency[5];
> >> +       } wm;
> >> +
> >>         /* Old dri1 support infrastructure, beware the dragons ya fools entering
> >>          * here! */
> >>         struct i915_dri1_state dri1;
> >> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> >> index e4d2477..68a1de4 100644
> >> --- a/drivers/gpu/drm/i915/intel_pm.c
> >> +++ b/drivers/gpu/drm/i915/intel_pm.c
> >> @@ -2367,6 +2367,39 @@ static void intel_read_wm_latency(struct drm_device *dev, uint16_t wm[5])
> >>         }
> >>  }
> >>
> >> +static void intel_fixup_spr_wm_latency(struct drm_device *dev, uint16_t wm[5])
> >> +{
> >> +       /* ILK sprite LP0 latency is 1300 ns */
> >> +       if (INTEL_INFO(dev)->gen == 5)
> >> +               wm[0] = 13;
> >> +}
> >> +
> >> +static void intel_fixup_cur_wm_latency(struct drm_device *dev, uint16_t wm[5])
> >> +{
> >> +       /* ILK cursor LP0 latency is 1300 ns */
> >> +       if (INTEL_INFO(dev)->gen == 5)
> >> +               wm[0] = 13;
> >> +
> >> +       /* WaDoubleCursorLP3Latency:ivb */
> >> +       if (IS_IVYBRIDGE(dev))
> >> +               wm[3] *= 2;
> >
> > Doesn't this WA apply only to pre-production steppings?

Hmm. Possibly. We have it in the current code, but both W/A database
and BSpec do indicate that it's perhaps not needed.

> >
> >
> >> +}
> >> +
> >> +static void intel_setup_wm_latency(struct drm_device *dev)
> >> +{
> >> +       struct drm_i915_private *dev_priv = dev->dev_private;
> >> +
> >> +       intel_read_wm_latency(dev, dev_priv->wm.pri_latency);
> >> +
> >> +       memcpy(dev_priv->wm.spr_latency, dev_priv->wm.pri_latency,
> >> +              sizeof dev_priv->wm.pri_latency);
> >> +       memcpy(dev_priv->wm.cur_latency, dev_priv->wm.pri_latency,
> >> +              sizeof dev_priv->wm.pri_latency);
> >
> > Checkpatch.pl complains about these sizeof without parens.

I hate checkpatch for that. Complaining about perfectly valid C. But I
can "fix" it up to reduce checkpatch warnings.

> >
> >
> >> +
> >> +       intel_fixup_spr_wm_latency(dev, dev_priv->wm.spr_latency);
> >> +       intel_fixup_cur_wm_latency(dev, dev_priv->wm.cur_latency);
> >> +}
> >> +
> >>  static void hsw_compute_wm_parameters(struct drm_device *dev,
> >>                                       struct hsw_pipe_wm_parameters *params,
> >>                                       struct hsw_wm_maximums *lp_max_1_2,
> >> @@ -2612,16 +2645,17 @@ static void haswell_update_wm(struct drm_device *dev)
> >>         struct hsw_wm_maximums lp_max_1_2, lp_max_5_6;
> >>         struct hsw_pipe_wm_parameters params[3];
> >>         struct hsw_wm_values results_1_2, results_5_6, *best_results;
> >> -       uint16_t wm[5] = {};
> >>         enum hsw_data_buf_partitioning partitioning;
> >>
> >> -       intel_read_wm_latency(dev, wm);
> >>         hsw_compute_wm_parameters(dev, params, &lp_max_1_2, &lp_max_5_6);
> >>
> >> -       hsw_compute_wm_results(dev, params, wm, &lp_max_1_2, &results_1_2);
> >> +       hsw_compute_wm_results(dev, params,
> >> +                              dev_priv->wm.pri_latency,
> >> +                              &lp_max_1_2, &results_1_2);
> >>         if (lp_max_1_2.pri != lp_max_5_6.pri) {
> >> -               hsw_compute_wm_results(dev, params, wm, &lp_max_5_6,
> >> -                                      &results_5_6);
> >> +               hsw_compute_wm_results(dev, params,
> >> +                                      dev_priv->wm.pri_latency,
> >> +                                      &lp_max_5_6, &results_5_6);
> >
> > My vote would be to just not pass dev_priv->wm.pri_latency here, it's
> > useless since we're already passing dev. And in the place where we
> > actually use dev_priv->wm.pri_latency we should add a comment saying
> > that on Haswell pri_latency should be the same as the others,
> > otherwise people will start wondering why you're using pri_latency and
> > not the others.

I think I changed it in a later patch to grab the latency values from
the correct place for each plane. I could see about squashing those
changes into this patch if you think it's better.

> >
> >
> >>                 best_results = hsw_find_best_result(&results_1_2, &results_5_6);
> >>         } else {
> >>                 best_results = &results_1_2;
> >> @@ -5211,8 +5245,12 @@ void intel_init_pm(struct drm_device *dev)
> >>
> >>         /* For FIFO watermark updates */
> >>         if (HAS_PCH_SPLIT(dev)) {
> >> +               intel_setup_wm_latency(dev);
> >> +
> >>                 if (IS_GEN5(dev)) {
> >> -                       if (I915_READ(MLTR_ILK) & ILK_SRLT_MASK)
> >> +                       if (dev_priv->wm.pri_latency[1] &&
> >> +                           dev_priv->wm.spr_latency[1] &&
> >> +                           dev_priv->wm.cur_latency[1])
> >
> > I always wondered why do we have these checks. Do we ever see real
> > machines that have zero values in the latency fields? On some gens we
> > only check wm[0] and not the others, but on ILK we check wm[1] and not
> > the others... Anyway, this is not a problem that should be solved by
> > this patch, but I'd love answers :)

Yeah, I have no idea if these checks make any sense. The reason I'm
checking just wm[1] on ILK is that wm[0] is hardcoded, but wm[1] comes
from the MLTR register, so the new code matches the old code a bit
better. Although since the old code just checks that there is something
in the register, it might plug in the watermark funcs even if not some
of the pri, spr and cur latency values are zero.

> >
> >
> >>                                 dev_priv->display.update_wm = ironlake_update_wm;
> >>                         else {
> >>                                 DRM_DEBUG_KMS("Failed to get proper latency. "
> >> @@ -5221,7 +5259,9 @@ void intel_init_pm(struct drm_device *dev)
> >>                         }
> >>                         dev_priv->display.init_clock_gating = ironlake_init_clock_gating;
> >>                 } else if (IS_GEN6(dev)) {
> >> -                       if (SNB_READ_WM0_LATENCY()) {
> >> +                       if (dev_priv->wm.pri_latency[0] &&
> >> +                           dev_priv->wm.spr_latency[0] &&
> >> +                           dev_priv->wm.cur_latency[0]) {
> >>                                 dev_priv->display.update_wm = sandybridge_update_wm;
> >>                                 dev_priv->display.update_sprite_wm = sandybridge_update_sprite_wm;
> >>                         } else {
> >> @@ -5231,7 +5271,9 @@ void intel_init_pm(struct drm_device *dev)
> >>                         }
> >>                         dev_priv->display.init_clock_gating = gen6_init_clock_gating;
> >>                 } else if (IS_IVYBRIDGE(dev)) {
> >> -                       if (SNB_READ_WM0_LATENCY()) {
> >> +                       if (dev_priv->wm.pri_latency[0] &&
> >> +                           dev_priv->wm.spr_latency[0] &&
> >> +                           dev_priv->wm.cur_latency[0]) {
> >>                                 dev_priv->display.update_wm = ivybridge_update_wm;
> >>                                 dev_priv->display.update_sprite_wm = sandybridge_update_sprite_wm;
> >>                         } else {
> >> @@ -5241,7 +5283,9 @@ void intel_init_pm(struct drm_device *dev)
> >>                         }
> >>                         dev_priv->display.init_clock_gating = ivybridge_init_clock_gating;
> >>                 } else if (IS_HASWELL(dev)) {
> >> -                       if (I915_READ64(MCH_SSKPD)) {
> >> +                       if (dev_priv->wm.pri_latency[0] &&
> >> +                           dev_priv->wm.spr_latency[0] &&
> >> +                           dev_priv->wm.cur_latency[0]) {
> >>                                 dev_priv->display.update_wm = haswell_update_wm;
> >>                                 dev_priv->display.update_sprite_wm =
> >>                                         haswell_update_sprite_wm;
> >> --
> >> 1.8.1.5
> >>
> >> _______________________________________________
> >> Intel-gfx mailing list
> >> Intel-gfx@lists.freedesktop.org
> >> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
> >
> >
> >
> > --
> > Paulo Zanoni
> 
> 
> 
> -- 
> Paulo Zanoni

-- 
Ville Syrjälä
Intel OTC

  reply	other threads:[~2013-07-31  9:44 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-05  8:57 [PATCH 00/35] drm/i915: ILK+ watermark rewrite ville.syrjala
2013-07-05  8:57 ` [PATCH 01/35] drm/i915: Add scaled paramater to update_sprite_watermarks() ville.syrjala
2013-07-30 18:26   ` Paulo Zanoni
2013-07-30 18:30     ` Ville Syrjälä
2013-07-30 18:49       ` Paulo Zanoni
2013-07-05  8:57 ` [PATCH 02/35] drm/i915: Pass the actual sprite width to watermarks functions ville.syrjala
2013-07-30 18:32   ` Paulo Zanoni
2013-07-05  8:57 ` [PATCH 03/35] drm/i915: Calculate the sprite WM based on the source width instead of the destination width ville.syrjala
2013-07-30 19:01   ` Paulo Zanoni
2013-07-05  8:57 ` [PATCH 04/35] drm/i915: Rename hsw_wm_get_pixel_rate to ilk_pipe_pixel_rate ville.syrjala
2013-07-30 19:20   ` Paulo Zanoni
2013-07-05  8:57 ` [PATCH 05/35] drm/i915: Rename most wm compute functions to ilk_ prefix ville.syrjala
2013-07-30 19:37   ` Paulo Zanoni
2013-07-05  8:57 ` [PATCH 06/35] drm/i915: Pass the watermark level to primary WM compute functions ville.syrjala
2013-07-30 19:49   ` Paulo Zanoni
2013-08-01  8:01     ` Ville Syrjälä
2013-07-05  8:57 ` [PATCH 07/35] drm/i915: Don't pass "mem_value" to ilk_compute_fbc_wm ville.syrjala
2013-07-30 19:54   ` Paulo Zanoni
2013-07-05  8:57 ` [PATCH 08/35] drm/i915: Change the watermark latency type to uint16_t ville.syrjala
2013-07-30 20:01   ` Paulo Zanoni
2013-07-05  8:57 ` [PATCH 09/35] drm/i915: Split out reading of HSW watermark latency values ville.syrjala
2013-07-05  9:19   ` Chris Wilson
2013-07-05 10:51     ` Ville Syrjälä
2013-07-30 20:09   ` Paulo Zanoni
2013-07-05  8:57 ` [PATCH 10/35] drm/i915: Don't multiply the watermark latency values too early ville.syrjala
2013-07-30 20:21   ` Paulo Zanoni
2013-07-05  8:57 ` [PATCH 11/35] drm/i915: Add SNB/IVB support to intel_read_wm_latency ville.syrjala
2013-07-30 21:01   ` Paulo Zanoni
2013-08-05  5:23     ` Daniel Vetter
2013-07-05  8:57 ` [PATCH 12/35] drm/i915: Add ILK " ville.syrjala
2013-07-05  8:57 ` [PATCH 13/35] drm/i915: Store the watermark latency values in dev_priv ville.syrjala
     [not found]   ` <CA+gsUGQ0JqEZiEUsONJh7nr6rPYRfTxJM79oc5tGcexEudB2Og@mail.gmail.com>
2013-07-30 21:42     ` Paulo Zanoni
2013-07-31  9:43       ` Ville Syrjälä [this message]
2013-07-05  8:57 ` [PATCH 14/35] drm/i915: Use the stored cursor and plane latencies properly ville.syrjala
2013-07-05  8:57 ` [PATCH 15/35] drm/i915: Print the watermark latencies during init ville.syrjala
2013-07-30 21:49   ` Paulo Zanoni
2013-07-31  9:47     ` Ville Syrjälä
2013-07-05  8:57 ` [PATCH 16/35] drm/i915: Disable specific watermark levels when latency is zero ville.syrjala
2013-07-30 21:51   ` Paulo Zanoni
2013-07-05  8:57 ` [PATCH 17/35] drm/i915: Pull watermark level validity check out ville.syrjala
2013-07-05  8:57 ` [PATCH 18/35] drm/i915: Split watermark level computation from the code ville.syrjala
2013-07-05  8:57 ` [PATCH 19/35] drm/i915: Kill fbc_enable from hsw_lp_wm_results ville.syrjala
2013-07-05  8:57 ` [PATCH 20/35] drm/i915: Rename hsw_data_buf_partitioning to intel_ddb_partitioning ville.syrjala
2013-07-05  8:57 ` [PATCH 21/35] drm/i915: Rename hsw_lp_wm_result to intel_wm_level ville.syrjala
2013-07-05  8:57 ` [PATCH 22/35] drm/i915: Calculate max watermark levels for ILK+ ville.syrjala
2013-07-05  8:57 ` [PATCH 23/35] drm/i915; Pull some watermarks state into a separate structure ville.syrjala
2013-07-05  8:57 ` [PATCH 24/35] drm/i915: Split plane watermark parameters into a separate struct ville.syrjala
2013-07-05  8:57 ` [PATCH 25/35] drm/i915: Pass crtc to our update/disable_plane hooks ville.syrjala
2013-07-05  8:57 ` [PATCH 26/35] drm/i915: Don't try to disable plane if it's already disabled ville.syrjala
2013-07-05  8:57 ` [PATCH 27/35] drm/i915: Pass plane and crtc to intel_update_sprite_watermarks ville.syrjala
2013-07-05  8:57 ` [PATCH 28/35] drm/i915: Always call intel_update_sprite_watermarks() when disabling a plane ville.syrjala
2013-07-05  8:57 ` [PATCH 29/35] drm/i915: Pass crtc to intel_update_watermarks() and call it in one place during modeset ville.syrjala
2013-07-05  9:32   ` Chris Wilson
2013-07-05  8:57 ` [PATCH 30/35] drm/i915: Replace the ILK/SNB/IVB/HSW watermark code ville.syrjala
2013-07-05  9:37   ` Chris Wilson
2013-07-05 10:49     ` Ville Syrjälä
2013-07-05 17:46       ` Paulo Zanoni
2013-07-05 18:00         ` Ville Syrjälä
2013-07-05 17:51   ` Paulo Zanoni
2013-07-05 18:11     ` Ville Syrjälä
2013-07-05  8:57 ` [PATCH 31/35] drm/i915: Move HSW linetime watermark handling to modeset code ville.syrjala
2013-07-05 17:44   ` Paulo Zanoni
2013-07-05  8:57 ` [PATCH 32/35] hack: Add debug prints to watermark compute funcs ville.syrjala
2013-07-05  8:57 ` [PATCH 33/35] hack: Don't disable underrun reporting on the first error on ILK/SNB/IVB ville.syrjala
2013-07-05 17:19   ` Paulo Zanoni
2013-07-05 17:34     ` Ville Syrjälä
2013-07-05  8:57 ` [PATCH 34/35] hack: Make fifo underruns DRM_ERROR ville.syrjala
2013-07-05 17:19   ` Paulo Zanoni
2013-07-05 17:39     ` Ville Syrjälä
2013-07-05  8:57 ` [PATCH 35/35] hack: Print watermark programming duration ville.syrjala
2013-07-05 16:54 ` [PATCH 00/35] drm/i915: ILK+ watermark rewrite Paulo Zanoni
2013-07-05 17:22   ` Ville Syrjälä
2013-07-05 17:41     ` Paulo Zanoni
2013-07-05 17:54       ` Ville Syrjälä

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=20130731094357.GY5004@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox