drm/i915: Always use intel_get_crtc_for_pipe()
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Mon, 31 Oct 2016 20:37:10 +0000 (22:37 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 1 Nov 2016 14:40:38 +0000 (16:40 +0200)
Replace the open coded dev_priv->pipe_to_crtc_mapping[] usage with
intel_get_crtc_for_pipe().

Mostly done with coccinelle, with a few manual tweaks

@@
expression E1, E2;
@@
(
- E1->pipe_to_crtc_mapping[E2]
+ intel_get_crtc_for_pipe(E1, E2)
|
- E1->plane_to_crtc_mapping[E2]
+ intel_get_crtc_for_plane(E1, E2)
)

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1477946245-14134-12-git-send-email-ville.syrjala@linux.intel.com
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
drivers/gpu/drm/i915/i915_debugfs.c
drivers/gpu/drm/i915/i915_irq.c
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/i915/intel_fifo_underrun.c
drivers/gpu/drm/i915/intel_pm.c

index 008f91d5df76c6f85ef838c4a6134f0cf3629ad9..a13ff4772e284f0e7e3b525356ff1ae1af8e0826 100644 (file)
@@ -4065,7 +4065,7 @@ static void hsw_trans_edp_pipe_A_crc_wa(struct drm_i915_private *dev_priv,
                                        bool enable)
 {
        struct drm_device *dev = &dev_priv->drm;
-       struct intel_crtc *crtc = dev_priv->pipe_to_crtc_mapping[PIPE_A];
+       struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv, PIPE_A);
        struct intel_crtc_state *pipe_config;
        struct drm_atomic_state *state;
        int ret = 0;
@@ -4203,7 +4203,8 @@ static int pipe_crc_set_source(struct drm_i915_private *dev_priv,
        /* real source -> none transition */
        if (source == INTEL_PIPE_CRC_SOURCE_NONE) {
                struct intel_pipe_crc_entry *entries;
-               struct intel_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe];
+               struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv,
+                                                                 pipe);
 
                DRM_DEBUG_DRIVER("stopping CRCs for pipe %c\n",
                                 pipe_name(pipe));
index 48bb5debb3efec5c0e949ad4edf14c1b4576edb9..ecd06d301d8bd755a0b1e4ddb9f9e3ea66d600f6 100644 (file)
@@ -725,7 +725,8 @@ static u32 i915_get_vblank_counter(struct drm_device *dev, unsigned int pipe)
        struct drm_i915_private *dev_priv = to_i915(dev);
        i915_reg_t high_frame, low_frame;
        u32 high1, high2, low, pixel, vbl_start, hsync_start, htotal;
-       struct intel_crtc *intel_crtc = dev_priv->pipe_to_crtc_mapping[pipe];
+       struct intel_crtc *intel_crtc = intel_get_crtc_for_pipe(dev_priv,
+                                                               pipe);
        const struct drm_display_mode *mode = &intel_crtc->base.hwmode;
 
        htotal = mode->crtc_htotal;
@@ -830,7 +831,8 @@ static int i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
                                    const struct drm_display_mode *mode)
 {
        struct drm_i915_private *dev_priv = to_i915(dev);
-       struct intel_crtc *intel_crtc = dev_priv->pipe_to_crtc_mapping[pipe];
+       struct intel_crtc *intel_crtc = intel_get_crtc_for_pipe(dev_priv,
+                                                               pipe);
        int position;
        int vbl_start, vbl_end, hsync_start, htotal, vtotal;
        bool in_vbl = true;
index 3cb41338894ce8f07a0e2f3921b8e76693daf0e7..b21dc272bbacdb5973b3f0da1712744ad0a5a020 100644 (file)
@@ -1030,7 +1030,7 @@ bool intel_crtc_active(struct intel_crtc *crtc)
 enum transcoder intel_pipe_to_cpu_transcoder(struct drm_i915_private *dev_priv,
                                             enum pipe pipe)
 {
-       struct intel_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe];
+       struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
 
        return crtc->config->cpu_transcoder;
 }
