drm/i915: Disable FIFO underrun reporting around IBX transcoder B workaround
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 30 Oct 2015 17:23:22 +0000 (19:23 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 10 Nov 2015 14:23:28 +0000 (16:23 +0200)
Doing the IBX transcoder B workaround causes underruns on
pipe/transcoder A. Just hide them by disabling underrun reporting for
pipe A around the workaround.

It might be possible to avoid the underruns by moving the workaround
to be applied only when enabling pipe A. But I was too lazy to try it
right now, and the current method has been proven to work, so didn't
want to change it too hastily.

Note that this can re-enable underrun reporting on pipe A if was
already disabled due to a previous actual underrun. But that's OK, we
may just get a second underrun report if another real underron occurrs
on pipe A.

v2: Note that pipe A underruns can get re-enabled due to this (Jani)

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org> (v1)
Link: http://patchwork.freedesktop.org/patch/msgid/1446225802-11180-1-git-send-email-ville.syrjala@linux.intel.com
drivers/gpu/drm/i915/intel_dp.c
drivers/gpu/drm/i915/intel_drv.h
drivers/gpu/drm/i915/intel_hdmi.c
drivers/gpu/drm/i915/intel_sdvo.c

index 5264887311f1b59cca2097b6be7af8ce167e54a4..278f025f4b20bd48246eb649683ef988f198e4f9 100644 (file)
@@ -3655,6 +3655,13 @@ intel_dp_link_down(struct intel_dp *intel_dp)
         * matching HDMI port to be enabled on transcoder A.
         */
        if (HAS_PCH_IBX(dev) && crtc->pipe == PIPE_B && port != PORT_A) {
+               /*
+                * We get CPU/PCH FIFO underruns on the other pipe when
+                * doing the workaround. Sweep them under the rug.
+                */
+               intel_set_cpu_fifo_underrun_reporting(dev_priv, PIPE_A, false);
+               intel_set_pch_fifo_underrun_reporting(dev_priv, PIPE_A, false);
+
                /* always enable with pattern 1 (as per spec) */
                DP &= ~(DP_PIPEB_SELECT | DP_LINK_TRAIN_MASK);
                DP |= DP_PORT_EN | DP_LINK_TRAIN_PAT_1;
@@ -3664,6 +3671,10 @@ intel_dp_link_down(struct intel_dp *intel_dp)
                DP &= ~DP_PORT_EN;
                I915_WRITE(intel_dp->output_reg, DP);
                POSTING_READ(intel_dp->output_reg);
+
+               intel_wait_for_vblank_if_active(dev_priv->dev, PIPE_A);
+               intel_set_cpu_fifo_underrun_reporting(dev_priv, PIPE_A, true);
+               intel_set_pch_fifo_underrun_reporting(dev_priv, PIPE_A, true);
        }
 
        msleep(intel_dp->panel_power_down_delay);
index d45677436170357e098929d75f91c2ac281e0f71..f32a59493a097d803540ec50d41ef868419d790b 100644 (file)
@@ -1079,6 +1079,15 @@ intel_wait_for_vblank(struct drm_device *dev, int pipe)
 {
        drm_wait_one_vblank(dev, pipe);
 }
+static inline void
+intel_wait_for_vblank_if_active(struct drm_device *dev, int pipe)
+{
+       const struct intel_crtc *crtc =
+               to_intel_crtc(intel_get_crtc_for_pipe(dev, pipe));
+
+       if (crtc->active)
+               intel_wait_for_vblank(dev, pipe);
+}
 int ironlake_get_lanes_required(int target_clock, int link_bw, int bpp);
 void vlv_wait_port_ready(struct drm_i915_private *dev_priv,
                         struct intel_digital_port *dport,
index 013bd7d522ca8c8a2be4a52869cd7b2c87892dc7..bccbe701649be6c0b5414f436a7485b1bd683994 100644 (file)
@@ -1108,6 +1108,13 @@ static void intel_disable_hdmi(struct intel_encoder *encoder)
         * matching DP port to be enabled on transcoder A.
         */
        if (HAS_PCH_IBX(dev) && crtc->pipe == PIPE_B) {
+               /*
+                * We get CPU/PCH FIFO underruns on the other pipe when
+                * doing the workaround. Sweep them under the rug.
+                */
+               intel_set_cpu_fifo_underrun_reporting(dev_priv, PIPE_A, false);
+               intel_set_pch_fifo_underrun_reporting(dev_priv, PIPE_A, false);
+
                temp &= ~SDVO_PIPE_B_SELECT;
                temp |= SDVO_ENABLE;
                /*
@@ -1122,6 +1129,10 @@ static void intel_disable_hdmi(struct intel_encoder *encoder)
                temp &= ~SDVO_ENABLE;
                I915_WRITE(intel_hdmi->hdmi_reg, temp);
                POSTING_READ(intel_hdmi->hdmi_reg);
+
+               intel_wait_for_vblank_if_active(dev_priv->dev, PIPE_A);
+               intel_set_cpu_fifo_underrun_reporting(dev_priv, PIPE_A, true);
+               intel_set_pch_fifo_underrun_reporting(dev_priv, PIPE_A, true);
        }
 
        intel_hdmi->set_infoframes(&encoder->base, false, NULL);
index c42b636c20877d0f37031e42864b9cf30da18fbe..267e6cb76c4a75cebbc13eea0778059a4a0bd308 100644 (file)
@@ -1464,12 +1464,23 @@ static void intel_disable_sdvo(struct intel_encoder *encoder)
         * matching DP port to be enabled on transcoder A.
         */
        if (HAS_PCH_IBX(dev_priv) && crtc->pipe == PIPE_B) {
+               /*
+                * We get CPU/PCH FIFO underruns on the other pipe when
+                * doing the workaround. Sweep them under the rug.
+                */
+               intel_set_cpu_fifo_underrun_reporting(dev_priv, PIPE_A, false);
+               intel_set_pch_fifo_underrun_reporting(dev_priv, PIPE_A, false);
+
                temp &= ~SDVO_PIPE_B_SELECT;
                temp |= SDVO_ENABLE;
                intel_sdvo_write_sdvox(intel_sdvo, temp);
 
                temp &= ~SDVO_ENABLE;
                intel_sdvo_write_sdvox(intel_sdvo, temp);
+
+               intel_wait_for_vblank_if_active(dev_priv->dev, PIPE_A);
+               intel_set_cpu_fifo_underrun_reporting(dev_priv, PIPE_A, true);
+               intel_set_pch_fifo_underrun_reporting(dev_priv, PIPE_A, true);
        }
 }