]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915: Remove (pipe == crtc->index) assumption
authorAnshuman Gupta <anshuman.gupta@intel.com>
Mon, 24 Feb 2020 12:39:59 +0000 (18:09 +0530)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Wed, 26 Feb 2020 14:14:39 +0000 (16:14 +0200)
we can't have (pipe == crtc->index) assumption in
driver in order to support 3 non-contiguous
display pipe system.

FIXME: Remove the WARN_ON(drm_crtc_index(&crtc->base) != crtc->pipe)
when we will fix all such assumption.

changes since RFC:
- Added again removed (pipe == crtc->index) WARN_ON.
- Pass drm_crtc_index instead of intel pipe in order to
  call drm_handle_vblank().
v2:
- Used drm_crtc_handle_vblank()/drm_crtc_wait_one_vblank()
  instead of drm_handle_vblank/drm_wait_one_vblank(). [Jani]
- Introduced intel_handle_vblank() helper to avoid sprinkle
  of intel_crtc across irq_handlers. [Ville]
v3:
- Moved intel_handle_vblank() from header to i915_irq.c. [Ville]

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200224124004.26712-3-anshuman.gupta@intel.com
drivers/gpu/drm/i915/display/intel_display.c
drivers/gpu/drm/i915/display/intel_display_types.h
drivers/gpu/drm/i915/i915_irq.c

index aaf2366d653f8caca09c1f818842f19bf41fa6f5..0563d91b83ff44d13b9de3f33ea0dff78a8c54b0 100644 (file)
@@ -14299,11 +14299,11 @@ verify_single_dpll_state(struct drm_i915_private *dev_priv,
        if (new_crtc_state->hw.active)
                I915_STATE_WARN(!(pll->active_mask & crtc_mask),
                                "pll active mismatch (expected pipe %c in active mask 0x%02x)\n",
-                               pipe_name(drm_crtc_index(&crtc->base)), pll->active_mask);
+                               pipe_name(crtc->pipe), pll->active_mask);
        else
                I915_STATE_WARN(pll->active_mask & crtc_mask,
                                "pll active mismatch (didn't expect pipe %c in active mask 0x%02x)\n",
-                               pipe_name(drm_crtc_index(&crtc->base)), pll->active_mask);
+                               pipe_name(crtc->pipe), pll->active_mask);
 
        I915_STATE_WARN(!(pll->state.crtc_mask & crtc_mask),
                        "pll enabled crtcs mismatch (expected 0x%x in 0x%02x)\n",
@@ -14332,10 +14332,10 @@ verify_shared_dpll_state(struct intel_crtc *crtc,
 
                I915_STATE_WARN(pll->active_mask & crtc_mask,
                                "pll active mismatch (didn't expect pipe %c in active mask)\n",
-                               pipe_name(drm_crtc_index(&crtc->base)));
+                               pipe_name(crtc->pipe));
                I915_STATE_WARN(pll->state.crtc_mask & crtc_mask,
                                "pll enabled crtcs mismatch (found %x in enabled mask)\n",
-                               pipe_name(drm_crtc_index(&crtc->base)));
+                               pipe_name(crtc->pipe));
        }
 }
 
index 0d8a643054648663256eb71ed82e90f1c5e2f03a..380ebe5ee26db80b5d3141ddd51fde2f1bb6df73 100644 (file)
@@ -1598,11 +1598,15 @@ intel_crtc_has_dp_encoder(const struct intel_crtc_state *crtc_state)
                 (1 << INTEL_OUTPUT_DP_MST) |
                 (1 << INTEL_OUTPUT_EDP));
 }
+
 static inline void
 intel_wait_for_vblank(struct drm_i915_private *dev_priv, enum pipe pipe)
 {
-       drm_wait_one_vblank(&dev_priv->drm, pipe);
+       struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
+
+       drm_crtc_wait_one_vblank(&crtc->base);
 }
