From: Deepak S <deepak.s@linux.intel.com>
To: Imre Deak <imre.deak@intel.com>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v2 2/3] drm/i915: gmch: set SR WMs to valid values before enabling them
Date: Tue, 01 Jul 2014 09:21:58 +0530 [thread overview]
Message-ID: <53B2305E.9030602@linux.intel.com> (raw)
In-Reply-To: <1402660461-32294-2-git-send-email-imre.deak@intel.com>
On Friday 13 June 2014 05:24 PM, Imre Deak wrote:
> Atm it's possible that we enable the memory self-refresh mode before the
> watermark levels used by this mode are programmed with valid values. So
> move the enabling after we programmed the WM levels.
>
> Signed-off-by: Imre Deak <imre.deak@intel.com>
> ---
> drivers/gpu/drm/i915/intel_pm.c | 21 ++++++++++++++++++---
> 1 file changed, 18 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index e55622e..c9ee1aa 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -1332,6 +1332,7 @@ static void valleyview_update_wm(struct drm_crtc *crtc)
> int plane_sr, cursor_sr;
> int ignore_plane_sr, ignore_cursor_sr;
> unsigned int enabled = 0;
> + bool cxsr_enabled;
>
> vlv_update_drain_latency(dev);
>
> @@ -1358,8 +1359,9 @@ static void valleyview_update_wm(struct drm_crtc *crtc)
> &valleyview_wm_info,
> &valleyview_cursor_wm_info,
> &ignore_plane_sr, &cursor_sr)) {
> - intel_set_memory_cxsr(dev_priv, true);
> + cxsr_enabled = true;
> } else {
> + cxsr_enabled = false;
> intel_set_memory_cxsr(dev_priv, false);
> plane_sr = cursor_sr = 0;
> }
> @@ -1380,6 +1382,9 @@ static void valleyview_update_wm(struct drm_crtc *crtc)
> I915_WRITE(DSPFW3,
> (I915_READ(DSPFW3) & ~DSPFW_CURSOR_SR_MASK) |
> (cursor_sr << DSPFW_CURSOR_SR_SHIFT));
> +
> + if (cxsr_enabled)
> + intel_set_memory_cxsr(dev_priv, true);
> }
>
> static void g4x_update_wm(struct drm_crtc *crtc)
> @@ -1390,6 +1395,7 @@ static void g4x_update_wm(struct drm_crtc *crtc)
> int planea_wm, planeb_wm, cursora_wm, cursorb_wm;
> int plane_sr, cursor_sr;
> unsigned int enabled = 0;
> + bool cxsr_enabled;
>
> if (g4x_compute_wm0(dev, PIPE_A,
> &g4x_wm_info, latency_ns,
> @@ -1409,8 +1415,9 @@ static void g4x_update_wm(struct drm_crtc *crtc)
> &g4x_wm_info,
> &g4x_cursor_wm_info,
> &plane_sr, &cursor_sr)) {
> - intel_set_memory_cxsr(dev_priv, true);
> + cxsr_enabled = true;
> } else {
> + cxsr_enabled = false;
> intel_set_memory_cxsr(dev_priv, false);
> plane_sr = cursor_sr = 0;
> }
> @@ -1432,6 +1439,9 @@ static void g4x_update_wm(struct drm_crtc *crtc)
> I915_WRITE(DSPFW3,
> (I915_READ(DSPFW3) & ~(DSPFW_HPLL_SR_EN | DSPFW_CURSOR_SR_MASK)) |
> (cursor_sr << DSPFW_CURSOR_SR_SHIFT));
> +
> + if (cxsr_enabled)
> + intel_set_memory_cxsr(dev_priv, true);
> }
>
> static void i965_update_wm(struct drm_crtc *unused_crtc)
> @@ -1441,6 +1451,7 @@ static void i965_update_wm(struct drm_crtc *unused_crtc)
> struct drm_crtc *crtc;
> int srwm = 1;
> int cursor_sr = 16;
> + bool cxsr_enabled;
>
> /* Calc sr entries for one plane configs */
> crtc = single_enabled_crtc(dev);
> @@ -1482,8 +1493,9 @@ static void i965_update_wm(struct drm_crtc *unused_crtc)
> DRM_DEBUG_KMS("self-refresh watermark: display plane %d "
> "cursor %d\n", srwm, cursor_sr);
>
> - intel_set_memory_cxsr(dev_priv, true);
> + cxsr_enabled = true;
> } else {
> + cxsr_enabled = false;
> /* Turn off self refresh if both pipes are enabled */
> intel_set_memory_cxsr(dev_priv, false);
> }
> @@ -1497,6 +1509,9 @@ static void i965_update_wm(struct drm_crtc *unused_crtc)
> I915_WRITE(DSPFW2, (8 << 8) | (8 << 0));
> /* update cursor SR watermark */
> I915_WRITE(DSPFW3, (cursor_sr << DSPFW_CURSOR_SR_SHIFT));
> +
> + if (cxsr_enabled)
> + intel_set_memory_cxsr(dev_priv, true);
> }
>
> static void i9xx_update_wm(struct drm_crtc *unused_crtc)
Reviewed-by: Deepak S<deepak.s@linux.intel.com>
next prev parent reply other threads:[~2014-06-30 3:57 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-13 11:54 [PATCH v2 1/3] drm/i915: gmch: factor out intel_set_memory_cxsr Imre Deak
2014-06-13 11:54 ` [PATCH v2 2/3] drm/i915: gmch: set SR WMs to valid values before enabling them Imre Deak
2014-06-30 3:42 ` Vijay Purushothaman
2014-07-01 3:51 ` Deepak S [this message]
2014-06-13 11:54 ` [PATCH v2 3/3] drm/i915: gmch: fix stuck primary plane due to memory self-refresh mode Imre Deak
2014-06-13 14:53 ` Daniel Vetter
2014-06-26 22:07 ` Egbert Eich
2014-06-27 6:22 ` Chris Wilson
2014-06-27 13:55 ` Egbert Eich
2014-06-27 18:38 ` Imre Deak
2014-07-07 9:36 ` Daniel Vetter
2014-06-30 3:44 ` Vijay Purushothaman
2014-07-01 3:53 ` Deepak S
2014-07-01 3:48 ` [PATCH v2 1/3] drm/i915: gmch: factor out intel_set_memory_cxsr Deepak S
2014-07-01 9:23 ` Imre Deak
2014-07-01 9:36 ` [PATCH v3 " Imre Deak
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=53B2305E.9030602@linux.intel.com \
--to=deepak.s@linux.intel.com \
--cc=imre.deak@intel.com \
--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
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