From: Imre Deak <imre.deak@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 7/7] drm/i915: vlv: handle only enabled pipestat interrupt events
Date: Tue, 4 Feb 2014 21:35:51 +0200 [thread overview]
Message-ID: <1391542551-20239-8-git-send-email-imre.deak@intel.com> (raw)
In-Reply-To: <1391542551-20239-1-git-send-email-imre.deak@intel.com>
Atm we call the handlers for pending pipestat interrupt events even if
they aren't explicitly enabled by i915_enable_pipestat(). This isn't an
issue for events other than the vblank start event, since those are
always enabled anyways. Otoh, we enable the vblank start event
on-demand, so we'll end up calling the vblank handler at times when they
are disabled.
I haven't checked if this causes any real problem, but for consistency
and to remove some overhead we should still fix this by clearing /
handling only the enabled interrupt events. Also this is a dependency
for the upcoming VLV power domain patchset where we need to disable all
the pipestat interrupts whenever the display power well is off.
Signed-off-by: Imre Deak <imre.deak@intel.com>
---
drivers/gpu/drm/i915/i915_drv.h | 1 +
drivers/gpu/drm/i915/i915_irq.c | 33 ++++++++++++++++++++++++++++++---
drivers/gpu/drm/i915/i915_reg.h | 4 ++++
3 files changed, 35 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 43f37ca..faca5b4 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1427,6 +1427,7 @@ typedef struct drm_i915_private {
};
u32 gt_irq_mask;
u32 pm_irq_mask;
+ u32 pipestat_irq_mask[I915_MAX_PIPES];
struct work_struct hotplug_work;
bool enable_hotplug_processing;
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index eea5398..2cac477 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -419,6 +419,16 @@ done:
return ret;
}
+static bool __cpu_fifo_underrun_reporting_enabled(struct drm_device *dev,
+ enum pipe pipe)
+{
+ struct drm_i915_private *dev_priv = dev->dev_private;
+ struct drm_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe];
+ struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
+
+ return !intel_crtc->cpu_fifo_underrun_disabled;
+}
+
/**
* intel_set_pch_fifo_underrun_reporting - enable/disable FIFO underrun messages
* @dev: drm device
@@ -520,6 +530,8 @@ i915_enable_pipestat(drm_i915_private_t *dev_priv, enum pipe pipe,
if ((pipestat & enable_mask) == enable_mask)
return;
+ dev_priv->pipestat_irq_mask[pipe] |= status_mask;
+
/* Enable the interrupt, clear any pending status */
pipestat |= enable_mask | status_mask;
I915_WRITE(reg, pipestat);
@@ -550,6 +562,8 @@ i915_disable_pipestat(drm_i915_private_t *dev_priv, enum pipe pipe,
if ((pipestat & enable_mask) == 0)
return;
+ dev_priv->pipestat_irq_mask[pipe] &= ~status_mask;
+
pipestat &= ~enable_mask;
I915_WRITE(reg, pipestat);
POSTING_READ(reg);
@@ -1530,18 +1544,31 @@ static void gen6_rps_irq_handler(struct drm_i915_private *dev_priv, u32 pm_iir)
static void valleyview_pipestat_irq_handler(struct drm_device *dev, u32 iir)
{
drm_i915_private_t *dev_priv = dev->dev_private;
- u32 pipe_stats[I915_MAX_PIPES];
+ u32 pipe_stats[I915_MAX_PIPES] = { };
int pipe;
spin_lock(&dev_priv->irq_lock);
for_each_pipe(pipe) {
- int reg = PIPESTAT(pipe);
+ int reg;
+ u32 mask;
+
+ if (!dev_priv->pipestat_irq_mask[pipe] &&
+ !__cpu_fifo_underrun_reporting_enabled(dev, pipe))
+ continue;
+
+ reg = PIPESTAT(pipe);
pipe_stats[pipe] = I915_READ(reg);
/*
* Clear the PIPE*STAT regs before the IIR
*/
- if (pipe_stats[pipe] & 0x8000ffff)
+ mask = PIPESTAT_INT_ENABLE_MASK | PIPE_FIFO_UNDERRUN_STATUS;
+ if (iir & I915_DISPLAY_PIPE_EVENT_INTERRUPT(pipe))
+ mask |= dev_priv->pipestat_irq_mask[pipe];
+ pipe_stats[pipe] &= mask;
+
+ if (pipe_stats[pipe] & (PIPE_FIFO_UNDERRUN_STATUS |
+ PIPESTAT_INT_STATUS_MASK))
I915_WRITE(reg, pipe_stats[pipe]);
}
spin_unlock(&dev_priv->irq_lock);
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index c998c4f..47e0635 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -997,6 +997,10 @@
#define I915_DISPLAY_PIPE_A_EVENT_INTERRUPT (1<<6)
#define I915_DISPLAY_PIPE_B_VBLANK_INTERRUPT (1<<5)
#define I915_DISPLAY_PIPE_B_EVENT_INTERRUPT (1<<4)
+#define I915_DISPLAY_PIPE_EVENT_INTERRUPT(pipe) \
+ ((pipe) == PIPE_A ? I915_DISPLAY_PIPE_A_EVENT_INTERRUPT : \
+ I915_DISPLAY_PIPE_B_EVENT_INTERRUPT)
+
#define I915_DEBUG_INTERRUPT (1<<2)
#define I915_USER_INTERRUPT (1<<1)
#define I915_ASLE_INTERRUPT (1<<0)
--
1.8.4
next prev parent reply other threads:[~2014-02-04 19:38 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-04 19:35 [PATCH 0/7] drm/i915: vlv: handle only enabled pipestat interrupts Imre Deak
2014-02-04 19:35 ` [PATCH 1/7] drm/i915: vlv: don't unmask IIR[DISPLAY_PIPE_A/B_VBLANK] interrupt Imre Deak
2014-02-05 15:22 ` Jesse Barnes
2014-02-04 19:35 ` [PATCH 2/7] drm/i915: factor out valleyview_pipestat_irq_handler Imre Deak
2014-02-05 15:24 ` Jesse Barnes
2014-02-05 16:05 ` Daniel Vetter
2014-02-06 7:14 ` Jani Nikula
2014-02-06 9:44 ` Daniel Vetter
2014-02-04 19:35 ` [PATCH 3/7] drm/i915: vlv: s/spin_lock_irqsave/spin_lock/ in irq handler Imre Deak
2014-02-05 15:28 ` Jesse Barnes
2014-02-04 19:35 ` [PATCH 4/7] drm/i915: unify FLIP_DONE macro names Imre Deak
2014-02-05 15:29 ` Jesse Barnes
2014-02-04 19:35 ` [PATCH 5/7] drm/i915: pass status instead of enable flags to i915_enable_pipestat Imre Deak
2014-02-05 15:35 ` Jesse Barnes
2014-02-05 16:12 ` Daniel Vetter
2014-02-05 16:53 ` Ville Syrjälä
2014-02-05 18:55 ` [PATCH v2 " Imre Deak
2014-02-04 19:35 ` [PATCH 6/7] drm/i915: vlv: fix mapping of pipestat enable to status bits Imre Deak
2014-02-05 14:54 ` Ville Syrjälä
2014-02-05 15:04 ` Imre Deak
2014-02-05 18:55 ` [PATCH v2 " Imre Deak
2014-02-05 19:06 ` Ville Syrjälä
2014-02-05 19:44 ` [PATCH v3 " Imre Deak
2014-02-04 19:35 ` Imre Deak [this message]
2014-02-05 15:11 ` [PATCH 7/7] drm/i915: vlv: handle only enabled pipestat interrupt events Ville Syrjälä
2014-02-05 15:22 ` Imre Deak
2014-02-05 18:55 ` [PATCH v2 " 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=1391542551-20239-8-git-send-email-imre.deak@intel.com \
--to=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