+
 static inline void
 intel_wait_for_vblank_if_active(struct drm_i915_private *dev_priv, enum pipe pipe)
 {
index a26f2bf1b6eaef9edfd59896780eb2ff5c4de55b..45f3f73c3f7619f60ddb4fa1a81fbb35ec8fabcf 100644 (file)
@@ -169,6 +169,14 @@ static const u32 hpd_tgp[HPD_NUM_PINS] = {
        [HPD_PORT_I] = SDE_TC_HOTPLUG_ICP(PORT_TC6),
 };
 
+static void
+intel_handle_vblank(struct drm_i915_private *dev_priv, enum pipe pipe)
+{
+       struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
+
+       drm_crtc_handle_vblank(&crtc->base);
+}
+
 void gen3_irq_reset(struct intel_uncore *uncore, i915_reg_t imr,
                    i915_reg_t iir, i915_reg_t ier)
 {
@@ -1364,7 +1372,7 @@ static void i8xx_pipestat_irq_handler(struct drm_i915_private *dev_priv,
 
        for_each_pipe(dev_priv, pipe) {
                if (pipe_stats[pipe] & PIPE_VBLANK_INTERRUPT_STATUS)
-                       drm_handle_vblank(&dev_priv->drm, pipe);
+                       intel_handle_vblank(dev_priv, pipe);
 
                if (pipe_stats[pipe] & PIPE_CRC_DONE_INTERRUPT_STATUS)
                        i9xx_pipe_crc_irq_handler(dev_priv, pipe);
@@ -1382,7 +1390,7 @@ static void i915_pipestat_irq_handler(struct drm_i915_private *dev_priv,
 
        for_each_pipe(dev_priv, pipe) {
                if (pipe_stats[pipe] & PIPE_VBLANK_INTERRUPT_STATUS)
-                       drm_handle_vblank(&dev_priv->drm, pipe);
+                       intel_handle_vblank(dev_priv, pipe);
 
                if (pipe_stats[pipe] & PIPE_LEGACY_BLC_EVENT_STATUS)
                        blc_event = true;
@@ -1406,7 +1414,7 @@ static void i965_pipestat_irq_handler(struct drm_i915_private *dev_priv,
 
        for_each_pipe(dev_priv, pipe) {
                if (pipe_stats[pipe] & PIPE_START_VBLANK_INTERRUPT_STATUS)
-                       drm_handle_vblank(&dev_priv->drm, pipe);
+                       intel_handle_vblank(dev_priv, pipe);
 
                if (pipe_stats[pipe] & PIPE_LEGACY_BLC_EVENT_STATUS)
                        blc_event = true;
@@ -1432,7 +1440,7 @@ static void valleyview_pipestat_irq_handler(struct drm_i915_private *dev_priv,
 
        for_each_pipe(dev_priv, pipe) {
                if (pipe_stats[pipe] & PIPE_START_VBLANK_INTERRUPT_STATUS)
-                       drm_handle_vblank(&dev_priv->drm, pipe);
+                       intel_handle_vblank(dev_priv, pipe);
 
                if (pipe_stats[pipe] & PIPE_CRC_DONE_INTERRUPT_STATUS)
                        i9xx_pipe_crc_irq_handler(dev_priv, pipe);
@@ -1970,7 +1978,7 @@ static void ilk_display_irq_handler(struct drm_i915_private *dev_priv,
 
        for_each_pipe(dev_priv, pipe) {
                if (de_iir & DE_PIPE_VBLANK(pipe))
-                       drm_handle_vblank(&dev_priv->drm, pipe);
+                       intel_handle_vblank(dev_priv, pipe);
 
                if (de_iir & DE_PIPE_FIFO_UNDERRUN(pipe))
                        intel_cpu_fifo_underrun_irq_handler(dev_priv, pipe);
@@ -2023,7 +2031,7 @@ static void ivb_display_irq_handler(struct drm_i915_private *dev_priv,
 
        for_each_pipe(dev_priv, pipe) {
                if (de_iir & (DE_PIPE_VBLANK_IVB(pipe)))
-                       drm_handle_vblank(&dev_priv->drm, pipe);
+                       intel_handle_vblank(dev_priv, pipe);
        }
 
        /* check event from PCH */
@@ -2336,7 +2344,7 @@ gen8_de_irq_handler(struct drm_i915_private *dev_priv, u32 master_ctl)
                I915_WRITE(GEN8_DE_PIPE_IIR(pipe), iir);
 
                if (iir & GEN8_PIPE_VBLANK)
-                       drm_handle_vblank(&dev_priv->drm, pipe);
+                       intel_handle_vblank(dev_priv, pipe);
 
                if (iir & GEN8_PIPE_CDCLK_CRC_DONE)
                        hsw_pipe_crc_irq_handler(dev_priv, pipe);