All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel.vetter@ffwll.ch>
To: Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Subject: [PATCH] drm/i915: improve GEN7_ERR_INT clearing for fifo underrun reporting
Date: Tue,  9 Jul 2013 22:59:16 +0200	[thread overview]
Message-ID: <1373403556-1677-1-git-send-email-daniel.vetter@ffwll.ch> (raw)
In-Reply-To: <1372973734-7601-4-git-send-email-daniel.vetter@ffwll.ch>

Same treatment as for SERR_INT: If we clear only the bit for the pipe
we're enabling (but unconditionally) then we can always check for
possible underruns after having disabled the interrupt. That way pipe
underruns won't be lost, but at worst only get reported in a delayed
fashion.

v2: The same logic bug as in the SERR handling change also existed
here. The same bugfix of only reporting missed underruns when the
error interrupt was masked applies, too.

v3: Do the same fixes as for the SERR handling that Paulo suggested in
his review:
- s/%i/%c/ fix in the debug output
- move the DE_ERR_INT_IVB read into the respective if block

Cc: Paulo Zanoni <przanoni@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/i915/i915_irq.c | 20 +++++++++++++-------
 drivers/gpu/drm/i915/i915_reg.h |  1 +
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index dd9d999..76e977b 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -154,21 +154,27 @@ static void ironlake_set_fifo_underrun_reporting(struct drm_device *dev,
 }
 
 static void ivybridge_set_fifo_underrun_reporting(struct drm_device *dev,
-						  bool enable)
+						  enum pipe pipe, bool enable)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
-
 	if (enable) {
+		I915_WRITE(GEN7_ERR_INT, ERR_INT_FIFO_UNDERRUN(pipe));
+
 		if (!ivb_can_enable_err_int(dev))
 			return;
 
-		I915_WRITE(GEN7_ERR_INT, ERR_INT_FIFO_UNDERRUN_A |
-					 ERR_INT_FIFO_UNDERRUN_B |
-					 ERR_INT_FIFO_UNDERRUN_C);
-
 		ironlake_enable_display_irq(dev_priv, DE_ERR_INT_IVB);
 	} else {
+		bool was_enabled = !(I915_READ(DEIMR) & DE_ERR_INT_IVB);
+
+		/* Change the state _after_ we've read out the current one. */
 		ironlake_disable_display_irq(dev_priv, DE_ERR_INT_IVB);
+
+		if (!was_enabled &&
+		    (I915_READ(GEN7_ERR_INT) & ERR_INT_FIFO_UNDERRUN(pipe))) {
+			DRM_DEBUG_KMS("uncleared fifo underrun on pipe %c\n",
+				      pipe_name(pipe));
+		}
 	}
 }
 
