Merge tag 'drm-next-2021-08-31-1' of git://anongit.freedesktop.org/drm/drm
[linux-2.6-microblaze.git] / drivers / gpu / drm / i915 / display / intel_display.c
index 0a8a239..134a6ac 100644 (file)
@@ -59,6 +59,7 @@
 #include "display/intel_hdmi.h"
 #include "display/intel_lvds.h"
 #include "display/intel_sdvo.h"
+#include "display/intel_snps_phy.h"
 #include "display/intel_tv.h"
 #include "display/intel_vdsc.h"
 #include "display/intel_vrr.h"
@@ -975,7 +976,7 @@ void intel_enable_pipe(const struct intel_crtc_state *new_crtc_state)
                /* FIXME: assert CPU port conditions for SNB+ */
        }
 
-       /* Wa_22012358565:adlp */
+       /* Wa_22012358565:adl-p */
        if (DISPLAY_VER(dev_priv) == 13)
                intel_de_rmw(dev_priv, PIPE_ARB_CTL(pipe),
                             0, PIPE_ARB_USE_PROG_SLOTS);
@@ -1035,6 +1036,10 @@ void intel_disable_pipe(const struct intel_crtc_state *old_crtc_state)
        if (!IS_I830(dev_priv))
                val &= ~PIPECONF_ENABLE;
 
+       if (DISPLAY_VER(dev_priv) >= 12)
+               intel_de_rmw(dev_priv, CHICKEN_TRANS(cpu_transcoder),
+                            FECSTALL_DIS_DPTSTREAM_DPTTG, 0);
+
        intel_de_write(dev_priv, reg, val);
        if ((val & PIPECONF_ENABLE) == 0)
                intel_wait_for_pipe_off(old_crtc_state);
@@ -1331,6 +1336,9 @@ retry:
        ret = i915_gem_object_lock(obj, &ww);
        if (!ret && phys_cursor)
                ret = i915_gem_object_attach_phys(obj, alignment);
+       else if (!ret && HAS_LMEM(dev_priv))
+               ret = i915_gem_object_migrate(obj, &ww, INTEL_REGION_LMEM);
+       /* TODO: Do we need to sync when migration becomes async? */
        if (!ret)
                ret = i915_gem_object_pin_pages(obj);
        if (ret)
@@ -1914,20 +1922,50 @@ static void intel_dpt_unpin(struct i915_address_space *vm)
        i915_vma_put(dpt->vma);
 }
 
+static bool
+intel_reuse_initial_plane_obj(struct drm_i915_private *i915,
+                             const struct intel_initial_plane_config *plane_config,
+                             struct drm_framebuffer **fb,
+                             struct i915_vma **vma)
+{
+       struct intel_crtc *crtc;
+
+       for_each_intel_crtc(&i915->drm, crtc) {
+               struct intel_crtc_state *crtc_state =
+                       to_intel_crtc_state(crtc->base.state);
+               struct intel_plane *plane =
+                       to_intel_plane(crtc->base.primary);
+               struct intel_plane_state *plane_state =
+                       to_intel_plane_state(plane->base.state);
+
+               if (!crtc_state->uapi.active)
+                       continue;
+
+               if (!plane_state->ggtt_vma)
+                       continue;
+
+               if (intel_plane_ggtt_offset(plane_state) == plane_config->base) {
+                       *fb = plane_state->hw.fb;
+                       *vma = plane_state->ggtt_vma;
+                       return true;
+               }
+       }
+
+       return false;
+}
+
 static void
