Daniel Vetter | 47339cd | 2014-09-30 10:56:46 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright © 2014 Intel Corporation |
| 3 | * |
| 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 5 | * copy of this software and associated documentation files (the "Software"), |
| 6 | * to deal in the Software without restriction, including without limitation |
| 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 8 | * and/or sell copies of the Software, and to permit persons to whom the |
| 9 | * Software is furnished to do so, subject to the following conditions: |
| 10 | * |
| 11 | * The above copyright notice and this permission notice (including the next |
| 12 | * paragraph) shall be included in all copies or substantial portions of the |
| 13 | * Software. |
| 14 | * |
| 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS |
| 21 | * IN THE SOFTWARE. |
| 22 | * |
| 23 | * Authors: |
| 24 | * Daniel Vetter <daniel.vetter@ffwll.ch> |
| 25 | * |
| 26 | */ |
| 27 | |
| 28 | #include "i915_drv.h" |
| 29 | #include "intel_drv.h" |
| 30 | |
Daniel Vetter | ef07388 | 2014-09-30 10:56:50 +0200 | [diff] [blame] | 31 | /** |
| 32 | * DOC: fifo underrun handling |
| 33 | * |
| 34 | * The i915 driver checks for display fifo underruns using the interrupt signals |
| 35 | * provided by the hardware. This is enabled by default and fairly useful to |
| 36 | * debug display issues, especially watermark settings. |
| 37 | * |
| 38 | * If an underrun is detected this is logged into dmesg. To avoid flooding logs |
| 39 | * and occupying the cpu underrun interrupts are disabled after the first |
| 40 | * occurrence until the next modeset on a given pipe. |
| 41 | * |
| 42 | * Note that underrun detection on gmch platforms is a bit more ugly since there |
| 43 | * is no interrupt (despite that the signalling bit is in the PIPESTAT pipe |
| 44 | * interrupt register). Also on some other platforms underrun interrupts are |
| 45 | * shared, which means that if we detect an underrun we need to disable underrun |
| 46 | * reporting on all pipes. |
| 47 | * |
| 48 | * The code also supports underrun detection on the PCH transcoder. |
| 49 | */ |
| 50 | |
Daniel Vetter | 47339cd | 2014-09-30 10:56:46 +0200 | [diff] [blame] | 51 | static bool ivb_can_enable_err_int(struct drm_device *dev) |
| 52 | { |
| 53 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 54 | struct intel_crtc *crtc; |
| 55 | enum pipe pipe; |
| 56 | |
| 57 | assert_spin_locked(&dev_priv->irq_lock); |
| 58 | |
| 59 | for_each_pipe(dev_priv, pipe) { |
| 60 | crtc = to_intel_crtc(dev_priv->pipe_to_crtc_mapping[pipe]); |
| 61 | |
| 62 | if (crtc->cpu_fifo_underrun_disabled) |
| 63 | return false; |
| 64 | } |
| 65 | |
| 66 | return true; |
| 67 | } |
| 68 | |
| 69 | static bool cpt_can_enable_serr_int(struct drm_device *dev) |
| 70 | { |
| 71 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 72 | enum pipe pipe; |
| 73 | struct intel_crtc *crtc; |
| 74 | |
| 75 | assert_spin_locked(&dev_priv->irq_lock); |
| 76 | |
| 77 | for_each_pipe(dev_priv, pipe) { |
| 78 | crtc = to_intel_crtc(dev_priv->pipe_to_crtc_mapping[pipe]); |
| 79 | |
| 80 | if (crtc->pch_fifo_underrun_disabled) |
| 81 | return false; |
| 82 | } |
| 83 | |
| 84 | return true; |
| 85 | } |
| 86 | |
Ville Syrjälä | aca7b68 | 2015-10-30 19:22:21 +0200 | [diff] [blame] | 87 | static void i9xx_check_fifo_underruns(struct intel_crtc *crtc) |
Daniel Vetter | 47339cd | 2014-09-30 10:56:46 +0200 | [diff] [blame] | 88 | { |
Ville Syrjälä | aca7b68 | 2015-10-30 19:22:21 +0200 | [diff] [blame] | 89 | struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); |
| 90 | u32 reg = PIPESTAT(crtc->pipe); |
| 91 | u32 pipestat = I915_READ(reg) & 0xffff0000; |
Daniel Vetter | 47339cd | 2014-09-30 10:56:46 +0200 | [diff] [blame] | 92 | |
Ville Syrjälä | aca7b68 | 2015-10-30 19:22:21 +0200 | [diff] [blame] | 93 | assert_spin_locked(&dev_priv->irq_lock); |
Daniel Vetter | 47339cd | 2014-09-30 10:56:46 +0200 | [diff] [blame] | 94 | |
Ville Syrjälä | aca7b68 | 2015-10-30 19:22:21 +0200 | [diff] [blame] | 95 | if ((pipestat & PIPE_FIFO_UNDERRUN_STATUS) == 0) |
| 96 | return; |
Daniel Vetter | 47339cd | 2014-09-30 10:56:46 +0200 | [diff] [blame] | 97 | |
Ville Syrjälä | aca7b68 | 2015-10-30 19:22:21 +0200 | [diff] [blame] | 98 | I915_WRITE(reg, pipestat | PIPE_FIFO_UNDERRUN_STATUS); |
| 99 | POSTING_READ(reg); |
Daniel Vetter | 47339cd | 2014-09-30 10:56:46 +0200 | [diff] [blame] | 100 | |
Ville Syrjälä | aca7b68 | 2015-10-30 19:22:21 +0200 | [diff] [blame] | 101 | DRM_ERROR("pipe %c underrun\n", pipe_name(crtc->pipe)); |
Daniel Vetter | 47339cd | 2014-09-30 10:56:46 +0200 | [diff] [blame] | 102 | } |
| 103 | |
| 104 | static void i9xx_set_fifo_underrun_reporting(struct drm_device *dev, |
| 105 | enum pipe pipe, |
| 106 | bool enable, bool old) |
| 107 | { |
| 108 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 109 | u32 reg = PIPESTAT(pipe); |
| 110 | u32 pipestat = I915_READ(reg) & 0xffff0000; |
| 111 | |
| 112 | assert_spin_locked(&dev_priv->irq_lock); |
| 113 | |
| 114 | if (enable) { |
| 115 | I915_WRITE(reg, pipestat | PIPE_FIFO_UNDERRUN_STATUS); |
| 116 | POSTING_READ(reg); |
| 117 | } else { |
| 118 | if (old && pipestat & PIPE_FIFO_UNDERRUN_STATUS) |
| 119 | DRM_ERROR("pipe %c underrun\n", pipe_name(pipe)); |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | static void ironlake_set_fifo_underrun_reporting(struct drm_device *dev, |
| 124 | enum pipe pipe, bool enable) |
| 125 | { |
| 126 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 127 | uint32_t bit = (pipe == PIPE_A) ? DE_PIPEA_FIFO_UNDERRUN : |
| 128 | DE_PIPEB_FIFO_UNDERRUN; |
| 129 | |
| 130 | if (enable) |
| 131 | ironlake_enable_display_irq(dev_priv, bit); |
| 132 | else |
| 133 | ironlake_disable_display_irq(dev_priv, bit); |
| 134 | } |
| 135 | |
Ville Syrjälä | aca7b68 | 2015-10-30 19:22:21 +0200 | [diff] [blame] | 136 | static void ivybridge_check_fifo_underruns(struct intel_crtc *crtc) |
| 137 | { |
| 138 | struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); |
| 139 | enum pipe pipe = crtc->pipe; |
| 140 | uint32_t err_int = I915_READ(GEN7_ERR_INT); |
| 141 | |
| 142 | assert_spin_locked(&dev_priv->irq_lock); |
| 143 | |
| 144 | if ((err_int & ERR_INT_FIFO_UNDERRUN(pipe)) == 0) |
| 145 | return; |
| 146 | |
| 147 | I915_WRITE(GEN7_ERR_INT, ERR_INT_FIFO_UNDERRUN(pipe)); |
| 148 | POSTING_READ(GEN7_ERR_INT); |
| 149 | |
| 150 | DRM_ERROR("fifo underrun on pipe %c\n", pipe_name(pipe)); |
| 151 | } |
| 152 | |
Daniel Vetter | 47339cd | 2014-09-30 10:56:46 +0200 | [diff] [blame] | 153 | static void ivybridge_set_fifo_underrun_reporting(struct drm_device *dev, |
| 154 | enum pipe pipe, |
| 155 | bool enable, bool old) |
| 156 | { |
| 157 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 158 | if (enable) { |
| 159 | I915_WRITE(GEN7_ERR_INT, ERR_INT_FIFO_UNDERRUN(pipe)); |
| 160 | |
| 161 | if (!ivb_can_enable_err_int(dev)) |
| 162 | return; |
| 163 | |
| 164 | ironlake_enable_display_irq(dev_priv, DE_ERR_INT_IVB); |
| 165 | } else { |
| 166 | ironlake_disable_display_irq(dev_priv, DE_ERR_INT_IVB); |
| 167 | |
| 168 | if (old && |
| 169 | I915_READ(GEN7_ERR_INT) & ERR_INT_FIFO_UNDERRUN(pipe)) { |
| 170 | DRM_ERROR("uncleared fifo underrun on pipe %c\n", |
| 171 | pipe_name(pipe)); |
| 172 | } |
| 173 | } |
| 174 | } |
| 175 | |
| 176 | static void broadwell_set_fifo_underrun_reporting(struct drm_device *dev, |
| 177 | enum pipe pipe, bool enable) |
| 178 | { |
| 179 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 180 | |
| 181 | assert_spin_locked(&dev_priv->irq_lock); |
| 182 | |
| 183 | if (enable) |
| 184 | dev_priv->de_irq_mask[pipe] &= ~GEN8_PIPE_FIFO_UNDERRUN; |
| 185 | else |
| 186 | dev_priv->de_irq_mask[pipe] |= GEN8_PIPE_FIFO_UNDERRUN; |
| 187 | I915_WRITE(GEN8_DE_PIPE_IMR(pipe), dev_priv->de_irq_mask[pipe]); |
| 188 | POSTING_READ(GEN8_DE_PIPE_IMR(pipe)); |
| 189 | } |
| 190 | |
| 191 | static void ibx_set_fifo_underrun_reporting(struct drm_device *dev, |
| 192 | enum transcoder pch_transcoder, |
| 193 | bool enable) |
| 194 | { |
| 195 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 196 | uint32_t bit = (pch_transcoder == TRANSCODER_A) ? |
| 197 | SDE_TRANSA_FIFO_UNDER : SDE_TRANSB_FIFO_UNDER; |
| 198 | |
| 199 | if (enable) |
| 200 | ibx_enable_display_interrupt(dev_priv, bit); |
| 201 | else |
| 202 | ibx_disable_display_interrupt(dev_priv, bit); |
| 203 | } |
| 204 | |
Ville Syrjälä | aca7b68 | 2015-10-30 19:22:21 +0200 | [diff] [blame] | 205 | static void cpt_check_pch_fifo_underruns(struct intel_crtc *crtc) |
| 206 | { |
| 207 | struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); |
| 208 | enum transcoder pch_transcoder = (enum transcoder) crtc->pipe; |
| 209 | uint32_t serr_int = I915_READ(SERR_INT); |
| 210 | |
| 211 | assert_spin_locked(&dev_priv->irq_lock); |
| 212 | |
| 213 | if ((serr_int & SERR_INT_TRANS_FIFO_UNDERRUN(pch_transcoder)) == 0) |
| 214 | return; |
| 215 | |
| 216 | I915_WRITE(SERR_INT, SERR_INT_TRANS_FIFO_UNDERRUN(pch_transcoder)); |
| 217 | POSTING_READ(SERR_INT); |
| 218 | |
| 219 | DRM_ERROR("pch fifo underrun on pch transcoder %c\n", |
| 220 | transcoder_name(pch_transcoder)); |
| 221 | } |
| 222 | |
Daniel Vetter | 47339cd | 2014-09-30 10:56:46 +0200 | [diff] [blame] | 223 | static void cpt_set_fifo_underrun_reporting(struct drm_device *dev, |
| 224 | enum transcoder pch_transcoder, |
| 225 | bool enable, bool old) |
| 226 | { |
| 227 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 228 | |
| 229 | if (enable) { |
| 230 | I915_WRITE(SERR_INT, |
| 231 | SERR_INT_TRANS_FIFO_UNDERRUN(pch_transcoder)); |
| 232 | |
| 233 | if (!cpt_can_enable_serr_int(dev)) |
| 234 | return; |
| 235 | |
| 236 | ibx_enable_display_interrupt(dev_priv, SDE_ERROR_CPT); |
| 237 | } else { |
| 238 | ibx_disable_display_interrupt(dev_priv, SDE_ERROR_CPT); |
| 239 | |
| 240 | if (old && I915_READ(SERR_INT) & |
| 241 | SERR_INT_TRANS_FIFO_UNDERRUN(pch_transcoder)) { |
| 242 | DRM_ERROR("uncleared pch fifo underrun on pch transcoder %c\n", |
| 243 | transcoder_name(pch_transcoder)); |
| 244 | } |
| 245 | } |
| 246 | } |
| 247 | |
Daniel Vetter | 47339cd | 2014-09-30 10:56:46 +0200 | [diff] [blame] | 248 | static bool __intel_set_cpu_fifo_underrun_reporting(struct drm_device *dev, |
| 249 | enum pipe pipe, bool enable) |
| 250 | { |
| 251 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 252 | struct drm_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe]; |
| 253 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
| 254 | bool old; |
| 255 | |
| 256 | assert_spin_locked(&dev_priv->irq_lock); |
| 257 | |
| 258 | old = !intel_crtc->cpu_fifo_underrun_disabled; |
| 259 | intel_crtc->cpu_fifo_underrun_disabled = !enable; |
| 260 | |
| 261 | if (HAS_GMCH_DISPLAY(dev)) |
| 262 | i9xx_set_fifo_underrun_reporting(dev, pipe, enable, old); |
| 263 | else if (IS_GEN5(dev) || IS_GEN6(dev)) |
| 264 | ironlake_set_fifo_underrun_reporting(dev, pipe, enable); |
| 265 | else if (IS_GEN7(dev)) |
| 266 | ivybridge_set_fifo_underrun_reporting(dev, pipe, enable, old); |
| 267 | else if (IS_GEN8(dev) || IS_GEN9(dev)) |
| 268 | broadwell_set_fifo_underrun_reporting(dev, pipe, enable); |
| 269 | |
| 270 | return old; |
| 271 | } |
| 272 | |
Daniel Vetter | ef07388 | 2014-09-30 10:56:50 +0200 | [diff] [blame] | 273 | /** |
| 274 | * intel_set_cpu_fifo_underrun_reporting - set cpu fifo underrrun reporting state |
| 275 | * @dev_priv: i915 device instance |
| 276 | * @pipe: (CPU) pipe to set state for |
| 277 | * @enable: whether underruns should be reported or not |
| 278 | * |
| 279 | * This function sets the fifo underrun state for @pipe. It is used in the |
| 280 | * modeset code to avoid false positives since on many platforms underruns are |
| 281 | * expected when disabling or enabling the pipe. |
| 282 | * |
| 283 | * Notice that on some platforms disabling underrun reports for one pipe |
| 284 | * disables for all due to shared interrupts. Actual reporting is still per-pipe |
| 285 | * though. |
| 286 | * |
| 287 | * Returns the previous state of underrun reporting. |
| 288 | */ |
Daniel Vetter | a72e4c9 | 2014-09-30 10:56:47 +0200 | [diff] [blame] | 289 | bool intel_set_cpu_fifo_underrun_reporting(struct drm_i915_private *dev_priv, |
Daniel Vetter | 47339cd | 2014-09-30 10:56:46 +0200 | [diff] [blame] | 290 | enum pipe pipe, bool enable) |
| 291 | { |
Daniel Vetter | 47339cd | 2014-09-30 10:56:46 +0200 | [diff] [blame] | 292 | unsigned long flags; |
| 293 | bool ret; |
| 294 | |
| 295 | spin_lock_irqsave(&dev_priv->irq_lock, flags); |
Daniel Vetter | a72e4c9 | 2014-09-30 10:56:47 +0200 | [diff] [blame] | 296 | ret = __intel_set_cpu_fifo_underrun_reporting(dev_priv->dev, pipe, |
| 297 | enable); |
Daniel Vetter | 47339cd | 2014-09-30 10:56:46 +0200 | [diff] [blame] | 298 | spin_unlock_irqrestore(&dev_priv->irq_lock, flags); |
| 299 | |
| 300 | return ret; |
| 301 | } |
| 302 | |
Daniel Vetter | 47339cd | 2014-09-30 10:56:46 +0200 | [diff] [blame] | 303 | /** |
Daniel Vetter | ef07388 | 2014-09-30 10:56:50 +0200 | [diff] [blame] | 304 | * intel_set_pch_fifo_underrun_reporting - set PCH fifo underrun reporting state |
| 305 | * @dev_priv: i915 device instance |
Daniel Vetter | 47339cd | 2014-09-30 10:56:46 +0200 | [diff] [blame] | 306 | * @pch_transcoder: the PCH transcoder (same as pipe on IVB and older) |
Daniel Vetter | ef07388 | 2014-09-30 10:56:50 +0200 | [diff] [blame] | 307 | * @enable: whether underruns should be reported or not |
Daniel Vetter | 47339cd | 2014-09-30 10:56:46 +0200 | [diff] [blame] | 308 | * |
| 309 | * This function makes us disable or enable PCH fifo underruns for a specific |
| 310 | * PCH transcoder. Notice that on some PCHs (e.g. CPT/PPT), disabling FIFO |
| 311 | * underrun reporting for one transcoder may also disable all the other PCH |
| 312 | * error interruts for the other transcoders, due to the fact that there's just |
| 313 | * one interrupt mask/enable bit for all the transcoders. |
| 314 | * |
| 315 | * Returns the previous state of underrun reporting. |
| 316 | */ |
Daniel Vetter | a72e4c9 | 2014-09-30 10:56:47 +0200 | [diff] [blame] | 317 | bool intel_set_pch_fifo_underrun_reporting(struct drm_i915_private *dev_priv, |
Daniel Vetter | 47339cd | 2014-09-30 10:56:46 +0200 | [diff] [blame] | 318 | enum transcoder pch_transcoder, |
| 319 | bool enable) |
| 320 | { |
Daniel Vetter | 47339cd | 2014-09-30 10:56:46 +0200 | [diff] [blame] | 321 | struct drm_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pch_transcoder]; |
| 322 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
| 323 | unsigned long flags; |
| 324 | bool old; |
| 325 | |
| 326 | /* |
| 327 | * NOTE: Pre-LPT has a fixed cpu pipe -> pch transcoder mapping, but LPT |
| 328 | * has only one pch transcoder A that all pipes can use. To avoid racy |
| 329 | * pch transcoder -> pipe lookups from interrupt code simply store the |
| 330 | * underrun statistics in crtc A. Since we never expose this anywhere |
| 331 | * nor use it outside of the fifo underrun code here using the "wrong" |
| 332 | * crtc on LPT won't cause issues. |
| 333 | */ |
| 334 | |
| 335 | spin_lock_irqsave(&dev_priv->irq_lock, flags); |
| 336 | |
| 337 | old = !intel_crtc->pch_fifo_underrun_disabled; |
| 338 | intel_crtc->pch_fifo_underrun_disabled = !enable; |
| 339 | |
Daniel Vetter | a72e4c9 | 2014-09-30 10:56:47 +0200 | [diff] [blame] | 340 | if (HAS_PCH_IBX(dev_priv->dev)) |
| 341 | ibx_set_fifo_underrun_reporting(dev_priv->dev, pch_transcoder, |
| 342 | enable); |
Daniel Vetter | 47339cd | 2014-09-30 10:56:46 +0200 | [diff] [blame] | 343 | else |
Daniel Vetter | a72e4c9 | 2014-09-30 10:56:47 +0200 | [diff] [blame] | 344 | cpt_set_fifo_underrun_reporting(dev_priv->dev, pch_transcoder, |
| 345 | enable, old); |
Daniel Vetter | 47339cd | 2014-09-30 10:56:46 +0200 | [diff] [blame] | 346 | |
| 347 | spin_unlock_irqrestore(&dev_priv->irq_lock, flags); |
| 348 | return old; |
| 349 | } |
Daniel Vetter | 1f7247c | 2014-09-30 10:56:48 +0200 | [diff] [blame] | 350 | |
Daniel Vetter | ef07388 | 2014-09-30 10:56:50 +0200 | [diff] [blame] | 351 | /** |
Kumar Amit Mehta | cea3bf8 | 2015-01-26 17:47:32 +0100 | [diff] [blame] | 352 | * intel_cpu_fifo_underrun_irq_handler - handle CPU fifo underrun interrupt |
Daniel Vetter | ef07388 | 2014-09-30 10:56:50 +0200 | [diff] [blame] | 353 | * @dev_priv: i915 device instance |
| 354 | * @pipe: (CPU) pipe to set state for |
| 355 | * |
| 356 | * This handles a CPU fifo underrun interrupt, generating an underrun warning |
| 357 | * into dmesg if underrun reporting is enabled and then disables the underrun |
| 358 | * interrupt to avoid an irq storm. |
| 359 | */ |
Daniel Vetter | 1f7247c | 2014-09-30 10:56:48 +0200 | [diff] [blame] | 360 | void intel_cpu_fifo_underrun_irq_handler(struct drm_i915_private *dev_priv, |
| 361 | enum pipe pipe) |
| 362 | { |
Chris Wilson | 54fc7c1 | 2015-02-26 15:53:02 +0000 | [diff] [blame] | 363 | struct drm_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe]; |
| 364 | |
| 365 | /* We may be called too early in init, thanks BIOS! */ |
| 366 | if (crtc == NULL) |
| 367 | return; |
| 368 | |
Daniel Vetter | 0f239f4 | 2014-09-30 10:56:49 +0200 | [diff] [blame] | 369 | /* GMCH can't disable fifo underruns, filter them. */ |
| 370 | if (HAS_GMCH_DISPLAY(dev_priv->dev) && |
Chris Wilson | 54fc7c1 | 2015-02-26 15:53:02 +0000 | [diff] [blame] | 371 | to_intel_crtc(crtc)->cpu_fifo_underrun_disabled) |
Daniel Vetter | 0f239f4 | 2014-09-30 10:56:49 +0200 | [diff] [blame] | 372 | return; |
| 373 | |
Daniel Vetter | 1f7247c | 2014-09-30 10:56:48 +0200 | [diff] [blame] | 374 | if (intel_set_cpu_fifo_underrun_reporting(dev_priv, pipe, false)) |
| 375 | DRM_ERROR("CPU pipe %c FIFO underrun\n", |
| 376 | pipe_name(pipe)); |
| 377 | } |
| 378 | |
Daniel Vetter | ef07388 | 2014-09-30 10:56:50 +0200 | [diff] [blame] | 379 | /** |
| 380 | * intel_pch_fifo_underrun_irq_handler - handle PCH fifo underrun interrupt |
| 381 | * @dev_priv: i915 device instance |
| 382 | * @pch_transcoder: the PCH transcoder (same as pipe on IVB and older) |
| 383 | * |
| 384 | * This handles a PCH fifo underrun interrupt, generating an underrun warning |
| 385 | * into dmesg if underrun reporting is enabled and then disables the underrun |
| 386 | * interrupt to avoid an irq storm. |
| 387 | */ |
Daniel Vetter | 1f7247c | 2014-09-30 10:56:48 +0200 | [diff] [blame] | 388 | void intel_pch_fifo_underrun_irq_handler(struct drm_i915_private *dev_priv, |
| 389 | enum transcoder pch_transcoder) |
| 390 | { |
| 391 | if (intel_set_pch_fifo_underrun_reporting(dev_priv, pch_transcoder, |
| 392 | false)) |
| 393 | DRM_ERROR("PCH transcoder %c FIFO underrun\n", |
| 394 | transcoder_name(pch_transcoder)); |
| 395 | } |
Ville Syrjälä | aca7b68 | 2015-10-30 19:22:21 +0200 | [diff] [blame] | 396 | |
| 397 | /** |
| 398 | * intel_check_cpu_fifo_underruns - check for CPU fifo underruns immediately |
| 399 | * @dev_priv: i915 device instance |
| 400 | * |
| 401 | * Check for CPU fifo underruns immediately. Useful on IVB/HSW where the shared |
| 402 | * error interrupt may have been disabled, and so CPU fifo underruns won't |
| 403 | * necessarily raise an interrupt, and on GMCH platforms where underruns never |
| 404 | * raise an interrupt. |
| 405 | */ |
| 406 | void intel_check_cpu_fifo_underruns(struct drm_i915_private *dev_priv) |
| 407 | { |
| 408 | struct intel_crtc *crtc; |
| 409 | |
| 410 | spin_lock_irq(&dev_priv->irq_lock); |
| 411 | |
| 412 | for_each_intel_crtc(dev_priv->dev, crtc) { |
| 413 | if (crtc->cpu_fifo_underrun_disabled) |
| 414 | continue; |
| 415 | |
| 416 | if (HAS_GMCH_DISPLAY(dev_priv)) |
| 417 | i9xx_check_fifo_underruns(crtc); |
| 418 | else if (IS_GEN7(dev_priv)) |
| 419 | ivybridge_check_fifo_underruns(crtc); |
| 420 | } |
| 421 | |
| 422 | spin_unlock_irq(&dev_priv->irq_lock); |
| 423 | } |
| 424 | |
| 425 | /** |
| 426 | * intel_check_pch_fifo_underruns - check for PCH fifo underruns immediately |
| 427 | * @dev_priv: i915 device instance |
| 428 | * |
| 429 | * Check for PCH fifo underruns immediately. Useful on CPT/PPT where the shared |
| 430 | * error interrupt may have been disabled, and so PCH fifo underruns won't |
| 431 | * necessarily raise an interrupt. |
| 432 | */ |
| 433 | void intel_check_pch_fifo_underruns(struct drm_i915_private *dev_priv) |
| 434 | { |
| 435 | struct intel_crtc *crtc; |
| 436 | |
| 437 | spin_lock_irq(&dev_priv->irq_lock); |
| 438 | |
| 439 | for_each_intel_crtc(dev_priv->dev, crtc) { |
| 440 | if (crtc->pch_fifo_underrun_disabled) |
| 441 | continue; |
| 442 | |
| 443 | if (HAS_PCH_CPT(dev_priv)) |
| 444 | cpt_check_pch_fifo_underruns(crtc); |
| 445 | } |
| 446 | |
| 447 | spin_unlock_irq(&dev_priv->irq_lock); |
| 448 | } |