public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: ville.syrjala@linux.intel.com, intel-gfx@lists.freedesktop.org
Cc: Robert N <crshman@gmail.com>, Arthur Ranyan <arthur.j.runyan@intel.com>
Subject: Re: [PATCH v2] drm/i915: Increase WM memory latency values on SNB
Date: Thu, 15 May 2014 13:13:21 +0300	[thread overview]
Message-ID: <87zjijnyda.fsf@intel.com> (raw)
In-Reply-To: <1399550959-4767-1-git-send-email-ville.syrjala@linux.intel.com>

On Thu, 08 May 2014, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> On SNB the BIOS provided WM memory latency values seem insufficient to
> handle high resolution displays.
>
> In this particular case the display mode was a 2560x1440@60Hz, which
> makes the pixel clock 241.5 MHz. It was empirically found that a memory
> latency value if 1.2 usec is enough to avoid underruns, whereas the BIOS
> provided value of 0.7 usec was clearly too low. Incidentally 1.2 usec
> is what the typical BIOS provided values are on IVB systems.
>
> Increase the WM memory latency values to at least 1.2 usec on SNB.
> Hopefully this won't have a significant effect on power consumption.
>
> v2: Increase the latency values regardless of the pixel clock
>
> Cc: Robert N <crshman@gmail.com>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70254
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_pm.c | 40 ++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 40 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index 834c49c..2809365 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -2113,6 +2113,43 @@ static void intel_print_wm_latency(struct drm_device *dev,
>  	}
>  }
>  
> +static bool ilk_increase_wm_latency(struct drm_i915_private *dev_priv,
> +				    uint16_t wm[5], uint16_t min)
> +{
> +	int level, max_level = ilk_wm_max_level(dev_priv->dev);
> +
> +	if (wm[0] >= min)
> +		return false;
> +
> +	wm[0] = max(wm[0], min);
> +	for (level = 1; level <= max_level; level++)
> +		wm[level] = max_t(uint16_t, wm[level], DIV_ROUND_UP(min, 5));

DIV_ROUND_UP(min, 5)?

I don't get the units, and the code vs. comments in the wm code aren't
helping. Please clarify.

> +
> +	return true;
> +}
> +
> +static void snb_wm_latency_quirk(struct drm_device *dev)
> +{
> +	struct drm_i915_private *dev_priv = dev->dev_private;
> +	bool changed;
> +
> +	/*
> +	 * The BIOS provided WM memory latency values are often
> +	 * inadequate for high resolution displays. Adjust them.
> +	 */
> +	changed = ilk_increase_wm_latency(dev_priv, dev_priv->wm.pri_latency, 12) |
> +		ilk_increase_wm_latency(dev_priv, dev_priv->wm.spr_latency, 12) |
> +		ilk_increase_wm_latency(dev_priv, dev_priv->wm.cur_latency, 12);

Nitpick, s/|/||/g for bools.

BR,
Jani.

> +
> +	if (!changed)
> +		return;
> +
> +	DRM_DEBUG_KMS("WM latency values increased to avoid potential underruns\n");
> +	intel_print_wm_latency(dev, "Primary", dev_priv->wm.pri_latency);
> +	intel_print_wm_latency(dev, "Sprite", dev_priv->wm.spr_latency);
> +	intel_print_wm_latency(dev, "Cursor", dev_priv->wm.cur_latency);
> +}
> +
>  static void ilk_setup_wm_latency(struct drm_device *dev)
>  {
>  	struct drm_i915_private *dev_priv = dev->dev_private;
> @@ -2130,6 +2167,9 @@ static void ilk_setup_wm_latency(struct drm_device *dev)
>  	intel_print_wm_latency(dev, "Primary", dev_priv->wm.pri_latency);
>  	intel_print_wm_latency(dev, "Sprite", dev_priv->wm.spr_latency);
>  	intel_print_wm_latency(dev, "Cursor", dev_priv->wm.cur_latency);
> +
> +	if (IS_GEN6(dev))
> +		snb_wm_latency_quirk(dev);
>  }
>  
>  static void ilk_compute_wm_parameters(struct drm_crtc *crtc,
> -- 
> 1.8.3.2
>

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2014-05-15 10:14 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-21  9:00 [PATCH] drm/i915: Increase WM memory latency values on SNB with high pixel clock Jani Nikula
2014-03-21  9:29 ` Chris Wilson
2014-03-21 10:19 ` Daniel Vetter
2014-03-21 17:28   ` Runyan, Arthur J
2014-03-31 18:29     ` Robert Navarro
2014-04-14  9:16       ` Ville Syrjälä
2014-05-08 12:09   ` [PATCH v2] drm/i915: Increase WM memory latency values on SNB ville.syrjala
2014-05-09 15:23     ` Robert Navarro
2014-05-09 15:38       ` [PATCH v2] drm/i915: Increase WM memory latency values?on SNB Ville Syrjälä
2014-05-09 17:46         ` Robert Navarro
2014-05-09 17:54           ` Ville Syrjälä
2014-05-14  0:55             ` Robert Navarro
2014-05-15 14:18               ` Robert Navarro
2014-05-15 10:13     ` Jani Nikula [this message]
2014-05-15 10:16       ` [PATCH v2] drm/i915: Increase WM memory latency values on SNB Chris Wilson
2014-05-15 10:34         ` Jani Nikula
2014-05-15 10:45           ` Ville Syrjälä
2014-05-15 10:58             ` Jani Nikula

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=87zjijnyda.fsf@intel.com \
    --to=jani.nikula@intel.com \
    --cc=arthur.j.runyan@intel.com \
    --cc=crshman@gmail.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ville.syrjala@linux.intel.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