-intel_find_initial_plane_obj(struct intel_crtc *intel_crtc,
+intel_find_initial_plane_obj(struct intel_crtc *crtc,
                             struct intel_initial_plane_config *plane_config)
 {
-       struct drm_device *dev = intel_crtc->base.dev;
+       struct drm_device *dev = crtc->base.dev;
        struct drm_i915_private *dev_priv = to_i915(dev);
-       struct drm_crtc *c;
-       struct drm_plane *primary = intel_crtc->base.primary;
-       struct drm_plane_state *plane_state = primary->state;
-       struct intel_plane *intel_plane = to_intel_plane(primary);
-       struct intel_plane_state *intel_state =
-               to_intel_plane_state(plane_state);
        struct intel_crtc_state *crtc_state =
-               to_intel_crtc_state(intel_crtc->base.state);
+               to_intel_crtc_state(crtc->base.state);
+       struct intel_plane *plane =
+               to_intel_plane(crtc->base.primary);
+       struct intel_plane_state *plane_state =
+               to_intel_plane_state(plane->base.state);
        struct drm_framebuffer *fb;
        struct i915_vma *vma;
 
@@ -1939,7 +1977,7 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc,
        if (!plane_config->fb)
                return;
 
-       if (intel_alloc_initial_plane_obj(intel_crtc, plane_config)) {
+       if (intel_alloc_initial_plane_obj(crtc, plane_config)) {
                fb = &plane_config->fb->base;
                vma = plane_config->vma;
                goto valid_fb;
@@ -1949,25 +1987,8 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc,
         * Failed to alloc the obj, check to see if we should share
         * an fb with another CRTC instead
         */
-       for_each_crtc(dev, c) {
-               struct intel_plane_state *state;
-
-               if (c == &intel_crtc->base)
-                       continue;
-
-               if (!to_intel_crtc_state(c->state)->uapi.active)
-                       continue;
-
-               state = to_intel_plane_state(c->primary->state);
-               if (!state->ggtt_vma)
-                       continue;
-
-               if (intel_plane_ggtt_offset(state) == plane_config->base) {
-                       fb = state->hw.fb;
-                       vma = state->ggtt_vma;
-                       goto valid_fb;
-               }
-       }
+       if (intel_reuse_initial_plane_obj(dev_priv, plane_config, &fb, &vma))
+               goto valid_fb;
 
        /*
         * We've failed to reconstruct the BIOS FB.  Current display state
@@ -1976,7 +1997,7 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc,
         * simplest solution is to just disable the primary plane now and
         * pretend the BIOS never had it enabled.
         */
-       intel_plane_disable_noatomic(intel_crtc, intel_plane);
+       intel_plane_disable_noatomic(crtc, plane);
        if (crtc_state->bigjoiner) {
                struct intel_crtc *slave =
                        crtc_state->bigjoiner_linked_crtc;
@@ -1986,40 +2007,38 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc,
        return;
 
 valid_fb:
-       plane_state->rotation = plane_config->rotation;
-       intel_fb_fill_view(to_intel_framebuffer(fb), plane_state->rotation,
-                          &intel_state->view);
+       plane_state->uapi.rotation = plane_config->rotation;
+       intel_fb_fill_view(to_intel_framebuffer(fb),
+                          plane_state->uapi.rotation, &plane_state->view);
 
        __i915_vma_pin(vma);
-       intel_state->ggtt_vma = i915_vma_get(vma);
-       if (intel_plane_uses_fence(intel_state) && i915_vma_pin_fence(vma) == 0)
-               if (vma->fence)
-                       intel_state->flags |= PLANE_HAS_FENCE;
+       plane_state->ggtt_vma = i915_vma_get(vma);
+       if (intel_plane_uses_fence(plane_state) &&
+           i915_vma_pin_fence(vma) == 0 && vma->fence)
+               plane_state->flags |= PLANE_HAS_FENCE;
 
-       plane_state->src_x = 0;
-       plane_state->src_y = 0;
-       plane_state->src_w = fb->width << 16;
-       plane_state->src_h = fb->height << 16;
+       plane_state->uapi.src_x = 0;
+       plane_state->uapi.src_y = 0;
+       plane_state->uapi.src_w = fb->width << 16;
+       plane_state->uapi.src_h = fb->height << 16;
 
-       plane_state->crtc_x = 0;
-       plane_state->crtc_y = 0;
-       plane_state->crtc_w = fb->width;
-       plane_state->crtc_h = fb->height;
+       plane_state->uapi.crtc_x = 0;
+       plane_state->uapi.crtc_y = 0;
+       plane_state->uapi.crtc_w = fb->width;
+       plane_state->uapi.crtc_h = fb->height;
 
        if (plane_config->tiling)
                dev_priv->preserve_bios_swizzle = true;
 
-       plane_state->fb = fb;
+       plane_state->uapi.fb = fb;
        drm_framebuffer_get(fb);
 
-       plane_state->crtc = &intel_crtc->base;
-       intel_plane_copy_uapi_to_hw_state(intel_state, intel_state,
-                                         intel_crtc);
+       plane_state->uapi.crtc = &crtc->base;
+       intel_plane_copy_uapi_to_hw_state(plane_state, plane_state, crtc);
 
        intel_frontbuffer_flush(to_intel_frontbuffer(fb), ORIGIN_DIRTYFB);
 
-       atomic_or(to_intel_plane(primary)->frontbuffer_bit,
-                 &to_intel_frontbuffer(fb)->bits);
+       atomic_or(plane->frontbuffer_bit, &to_intel_frontbuffer(fb)->bits);
 }
 
 unsigned int
@@ -2193,8 +2212,29 @@ unlock:
        clear_bit_unlock(I915_RESET_MODESET, &dev_priv->gt.reset.flags);
 }
 
-static void icl_set_pipe_chicken(struct intel_crtc *crtc)
+static bool underrun_recovery_supported(const struct intel_crtc_state *crtc_state)
 {
+       if (crtc_state->pch_pfit.enabled &&
+           (crtc_state->pipe_src_w > drm_rect_width(&crtc_state->pch_pfit.dst) ||
+            crtc_state->pipe_src_h > drm_rect_height(&crtc_state->pch_pfit.dst) ||
+            crtc_state->output_format == INTEL_OUTPUT_FORMAT_YCBCR420))
+               return false;
+
+       if (crtc_state->dsc.compression_enable)
+               return false;
+
+       if (crtc_state->has_psr2)
+               return false;
+
+       if (crtc_state->splitter.enable)
+               return false;
+
+       return true;
+}
+
+static void icl_set_pipe_chicken(const struct intel_crtc_state *crtc_state)
+{
+       struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
        struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
        enum pipe pipe = crtc->pipe;
        u32 tmp;
@@ -2215,19 +2255,19 @@ static void icl_set_pipe_chicken(struct intel_crtc *crtc)
         */
        tmp |= PIXEL_ROUNDING_TRUNC_FB_PASSTHRU;
 
-       /*
-        * "The underrun recovery mechanism should be disabled
-        *  when the following is enabled for this pipe:
-        *  WiDi
-        *  Downscaling (this includes YUV420 fullblend)
-        *  COG
-        *  DSC
-        *  PSR2"
-        *
-        * FIXME: enable whenever possible...
-        */
-       if (IS_ALDERLAKE_P(dev_priv))
-               tmp |= UNDERRUN_RECOVERY_DISABLE;
+       if (IS_DG2(dev_priv)) {
+               /*
+                * Underrun recovery must always be disabled on DG2.  However
+                * the chicken bit meaning is inverted compared to other
+                * platforms.
+                */
+               tmp &= ~UNDERRUN_RECOVERY_ENABLE_DG2;
+       } else if (DISPLAY_VER(dev_priv) >= 13) {
+               if (underrun_recovery_supported(crtc_state))
+                       tmp &= ~UNDERRUN_RECOVERY_DISABLE_ADLP;
+               else
+                       tmp |= UNDERRUN_RECOVERY_DISABLE_ADLP;
+       }
 
        intel_de_write(dev_priv, PIPE_CHICKEN(pipe), tmp);
 }
@@ -2706,10 +2746,10 @@ void hsw_disable_ips(const struct intel_crtc_state *crtc_state)
        intel_wait_for_vblank(dev_priv, crtc->pipe);
 }
 
-static void intel_crtc_dpms_overlay_disable(struct intel_crtc *intel_crtc)
+static void intel_crtc_dpms_overlay_disable(struct intel_crtc *crtc)
 {
-       if (intel_crtc->overlay)
-               (void) intel_overlay_switch_off(intel_crtc->overlay);
+       if (crtc->overlay)
+               (void) intel_overlay_switch_off(crtc->overlay);
 
        /* Let userspace switch the overlay on again. In most cases userspace
         * has to recompute where to put it anyway.
@@ -3177,6 +3217,28 @@ static void intel_encoders_enable(struct intel_atomic_state *state,
        }
 }
 
+static void intel_encoders_pre_disable(struct intel_atomic_state *state,
+                                      struct intel_crtc *crtc)
+{
+       const struct intel_crtc_state *old_crtc_state =
+               intel_atomic_get_old_crtc_state(state, crtc);
+       const struct drm_connector_state *old_conn_state;
+       struct drm_connector *conn;
+       int i;
+
+       for_each_old_connector_in_state(&state->base, conn, old_conn_state, i) {
+               struct intel_encoder *encoder =
+                       to_intel_encoder(old_conn_state->best_encoder);
+
+               if (old_conn_state->crtc != &crtc->base)
+                       continue;
+
+               if (encoder->pre_disable)
+                       encoder->pre_disable(state, encoder, old_crtc_state,
+                                            old_conn_state);
+       }
+}
+
 static void intel_encoders_disable(struct intel_atomic_state *state,
                                   struct intel_crtc *crtc)
 {
@@ -3386,13 +3448,17 @@ static void glk_pipe_scaler_clock_gating_wa(struct drm_i915_private *dev_priv,
        intel_de_write(dev_priv, CLKGATE_DIS_PSL(pipe), val);
 }
 
-static void icl_pipe_mbus_enable(struct intel_crtc *crtc)
+static void icl_pipe_mbus_enable(struct intel_crtc *crtc, bool joined_mbus)
 {
        struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
        enum pipe pipe = crtc->pipe;
        u32 val;
 
-       val = MBUS_DBOX_A_CREDIT(2);
+       /* Wa_22010947358:adl-p */
+       if (IS_ALDERLAKE_P(dev_priv))
+               val = joined_mbus ? MBUS_DBOX_A_CREDIT(6) : MBUS_DBOX_A_CREDIT(4);
+       else
+               val = MBUS_DBOX_A_CREDIT(2);
 
        if (DISPLAY_VER(dev_priv) >= 12) {
                val |= MBUS_DBOX_BW_CREDIT(2);
@@ -3460,7 +3526,8 @@ static void icl_ddi_bigjoiner_pre_enable(struct intel_atomic_state *state,
                 * Enable sequence steps 1-7 on bigjoiner master
                 */
                intel_encoders_pre_pll_enable(state, master);
-               intel_enable_shared_dpll(master_crtc_state);
+               if (master_crtc_state->shared_dpll)
+                       intel_enable_shared_dpll(master_crtc_state);
                intel_encoders_pre_enable(state, master);
 
                /* and DSC on slave */
@@ -3518,7 +3585,7 @@ static void hsw_crtc_enable(struct intel_atomic_state *state,
 
        crtc->active = true;
 
-       /* Display WA #1180: WaDisableScalarClockGating: glk, cnl */
+       /* Display WA #1180: WaDisableScalarClockGating: glk */
        psl_clkgate_wa = DISPLAY_VER(dev_priv) == 10 &&
                new_crtc_state->pch_pfit.enabled;
        if (psl_clkgate_wa)
@@ -3542,13 +3609,17 @@ static void hsw_crtc_enable(struct intel_atomic_state *state,
        hsw_set_linetime_wm(new_crtc_state);
 
        if (DISPLAY_VER(dev_priv) >= 11)
-               icl_set_pipe_chicken(crtc);
+               icl_set_pipe_chicken(new_crtc_state);
 
        if (dev_priv->display.initial_watermarks)
                dev_priv->display.initial_watermarks(state, crtc);
 
-       if (DISPLAY_VER(dev_priv) >= 11)
-               icl_pipe_mbus_enable(crtc);
+       if (DISPLAY_VER(dev_priv) >= 11) {
+               const struct intel_dbuf_state *dbuf_state =
+                               intel_atomic_get_new_dbuf_state(state);
+
+               icl_pipe_mbus_enable(crtc, dbuf_state->joined_mbus);
+       }
 
        if (new_crtc_state->bigjoiner_slave)
                intel_crtc_vblank_on(new_crtc_state);
@@ -3682,6 +3753,13 @@ bool intel_phy_is_combo(struct drm_i915_private *dev_priv, enum phy phy)
 {
        if (phy == PHY_NONE)
                return false;
+       else if (IS_DG2(dev_priv))
+               /*
+                * DG2 outputs labelled as "combo PHY" in the bspec use
+                * SNPS PHYs with completely different programming,
+                * hence we always return false here.
+                */
+               return false;
        else if (IS_ALDERLAKE_S(dev_priv))
                return phy <= PHY_E;
        else if (IS_DG1(dev_priv) || IS_ROCKETLAKE(dev_priv))
@@ -3696,7 +3774,10 @@ bool intel_phy_is_combo(struct drm_i915_private *dev_priv, enum phy phy)
 
 bool intel_phy_is_tc(struct drm_i915_private *dev_priv, enum phy phy)
 {
-       if (IS_ALDERLAKE_P(dev_priv))
+       if (IS_DG2(dev_priv))
+               /* DG2's "TC1" output uses a SNPS PHY */
+               return false;
+       else if (IS_ALDERLAKE_P(dev_priv))
                return phy >= PHY_F && phy <= PHY_I;
        else if (IS_TIGERLAKE(dev_priv))
                return phy >= PHY_D && phy <= PHY_I;
@@ -3706,6 +3787,20 @@ bool intel_phy_is_tc(struct drm_i915_private *dev_priv, enum phy phy)
                return false;
 }
 
+bool intel_phy_is_snps(struct drm_i915_private *dev_priv, enum phy phy)
+{
+       if (phy == PHY_NONE)
+               return false;
+       else if (IS_DG2(dev_priv))
+               /*
+                * All four "combo" ports and the TC1 port (PHY E) use
+                * Synopsis PHYs.
+                */
+               return phy <= PHY_E;
+
+       return false;
+}
+
 enum phy intel_port_to_phy(struct drm_i915_private *i915, enum port port)
 {
        if (DISPLAY_VER(i915) >= 13 && port >= PORT_D_XELPD)
@@ -3850,7 +3945,7 @@ static u64 get_crtc_power_domains(struct intel_crtc_state *crtc_state)
        }
 
        if (HAS_DDI(dev_priv) && crtc_state->has_audio)
-               mask |= BIT_ULL(POWER_DOMAIN_AUDIO);
+               mask |= BIT_ULL(POWER_DOMAIN_AUDIO_MMIO);
 
        if (crtc_state->shared_dpll)
                mask |= BIT_ULL(POWER_DOMAIN_DISPLAY_CORE);
@@ -6487,23 +6582,21 @@ int intel_get_load_detect_pipe(struct drm_connector *connector,
                               struct intel_load_detect_pipe *old,
                               struct drm_modeset_acquire_ctx *ctx)
 {
-       struct intel_crtc *intel_crtc;
-       struct intel_encoder *intel_encoder =
+       struct intel_encoder *encoder =
                intel_attached_encoder(to_intel_connector(connector));
-       struct drm_crtc *possible_crtc;
-       struct drm_encoder *encoder = &intel_encoder->base;
-       struct drm_crtc *crtc = NULL;
-       struct drm_device *dev = encoder->dev;
+       struct intel_crtc *possible_crtc;
+       struct intel_crtc *crtc = NULL;
+       struct drm_device *dev = encoder->base.dev;
        struct drm_i915_private *dev_priv = to_i915(dev);
        struct drm_mode_config *config = &dev->mode_config;
        struct drm_atomic_state *state = NULL, *restore_state = NULL;
        struct drm_connector_state *connector_state;
        struct intel_crtc_state *crtc_state;
-       int ret, i = -1;
+       int ret;
 
        drm_dbg_kms(&dev_priv->drm, "[CONNECTOR:%d:%s], [ENCODER:%d:%s]\n",
                    connector->base.id, connector->name,
-                   encoder->base.id, encoder->name);
+                   encoder->base.base.id, encoder->base.name);
 
        old->restore_state = NULL;
 
@@ -6521,9 +6614,9 @@ int intel_get_load_detect_pipe(struct drm_connector *connector,
 
        /* See if we already have a CRTC for this connector */
        if (connector->state->crtc) {
-               crtc = connector->state->crtc;
+               crtc = to_intel_crtc(connector->state->crtc);
 
-               ret = drm_modeset_lock(&crtc->mutex, ctx);
+               ret = drm_modeset_lock(&crtc->base.mutex, ctx);
                if (ret)
                        goto fail;
 
@@ -6532,17 +6625,17 @@ int intel_get_load_detect_pipe(struct drm_connector *connector,
        }
 
        /* Find an unused one (if possible) */
-       for_each_crtc(dev, possible_crtc) {
-               i++;
-               if (!(encoder->possible_crtcs & (1 << i)))
+       for_each_intel_crtc(dev, possible_crtc) {
+               if (!(encoder->base.possible_crtcs &
+                     drm_crtc_mask(&possible_crtc->base)))
                        continue;
 
-               ret = drm_modeset_lock(&possible_crtc->mutex, ctx);
+               ret = drm_modeset_lock(&possible_crtc->base.mutex, ctx);
                if (ret)
                        goto fail;
 
-               if (possible_crtc->state->enable) {
-                       drm_modeset_unlock(&possible_crtc->mutex);
+               if (possible_crtc->base.state->enable) {
+                       drm_modeset_unlock(&possible_crtc->base.mutex);
                        continue;
                }
 
@@ -6561,8 +6654,6 @@ int intel_get_load_detect_pipe(struct drm_connector *connector,
        }
 
 found:
-       intel_crtc = to_intel_crtc(crtc);
-
        state = drm_atomic_state_alloc(dev);
        restore_state = drm_atomic_state_alloc(dev);
        if (!state || !restore_state) {
@@ -6579,11 +6670,11 @@ found:
                goto fail;
        }
 
-       ret = drm_atomic_set_crtc_for_connector(connector_state, crtc);
+       ret = drm_atomic_set_crtc_for_connector(connector_state, &crtc->base);
        if (ret)
                goto fail;
 
-       crtc_state = intel_atomic_get_crtc_state(state, intel_crtc);
+       crtc_state = intel_atomic_get_crtc_state(state, crtc);
        if (IS_ERR(crtc_state)) {
                ret = PTR_ERR(crtc_state);
                goto fail;
@@ -6596,15 +6687,15 @@ found:
        if (ret)
                goto fail;
 
-       ret = intel_modeset_disable_planes(state, crtc);
+       ret = intel_modeset_disable_planes(state, &crtc->base);
        if (ret)
                goto fail;
 
        ret = PTR_ERR_OR_ZERO(drm_atomic_get_connector_state(restore_state, connector));
        if (!ret)
-               ret = PTR_ERR_OR_ZERO(drm_atomic_get_crtc_state(restore_state, crtc));
+               ret = PTR_ERR_OR_ZERO(drm_atomic_get_crtc_state(restore_state, &crtc->base));
        if (!ret)
-               ret = drm_atomic_add_affected_planes(restore_state, crtc);
+               ret = drm_atomic_add_affected_planes(restore_state, &crtc->base);
        if (ret) {
                drm_dbg_kms(&dev_priv->drm,
                            "Failed to create a copy of old state to restore: %i\n",
@@ -6623,7 +6714,7 @@ found:
        drm_atomic_state_put(state);
 
        /* let the connector get through one full cycle before testing */
-       intel_wait_for_vblank(dev_priv, intel_crtc->pipe);
+       intel_wait_for_vblank(dev_priv, crtc->pipe);
        return true;
 
 fail:
@@ -7295,12 +7386,13 @@ static int intel_crtc_atomic_check(struct intel_atomic_state *state,
        }
 
        if (dev_priv->display.compute_pipe_wm) {
-               ret = dev_priv->display.compute_pipe_wm(crtc_state);
+               ret = dev_priv->display.compute_pipe_wm(state, crtc);
                if (ret) {
                        drm_dbg_kms(&dev_priv->drm,
                                    "Target pipe watermarks are invalid\n");
                        return ret;
                }
+
        }
 
        if (dev_priv->display.compute_intermediate_wm) {
@@ -7313,7 +7405,7 @@ static int intel_crtc_atomic_check(struct intel_atomic_state *state,
                 * old state and the new state.  We can program these
                 * immediately.
                 */
-               ret = dev_priv->display.compute_intermediate_wm(crtc_state);
+               ret = dev_priv->display.compute_intermediate_wm(state, crtc);
                if (ret) {
                        drm_dbg_kms(&dev_priv->drm,
                                    "No valid intermediate pipe watermarks are possible\n");
@@ -8636,10 +8728,11 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config,
 
        PIPE_CONF_CHECK_BOOL(double_wide);
 
-       PIPE_CONF_CHECK_P(shared_dpll);
+       if (dev_priv->dpll.mgr)
+               PIPE_CONF_CHECK_P(shared_dpll);
 
        /* FIXME do the readout properly and get rid of this quirk */
-       if (!PIPE_CONF_QUIRK(PIPE_CONFIG_QUIRK_BIGJOINER_SLAVE)) {
+       if (dev_priv->dpll.mgr && !PIPE_CONF_QUIRK(PIPE_CONFIG_QUIRK_BIGJOINER_SLAVE)) {
                PIPE_CONF_CHECK_X(dpll_hw_state.dpll);
                PIPE_CONF_CHECK_X(dpll_hw_state.dpll_md);
                PIPE_CONF_CHECK_X(dpll_hw_state.fp0);
@@ -8671,7 +8764,9 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config,
                PIPE_CONF_CHECK_X(dpll_hw_state.mg_pll_ssc);
                PIPE_CONF_CHECK_X(dpll_hw_state.mg_pll_bias);
                PIPE_CONF_CHECK_X(dpll_hw_state.mg_pll_tdc_coldst_bias);
+       }
 
+       if (!PIPE_CONF_QUIRK(PIPE_CONFIG_QUIRK_BIGJOINER_SLAVE)) {
                PIPE_CONF_CHECK_X(dsi_pll.ctrl);
                PIPE_CONF_CHECK_X(dsi_pll.div);
 
@@ -9009,6 +9104,10 @@ verify_crtc_state(struct intel_crtc *crtc,
        if (!new_crtc_state->hw.active)
                return;
 
+       if (new_crtc_state->bigjoiner_slave)
+               /* No PLLs set for slave */
+               pipe_config->shared_dpll = NULL;
+
        intel_pipe_config_sanity_check(dev_priv, pipe_config);
 
        if (!intel_pipe_config_compare(new_crtc_state,
@@ -9111,6 +9210,55 @@ verify_shared_dpll_state(struct intel_crtc *crtc,
        }
 }
 
+static void
+verify_mpllb_state(struct intel_atomic_state *state,
+                  struct intel_crtc_state *new_crtc_state)
+{
+       struct drm_i915_private *i915 = to_i915(state->base.dev);
+       struct intel_mpllb_state mpllb_hw_state = { 0 };
+       struct intel_mpllb_state *mpllb_sw_state = &new_crtc_state->mpllb_state;
+       struct intel_crtc *crtc = to_intel_crtc(new_crtc_state->uapi.crtc);
+       struct intel_encoder *encoder;
+
+       if (!IS_DG2(i915))
+               return;
+
+       if (!new_crtc_state->hw.active)
+               return;
+
+       if (new_crtc_state->bigjoiner_slave)
+               return;
+
+       encoder = intel_get_crtc_new_encoder(state, new_crtc_state);
+       intel_mpllb_readout_hw_state(encoder, &mpllb_hw_state);
+
+#define MPLLB_CHECK(name) do { \
+       if (mpllb_sw_state->name != mpllb_hw_state.name) { \
+               pipe_config_mismatch(false, crtc, "MPLLB:" __stringify(name), \
+                                    "(expected 0x%08x, found 0x%08x)", \
+                                    mpllb_sw_state->name, \
+                                    mpllb_hw_state.name); \
+       } \
+} while (0)
+
+       MPLLB_CHECK(mpllb_cp);
+       MPLLB_CHECK(mpllb_div);
+       MPLLB_CHECK(mpllb_div2);
+       MPLLB_CHECK(mpllb_fracn1);
+       MPLLB_CHECK(mpllb_fracn2);
+       MPLLB_CHECK(mpllb_sscen);
+       MPLLB_CHECK(mpllb_sscstep);
+
+       /*
+        * ref_control is handled by the hardware/firemware and never
+        * programmed by the software, but the proper values are supplied
+        * in the bspec for verification purposes.
+        */
+       MPLLB_CHECK(ref_control);
+
+#undef MPLLB_CHECK
+}
+
 static void
 intel_modeset_verify_crtc(struct intel_crtc *crtc,
                          struct intel_atomic_state *state,
@@ -9124,6 +9272,7 @@ intel_modeset_verify_crtc(struct intel_crtc *crtc,
        verify_connector_state(state, crtc);
        verify_crtc_state(crtc, old_crtc_state, new_crtc_state);
        verify_shared_dpll_state(crtc, old_crtc_state, new_crtc_state);
+       verify_mpllb_state(state, new_crtc_state);
 }
 
 static void
@@ -9749,7 +9898,7 @@ static int intel_atomic_check_async(struct intel_atomic_state *state)
 
                /*
                 * FIXME: This check is kept generic for all platforms.
-                * Need to verify this for all gen9 and gen10 platforms to enable
+                * Need to verify this for all gen9 platforms to enable
                 * this selectively if required.
                 */
                switch (new_plane_state->hw.fb->modifier) {
@@ -10160,7 +10309,7 @@ static void intel_pipe_fastset(const struct intel_crtc_state *old_crtc_state,
                hsw_set_linetime_wm(new_crtc_state);
 
        if (DISPLAY_VER(dev_priv) >= 11)
-               icl_set_pipe_chicken(crtc);
+               icl_set_pipe_chicken(new_crtc_state);
 }
 
 static void commit_pipe_pre_planes(struct intel_atomic_state *state,
@@ -10294,6 +10443,8 @@ static void intel_old_crtc_state_disables(struct intel_atomic_state *state,
 
        drm_WARN_ON(&dev_priv->drm, old_crtc_state->bigjoiner_slave);
 
+       intel_encoders_pre_disable(state, crtc);
+
        intel_crtc_disable_planes(state, crtc);
 
        /*
@@ -11328,7 +11479,12 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv)
        if (!HAS_DISPLAY(dev_priv))
                return;
 
-       if (IS_ALDERLAKE_P(dev_priv)) {
+       if (IS_DG2(dev_priv)) {
+               intel_ddi_init(dev_priv, PORT_A);
+               intel_ddi_init(dev_priv, PORT_B);
+               intel_ddi_init(dev_priv, PORT_C);
+               intel_ddi_init(dev_priv, PORT_D_XELPD);
+       } else if (IS_ALDERLAKE_P(dev_priv)) {
                intel_ddi_init(dev_priv, PORT_A);
                intel_ddi_init(dev_priv, PORT_B);
                intel_ddi_init(dev_priv, PORT_TC1);
@@ -11375,13 +11531,6 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv)
                intel_ddi_init(dev_priv, PORT_B);
                intel_ddi_init(dev_priv, PORT_C);
                vlv_dsi_init(dev_priv);
-       } else if (DISPLAY_VER(dev_priv) == 10) {
-               intel_ddi_init(dev_priv, PORT_A);
-               intel_ddi_init(dev_priv, PORT_B);
-               intel_ddi_init(dev_priv, PORT_C);
-               intel_ddi_init(dev_priv, PORT_D);
-               intel_ddi_init(dev_priv, PORT_E);
-               intel_ddi_init(dev_priv, PORT_F);
        } else if (DISPLAY_VER(dev_priv) >= 9) {
                intel_ddi_init(dev_priv, PORT_A);
                intel_ddi_init(dev_priv, PORT_B);
@@ -11790,7 +11939,7 @@ intel_user_framebuffer_create(struct drm_device *dev,
 
        /* object is backed with LMEM for discrete */
        i915 = to_i915(obj->base.dev);
-       if (HAS_LMEM(i915) && !i915_gem_object_is_lmem(obj)) {
+       if (HAS_LMEM(i915) && !i915_gem_object_can_migrate(obj, INTEL_REGION_LMEM)) {
                /* object is "remote", not in local memory */
                i915_gem_object_put(obj);
                return ERR_PTR(-EREMOTE);
@@ -13136,7 +13285,7 @@ get_encoder_power_domains(struct drm_i915_private *dev_priv)
 static void intel_early_display_was(struct drm_i915_private *dev_priv)
 {
        /*
-        * Display WA #1185 WaDisableDARBFClkGating:cnl,glk,icl,ehl,tgl
+        * Display WA #1185 WaDisableDARBFClkGating:glk,icl,ehl,tgl
         * Also known as Wa_14010480278.
         */
        if (IS_DISPLAY_VER(dev_priv, 10, 12))