All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 02/15] drm/i915: skip redundant operations whilst enabling pipes and planes
Date: Sun, 20 Mar 2011 08:58:46 +0000	[thread overview]
Message-ID: <1300611539-24791-3-git-send-email-chris@chris-wilson.co.uk> (raw)
In-Reply-To: <1300611539-24791-1-git-send-email-chris@chris-wilson.co.uk>

If the pipe or plane is already enabled, then we do not need to enable
it again and can skip the delay. Similarly if it is already disabled
when we want to disable it, we can also skip it.

This fixes a regression from b24e717988, which caused the LVDS
output on one PineView machine to become corrupt after changing
orientation several times.

References: https://bugs.freedesktop.org/show_bug.cgi?id=34601
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Keith Packard <keithp@keithp.com>
---
 drivers/gpu/drm/i915/intel_display.c |   24 ++++++++++++++++--------
 1 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 3bc6ab5..841f039 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -1516,8 +1516,10 @@ static void intel_enable_pipe(struct drm_i915_private *dev_priv, enum pipe pipe,
 
 	reg = PIPECONF(pipe);
 	val = I915_READ(reg);
-	val |= PIPECONF_ENABLE;
-	I915_WRITE(reg, val);
+	if (val & PIPECONF_ENABLE)
+		return;
+
+	I915_WRITE(reg, val | PIPECONF_ENABLE);
 	intel_wait_for_vblank(dev_priv->dev, pipe);
 }
 
@@ -1551,8 +1553,10 @@ static void intel_disable_pipe(struct drm_i915_private *dev_priv,
 
 	reg = PIPECONF(pipe);
 	val = I915_READ(reg);
-	val &= ~PIPECONF_ENABLE;
-	I915_WRITE(reg, val);
+	if ((val & PIPECONF_ENABLE) == 0)
+		return;
+
+	I915_WRITE(reg, val & ~PIPECONF_ENABLE);
 	intel_wait_for_pipe_off(dev_priv->dev, pipe);
 }
 
@@ -1575,8 +1579,10 @@ static void intel_enable_plane(struct drm_i915_private *dev_priv,
 
 	reg = DSPCNTR(plane);
 	val = I915_READ(reg);
-	val |= DISPLAY_PLANE_ENABLE;
-	I915_WRITE(reg, val);
+	if (val & DISPLAY_PLANE_ENABLE)
+		return;
+
+	I915_WRITE(reg, val | DISPLAY_PLANE_ENABLE);
 	intel_wait_for_vblank(dev_priv->dev, pipe);
 }
 
@@ -1607,8 +1613,10 @@ static void intel_disable_plane(struct drm_i915_private *dev_priv,
 
 	reg = DSPCNTR(plane);
 	val = I915_READ(reg);
-	val &= ~DISPLAY_PLANE_ENABLE;
-	I915_WRITE(reg, val);
+	if ((val & DISPLAY_PLANE_ENABLE) == 0)
+		return;
+
+	I915_WRITE(reg, val & ~DISPLAY_PLANE_ENABLE);
 	intel_flush_display_plane(dev_priv, plane);
 	intel_wait_for_vblank(dev_priv->dev, pipe);
 }
-- 
1.7.4.1

  parent reply	other threads:[~2011-03-20  8:59 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-20  8:58 drm-intel-fixes queue Chris Wilson
2011-03-20  8:58 ` [PATCH 01/15] drm/i915: Remove surplus POSTING_READs before wait_for_vblank Chris Wilson
2011-03-20  8:58 ` Chris Wilson [this message]
2011-03-20  8:58 ` [PATCH 03/15] drm/i915: Prevent racy removal of request from client list Chris Wilson
2011-03-20  8:58 ` [PATCH 04/15] drm: Fix use-after-free in drm_gem_vm_close() Chris Wilson
2011-03-20  8:58 ` [PATCH 05/15] drm/i915: Re-enable self-refresh Chris Wilson
2011-03-20  8:58 ` [PATCH 06/15] drm/i915: Fix tiling corruption from pipelined fencing Chris Wilson
2011-03-20  8:58 ` [PATCH 07/15] drm/i915/dp: Correct the order of deletion for ghost eDP devices Chris Wilson
2011-03-20  8:58 ` [PATCH 08/15] drm/i915: report correct render clock frequencies on SNB Chris Wilson
2011-03-20  8:58 ` [PATCH 09/15] drm/i915: Track fence setup separately from fenced object lifetime Chris Wilson
2011-03-20  8:58 ` [PATCH 10/15] drm/i915: Invalidate fenced read domains upon flush Chris Wilson
2011-03-24 13:47   ` Ted Phelps
2011-03-24 13:52     ` Ted Phelps
2011-03-24 14:21       ` Chris Wilson
2011-03-20  8:58 ` [PATCH 11/15] drm/i915: Cleanup handling of last_fenced_seqno Chris Wilson
2011-03-20  8:58 ` [PATCH 12/15] drm/i915: Prevent fence-reuse stalls Chris Wilson
2011-03-20  8:58 ` [PATCH 13/15] drm/i915: Fix computation of pitch for dumb bo creator Chris Wilson
2011-03-20  8:58 ` [PATCH 14/15] drm/i915: Disable pagefaults along execbuffer relocation fast path Chris Wilson
2011-03-20  8:58 ` [PATCH 15/15] drm/i915: Restore missing command flush before interrupt on BLT ring Chris Wilson
2011-03-20 14:22 ` drm-intel-fixes queue Jan Niehusmann
2011-03-20 14:58   ` Chris Wilson
2011-04-07  9:42     ` Zdenek Kabelac

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=1300611539-24791-3-git-send-email-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --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 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.