HSW_FRAME_START_DELAY(crtc_state->framestart_delay - 1));
 }
 
-static void icl_ddi_bigjoiner_pre_enable(struct intel_atomic_state *state,
-                                        const struct intel_crtc_state *crtc_state)
-{
-       struct intel_crtc *master_crtc = intel_master_crtc(crtc_state);
-
-       /*
-        * Enable sequence steps 1-7 on bigjoiner master
-        */
-       if (intel_crtc_is_bigjoiner_slave(crtc_state))
-               intel_encoders_pre_pll_enable(state, master_crtc);
-
-       if (crtc_state->shared_dpll)
-               intel_enable_shared_dpll(crtc_state);
-
-       if (intel_crtc_is_bigjoiner_slave(crtc_state))
-               intel_encoders_pre_enable(state, master_crtc);
-}
-
 static void hsw_configure_cpu_transcoder(const struct intel_crtc_state *crtc_state)
 {
        struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
                intel_atomic_get_new_crtc_state(state, crtc);
        struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
        enum transcoder cpu_transcoder = new_crtc_state->cpu_transcoder;
-       enum pipe hsw_workaround_pipe;
+       struct intel_crtc *pipe_crtc;
 
        if (drm_WARN_ON(&dev_priv->drm, crtc->active))
                return;
 
-       intel_dmc_enable_pipe(dev_priv, crtc->pipe);
+       for_each_intel_crtc_in_pipe_mask_reverse(&dev_priv->drm, pipe_crtc,
+                                                intel_crtc_joined_pipe_mask(new_crtc_state))
+               intel_dmc_enable_pipe(dev_priv, pipe_crtc->pipe);
 
-       if (!new_crtc_state->bigjoiner_pipes) {
-               intel_encoders_pre_pll_enable(state, crtc);
+       intel_encoders_pre_pll_enable(state, crtc);
 
-               if (new_crtc_state->shared_dpll)
-                       intel_enable_shared_dpll(new_crtc_state);
+       for_each_intel_crtc_in_pipe_mask_reverse(&dev_priv->drm, pipe_crtc,
+                                                intel_crtc_joined_pipe_mask(new_crtc_state)) {
+               const struct intel_crtc_state *pipe_crtc_state =
+                       intel_atomic_get_new_crtc_state(state, pipe_crtc);
 
-               intel_encoders_pre_enable(state, crtc);
-       } else {
-               icl_ddi_bigjoiner_pre_enable(state, new_crtc_state);
+               if (pipe_crtc_state->shared_dpll)
+                       intel_enable_shared_dpll(pipe_crtc_state);
        }
 
-       intel_dsc_enable(new_crtc_state);
+       intel_encoders_pre_enable(state, crtc);
 
-       if (DISPLAY_VER(dev_priv) >= 13)
-               intel_uncompressed_joiner_enable(new_crtc_state);
+       for_each_intel_crtc_in_pipe_mask_reverse(&dev_priv->drm, pipe_crtc,
+                                                intel_crtc_joined_pipe_mask(new_crtc_state)) {
+               const struct intel_crtc_state *pipe_crtc_state =
+                       intel_atomic_get_new_crtc_state(state, pipe_crtc);
 
-       intel_set_pipe_src_size(new_crtc_state);
-       if (DISPLAY_VER(dev_priv) >= 9 || IS_BROADWELL(dev_priv))
-               bdw_set_pipe_misc(new_crtc_state);
+               intel_dsc_enable(pipe_crtc_state);
 
-       if (!intel_crtc_is_bigjoiner_slave(new_crtc_state) &&
-           !transcoder_is_dsi(cpu_transcoder))
+               if (DISPLAY_VER(dev_priv) >= 13)
+                       intel_uncompressed_joiner_enable(pipe_crtc_state);
+
+               intel_set_pipe_src_size(pipe_crtc_state);
+
+               if (DISPLAY_VER(dev_priv) >= 9 || IS_BROADWELL(dev_priv))
+                       bdw_set_pipe_misc(pipe_crtc_state);
+       }
+
+       if (!transcoder_is_dsi(cpu_transcoder))
                hsw_configure_cpu_transcoder(new_crtc_state);
 
-       crtc->active = true;
+       for_each_intel_crtc_in_pipe_mask_reverse(&dev_priv->drm, pipe_crtc,
+                                                intel_crtc_joined_pipe_mask(new_crtc_state)) {
+               const struct intel_crtc_state *pipe_crtc_state =
+                       intel_atomic_get_new_crtc_state(state, pipe_crtc);
 
-       if (glk_need_scaler_clock_gating_wa(new_crtc_state))
-               glk_pipe_scaler_clock_gating_wa(crtc, true);
+               pipe_crtc->active = true;
 
-       if (DISPLAY_VER(dev_priv) >= 9)
-               skl_pfit_enable(new_crtc_state);
-       else
-               ilk_pfit_enable(new_crtc_state);
+               if (glk_need_scaler_clock_gating_wa(pipe_crtc_state))
+                       glk_pipe_scaler_clock_gating_wa(pipe_crtc, true);
 
-       /*
-        * On ILK+ LUT must be loaded before the pipe is running but with
-        * clocks enabled
-        */
-       intel_color_load_luts(new_crtc_state);
-       intel_color_commit_noarm(new_crtc_state);
-       intel_color_commit_arm(new_crtc_state);
-       /* update DSPCNTR to configure gamma/csc for pipe bottom color */
-       if (DISPLAY_VER(dev_priv) < 9)
-               intel_disable_primary_plane(new_crtc_state);
+               if (DISPLAY_VER(dev_priv) >= 9)
+                       skl_pfit_enable(pipe_crtc_state);
+               else
+                       ilk_pfit_enable(pipe_crtc_state);
 
-       hsw_set_linetime_wm(new_crtc_state);
+               /*
+                * On ILK+ LUT must be loaded before the pipe is running but with
+                * clocks enabled
+                */
+               intel_color_load_luts(pipe_crtc_state);
+               intel_color_commit_noarm(pipe_crtc_state);
+               intel_color_commit_arm(pipe_crtc_state);
+               /* update DSPCNTR to configure gamma/csc for pipe bottom color */
+               if (DISPLAY_VER(dev_priv) < 9)
+                       intel_disable_primary_plane(pipe_crtc_state);
 
-       if (DISPLAY_VER(dev_priv) >= 11)
-               icl_set_pipe_chicken(new_crtc_state);
+               hsw_set_linetime_wm(pipe_crtc_state);
 
-       intel_initial_watermarks(state, crtc);
+               if (DISPLAY_VER(dev_priv) >= 11)
+                       icl_set_pipe_chicken(pipe_crtc_state);
 
-       if (intel_crtc_is_bigjoiner_slave(new_crtc_state))
-               intel_crtc_vblank_on(new_crtc_state);
+               intel_initial_watermarks(state, pipe_crtc);
+       }
 
        intel_encoders_enable(state, crtc);
 
-       if (glk_need_scaler_clock_gating_wa(new_crtc_state)) {
-               intel_crtc_wait_for_next_vblank(crtc);
-               glk_pipe_scaler_clock_gating_wa(crtc, false);
-       }
+       for_each_intel_crtc_in_pipe_mask_reverse(&dev_priv->drm, pipe_crtc,
+                                                intel_crtc_joined_pipe_mask(new_crtc_state)) {
+               const struct intel_crtc_state *pipe_crtc_state =
+                       intel_atomic_get_new_crtc_state(state, pipe_crtc);
+               enum pipe hsw_workaround_pipe;
 
-       /* If we change the relative order between pipe/planes enabling, we need
-        * to change the workaround. */
-       hsw_workaround_pipe = new_crtc_state->hsw_workaround_pipe;
-       if (IS_HASWELL(dev_priv) && hsw_workaround_pipe != INVALID_PIPE) {
-               struct intel_crtc *wa_crtc;
+               if (glk_need_scaler_clock_gating_wa(pipe_crtc_state)) {
+                       intel_crtc_wait_for_next_vblank(pipe_crtc);
+                       glk_pipe_scaler_clock_gating_wa(pipe_crtc, false);
+               }
 
-               wa_crtc = intel_crtc_for_pipe(dev_priv, hsw_workaround_pipe);
+               /*
+                * If we change the relative order between pipe/planes
+                * enabling, we need to change the workaround.
+                */
+               hsw_workaround_pipe = pipe_crtc_state->hsw_workaround_pipe;
+               if (IS_HASWELL(dev_priv) && hsw_workaround_pipe != INVALID_PIPE) {
+                       struct intel_crtc *wa_crtc =
+                               intel_crtc_for_pipe(dev_priv, hsw_workaround_pipe);
 
-               intel_crtc_wait_for_next_vblank(wa_crtc);
-               intel_crtc_wait_for_next_vblank(wa_crtc);
+                       intel_crtc_wait_for_next_vblank(wa_crtc);
+                       intel_crtc_wait_for_next_vblank(wa_crtc);
+               }
        }
 }
 
        struct drm_i915_private *dev_priv = to_i915(state->base.dev);
        const struct intel_crtc_state *new_crtc_state =
                intel_atomic_get_new_crtc_state(state, crtc);
+       struct intel_crtc *pipe_crtc;
 
        if (!intel_crtc_needs_modeset(new_crtc_state))
                return;
 
-       /* VRR will be enable later, if required */
-       intel_crtc_update_active_timings(new_crtc_state, false);
+       for_each_intel_crtc_in_pipe_mask_reverse(&dev_priv->drm, pipe_crtc,
+                                                intel_crtc_joined_pipe_mask(new_crtc_state)) {
+               const struct intel_crtc_state *pipe_crtc_state =
+                       intel_atomic_get_new_crtc_state(state, pipe_crtc);
 
-       dev_priv->display.funcs.display->crtc_enable(state, crtc);
+               /* VRR will be enable later, if required */
+               intel_crtc_update_active_timings(pipe_crtc_state, false);
+       }
 
-       if (intel_crtc_is_bigjoiner_slave(new_crtc_state))
-               return;
+       dev_priv->display.funcs.display->crtc_enable(state, crtc);
 
        /* vblanks work again, re-enable pipe CRC. */
        intel_crtc_enable_pipe_crc(crtc);
                if ((modeset_pipes & BIT(pipe)) == 0)
                        continue;
 
+               if (intel_crtc_is_bigjoiner_slave(new_crtc_state))
+                       continue;
+
                if (intel_dp_mst_is_slave_trans(new_crtc_state) ||
-                   is_trans_port_sync_master(new_crtc_state) ||
-                   intel_crtc_is_bigjoiner_master(new_crtc_state))
+                   is_trans_port_sync_master(new_crtc_state))
                        continue;
 
-               modeset_pipes &= ~BIT(pipe);
+               modeset_pipes &= ~intel_crtc_joined_pipe_mask(new_crtc_state);
 
                intel_enable_crtc(state, crtc);
        }
                if ((modeset_pipes & BIT(pipe)) == 0)
                        continue;
 
-               modeset_pipes &= ~BIT(pipe);
+               if (intel_crtc_is_bigjoiner_slave(new_crtc_state))
+                       continue;
+
+               modeset_pipes &= ~intel_crtc_joined_pipe_mask(new_crtc_state);
 
                intel_enable_crtc(state, crtc);
        }