@@ -1785,7 +1785,8 @@ void vlv_wait_port_ready(struct drm_i915_private *dev_priv,
 static void ironlake_enable_pch_transcoder(struct drm_i915_private *dev_priv,
                                           enum pipe pipe)
 {
-       struct intel_crtc *intel_crtc = dev_priv->pipe_to_crtc_mapping[pipe];
+       struct intel_crtc *intel_crtc = intel_get_crtc_for_pipe(dev_priv,
+                                                               pipe);
        i915_reg_t reg;
        uint32_t val, pipeconf_val;
 
@@ -11662,7 +11663,7 @@ static bool pageflip_finished(struct intel_crtc *crtc,
 void intel_finish_page_flip_cs(struct drm_i915_private *dev_priv, int pipe)
 {
        struct drm_device *dev = &dev_priv->drm;
-       struct intel_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe];
+       struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
        struct intel_flip_work *work;
        unsigned long flags;
 
@@ -11688,7 +11689,7 @@ void intel_finish_page_flip_cs(struct drm_i915_private *dev_priv, int pipe)
 void intel_finish_page_flip_mmio(struct drm_i915_private *dev_priv, int pipe)
 {
        struct drm_device *dev = &dev_priv->drm;
-       struct intel_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe];
+       struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
        struct intel_flip_work *work;
        unsigned long flags;
 
@@ -12118,7 +12119,7 @@ static bool __pageflip_stall_check_cs(struct drm_i915_private *dev_priv,
 void intel_check_page_flip(struct drm_i915_private *dev_priv, int pipe)
 {
        struct drm_device *dev = &dev_priv->drm;
-       struct intel_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe];
+       struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
        struct intel_flip_work *work;
 
        WARN_ON(!in_interrupt());
@@ -14177,7 +14178,8 @@ static void intel_atomic_wait_for_vblanks(struct drm_device *dev,
                return;
 
        for_each_pipe(dev_priv, pipe) {
-               struct intel_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe];
+               struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv,
+                                                                 pipe);
 
                if (!((1 << pipe) & crtc_mask))
                        continue;
@@ -14192,7 +14194,8 @@ static void intel_atomic_wait_for_vblanks(struct drm_device *dev,
        }
 
        for_each_pipe(dev_priv, pipe) {
-               struct intel_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe];
+               struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv,
+                                                                 pipe);
                long lret;
 
                if (!((1 << pipe) & crtc_mask))
@@ -16867,7 +16870,7 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
                pipe = 0;
 
                if (encoder->get_hw_state(encoder, &pipe)) {
-                       crtc = dev_priv->pipe_to_crtc_mapping[pipe];
+                       crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
 
                        encoder->base.crtc = &crtc->base;
                        crtc->config->output_types |= 1 << encoder->type;
@@ -16969,7 +16972,7 @@ intel_modeset_setup_hw_state(struct drm_device *dev)
        }
 
        for_each_pipe(dev_priv, pipe) {
-               crtc = dev_priv->pipe_to_crtc_mapping[pipe];
+               crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
 
                intel_sanitize_crtc(crtc);
                intel_dump_pipe_config(crtc, crtc->config,
index 34f93f112107b4811775c4ae64a04991560b3732..e660d8b4bbc3e06312b575fd0dcd94f770709871 100644 (file)
@@ -57,7 +57,7 @@ static bool ivb_can_enable_err_int(struct drm_device *dev)
        assert_spin_locked(&dev_priv->irq_lock);
 
        for_each_pipe(dev_priv, pipe) {
-               crtc = dev_priv->pipe_to_crtc_mapping[pipe];
+               crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
 
                if (crtc->cpu_fifo_underrun_disabled)
                        return false;
@@ -75,7 +75,7 @@ static bool cpt_can_enable_serr_int(struct drm_device *dev)
        assert_spin_locked(&dev_priv->irq_lock);
 
        for_each_pipe(dev_priv, pipe) {
-               crtc = dev_priv->pipe_to_crtc_mapping[pipe];
+               crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
 
                if (crtc->pch_fifo_underrun_disabled)
                        return false;
@@ -245,7 +245,7 @@ static bool __intel_set_cpu_fifo_underrun_reporting(struct drm_device *dev,
                                                    enum pipe pipe, bool enable)
 {
        struct drm_i915_private *dev_priv = to_i915(dev);
-       struct intel_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe];
+       struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
        bool old;
 
        assert_spin_locked(&dev_priv->irq_lock);
@@ -313,7 +313,8 @@ bool intel_set_pch_fifo_underrun_reporting(struct drm_i915_private *dev_priv,
                                           enum transcoder pch_transcoder,
                                           bool enable)
 {
-       struct intel_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pch_transcoder];
+       struct intel_crtc *crtc =
+               intel_get_crtc_for_pipe(dev_priv, (enum pipe) pch_transcoder);
        unsigned long flags;
        bool old;
 
@@ -356,7 +357,7 @@ bool intel_set_pch_fifo_underrun_reporting(struct drm_i915_private *dev_priv,
 void intel_cpu_fifo_underrun_irq_handler(struct drm_i915_private *dev_priv,
                                         enum pipe pipe)
 {
-       struct intel_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe];
+       struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
 
        /* We may be called too early in init, thanks BIOS! */
        if (crtc == NULL)
index 976d66aa86629f1cf85e35804628ab3dab5acf17..4f51f8656cf65f6b5c8a448943d6eea98d75687e 100644 (file)
@@ -3065,7 +3065,7 @@ bool intel_can_enable_sagv(struct drm_atomic_state *state)
 
        /* Since we're now guaranteed to only have one active CRTC... */
        pipe = ffs(intel_state->active_crtcs) - 1;
-       crtc = dev_priv->pipe_to_crtc_mapping[pipe];
+       crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
        cstate = to_intel_crtc_state(crtc->base.state);
 
        if (crtc->base.state->adjusted_mode.flags & DRM_MODE_FLAG_INTERLACE)