@@ -274,7 +280,7 @@ bool intel_set_cpu_fifo_underrun_reporting(struct drm_device *dev,
 	if (IS_GEN5(dev) || IS_GEN6(dev))
 		ironlake_set_fifo_underrun_reporting(dev, pipe, enable);
 	else if (IS_GEN7(dev))
-		ivybridge_set_fifo_underrun_reporting(dev, enable);
+		ivybridge_set_fifo_underrun_reporting(dev, pipe, enable);
 
 done:
 	spin_unlock_irqrestore(&dev_priv->irq_lock, flags);
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 7e2684f..43e81c1 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -681,6 +681,7 @@
 #define   ERR_INT_FIFO_UNDERRUN_C	(1<<6)
 #define   ERR_INT_FIFO_UNDERRUN_B	(1<<3)
 #define   ERR_INT_FIFO_UNDERRUN_A	(1<<0)
+#define   ERR_INT_FIFO_UNDERRUN(pipe)	(1<< (pipe*3))
 
 #define FPGA_DBG		0x42300
 #define   FPGA_DBG_RM_NOCLAIM	(1<<31)
-- 
1.8.1.4

  reply	other threads:[~2013-07-09 20:59 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-04 21:35 [PATCH 00/14] irq locking review v2 Daniel Vetter
2013-07-04 21:35 ` [PATCH 01/14] drm/i915: extract ibx_display_interrupt_update Daniel Vetter
2013-07-08 14:38   ` Paulo Zanoni
2013-07-09 15:21     ` Daniel Vetter
2013-07-04 21:35 ` [PATCH 02/14] drm/i915: improve SERR_INT clearing for fifo underrun reporting Daniel Vetter
2013-07-08 16:46   ` Paulo Zanoni
2013-07-09 20:58     ` [PATCH] " Daniel Vetter
2013-07-09 22:26       ` Paulo Zanoni
2013-07-10  6:30         ` Daniel Vetter
2013-07-10 19:45           ` Paulo Zanoni
2013-07-04 21:35 ` [PATCH 03/14] drm/i915: improve GEN7_ERR_INT " Daniel Vetter
2013-07-09 20:59   ` Daniel Vetter [this message]
2013-07-10 19:47     ` [PATCH] " Paulo Zanoni
2013-07-10 20:22       ` Daniel Vetter
2013-07-04 21:35 ` [PATCH 04/14] drm/i915: kill lpt pch transcoder->crtc mapping code for fifo underruns Daniel Vetter
2013-07-08 16:54   ` Paulo Zanoni
2013-07-04 21:35 ` [PATCH 05/14] drm/i915: irq handlers don't need interrupt-safe spinlocks Daniel Vetter
2013-07-04 21:35 ` [PATCH 06/14] drm/i915: streamline hsw_pm_irq_handler Daniel Vetter
2013-07-04 21:35 ` [PATCH 07/14] drm/i915: queue work outside spinlock in hsw_pm_irq_handler Daniel Vetter
2013-07-04 21:35 ` [PATCH 08/14] drm/i915: kill dev_priv->rps.lock Daniel Vetter
2013-07-04 21:35 ` [PATCH 09/14] drm/i915: unify ring irq refcounts (again) Daniel Vetter
2013-07-04 21:35 ` [PATCH 10/14] drm/i915: don't enable PM_VEBOX_CS_ERROR_INTERRUPT Daniel Vetter
2013-07-11 12:37   ` Daniel Vetter
2013-07-04 21:35 ` [PATCH 11/14] drm/i915: unify PM interrupt preinstall sequence Daniel Vetter
2013-07-08 17:06   ` Paulo Zanoni
2013-07-09 15:55     ` Daniel Vetter
2013-07-09 21:00     ` [PATCH] " Daniel Vetter
2013-07-10 20:05       ` Paulo Zanoni
2013-07-10 20:21         ` Daniel Vetter
2013-07-10 20:52           ` Paulo Zanoni
2013-07-04 21:35 ` [PATCH 12/14] drm/i915: unify GT/PM irq postinstall code Daniel Vetter
2013-07-10 20:48   ` Paulo Zanoni
2013-07-11  6:13     ` Daniel Vetter
2013-07-12 20:43       ` [PATCH 1/3] drm/i915: unify PM interrupt preinstall sequence Daniel Vetter
2013-07-12 20:43         ` [PATCH 2/3] drm/i915: unify GT/PM irq postinstall code Daniel Vetter
2013-07-14 20:55           ` Ben Widawsky
2013-07-14 21:31             ` Daniel Vetter
2013-07-14 21:40               ` Ben Widawsky
2013-07-15  0:13               ` Ben Widawsky
2013-07-16  6:17                 ` Daniel Vetter
2013-07-12 20:43         ` [PATCH 3/3] drm/i915: extract rps interrupt enable/disable helpers Daniel Vetter
2013-07-14 21:06           ` Ben Widawsky
2013-07-14 21:35             ` Daniel Vetter
2013-07-15 16:39               ` Ben Widawsky
2013-07-14 20:43         ` [PATCH 1/3] drm/i915: unify PM interrupt preinstall sequence Ben Widawsky
2013-07-04 21:35 ` [PATCH 13/14] drm/i915: extract rps interrupt enable/disable helpers Daniel Vetter
2013-07-10 21:12   ` Paulo Zanoni
2013-07-11  6:20     ` Daniel Vetter
2013-07-04 21:35 ` [PATCH 14/14] drm/i915: simplify rps interrupt enabling/disabling sequence Daniel Vetter
2013-07-16  6:19   ` Daniel Vetter

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=1373403556-1677-1-git-send-email-daniel.vetter@ffwll.ch \
    --to=daniel.vetter@ffwll.ch \
    --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.