diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2014-09-30 04:56:48 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2014-10-24 10:33:54 -0400 |
commit | 1f7247c01c9d1bdc7b0e239a8f2e256972b9189b (patch) | |
tree | df01af81c75b6c05339a8fbfc07135fa6037c64c | |
parent | a72e4c9f9a11d44458a12928cc776921ae43a616 (diff) |
drm/i915: Add wrappers to handle fifo underrun interrupts
Way too much copypasta all over. And this also clarifies a bit what's
going on since it separates the "do we have an underrun irq" from the
"should we report the underrun" check.
v2: Fix excessively long lines.
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
-rw-r--r-- | drivers/gpu/drm/i915/i915_irq.c | 72 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_drv.h | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_fifo_underrun.c | 17 |
3 files changed, 42 insertions, 51 deletions
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index 3ee8c4756adb..1db9fb567359 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c | |||
@@ -1796,10 +1796,8 @@ static void valleyview_pipestat_irq_handler(struct drm_device *dev, u32 iir) | |||
1796 | if (pipe_stats[pipe] & PIPE_CRC_DONE_INTERRUPT_STATUS) | 1796 | if (pipe_stats[pipe] & PIPE_CRC_DONE_INTERRUPT_STATUS) |
1797 | i9xx_pipe_crc_irq_handler(dev, pipe); | 1797 | i9xx_pipe_crc_irq_handler(dev, pipe); |
1798 | 1798 | ||
1799 | if (pipe_stats[pipe] & PIPE_FIFO_UNDERRUN_STATUS && | 1799 | if (pipe_stats[pipe] & PIPE_FIFO_UNDERRUN_STATUS) |
1800 | intel_set_cpu_fifo_underrun_reporting(dev_priv, pipe, | 1800 | intel_cpu_fifo_underrun_irq_handler(dev_priv, pipe); |
1801 | false)) | ||
1802 | DRM_ERROR("pipe %c underrun\n", pipe_name(pipe)); | ||
1803 | } | 1801 | } |
1804 | 1802 | ||
1805 | if (pipe_stats[0] & PIPE_GMBUS_INTERRUPT_STATUS) | 1803 | if (pipe_stats[0] & PIPE_GMBUS_INTERRUPT_STATUS) |
@@ -1966,16 +1964,10 @@ static void ibx_irq_handler(struct drm_device *dev, u32 pch_iir) | |||
1966 | DRM_DEBUG_DRIVER("PCH transcoder CRC error interrupt\n"); | 1964 | DRM_DEBUG_DRIVER("PCH transcoder CRC error interrupt\n"); |
1967 | 1965 | ||
1968 | if (pch_iir & SDE_TRANSA_FIFO_UNDER) | 1966 | if (pch_iir & SDE_TRANSA_FIFO_UNDER) |
1969 | if (intel_set_pch_fifo_underrun_reporting(dev_priv, | 1967 | intel_pch_fifo_underrun_irq_handler(dev_priv, TRANSCODER_A); |
1970 | TRANSCODER_A, | ||
1971 | false)) | ||
1972 | DRM_ERROR("PCH transcoder A FIFO underrun\n"); | ||
1973 | 1968 | ||
1974 | if (pch_iir & SDE_TRANSB_FIFO_UNDER) | 1969 | if (pch_iir & SDE_TRANSB_FIFO_UNDER) |
1975 | if (intel_set_pch_fifo_underrun_reporting(dev_priv, | 1970 | intel_pch_fifo_underrun_irq_handler(dev_priv, TRANSCODER_B); |
1976 | TRANSCODER_B, | ||
1977 | false)) | ||
1978 | DRM_ERROR("PCH transcoder B FIFO underrun\n"); | ||
1979 | } | 1971 | } |
1980 | 1972 | ||
1981 | static void ivb_err_int_handler(struct drm_device *dev) | 1973 | static void ivb_err_int_handler(struct drm_device *dev) |
@@ -1988,12 +1980,8 @@ static void ivb_err_int_handler(struct drm_device *dev) | |||
1988 | DRM_ERROR("Poison interrupt\n"); | 1980 | DRM_ERROR("Poison interrupt\n"); |
1989 | 1981 | ||
1990 | for_each_pipe(dev_priv, pipe) { | 1982 | for_each_pipe(dev_priv, pipe) { |
1991 | if (err_int & ERR_INT_FIFO_UNDERRUN(pipe)) { | 1983 | if (err_int & ERR_INT_FIFO_UNDERRUN(pipe)) |
1992 | if (intel_set_cpu_fifo_underrun_reporting(dev_priv, pipe, | 1984 | intel_cpu_fifo_underrun_irq_handler(dev_priv, pipe); |
1993 | false)) | ||
1994 | DRM_ERROR("Pipe %c FIFO underrun\n", | ||
1995 | pipe_name(pipe)); | ||
1996 | } | ||
1997 | 1985 | ||
1998 | if (err_int & ERR_INT_PIPE_CRC_DONE(pipe)) { | 1986 | if (err_int & ERR_INT_PIPE_CRC_DONE(pipe)) { |
1999 | if (IS_IVYBRIDGE(dev)) | 1987 | if (IS_IVYBRIDGE(dev)) |
@@ -2015,19 +2003,13 @@ static void cpt_serr_int_handler(struct drm_device *dev) | |||
2015 | DRM_ERROR("PCH poison interrupt\n"); | 2003 | DRM_ERROR("PCH poison interrupt\n"); |
2016 | 2004 | ||
2017 | if (serr_int & SERR_INT_TRANS_A_FIFO_UNDERRUN) | 2005 | if (serr_int & SERR_INT_TRANS_A_FIFO_UNDERRUN) |
2018 | if (intel_set_pch_fifo_underrun_reporting(dev_priv, TRANSCODER_A, | 2006 | intel_pch_fifo_underrun_irq_handler(dev_priv, TRANSCODER_A); |
2019 | false)) | ||
2020 | DRM_ERROR("PCH transcoder A FIFO underrun\n"); | ||
2021 | 2007 | ||
2022 | if (serr_int & SERR_INT_TRANS_B_FIFO_UNDERRUN) | 2008 | if (serr_int & SERR_INT_TRANS_B_FIFO_UNDERRUN) |
2023 | if (intel_set_pch_fifo_underrun_reporting(dev_priv, TRANSCODER_B, | 2009 | intel_pch_fifo_underrun_irq_handler(dev_priv, TRANSCODER_B); |
2024 | false)) | ||
2025 | DRM_ERROR("PCH transcoder B FIFO underrun\n"); | ||
2026 | 2010 | ||
2027 | if (serr_int & SERR_INT_TRANS_C_FIFO_UNDERRUN) | 2011 | if (serr_int & SERR_INT_TRANS_C_FIFO_UNDERRUN) |
2028 | if (intel_set_pch_fifo_underrun_reporting(dev_priv, TRANSCODER_C, | 2012 | intel_pch_fifo_underrun_irq_handler(dev_priv, TRANSCODER_C); |
2029 | false)) | ||
2030 | DRM_ERROR("PCH transcoder C FIFO underrun\n"); | ||
2031 | 2013 | ||
2032 | I915_WRITE(SERR_INT, serr_int); | 2014 | I915_WRITE(SERR_INT, serr_int); |
2033 | } | 2015 | } |
@@ -2093,11 +2075,7 @@ static void ilk_display_irq_handler(struct drm_device *dev, u32 de_iir) | |||
2093 | intel_check_page_flip(dev, pipe); | 2075 | intel_check_page_flip(dev, pipe); |
2094 | 2076 | ||
2095 | if (de_iir & DE_PIPE_FIFO_UNDERRUN(pipe)) | 2077 | if (de_iir & DE_PIPE_FIFO_UNDERRUN(pipe)) |
2096 | if (intel_set_cpu_fifo_underrun_reporting(dev_priv, | 2078 | intel_cpu_fifo_underrun_irq_handler(dev_priv, pipe); |
2097 | pipe, | ||
2098 | false)) | ||
2099 | DRM_ERROR("Pipe %c FIFO underrun\n", | ||
2100 | pipe_name(pipe)); | ||
2101 | 2079 | ||
2102 | if (de_iir & DE_PIPE_CRC_DONE(pipe)) | 2080 | if (de_iir & DE_PIPE_CRC_DONE(pipe)) |
2103 | i9xx_pipe_crc_irq_handler(dev, pipe); | 2081 | i9xx_pipe_crc_irq_handler(dev, pipe); |
@@ -2316,13 +2294,9 @@ static irqreturn_t gen8_irq_handler(int irq, void *arg) | |||
2316 | if (pipe_iir & GEN8_PIPE_CDCLK_CRC_DONE) | 2294 | if (pipe_iir & GEN8_PIPE_CDCLK_CRC_DONE) |
2317 | hsw_pipe_crc_irq_handler(dev, pipe); | 2295 | hsw_pipe_crc_irq_handler(dev, pipe); |
2318 | 2296 | ||
2319 | if (pipe_iir & GEN8_PIPE_FIFO_UNDERRUN) { | 2297 | if (pipe_iir & GEN8_PIPE_FIFO_UNDERRUN) |
2320 | if (intel_set_cpu_fifo_underrun_reporting(dev_priv, | 2298 | intel_cpu_fifo_underrun_irq_handler(dev_priv, |
2321 | pipe, | 2299 | pipe); |
2322 | false)) | ||
2323 | DRM_ERROR("Pipe %c FIFO underrun\n", | ||
2324 | pipe_name(pipe)); | ||
2325 | } | ||
2326 | 2300 | ||
2327 | 2301 | ||
2328 | if (IS_GEN9(dev)) | 2302 | if (IS_GEN9(dev)) |
@@ -3839,10 +3813,9 @@ static irqreturn_t i8xx_irq_handler(int irq, void *arg) | |||
3839 | if (pipe_stats[pipe] & PIPE_CRC_DONE_INTERRUPT_STATUS) | 3813 | if (pipe_stats[pipe] & PIPE_CRC_DONE_INTERRUPT_STATUS) |
3840 | i9xx_pipe_crc_irq_handler(dev, pipe); | 3814 | i9xx_pipe_crc_irq_handler(dev, pipe); |
3841 | 3815 | ||
3842 | if (pipe_stats[pipe] & PIPE_FIFO_UNDERRUN_STATUS && | 3816 | if (pipe_stats[pipe] & PIPE_FIFO_UNDERRUN_STATUS) |
3843 | intel_set_cpu_fifo_underrun_reporting(dev_priv, | 3817 | intel_cpu_fifo_underrun_irq_handler(dev_priv, |
3844 | pipe, false)) | 3818 | pipe); |
3845 | DRM_ERROR("pipe %c underrun\n", pipe_name(pipe)); | ||
3846 | } | 3819 | } |
3847 | 3820 | ||
3848 | iir = new_iir; | 3821 | iir = new_iir; |
@@ -4034,10 +4007,9 @@ static irqreturn_t i915_irq_handler(int irq, void *arg) | |||
4034 | if (pipe_stats[pipe] & PIPE_CRC_DONE_INTERRUPT_STATUS) | 4007 | if (pipe_stats[pipe] & PIPE_CRC_DONE_INTERRUPT_STATUS) |
4035 | i9xx_pipe_crc_irq_handler(dev, pipe); | 4008 | i9xx_pipe_crc_irq_handler(dev, pipe); |
4036 | 4009 | ||
4037 | if (pipe_stats[pipe] & PIPE_FIFO_UNDERRUN_STATUS && | 4010 | if (pipe_stats[pipe] & PIPE_FIFO_UNDERRUN_STATUS) |
4038 | intel_set_cpu_fifo_underrun_reporting(dev_priv, | 4011 | intel_cpu_fifo_underrun_irq_handler(dev_priv, |
4039 | pipe, false)) | 4012 | pipe); |
4040 | DRM_ERROR("pipe %c underrun\n", pipe_name(pipe)); | ||
4041 | } | 4013 | } |
4042 | 4014 | ||
4043 | if (blc_event || (iir & I915_ASLE_INTERRUPT)) | 4015 | if (blc_event || (iir & I915_ASLE_INTERRUPT)) |
@@ -4263,10 +4235,8 @@ static irqreturn_t i965_irq_handler(int irq, void *arg) | |||
4263 | if (pipe_stats[pipe] & PIPE_CRC_DONE_INTERRUPT_STATUS) | 4235 | if (pipe_stats[pipe] & PIPE_CRC_DONE_INTERRUPT_STATUS) |
4264 | i9xx_pipe_crc_irq_handler(dev, pipe); | 4236 | i9xx_pipe_crc_irq_handler(dev, pipe); |
4265 | 4237 | ||
4266 | if (pipe_stats[pipe] & PIPE_FIFO_UNDERRUN_STATUS && | 4238 | if (pipe_stats[pipe] & PIPE_FIFO_UNDERRUN_STATUS) |
4267 | intel_set_cpu_fifo_underrun_reporting(dev_priv, | 4239 | intel_cpu_fifo_underrun_irq_handler(dev_priv, pipe); |
4268 | pipe, false)) | ||
4269 | DRM_ERROR("pipe %c underrun\n", pipe_name(pipe)); | ||
4270 | } | 4240 | } |
4271 | 4241 | ||
4272 | if (blc_event || (iir & I915_ASLE_INTERRUPT)) | 4242 | if (blc_event || (iir & I915_ASLE_INTERRUPT)) |
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index ede96065235d..4ffbe4e5f822 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
@@ -761,6 +761,10 @@ bool intel_set_cpu_fifo_underrun_reporting(struct drm_i915_private *dev_priv, | |||
761 | bool intel_set_pch_fifo_underrun_reporting(struct drm_i915_private *dev_priv, | 761 | bool intel_set_pch_fifo_underrun_reporting(struct drm_i915_private *dev_priv, |
762 | enum transcoder pch_transcoder, | 762 | enum transcoder pch_transcoder, |
763 | bool enable); | 763 | bool enable); |
764 | void intel_cpu_fifo_underrun_irq_handler(struct drm_i915_private *dev_priv, | ||
765 | enum pipe pipe); | ||
766 | void intel_pch_fifo_underrun_irq_handler(struct drm_i915_private *dev_priv, | ||
767 | enum transcoder pch_transcoder); | ||
764 | void i9xx_check_fifo_underruns(struct drm_i915_private *dev_priv); | 768 | void i9xx_check_fifo_underruns(struct drm_i915_private *dev_priv); |
765 | bool __cpu_fifo_underrun_reporting_enabled(struct drm_i915_private *dev_priv, | 769 | bool __cpu_fifo_underrun_reporting_enabled(struct drm_i915_private *dev_priv, |
766 | enum pipe pipe); | 770 | enum pipe pipe); |
diff --git a/drivers/gpu/drm/i915/intel_fifo_underrun.c b/drivers/gpu/drm/i915/intel_fifo_underrun.c index 0604a112a4ad..5d66b933a097 100644 --- a/drivers/gpu/drm/i915/intel_fifo_underrun.c +++ b/drivers/gpu/drm/i915/intel_fifo_underrun.c | |||
@@ -308,3 +308,20 @@ bool intel_set_pch_fifo_underrun_reporting(struct drm_i915_private *dev_priv, | |||
308 | spin_unlock_irqrestore(&dev_priv->irq_lock, flags); | 308 | spin_unlock_irqrestore(&dev_priv->irq_lock, flags); |
309 | return old; | 309 | return old; |
310 | } | 310 | } |
311 | |||
312 | void intel_cpu_fifo_underrun_irq_handler(struct drm_i915_private *dev_priv, | ||
313 | enum pipe pipe) | ||
314 | { | ||
315 | if (intel_set_cpu_fifo_underrun_reporting(dev_priv, pipe, false)) | ||
316 | DRM_ERROR("CPU pipe %c FIFO underrun\n", | ||
317 | pipe_name(pipe)); | ||
318 | } | ||
319 | |||
320 | void intel_pch_fifo_underrun_irq_handler(struct drm_i915_private *dev_priv, | ||
321 | enum transcoder pch_transcoder) | ||
322 | { | ||
323 | if (intel_set_pch_fifo_underrun_reporting(dev_priv, pch_transcoder, | ||
324 | false)) | ||
325 | DRM_ERROR("PCH transcoder %c FIFO underrun\n", | ||
326 | transcoder_name(pch_transcoder)); | ||
327 | } | ||