Merge tag 'drm-intel-gt-next-2022-09-09' of git://anongit.freedesktop.org/drm/drm...
authorDave Airlie <airlied@redhat.com>
Mon, 12 Sep 2022 11:12:22 +0000 (21:12 +1000)
committerDave Airlie <airlied@redhat.com>
Mon, 12 Sep 2022 11:12:23 +0000 (21:12 +1000)
UAPI Changes:

- Revert "drm/i915/dg2: Add preemption changes for Wa_14015141709"

  The intent of Wa_14015141709 was to inform us that userspace can no
  longer control object-level preemption as it has on past platforms
  (i.e., by twiddling register bit CS_CHICKEN1[0]).  The description of
  the workaround in the spec wasn't terribly well-written, and when we
  requested clarification from the hardware teams we were told that on the
  kernel side we should also probably stop setting
  FF_SLICE_CS_CHICKEN1[14], which is the register bit that directs the
  hardware to honor the settings in per-context register CS_CHICKEN1.  It
  turns out that this guidance about FF_SLICE_CS_CHICKEN1[14] was a
  mistake; even though CS_CHICKEN1[0] is non-operational and useless to
  userspace, there are other bits in the register that do still work and
  might need to be adjusted by userspace in the future (e.g., to implement
  other workarounds that show up).  If we don't set
  FF_SLICE_CS_CHICKEN1[14] in i915, then those future workarounds would
  not take effect.

  Even more details at:

  https://lists.freedesktop.org/archives/intel-gfx/2022-September/305478.html

Driver Changes:

- Align GuC/HuC firmware versioning scheme to kernel practices (John)
- Fix #6639: h264 hardware video decoding broken in 5.19 on Intel(R)
  Celeron(R) N3060 (Nirmoy)
- Meteorlake (MTL) enabling (Matt R)
- GuC SLPC improvements (Vinay, Rodrigo)
- Add thread execution tuning setting for ATS-M (Matt R)
- Don't start PXP without mei_pxp bind (Juston)
- Remove leftover verbose debug logging from GuC error capture (John)
- Abort suspend on low system memory conditions (Nirmoy, Matt A, Chris)
- Add DG2 Wa_16014892111 (Matt R)

- Rename ggtt_view as gtt_view (Niranjana)
- Consider HAS_FLAT_CCS() in needs_ccs_pages (Matt A)
- Don't try to disable host RPS when this was never enabled. (Rodrigo)
- Clear stalled GuC CT request after a reset (Daniele)
- Remove runtime info printing from GuC time stamp logging (Jani)
- Skip Bit12 fw domain reset for gen12+ (Sushma, Radhakrishna)

- Make GuC log sizes runtime configurable (John)
- Selftest improvements (Daniele, Matt B, Andrzej)

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/YxshfqUN+vDe92Zn@jlahtine-mobl.ger.corp.intel.com
1  2 
drivers/gpu/drm/i915/display/intel_display.c
drivers/gpu/drm/i915/display/intel_display.h
drivers/gpu/drm/i915/display/intel_display_types.h
drivers/gpu/drm/i915/display/intel_fb.c
drivers/gpu/drm/i915/gem/i915_gem_ttm.c
drivers/gpu/drm/i915/gt/uc/intel_guc_log.c
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/i915_pci.c
drivers/gpu/drm/i915/intel_device_info.h

index b8dc62203cd1fcbd893928ed2d15dfa66b7a2d94,85866f9f50eed1f090f4b82c9506bd1596a73a46..f4f7c341476240a1a30625b6428f698291fad51b
@@@ -27,6 -27,7 +27,6 @@@
  #include <acpi/video.h>
  #include <linux/i2c.h>
  #include <linux/input.h>
 -#include <linux/intel-iommu.h>
  #include <linux/kernel.h>
  #include <linux/module.h>
  #include <linux/dma-resv.h>
  #include <linux/string_helpers.h>
  #include <linux/vga_switcheroo.h>
  
 +#include <drm/display/drm_dp_helper.h>
  #include <drm/drm_atomic.h>
  #include <drm/drm_atomic_helper.h>
  #include <drm/drm_atomic_uapi.h>
  #include <drm/drm_damage_helper.h>
 -#include <drm/dp/drm_dp_helper.h>
  #include <drm/drm_edid.h>
  #include <drm/drm_fourcc.h>
 -#include <drm/drm_plane_helper.h>
  #include <drm/drm_privacy_screen_consumer.h>
  #include <drm/drm_probe_helper.h>
  #include <drm/drm_rect.h>
@@@ -85,7 -87,6 +85,7 @@@
  #include "intel_cdclk.h"
  #include "intel_color.h"
  #include "intel_crtc.h"
 +#include "intel_crtc_state_dump.h"
  #include "intel_de.h"
  #include "intel_display_types.h"
  #include "intel_dmc.h"
@@@ -98,8 -99,6 +98,8 @@@
  #include "intel_frontbuffer.h"
  #include "intel_hdcp.h"
  #include "intel_hotplug.h"
 +#include "intel_modeset_verify.h"
 +#include "intel_modeset_setup.h"
  #include "intel_overlay.h"
  #include "intel_panel.h"
  #include "intel_pch_display.h"
  
  static void intel_set_transcoder_timings(const struct intel_crtc_state *crtc_state);
  static void intel_set_pipe_src_size(const struct intel_crtc_state *crtc_state);
 -static void i9xx_set_pipeconf(const struct intel_crtc_state *crtc_state);
 -static void ilk_set_pipeconf(const struct intel_crtc_state *crtc_state);
  static void hsw_set_transconf(const struct intel_crtc_state *crtc_state);
  static void bdw_set_pipemisc(const struct intel_crtc_state *crtc_state);
  static void ilk_pfit_enable(const struct intel_crtc_state *crtc_state);
 -static void intel_modeset_setup_hw_state(struct drm_device *dev,
 -                                       struct drm_modeset_acquire_ctx *ctx);
  
  /**
   * intel_update_watermarks - update FIFO watermark values based on current modes
   * We don't use the sprite, so we can ignore that.  And on Crestline we have
   * to set the non-SR watermarks to 8.
   */
 -static void intel_update_watermarks(struct drm_i915_private *dev_priv)
 +void intel_update_watermarks(struct drm_i915_private *dev_priv)
  {
        if (dev_priv->wm_disp->update_wm)
                dev_priv->wm_disp->update_wm(dev_priv);
@@@ -497,9 -500,6 +497,9 @@@ void vlv_wait_port_ready(struct drm_i91
        i915_reg_t dpll_reg;
  
        switch (dig_port->base.port) {
 +      default:
 +              MISSING_CASE(dig_port->base.port);
 +              fallthrough;
        case PORT_B:
                port_mask = DPLL_PORTB_READY_MASK;
                dpll_reg = DPLL(0);
                port_mask = DPLL_PORTD_READY_MASK;
                dpll_reg = DPIO_PHY_STATUS;
                break;
 -      default:
 -              BUG();
        }
  
        if (intel_de_wait_for_register(dev_priv, dpll_reg,
@@@ -670,7 -672,7 +670,7 @@@ bool intel_plane_uses_fence(const struc
  
        return DISPLAY_VER(dev_priv) < 4 ||
                (plane->fbc &&
-                plane_state->view.gtt.type == I915_GGTT_VIEW_NORMAL);
+                plane_state->view.gtt.type == I915_GTT_VIEW_NORMAL);
  }
  
  /*
@@@ -728,9 -730,10 +728,9 @@@ u32 intel_plane_fb_max_stride(struct dr
                                 DRM_MODE_ROTATE_0);
  }
  
 -static void
 -intel_set_plane_visible(struct intel_crtc_state *crtc_state,
 -                      struct intel_plane_state *plane_state,
 -                      bool visible)
 +void intel_set_plane_visible(struct intel_crtc_state *crtc_state,
 +                           struct intel_plane_state *plane_state,
 +                           bool visible)
  {
        struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
  
                crtc_state->uapi.plane_mask &= ~drm_plane_mask(&plane->base);
  }
  
 -static void fixup_plane_bitmasks(struct intel_crtc_state *crtc_state)
 +void intel_plane_fixup_bitmasks(struct intel_crtc_state *crtc_state)
  {
        struct drm_i915_private *dev_priv = to_i915(crtc_state->uapi.crtc->dev);
        struct drm_plane *plane;
@@@ -777,7 -780,7 +777,7 @@@ void intel_plane_disable_noatomic(struc
                    crtc->base.base.id, crtc->base.name);
  
        intel_set_plane_visible(crtc_state, plane_state, false);
 -      fixup_plane_bitmasks(crtc_state);
 +      intel_plane_fixup_bitmasks(crtc_state);
        crtc_state->data_rate[plane->id] = 0;
        crtc_state->data_rate_y[plane->id] = 0;
        crtc_state->rel_data_rate[plane->id] = 0;
@@@ -826,7 -829,7 +826,7 @@@ intel_plane_fence_y_offset(const struc
  }
  
  static int
 -__intel_display_resume(struct drm_device *dev,
 +__intel_display_resume(struct drm_i915_private *i915,
                       struct drm_atomic_state *state,
                       struct drm_modeset_acquire_ctx *ctx)
  {
        struct drm_crtc *crtc;
        int i, ret;
  
 -      intel_modeset_setup_hw_state(dev, ctx);
 -      intel_vga_redisable(to_i915(dev));
 +      intel_modeset_setup_hw_state(i915, ctx);
 +      intel_vga_redisable(i915);
  
        if (!state)
                return 0;
        }
  
        /* ignore any reset values/BIOS leftovers in the WM registers */
 -      if (!HAS_GMCH(to_i915(dev)))
 +      if (!HAS_GMCH(i915))
                to_intel_atomic_state(state)->skip_intermediate_wm = true;
  
        ret = drm_atomic_helper_commit_duplicated_state(state, ctx);
  
 -      drm_WARN_ON(dev, ret == -EDEADLK);
 +      drm_WARN_ON(&i915->drm, ret == -EDEADLK);
 +
        return ret;
  }
  
@@@ -934,55 -936,56 +934,55 @@@ void intel_display_prepare_reset(struc
        state->acquire_ctx = ctx;
  }
  
 -void intel_display_finish_reset(struct drm_i915_private *dev_priv)
 +void intel_display_finish_reset(struct drm_i915_private *i915)
  {
 -      struct drm_device *dev = &dev_priv->drm;
 -      struct drm_modeset_acquire_ctx *ctx = &dev_priv->reset_ctx;
 +      struct drm_modeset_acquire_ctx *ctx = &i915->reset_ctx;
        struct drm_atomic_state *state;
        int ret;
  
 -      if (!HAS_DISPLAY(dev_priv))
 +      if (!HAS_DISPLAY(i915))
                return;
  
        /* reset doesn't touch the display */
 -      if (!test_bit(I915_RESET_MODESET, &to_gt(dev_priv)->reset.flags))
 +      if (!test_bit(I915_RESET_MODESET, &to_gt(i915)->reset.flags))
                return;
  
 -      state = fetch_and_zero(&dev_priv->modeset_restore_state);
 +      state = fetch_and_zero(&i915->modeset_restore_state);
        if (!state)
                goto unlock;
  
        /* reset doesn't touch the display */
 -      if (!gpu_reset_clobbers_display(dev_priv)) {
 +      if (!gpu_reset_clobbers_display(i915)) {
                /* for testing only restore the display */
 -              ret = __intel_display_resume(dev, state, ctx);
 +              ret = __intel_display_resume(i915, state, ctx);
                if (ret)
 -                      drm_err(&dev_priv->drm,
 +                      drm_err(&i915->drm,
                                "Restoring old state failed with %i\n", ret);
        } else {
                /*
                 * The display has been reset as well,
                 * so need a full re-initialization.
                 */
 -              intel_pps_unlock_regs_wa(dev_priv);
 -              intel_modeset_init_hw(dev_priv);
 -              intel_init_clock_gating(dev_priv);
 -              intel_hpd_init(dev_priv);
 +              intel_pps_unlock_regs_wa(i915);
 +              intel_modeset_init_hw(i915);
 +              intel_init_clock_gating(i915);
 +              intel_hpd_init(i915);
  
 -              ret = __intel_display_resume(dev, state, ctx);
 +              ret = __intel_display_resume(i915, state, ctx);
                if (ret)
 -                      drm_err(&dev_priv->drm,
 +                      drm_err(&i915->drm,
                                "Restoring old state failed with %i\n", ret);
  
 -              intel_hpd_poll_disable(dev_priv);
 +              intel_hpd_poll_disable(i915);
        }
  
        drm_atomic_state_put(state);
  unlock:
        drm_modeset_drop_locks(ctx);
        drm_modeset_acquire_fini(ctx);
 -      mutex_unlock(&dev->mode_config.mutex);
 +      mutex_unlock(&i915->drm.mode_config.mutex);
  
 -      clear_bit_unlock(I915_RESET_MODESET, &to_gt(dev_priv)->reset.flags);
 +      clear_bit_unlock(I915_RESET_MODESET, &to_gt(i915)->reset.flags);
  }
  
  static void icl_set_pipe_chicken(const struct intel_crtc_state *crtc_state)
@@@ -2203,8 -2206,9 +2203,8 @@@ static void get_crtc_power_domains(stru
                set_bit(intel_dsc_power_domain(crtc, cpu_transcoder), mask->bits);
  }
  
 -static void
 -modeset_get_crtc_power_domains(struct intel_crtc_state *crtc_state,
 -                             struct intel_power_domain_mask *old_domains)
 +void intel_modeset_get_crtc_power_domains(struct intel_crtc_state *crtc_state,
 +                                        struct intel_power_domain_mask *old_domains)
  {
        struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
        struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
                                               domain);
  }
  
 -static void modeset_put_crtc_power_domains(struct intel_crtc *crtc,
 -                                         struct intel_power_domain_mask *domains)
 +void intel_modeset_put_crtc_power_domains(struct intel_crtc *crtc,
 +                                        struct intel_power_domain_mask *domains)
  {
        intel_display_power_put_mask_in_set(to_i915(crtc->base.dev),
                                            &crtc->enabled_power_domains,
@@@ -2409,6 -2413,89 +2409,6 @@@ static void i9xx_crtc_disable(struct in
                i830_enable_pipe(dev_priv, pipe);
  }
  
 -static void intel_crtc_disable_noatomic(struct intel_crtc *crtc,
 -                                      struct drm_modeset_acquire_ctx *ctx)
 -{
 -      struct intel_encoder *encoder;
 -      struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
 -      struct intel_bw_state *bw_state =
 -              to_intel_bw_state(dev_priv->bw_obj.state);
 -      struct intel_cdclk_state *cdclk_state =
 -              to_intel_cdclk_state(dev_priv->cdclk.obj.state);
 -      struct intel_dbuf_state *dbuf_state =
 -              to_intel_dbuf_state(dev_priv->dbuf.obj.state);
 -      struct intel_crtc_state *crtc_state =
 -              to_intel_crtc_state(crtc->base.state);
 -      struct intel_plane *plane;
 -      struct drm_atomic_state *state;
 -      struct intel_crtc_state *temp_crtc_state;
 -      enum pipe pipe = crtc->pipe;
 -      int ret;
 -
 -      if (!crtc_state->hw.active)
 -              return;
 -
 -      for_each_intel_plane_on_crtc(&dev_priv->drm, crtc, plane) {
 -              const struct intel_plane_state *plane_state =
 -                      to_intel_plane_state(plane->base.state);
 -
 -              if (plane_state->uapi.visible)
 -                      intel_plane_disable_noatomic(crtc, plane);
 -      }
 -
 -      state = drm_atomic_state_alloc(&dev_priv->drm);
 -      if (!state) {
 -              drm_dbg_kms(&dev_priv->drm,
 -                          "failed to disable [CRTC:%d:%s], out of memory",
 -                          crtc->base.base.id, crtc->base.name);
 -              return;
 -      }
 -
 -      state->acquire_ctx = ctx;
 -
 -      /* Everything's already locked, -EDEADLK can't happen. */
 -      temp_crtc_state = intel_atomic_get_crtc_state(state, crtc);
 -      ret = drm_atomic_add_affected_connectors(state, &crtc->base);
 -
 -      drm_WARN_ON(&dev_priv->drm, IS_ERR(temp_crtc_state) || ret);
 -
 -      dev_priv->display->crtc_disable(to_intel_atomic_state(state), crtc);
 -
 -      drm_atomic_state_put(state);
 -
 -      drm_dbg_kms(&dev_priv->drm,
 -                  "[CRTC:%d:%s] hw state adjusted, was enabled, now disabled\n",
 -                  crtc->base.base.id, crtc->base.name);
 -
 -      crtc->active = false;
 -      crtc->base.enabled = false;
 -
 -      drm_WARN_ON(&dev_priv->drm,
 -                  drm_atomic_set_mode_for_crtc(&crtc_state->uapi, NULL) < 0);
 -      crtc_state->uapi.active = false;
 -      crtc_state->uapi.connector_mask = 0;
 -      crtc_state->uapi.encoder_mask = 0;
 -      intel_crtc_free_hw_state(crtc_state);
 -      memset(&crtc_state->hw, 0, sizeof(crtc_state->hw));
 -
 -      for_each_encoder_on_crtc(&dev_priv->drm, &crtc->base, encoder)
 -              encoder->base.crtc = NULL;
 -
 -      intel_fbc_disable(crtc);
 -      intel_update_watermarks(dev_priv);
 -      intel_disable_shared_dpll(crtc_state);
 -
 -      intel_display_power_put_all_in_set(dev_priv, &crtc->enabled_power_domains);
 -
 -      cdclk_state->min_cdclk[pipe] = 0;
 -      cdclk_state->min_voltage_level[pipe] = 0;
 -      cdclk_state->active_pipes &= ~BIT(pipe);
 -
 -      dbuf_state->active_pipes &= ~BIT(pipe);
 -
 -      bw_state->data_rate[pipe] = 0;
 -      bw_state->num_active_planes[pipe] = 0;
 -}
  
  /*
   * turn all crtc's off, but do not adjust state
@@@ -2441,6 -2528,45 +2441,6 @@@ void intel_encoder_destroy(struct drm_e
        kfree(intel_encoder);
  }
  
 -/* Cross check the actual hw state with our own modeset state tracking (and it's
 - * internal consistency). */
 -static void intel_connector_verify_state(struct intel_crtc_state *crtc_state,
 -                                       struct drm_connector_state *conn_state)
 -{
 -      struct intel_connector *connector = to_intel_connector(conn_state->connector);
 -      struct drm_i915_private *i915 = to_i915(connector->base.dev);
 -
 -      drm_dbg_kms(&i915->drm, "[CONNECTOR:%d:%s]\n",
 -                  connector->base.base.id, connector->base.name);
 -
 -      if (connector->get_hw_state(connector)) {
 -              struct intel_encoder *encoder = intel_attached_encoder(connector);
 -
 -              I915_STATE_WARN(!crtc_state,
 -                       "connector enabled without attached crtc\n");
 -
 -              if (!crtc_state)
 -                      return;
 -
 -              I915_STATE_WARN(!crtc_state->hw.active,
 -                              "connector is active, but attached crtc isn't\n");
 -
 -              if (!encoder || encoder->type == INTEL_OUTPUT_DP_MST)
 -                      return;
 -
 -              I915_STATE_WARN(conn_state->best_encoder != &encoder->base,
 -                      "atomic encoder doesn't match attached encoder\n");
 -
 -              I915_STATE_WARN(conn_state->crtc != encoder->base.crtc,
 -                      "attached encoder crtc differs from connector crtc\n");
 -      } else {
 -              I915_STATE_WARN(crtc_state && crtc_state->hw.active,
 -                              "attached crtc is active, but connector isn't\n");
 -              I915_STATE_WARN(!crtc_state && conn_state->best_encoder,
 -                      "best encoder set without crtc!\n");
 -      }
 -}
 -
  static bool intel_crtc_supports_double_wide(const struct intel_crtc *crtc)
  {
        const struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
@@@ -2582,8 -2708,8 +2582,8 @@@ static void intel_crtc_readout_derived_
        intel_crtc_compute_pixel_rate(crtc_state);
  }
  
 -static void intel_encoder_get_config(struct intel_encoder *encoder,
 -                                   struct intel_crtc_state *crtc_state)
 +void intel_encoder_get_config(struct intel_encoder *encoder,
 +                            struct intel_crtc_state *crtc_state)
  {
        encoder->get_config(encoder, crtc_state);
  
@@@ -2685,11 -2811,9 +2685,11 @@@ static int intel_crtc_compute_pipe_mode
        return 0;
  }
  
 -static int intel_crtc_compute_config(struct intel_crtc *crtc,
 -                                   struct intel_crtc_state *crtc_state)
 +static int intel_crtc_compute_config(struct intel_atomic_state *state,
 +                                   struct intel_crtc *crtc)
  {
 +      struct intel_crtc_state *crtc_state =
 +              intel_atomic_get_new_crtc_state(state, crtc);
        int ret;
  
        ret = intel_crtc_compute_pipe_src(crtc_state);
@@@ -3011,18 -3135,14 +3011,18 @@@ static void intel_get_pipe_src_size(str
        intel_bigjoiner_adjust_pipe_src(pipe_config);
  }
  
 -static void i9xx_set_pipeconf(const struct intel_crtc_state *crtc_state)
 +void i9xx_set_pipeconf(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);
        u32 pipeconf = 0;
  
 -      /* we keep both pipes enabled on 830 */
 -      if (IS_I830(dev_priv))
 +      /*
 +       * - We keep both pipes enabled on 830
 +       * - During modeset the pipe is still disabled and must remain so
 +       * - During fastset the pipe is already enabled and must remain so
 +       */
 +      if (IS_I830(dev_priv) || !intel_crtc_needs_modeset(crtc_state))
                pipeconf |= PIPECONF_ENABLE;
  
        if (crtc_state->double_wide)
                                    PIPECONF_DITHER_TYPE_SP;
  
                switch (crtc_state->pipe_bpp) {
 +              default:
 +                      /* Case prevented by intel_choose_pipe_bpp_dither. */
 +                      MISSING_CASE(crtc_state->pipe_bpp);
 +                      fallthrough;
                case 18:
                        pipeconf |= PIPECONF_BPC_6;
                        break;
                case 30:
                        pipeconf |= PIPECONF_BPC_10;
                        break;
 -              default:
 -                      /* Case prevented by intel_choose_pipe_bpp_dither. */
 -                      BUG();
                }
        }
  
        return ret;
  }
  
 -static void ilk_set_pipeconf(const struct intel_crtc_state *crtc_state)
 +void ilk_set_pipeconf(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 val;
 +      u32 val = 0;
  
 -      val = 0;
 +      /*
 +       * - During modeset the pipe is still disabled and must remain so
 +       * - During fastset the pipe is already enabled and must remain so
 +       */
 +      if (!intel_crtc_needs_modeset(crtc_state))
 +              val |= PIPECONF_ENABLE;
  
        switch (crtc_state->pipe_bpp) {
 +      default:
 +              /* Case prevented by intel_choose_pipe_bpp_dither. */
 +              MISSING_CASE(crtc_state->pipe_bpp);
 +              fallthrough;
        case 18:
                val |= PIPECONF_BPC_6;
                break;
        case 36:
                val |= PIPECONF_BPC_12;
                break;
 -      default:
 -              /* Case prevented by intel_choose_pipe_bpp_dither. */
 -              BUG();
        }
  
        if (crtc_state->dither)
@@@ -3406,13 -3519,6 +3406,13 @@@ static void hsw_set_transconf(const str
        enum transcoder cpu_transcoder = crtc_state->cpu_transcoder;
        u32 val = 0;
  
 +      /*
 +       * - During modeset the pipe is still disabled and must remain so
 +       * - During fastset the pipe is already enabled and must remain so
 +       */
 +      if (!intel_crtc_needs_modeset(crtc_state))
 +              val |= PIPECONF_ENABLE;
 +
        if (IS_HASWELL(dev_priv) && crtc_state->dither)
                val |= PIPECONF_DITHER_EN | PIPECONF_DITHER_TYPE_SP;
  
@@@ -4140,7 -4246,7 +4140,7 @@@ out
        return active;
  }
  
 -static bool intel_crtc_get_pipe_config(struct intel_crtc_state *crtc_state)
 +bool intel_crtc_get_pipe_config(struct intel_crtc_state *crtc_state)
  {
        struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
        struct drm_i915_private *i915 = to_i915(crtc->base.dev);
@@@ -4874,12 -4980,45 +4874,12 @@@ static int intel_crtc_atomic_check(stru
        return 0;
  }
  
 -static void intel_modeset_update_connector_atomic_state(struct drm_device *dev)
 -{
 -      struct intel_connector *connector;
 -      struct drm_connector_list_iter conn_iter;
 -
 -      drm_connector_list_iter_begin(dev, &conn_iter);
 -      for_each_intel_connector_iter(connector, &conn_iter) {
 -              struct drm_connector_state *conn_state = connector->base.state;
 -              struct intel_encoder *encoder =
 -                      to_intel_encoder(connector->base.encoder);
 -
 -              if (conn_state->crtc)
 -                      drm_connector_put(&connector->base);
 -
 -              if (encoder) {
 -                      struct intel_crtc *crtc =
 -                              to_intel_crtc(encoder->base.crtc);
 -                      const struct intel_crtc_state *crtc_state =
 -                              to_intel_crtc_state(crtc->base.state);
 -
 -                      conn_state->best_encoder = &encoder->base;
 -                      conn_state->crtc = &crtc->base;
 -                      conn_state->max_bpc = (crtc_state->pipe_bpp ?: 24) / 3;
 -
 -                      drm_connector_get(&connector->base);
 -              } else {
 -                      conn_state->best_encoder = NULL;
 -                      conn_state->crtc = NULL;
 -              }
 -      }
 -      drm_connector_list_iter_end(&conn_iter);
 -}
 -
  static int
  compute_sink_pipe_bpp(const struct drm_connector_state *conn_state,
 -                    struct intel_crtc_state *pipe_config)
 +                    struct intel_crtc_state *crtc_state)
  {
        struct drm_connector *connector = conn_state->connector;
 -      struct drm_i915_private *i915 = to_i915(pipe_config->uapi.crtc->dev);
 +      struct drm_i915_private *i915 = to_i915(crtc_state->uapi.crtc->dev);
        const struct drm_display_info *info = &connector->display_info;
        int bpp;
  
                return -EINVAL;
        }
  
 -      if (bpp < pipe_config->pipe_bpp) {
 +      if (bpp < crtc_state->pipe_bpp) {
                drm_dbg_kms(&i915->drm,
 -                          "[CONNECTOR:%d:%s] Limiting display bpp to %d instead of "
 -                          "EDID bpp %d, requested bpp %d, max platform bpp %d\n",
 +                          "[CONNECTOR:%d:%s] Limiting display bpp to %d "
 +                          "(EDID bpp %d, max requested bpp %d, max platform bpp %d)\n",
                            connector->base.id, connector->name,
                            bpp, 3 * info->bpc,
                            3 * conn_state->max_requested_bpc,
 -                          pipe_config->pipe_bpp);
 +                          crtc_state->pipe_bpp);
  
 -              pipe_config->pipe_bpp = bpp;
 +              crtc_state->pipe_bpp = bpp;
        }
  
        return 0;
  }
  
  static int
 -compute_baseline_pipe_bpp(struct intel_crtc *crtc,
 -                        struct intel_crtc_state *pipe_config)
 +compute_baseline_pipe_bpp(struct intel_atomic_state *state,
 +                        struct intel_crtc *crtc)
  {
        struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
 -      struct drm_atomic_state *state = pipe_config->uapi.state;
 +      struct intel_crtc_state *crtc_state =
 +              intel_atomic_get_new_crtc_state(state, crtc);
        struct drm_connector *connector;
        struct drm_connector_state *connector_state;
        int bpp, i;
        else
                bpp = 8*3;
  
 -      pipe_config->pipe_bpp = bpp;
 +      crtc_state->pipe_bpp = bpp;
  
        /* Clamp display bpp to connector max bpp */
 -      for_each_new_connector_in_state(state, connector, connector_state, i) {
 +      for_each_new_connector_in_state(&state->base, connector, connector_state, i) {
                int ret;
  
                if (connector_state->crtc != &crtc->base)
                        continue;
  
 -              ret = compute_sink_pipe_bpp(connector_state, pipe_config);
 +              ret = compute_sink_pipe_bpp(connector_state, crtc_state);
                if (ret)
                        return ret;
        }
        return 0;
  }
  
 -static void intel_dump_crtc_timings(struct drm_i915_private *i915,
 -                                  const struct drm_display_mode *mode)
 -{
 -      drm_dbg_kms(&i915->drm, "crtc timings: %d %d %d %d %d %d %d %d %d, "
 -                  "type: 0x%x flags: 0x%x\n",
 -                  mode->crtc_clock,
 -                  mode->crtc_hdisplay, mode->crtc_hsync_start,
 -                  mode->crtc_hsync_end, mode->crtc_htotal,
 -                  mode->crtc_vdisplay, mode->crtc_vsync_start,
 -                  mode->crtc_vsync_end, mode->crtc_vtotal,
 -                  mode->type, mode->flags);
 -}
 -
 -static void
 -intel_dump_m_n_config(const struct intel_crtc_state *pipe_config,
 -                    const char *id, unsigned int lane_count,
 -                    const struct intel_link_m_n *m_n)
 -{
 -      struct drm_i915_private *i915 = to_i915(pipe_config->uapi.crtc->dev);
 -
 -      drm_dbg_kms(&i915->drm,
 -                  "%s: lanes: %i; data_m: %u, data_n: %u, link_m: %u, link_n: %u, tu: %u\n",
 -                  id, lane_count,
 -                  m_n->data_m, m_n->data_n,
 -                  m_n->link_m, m_n->link_n, m_n->tu);
 -}
 -
 -static void
 -intel_dump_infoframe(struct drm_i915_private *dev_priv,
 -                   const union hdmi_infoframe *frame)
 -{
 -      if (!drm_debug_enabled(DRM_UT_KMS))
 -              return;
 -
 -      hdmi_infoframe_log(KERN_DEBUG, dev_priv->drm.dev, frame);
 -}
 -
 -static void
 -intel_dump_dp_vsc_sdp(struct drm_i915_private *dev_priv,
 -                    const struct drm_dp_vsc_sdp *vsc)
 -{
 -      if (!drm_debug_enabled(DRM_UT_KMS))
 -              return;
 -
 -      drm_dp_vsc_sdp_log(KERN_DEBUG, dev_priv->drm.dev, vsc);
 -}
 -
 -#define OUTPUT_TYPE(x) [INTEL_OUTPUT_ ## x] = #x
 -
 -static const char * const output_type_str[] = {
 -      OUTPUT_TYPE(UNUSED),
 -      OUTPUT_TYPE(ANALOG),
 -      OUTPUT_TYPE(DVO),
 -      OUTPUT_TYPE(SDVO),
 -      OUTPUT_TYPE(LVDS),
 -      OUTPUT_TYPE(TVOUT),
 -      OUTPUT_TYPE(HDMI),
 -      OUTPUT_TYPE(DP),
 -      OUTPUT_TYPE(EDP),
 -      OUTPUT_TYPE(DSI),
 -      OUTPUT_TYPE(DDI),
 -      OUTPUT_TYPE(DP_MST),
 -};
 -
 -#undef OUTPUT_TYPE
 -
 -static void snprintf_output_types(char *buf, size_t len,
 -                                unsigned int output_types)
 -{
 -      char *str = buf;
 -      int i;
 -
 -      str[0] = '\0';
 -
 -      for (i = 0; i < ARRAY_SIZE(output_type_str); i++) {
 -              int r;
 -
 -              if ((output_types & BIT(i)) == 0)
 -                      continue;
 -
 -              r = snprintf(str, len, "%s%s",
 -                           str != buf ? "," : "", output_type_str[i]);
 -              if (r >= len)
 -                      break;
 -              str += r;
 -              len -= r;
 -
 -              output_types &= ~BIT(i);
 -      }
 -
 -      WARN_ON_ONCE(output_types != 0);
 -}
 -
 -static const char * const output_format_str[] = {
 -      [INTEL_OUTPUT_FORMAT_RGB] = "RGB",
 -      [INTEL_OUTPUT_FORMAT_YCBCR420] = "YCBCR4:2:0",
 -      [INTEL_OUTPUT_FORMAT_YCBCR444] = "YCBCR4:4:4",
 -};
 -
 -static const char *output_formats(enum intel_output_format format)
 -{
 -      if (format >= ARRAY_SIZE(output_format_str))
 -              return "invalid";
 -      return output_format_str[format];
 -}
 -
 -static void intel_dump_plane_state(const struct intel_plane_state *plane_state)
 -{
 -      struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
 -      struct drm_i915_private *i915 = to_i915(plane->base.dev);
 -      const struct drm_framebuffer *fb = plane_state->hw.fb;
 -
 -      if (!fb) {
 -              drm_dbg_kms(&i915->drm,
 -                          "[PLANE:%d:%s] fb: [NOFB], visible: %s\n",
 -                          plane->base.base.id, plane->base.name,
 -                          str_yes_no(plane_state->uapi.visible));
 -              return;
 -      }
 -
 -      drm_dbg_kms(&i915->drm,
 -                  "[PLANE:%d:%s] fb: [FB:%d] %ux%u format = %p4cc modifier = 0x%llx, visible: %s\n",
 -                  plane->base.base.id, plane->base.name,
 -                  fb->base.id, fb->width, fb->height, &fb->format->format,
 -                  fb->modifier, str_yes_no(plane_state->uapi.visible));
 -      drm_dbg_kms(&i915->drm, "\trotation: 0x%x, scaler: %d\n",
 -                  plane_state->hw.rotation, plane_state->scaler_id);
 -      if (plane_state->uapi.visible)
 -              drm_dbg_kms(&i915->drm,
 -                          "\tsrc: " DRM_RECT_FP_FMT " dst: " DRM_RECT_FMT "\n",
 -                          DRM_RECT_FP_ARG(&plane_state->uapi.src),
 -                          DRM_RECT_ARG(&plane_state->uapi.dst));
 -}
 -
 -static void intel_dump_pipe_config(const struct intel_crtc_state *pipe_config,
 -                                 struct intel_atomic_state *state,
 -                                 const char *context)
 -{
 -      struct intel_crtc *crtc = to_intel_crtc(pipe_config->uapi.crtc);
 -      struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
 -      const struct intel_plane_state *plane_state;
 -      struct intel_plane *plane;
 -      char buf[64];
 -      int i;
 -
 -      drm_dbg_kms(&dev_priv->drm, "[CRTC:%d:%s] enable: %s %s\n",
 -                  crtc->base.base.id, crtc->base.name,
 -                  str_yes_no(pipe_config->hw.enable), context);
 -
 -      if (!pipe_config->hw.enable)
 -              goto dump_planes;
 -
 -      snprintf_output_types(buf, sizeof(buf), pipe_config->output_types);
 -      drm_dbg_kms(&dev_priv->drm,
 -                  "active: %s, output_types: %s (0x%x), output format: %s\n",
 -                  str_yes_no(pipe_config->hw.active),
 -                  buf, pipe_config->output_types,
 -                  output_formats(pipe_config->output_format));
 -
 -      drm_dbg_kms(&dev_priv->drm,
 -                  "cpu_transcoder: %s, pipe bpp: %i, dithering: %i\n",
 -                  transcoder_name(pipe_config->cpu_transcoder),
 -                  pipe_config->pipe_bpp, pipe_config->dither);
 -
 -      drm_dbg_kms(&dev_priv->drm, "MST master transcoder: %s\n",
 -                  transcoder_name(pipe_config->mst_master_transcoder));
 -
 -      drm_dbg_kms(&dev_priv->drm,
 -                  "port sync: master transcoder: %s, slave transcoder bitmask = 0x%x\n",
 -                  transcoder_name(pipe_config->master_transcoder),
 -                  pipe_config->sync_mode_slaves_mask);
 -
 -      drm_dbg_kms(&dev_priv->drm, "bigjoiner: %s, pipes: 0x%x\n",
 -                  intel_crtc_is_bigjoiner_slave(pipe_config) ? "slave" :
 -                  intel_crtc_is_bigjoiner_master(pipe_config) ? "master" : "no",
 -                  pipe_config->bigjoiner_pipes);
 -
 -      drm_dbg_kms(&dev_priv->drm, "splitter: %s, link count %d, overlap %d\n",
 -                  str_enabled_disabled(pipe_config->splitter.enable),
 -                  pipe_config->splitter.link_count,
 -                  pipe_config->splitter.pixel_overlap);
 -
 -      if (pipe_config->has_pch_encoder)
 -              intel_dump_m_n_config(pipe_config, "fdi",
 -                                    pipe_config->fdi_lanes,
 -                                    &pipe_config->fdi_m_n);
 -
 -      if (intel_crtc_has_dp_encoder(pipe_config)) {
 -              intel_dump_m_n_config(pipe_config, "dp m_n",
 -                                    pipe_config->lane_count,
 -                                    &pipe_config->dp_m_n);
 -              intel_dump_m_n_config(pipe_config, "dp m2_n2",
 -                                    pipe_config->lane_count,
 -                                    &pipe_config->dp_m2_n2);
 -      }
 -
 -      drm_dbg_kms(&dev_priv->drm, "framestart delay: %d, MSA timing delay: %d\n",
 -                  pipe_config->framestart_delay, pipe_config->msa_timing_delay);
 -
 -      drm_dbg_kms(&dev_priv->drm,
 -                  "audio: %i, infoframes: %i, infoframes enabled: 0x%x\n",
 -                  pipe_config->has_audio, pipe_config->has_infoframe,
 -                  pipe_config->infoframes.enable);
 -
 -      if (pipe_config->infoframes.enable &
 -          intel_hdmi_infoframe_enable(HDMI_PACKET_TYPE_GENERAL_CONTROL))
 -              drm_dbg_kms(&dev_priv->drm, "GCP: 0x%x\n",
 -                          pipe_config->infoframes.gcp);
 -      if (pipe_config->infoframes.enable &
 -          intel_hdmi_infoframe_enable(HDMI_INFOFRAME_TYPE_AVI))
 -              intel_dump_infoframe(dev_priv, &pipe_config->infoframes.avi);
 -      if (pipe_config->infoframes.enable &
 -          intel_hdmi_infoframe_enable(HDMI_INFOFRAME_TYPE_SPD))
 -              intel_dump_infoframe(dev_priv, &pipe_config->infoframes.spd);
 -      if (pipe_config->infoframes.enable &
 -          intel_hdmi_infoframe_enable(HDMI_INFOFRAME_TYPE_VENDOR))
 -              intel_dump_infoframe(dev_priv, &pipe_config->infoframes.hdmi);
 -      if (pipe_config->infoframes.enable &
 -          intel_hdmi_infoframe_enable(HDMI_INFOFRAME_TYPE_DRM))
 -              intel_dump_infoframe(dev_priv, &pipe_config->infoframes.drm);
 -      if (pipe_config->infoframes.enable &
 -          intel_hdmi_infoframe_enable(HDMI_PACKET_TYPE_GAMUT_METADATA))
 -              intel_dump_infoframe(dev_priv, &pipe_config->infoframes.drm);
 -      if (pipe_config->infoframes.enable &
 -          intel_hdmi_infoframe_enable(DP_SDP_VSC))
 -              intel_dump_dp_vsc_sdp(dev_priv, &pipe_config->infoframes.vsc);
 -
 -      drm_dbg_kms(&dev_priv->drm, "vrr: %s, vmin: %d, vmax: %d, pipeline full: %d, guardband: %d flipline: %d, vmin vblank: %d, vmax vblank: %d\n",
 -                  str_yes_no(pipe_config->vrr.enable),
 -                  pipe_config->vrr.vmin, pipe_config->vrr.vmax,
 -                  pipe_config->vrr.pipeline_full, pipe_config->vrr.guardband,
 -                  pipe_config->vrr.flipline,
 -                  intel_vrr_vmin_vblank_start(pipe_config),
 -                  intel_vrr_vmax_vblank_start(pipe_config));
 -
 -      drm_dbg_kms(&dev_priv->drm, "requested mode: " DRM_MODE_FMT "\n",
 -                  DRM_MODE_ARG(&pipe_config->hw.mode));
 -      drm_dbg_kms(&dev_priv->drm, "adjusted mode: " DRM_MODE_FMT "\n",
 -                  DRM_MODE_ARG(&pipe_config->hw.adjusted_mode));
 -      intel_dump_crtc_timings(dev_priv, &pipe_config->hw.adjusted_mode);
 -      drm_dbg_kms(&dev_priv->drm, "pipe mode: " DRM_MODE_FMT "\n",
 -                  DRM_MODE_ARG(&pipe_config->hw.pipe_mode));
 -      intel_dump_crtc_timings(dev_priv, &pipe_config->hw.pipe_mode);
 -      drm_dbg_kms(&dev_priv->drm,
 -                  "port clock: %d, pipe src: " DRM_RECT_FMT ", pixel rate %d\n",
 -                  pipe_config->port_clock, DRM_RECT_ARG(&pipe_config->pipe_src),
 -                  pipe_config->pixel_rate);
 -
 -      drm_dbg_kms(&dev_priv->drm, "linetime: %d, ips linetime: %d\n",
 -                  pipe_config->linetime, pipe_config->ips_linetime);
 -
 -      if (DISPLAY_VER(dev_priv) >= 9)
 -              drm_dbg_kms(&dev_priv->drm,
 -                          "num_scalers: %d, scaler_users: 0x%x, scaler_id: %d\n",
 -                          crtc->num_scalers,
 -                          pipe_config->scaler_state.scaler_users,
 -                          pipe_config->scaler_state.scaler_id);
 -
 -      if (HAS_GMCH(dev_priv))
 -              drm_dbg_kms(&dev_priv->drm,
 -                          "gmch pfit: control: 0x%08x, ratios: 0x%08x, lvds border: 0x%08x\n",
 -                          pipe_config->gmch_pfit.control,
 -                          pipe_config->gmch_pfit.pgm_ratios,
 -                          pipe_config->gmch_pfit.lvds_border_bits);
 -      else
 -              drm_dbg_kms(&dev_priv->drm,
 -                          "pch pfit: " DRM_RECT_FMT ", %s, force thru: %s\n",
 -                          DRM_RECT_ARG(&pipe_config->pch_pfit.dst),
 -                          str_enabled_disabled(pipe_config->pch_pfit.enabled),
 -                          str_yes_no(pipe_config->pch_pfit.force_thru));
 -
 -      drm_dbg_kms(&dev_priv->drm, "ips: %i, double wide: %i, drrs: %i\n",
 -                  pipe_config->ips_enabled, pipe_config->double_wide,
 -                  pipe_config->has_drrs);
 -
 -      intel_dpll_dump_hw_state(dev_priv, &pipe_config->dpll_hw_state);
 -
 -      if (IS_CHERRYVIEW(dev_priv))
 -              drm_dbg_kms(&dev_priv->drm,
 -                          "cgm_mode: 0x%x gamma_mode: 0x%x gamma_enable: %d csc_enable: %d\n",
 -                          pipe_config->cgm_mode, pipe_config->gamma_mode,
 -                          pipe_config->gamma_enable, pipe_config->csc_enable);
 -      else
 -              drm_dbg_kms(&dev_priv->drm,
 -                          "csc_mode: 0x%x gamma_mode: 0x%x gamma_enable: %d csc_enable: %d\n",
 -                          pipe_config->csc_mode, pipe_config->gamma_mode,
 -                          pipe_config->gamma_enable, pipe_config->csc_enable);
 -
 -      drm_dbg_kms(&dev_priv->drm, "degamma lut: %d entries, gamma lut: %d entries\n",
 -                  pipe_config->hw.degamma_lut ?
 -                  drm_color_lut_size(pipe_config->hw.degamma_lut) : 0,
 -                  pipe_config->hw.gamma_lut ?
 -                  drm_color_lut_size(pipe_config->hw.gamma_lut) : 0);
 -
 -dump_planes:
 -      if (!state)
 -              return;
 -
 -      for_each_new_intel_plane_in_state(state, plane, plane_state, i) {
 -              if (plane->pipe == crtc->pipe)
 -                      intel_dump_plane_state(plane_state);
 -      }
 -}
 -
  static bool check_digital_port_conflicts(struct intel_atomic_state *state)
  {
        struct drm_device *dev = state->base.dev;
@@@ -5058,6 -5500,27 +5058,6 @@@ intel_crtc_copy_uapi_to_hw_state_modese
        intel_crtc_copy_uapi_to_hw_state_nomodeset(state, crtc);
  }
  
 -static void intel_crtc_copy_hw_to_uapi_state(struct intel_crtc_state *crtc_state)
 -{
 -      if (intel_crtc_is_bigjoiner_slave(crtc_state))
 -              return;
 -
 -      crtc_state->uapi.enable = crtc_state->hw.enable;
 -      crtc_state->uapi.active = crtc_state->hw.active;
 -      drm_WARN_ON(crtc_state->uapi.crtc->dev,
 -                  drm_atomic_set_mode_for_crtc(&crtc_state->uapi, &crtc_state->hw.mode) < 0);
 -
 -      crtc_state->uapi.adjusted_mode = crtc_state->hw.adjusted_mode;
 -      crtc_state->uapi.scaling_filter = crtc_state->hw.scaling_filter;
 -
 -      drm_property_replace_blob(&crtc_state->uapi.degamma_lut,
 -                                crtc_state->hw.degamma_lut);
 -      drm_property_replace_blob(&crtc_state->uapi.gamma_lut,
 -                                crtc_state->hw.gamma_lut);
 -      drm_property_replace_blob(&crtc_state->uapi.ctm,
 -                                crtc_state->hw.ctm);
 -}
 -
  static void
  copy_bigjoiner_crtc_state_nomodeset(struct intel_atomic_state *state,
                                    struct intel_crtc *slave_crtc)
@@@ -5173,39 -5636,40 +5173,39 @@@ intel_crtc_prepare_cleared_state(struc
  
  static int
  intel_modeset_pipe_config(struct intel_atomic_state *state,
 -                        struct intel_crtc_state *pipe_config)
 +                        struct intel_crtc *crtc)
  {
 -      struct drm_crtc *crtc = pipe_config->uapi.crtc;
 -      struct drm_i915_private *i915 = to_i915(pipe_config->uapi.crtc->dev);
 +      struct drm_i915_private *i915 = to_i915(crtc->base.dev);
 +      struct intel_crtc_state *crtc_state =
 +              intel_atomic_get_new_crtc_state(state, crtc);
        struct drm_connector *connector;
        struct drm_connector_state *connector_state;
        int pipe_src_w, pipe_src_h;
        int base_bpp, ret, i;
        bool retry = true;
  
 -      pipe_config->cpu_transcoder =
 -              (enum transcoder) to_intel_crtc(crtc)->pipe;
 +      crtc_state->cpu_transcoder = (enum transcoder) crtc->pipe;
  
 -      pipe_config->framestart_delay = 1;
 +      crtc_state->framestart_delay = 1;
  
        /*
         * Sanitize sync polarity flags based on requested ones. If neither
         * positive or negative polarity is requested, treat this as meaning
         * negative polarity.
         */
 -      if (!(pipe_config->hw.adjusted_mode.flags &
 +      if (!(crtc_state->hw.adjusted_mode.flags &
              (DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NHSYNC)))
 -              pipe_config->hw.adjusted_mode.flags |= DRM_MODE_FLAG_NHSYNC;
 +              crtc_state->hw.adjusted_mode.flags |= DRM_MODE_FLAG_NHSYNC;
  
 -      if (!(pipe_config->hw.adjusted_mode.flags &
 +      if (!(crtc_state->hw.adjusted_mode.flags &
              (DRM_MODE_FLAG_PVSYNC | DRM_MODE_FLAG_NVSYNC)))
 -              pipe_config->hw.adjusted_mode.flags |= DRM_MODE_FLAG_NVSYNC;
 +              crtc_state->hw.adjusted_mode.flags |= DRM_MODE_FLAG_NVSYNC;
  
 -      ret = compute_baseline_pipe_bpp(to_intel_crtc(crtc),
 -                                      pipe_config);
 +      ret = compute_baseline_pipe_bpp(state, crtc);
        if (ret)
                return ret;
  
 -      base_bpp = pipe_config->pipe_bpp;
 +      base_bpp = crtc_state->pipe_bpp;
  
        /*
         * Determine the real pipe dimensions. Note that stereo modes can
         * computation to clearly distinguish it from the adjusted mode, which
         * can be changed by the connectors in the below retry loop.
         */
 -      drm_mode_get_hv_timing(&pipe_config->hw.mode,
 +      drm_mode_get_hv_timing(&crtc_state->hw.mode,
                               &pipe_src_w, &pipe_src_h);
 -      drm_rect_init(&pipe_config->pipe_src, 0, 0,
 +      drm_rect_init(&crtc_state->pipe_src, 0, 0,
                      pipe_src_w, pipe_src_h);
  
        for_each_new_connector_in_state(&state->base, connector, connector_state, i) {
                struct intel_encoder *encoder =
                        to_intel_encoder(connector_state->best_encoder);
  
 -              if (connector_state->crtc != crtc)
 +              if (connector_state->crtc != &crtc->base)
                        continue;
  
 -              if (!check_single_encoder_cloning(state, to_intel_crtc(crtc), encoder)) {
 +              if (!check_single_encoder_cloning(state, crtc, encoder)) {
                        drm_dbg_kms(&i915->drm,
 -                                  "rejecting invalid cloning configuration\n");
 +                                  "[ENCODER:%d:%s] rejecting invalid cloning configuration\n",
 +                                  encoder->base.base.id, encoder->base.name);
                        return -EINVAL;
                }
  
                 * hooks so that the hooks can use this information safely.
                 */
                if (encoder->compute_output_type)
 -                      pipe_config->output_types |=
 -                              BIT(encoder->compute_output_type(encoder, pipe_config,
 +                      crtc_state->output_types |=
 +                              BIT(encoder->compute_output_type(encoder, crtc_state,
                                                                 connector_state));
                else
 -                      pipe_config->output_types |= BIT(encoder->type);
 +                      crtc_state->output_types |= BIT(encoder->type);
        }
  
  encoder_retry:
        /* Ensure the port clock defaults are reset when retrying. */
 -      pipe_config->port_clock = 0;
 -      pipe_config->pixel_multiplier = 1;
 +      crtc_state->port_clock = 0;
 +      crtc_state->pixel_multiplier = 1;
  
        /* Fill in default crtc timings, allow encoders to overwrite them. */
 -      drm_mode_set_crtcinfo(&pipe_config->hw.adjusted_mode,
 +      drm_mode_set_crtcinfo(&crtc_state->hw.adjusted_mode,
                              CRTC_STEREO_DOUBLE);
  
        /* Pass our mode to the connectors and the CRTC to give them a chance to
                struct intel_encoder *encoder =
                        to_intel_encoder(connector_state->best_encoder);
  
 -              if (connector_state->crtc != crtc)
 +              if (connector_state->crtc != &crtc->base)
                        continue;
  
 -              ret = encoder->compute_config(encoder, pipe_config,
 +              ret = encoder->compute_config(encoder, crtc_state,
                                              connector_state);
                if (ret == -EDEADLK)
                        return ret;
                if (ret < 0) {
 -                      drm_dbg_kms(&i915->drm, "Encoder config failure: %d\n", ret);
 +                      drm_dbg_kms(&i915->drm, "[ENCODER:%d:%s] config failure: %d\n",
 +                                  encoder->base.base.id, encoder->base.name, ret);
                        return ret;
                }
        }
  
        /* Set default port clock if not overwritten by the encoder. Needs to be
         * done afterwards in case the encoder adjusts the mode. */
 -      if (!pipe_config->port_clock)
 -              pipe_config->port_clock = pipe_config->hw.adjusted_mode.crtc_clock
 -                      * pipe_config->pixel_multiplier;
 +      if (!crtc_state->port_clock)
 +              crtc_state->port_clock = crtc_state->hw.adjusted_mode.crtc_clock
 +                      * crtc_state->pixel_multiplier;
  
 -      ret = intel_crtc_compute_config(to_intel_crtc(crtc), pipe_config);
 +      ret = intel_crtc_compute_config(state, crtc);
        if (ret == -EDEADLK)
                return ret;
        if (ret == -EAGAIN) {
                if (drm_WARN(&i915->drm, !retry,
 -                           "loop in pipe configuration computation\n"))
 +                           "[CRTC:%d:%s] loop in pipe configuration computation\n",
 +                           crtc->base.base.id, crtc->base.name))
                        return -EINVAL;
  
 -              drm_dbg_kms(&i915->drm, "CRTC bw constrained, retrying\n");
 +              drm_dbg_kms(&i915->drm, "[CRTC:%d:%s] bw constrained, retrying\n",
 +                          crtc->base.base.id, crtc->base.name);
                retry = false;
                goto encoder_retry;
        }
        if (ret < 0) {
 -              drm_dbg_kms(&i915->drm, "CRTC config failure: %d\n", ret);
 +              drm_dbg_kms(&i915->drm, "[CRTC:%d:%s] config failure: %d\n",
 +                          crtc->base.base.id, crtc->base.name, ret);
                return ret;
        }
  
         * only enable it on 6bpc panels and when its not a compliance
         * test requesting 6bpc video pattern.
         */
 -      pipe_config->dither = (pipe_config->pipe_bpp == 6*3) &&
 -              !pipe_config->dither_force_disable;
 +      crtc_state->dither = (crtc_state->pipe_bpp == 6*3) &&
 +              !crtc_state->dither_force_disable;
        drm_dbg_kms(&i915->drm,
 -                  "hw max bpp: %i, pipe bpp: %i, dithering: %i\n",
 -                  base_bpp, pipe_config->pipe_bpp, pipe_config->dither);
 +                  "[CRTC:%d:%s] hw max bpp: %i, pipe bpp: %i, dithering: %i\n",
 +                  crtc->base.base.id, crtc->base.name,
 +                  base_bpp, crtc_state->pipe_bpp, crtc_state->dither);
  
        return 0;
  }
  
  static int
 -intel_modeset_pipe_config_late(struct intel_crtc_state *crtc_state)
 +intel_modeset_pipe_config_late(struct intel_atomic_state *state,
 +                             struct intel_crtc *crtc)
  {
 -      struct intel_atomic_state *state =
 -              to_intel_atomic_state(crtc_state->uapi.state);
 -      struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
 +      struct intel_crtc_state *crtc_state =
 +              intel_atomic_get_new_crtc_state(state, crtc);
        struct drm_connector_state *conn_state;
        struct drm_connector *connector;
        int i;
@@@ -5513,7 -5971,7 +5513,7 @@@ static bool fastboot_enabled(struct drm
        return false;
  }
  
 -static bool
 +bool
  intel_pipe_config_compare(const struct intel_crtc_state *current_config,
                          const struct intel_crtc_state *pipe_config,
                          bool fastset)
        } \
  } while (0)
  
 +#define PIPE_CONF_CHECK_TIMINGS(name) do { \
 +      PIPE_CONF_CHECK_I(name.crtc_hdisplay); \
 +      PIPE_CONF_CHECK_I(name.crtc_htotal); \
 +      PIPE_CONF_CHECK_I(name.crtc_hblank_start); \
 +      PIPE_CONF_CHECK_I(name.crtc_hblank_end); \
 +      PIPE_CONF_CHECK_I(name.crtc_hsync_start); \
 +      PIPE_CONF_CHECK_I(name.crtc_hsync_end); \
 +      PIPE_CONF_CHECK_I(name.crtc_vdisplay); \
 +      PIPE_CONF_CHECK_I(name.crtc_vtotal); \
 +      PIPE_CONF_CHECK_I(name.crtc_vblank_start); \
 +      PIPE_CONF_CHECK_I(name.crtc_vblank_end); \
 +      PIPE_CONF_CHECK_I(name.crtc_vsync_start); \
 +      PIPE_CONF_CHECK_I(name.crtc_vsync_end); \
 +} while (0)
 +
 +#define PIPE_CONF_CHECK_RECT(name) do { \
 +      PIPE_CONF_CHECK_I(name.x1); \
 +      PIPE_CONF_CHECK_I(name.x2); \
 +      PIPE_CONF_CHECK_I(name.y1); \
 +      PIPE_CONF_CHECK_I(name.y2); \
 +} while (0)
 +
  /* This is required for BDW+ where there is only one set of registers for
   * switching between high and low RR.
   * This macro can be used whenever a comparison has to be made between one
  #define PIPE_CONF_QUIRK(quirk) \
        ((current_config->quirks | pipe_config->quirks) & (quirk))
  
 +      PIPE_CONF_CHECK_I(hw.enable);
 +      PIPE_CONF_CHECK_I(hw.active);
 +
        PIPE_CONF_CHECK_I(cpu_transcoder);
 +      PIPE_CONF_CHECK_I(mst_master_transcoder);
  
        PIPE_CONF_CHECK_BOOL(has_pch_encoder);
        PIPE_CONF_CHECK_I(fdi_lanes);
        PIPE_CONF_CHECK_I(framestart_delay);
        PIPE_CONF_CHECK_I(msa_timing_delay);
  
 -      PIPE_CONF_CHECK_I(hw.pipe_mode.crtc_hdisplay);
 -      PIPE_CONF_CHECK_I(hw.pipe_mode.crtc_htotal);
 -      PIPE_CONF_CHECK_I(hw.pipe_mode.crtc_hblank_start);
 -      PIPE_CONF_CHECK_I(hw.pipe_mode.crtc_hblank_end);
 -      PIPE_CONF_CHECK_I(hw.pipe_mode.crtc_hsync_start);
 -      PIPE_CONF_CHECK_I(hw.pipe_mode.crtc_hsync_end);
 -
 -      PIPE_CONF_CHECK_I(hw.pipe_mode.crtc_vdisplay);
 -      PIPE_CONF_CHECK_I(hw.pipe_mode.crtc_vtotal);
 -      PIPE_CONF_CHECK_I(hw.pipe_mode.crtc_vblank_start);
 -      PIPE_CONF_CHECK_I(hw.pipe_mode.crtc_vblank_end);
 -      PIPE_CONF_CHECK_I(hw.pipe_mode.crtc_vsync_start);
 -      PIPE_CONF_CHECK_I(hw.pipe_mode.crtc_vsync_end);
 -
 -      PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_hdisplay);
 -      PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_htotal);
 -      PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_hblank_start);
 -      PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_hblank_end);
 -      PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_hsync_start);
 -      PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_hsync_end);
 -
 -      PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_vdisplay);
 -      PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_vtotal);
 -      PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_vblank_start);
 -      PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_vblank_end);
 -      PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_vsync_start);
 -      PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_vsync_end);
 +      PIPE_CONF_CHECK_TIMINGS(hw.pipe_mode);
 +      PIPE_CONF_CHECK_TIMINGS(hw.adjusted_mode);
  
        PIPE_CONF_CHECK_I(pixel_multiplier);
  
        PIPE_CONF_CHECK_BOOL(pch_pfit.force_thru);
  
        if (!fastset) {
 -              PIPE_CONF_CHECK_I(pipe_src.x1);
 -              PIPE_CONF_CHECK_I(pipe_src.y1);
 -              PIPE_CONF_CHECK_I(pipe_src.x2);
 -              PIPE_CONF_CHECK_I(pipe_src.y2);
 +              PIPE_CONF_CHECK_RECT(pipe_src);
  
                PIPE_CONF_CHECK_BOOL(pch_pfit.enabled);
 -              if (current_config->pch_pfit.enabled) {
 -                      PIPE_CONF_CHECK_I(pch_pfit.dst.x1);
 -                      PIPE_CONF_CHECK_I(pch_pfit.dst.y1);
 -                      PIPE_CONF_CHECK_I(pch_pfit.dst.x2);
 -                      PIPE_CONF_CHECK_I(pch_pfit.dst.y2);
 -              }
 +              PIPE_CONF_CHECK_RECT(pch_pfit.dst);
  
                PIPE_CONF_CHECK_I(scaler_state.scaler_id);
                PIPE_CONF_CHECK_CLOCK_FUZZY(pixel_rate);
        PIPE_CONF_CHECK_I(splitter.link_count);
        PIPE_CONF_CHECK_I(splitter.pixel_overlap);
  
 -      PIPE_CONF_CHECK_I(mst_master_transcoder);
 -
        PIPE_CONF_CHECK_BOOL(vrr.enable);
        PIPE_CONF_CHECK_I(vrr.vmin);
        PIPE_CONF_CHECK_I(vrr.vmax);
  #undef PIPE_CONF_CHECK_FLAGS
  #undef PIPE_CONF_CHECK_CLOCK_FUZZY
  #undef PIPE_CONF_CHECK_COLOR_LUT
 +#undef PIPE_CONF_CHECK_TIMINGS
 +#undef PIPE_CONF_CHECK_RECT
  #undef PIPE_CONF_QUIRK
  
        return ret;
  }
  
 -static void intel_pipe_config_sanity_check(struct drm_i915_private *dev_priv,
 -                                         const struct intel_crtc_state *pipe_config)
 -{
 -      if (pipe_config->has_pch_encoder) {
 -              int fdi_dotclock = intel_dotclock_calculate(intel_fdi_link_freq(dev_priv, pipe_config),
 -                                                          &pipe_config->fdi_m_n);
 -              int dotclock = pipe_config->hw.adjusted_mode.crtc_clock;
 -
 -              /*
 -               * FDI already provided one idea for the dotclock.
 -               * Yell if the encoder disagrees.
 -               */
 -              drm_WARN(&dev_priv->drm,
 -                       !intel_fuzzy_clock_check(fdi_dotclock, dotclock),
 -                       "FDI dotclock and encoder dotclock mismatch, fdi: %i, encoder: %i\n",
 -                       fdi_dotclock, dotclock);
 -      }
 -}
 -
 -static void verify_wm_state(struct intel_crtc *crtc,
 -                          struct intel_crtc_state *new_crtc_state)
 -{
 -      struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
 -      struct skl_hw_state {
 -              struct skl_ddb_entry ddb[I915_MAX_PLANES];
 -              struct skl_ddb_entry ddb_y[I915_MAX_PLANES];
 -              struct skl_pipe_wm wm;
 -      } *hw;
 -      const struct skl_pipe_wm *sw_wm = &new_crtc_state->wm.skl.optimal;
 -      int level, max_level = ilk_wm_max_level(dev_priv);
 -      struct intel_plane *plane;
 -      u8 hw_enabled_slices;
 -
 -      if (DISPLAY_VER(dev_priv) < 9 || !new_crtc_state->hw.active)
 -              return;
 -
 -      hw = kzalloc(sizeof(*hw), GFP_KERNEL);
 -      if (!hw)
 -              return;
 -
 -      skl_pipe_wm_get_hw_state(crtc, &hw->wm);
 -
 -      skl_pipe_ddb_get_hw_state(crtc, hw->ddb, hw->ddb_y);
 -
 -      hw_enabled_slices = intel_enabled_dbuf_slices_mask(dev_priv);
 -
 -      if (DISPLAY_VER(dev_priv) >= 11 &&
 -          hw_enabled_slices != dev_priv->dbuf.enabled_slices)
 -              drm_err(&dev_priv->drm,
 -                      "mismatch in DBUF Slices (expected 0x%x, got 0x%x)\n",
 -                      dev_priv->dbuf.enabled_slices,
 -                      hw_enabled_slices);
 -
 -      for_each_intel_plane_on_crtc(&dev_priv->drm, crtc, plane) {
 -              const struct skl_ddb_entry *hw_ddb_entry, *sw_ddb_entry;
 -              const struct skl_wm_level *hw_wm_level, *sw_wm_level;
 -
 -              /* Watermarks */
 -              for (level = 0; level <= max_level; level++) {
 -                      hw_wm_level = &hw->wm.planes[plane->id].wm[level];
 -                      sw_wm_level = skl_plane_wm_level(sw_wm, plane->id, level);
 -
 -                      if (skl_wm_level_equals(hw_wm_level, sw_wm_level))
 -                              continue;
 -
 -                      drm_err(&dev_priv->drm,
 -                              "[PLANE:%d:%s] mismatch in WM%d (expected e=%d b=%u l=%u, got e=%d b=%u l=%u)\n",
 -                              plane->base.base.id, plane->base.name, level,
 -                              sw_wm_level->enable,
 -                              sw_wm_level->blocks,
 -                              sw_wm_level->lines,
 -                              hw_wm_level->enable,
 -                              hw_wm_level->blocks,
 -                              hw_wm_level->lines);
 -              }
 -
 -              hw_wm_level = &hw->wm.planes[plane->id].trans_wm;
 -              sw_wm_level = skl_plane_trans_wm(sw_wm, plane->id);
 -
 -              if (!skl_wm_level_equals(hw_wm_level, sw_wm_level)) {
 -                      drm_err(&dev_priv->drm,
 -                              "[PLANE:%d:%s] mismatch in trans WM (expected e=%d b=%u l=%u, got e=%d b=%u l=%u)\n",
 -                              plane->base.base.id, plane->base.name,
 -                              sw_wm_level->enable,
 -                              sw_wm_level->blocks,
 -                              sw_wm_level->lines,
 -                              hw_wm_level->enable,
 -                              hw_wm_level->blocks,
 -                              hw_wm_level->lines);
 -              }
 -
 -              hw_wm_level = &hw->wm.planes[plane->id].sagv.wm0;
 -              sw_wm_level = &sw_wm->planes[plane->id].sagv.wm0;
 -
 -              if (HAS_HW_SAGV_WM(dev_priv) &&
 -                  !skl_wm_level_equals(hw_wm_level, sw_wm_level)) {
 -                      drm_err(&dev_priv->drm,
 -                              "[PLANE:%d:%s] mismatch in SAGV WM (expected e=%d b=%u l=%u, got e=%d b=%u l=%u)\n",
 -                              plane->base.base.id, plane->base.name,
 -                              sw_wm_level->enable,
 -                              sw_wm_level->blocks,
 -                              sw_wm_level->lines,
 -                              hw_wm_level->enable,
 -                              hw_wm_level->blocks,
 -                              hw_wm_level->lines);
 -              }
 -
 -              hw_wm_level = &hw->wm.planes[plane->id].sagv.trans_wm;
 -              sw_wm_level = &sw_wm->planes[plane->id].sagv.trans_wm;
 -
 -              if (HAS_HW_SAGV_WM(dev_priv) &&
 -                  !skl_wm_level_equals(hw_wm_level, sw_wm_level)) {
 -                      drm_err(&dev_priv->drm,
 -                              "[PLANE:%d:%s] mismatch in SAGV trans WM (expected e=%d b=%u l=%u, got e=%d b=%u l=%u)\n",
 -                              plane->base.base.id, plane->base.name,
 -                              sw_wm_level->enable,
 -                              sw_wm_level->blocks,
 -                              sw_wm_level->lines,
 -                              hw_wm_level->enable,
 -                              hw_wm_level->blocks,
 -                              hw_wm_level->lines);
 -              }
 -
 -              /* DDB */
 -              hw_ddb_entry = &hw->ddb[PLANE_CURSOR];
 -              sw_ddb_entry = &new_crtc_state->wm.skl.plane_ddb[PLANE_CURSOR];
 -
 -              if (!skl_ddb_entry_equal(hw_ddb_entry, sw_ddb_entry)) {
 -                      drm_err(&dev_priv->drm,
 -                              "[PLANE:%d:%s] mismatch in DDB (expected (%u,%u), found (%u,%u))\n",
 -                              plane->base.base.id, plane->base.name,
 -                              sw_ddb_entry->start, sw_ddb_entry->end,
 -                              hw_ddb_entry->start, hw_ddb_entry->end);
 -              }
 -      }
 -
 -      kfree(hw);
 -}
 -
 -static void
 -verify_connector_state(struct intel_atomic_state *state,
 -                     struct intel_crtc *crtc)
 -{
 -      struct drm_connector *connector;
 -      struct drm_connector_state *new_conn_state;
 -      int i;
 -
 -      for_each_new_connector_in_state(&state->base, connector, new_conn_state, i) {
 -              struct drm_encoder *encoder = connector->encoder;
 -              struct intel_crtc_state *crtc_state = NULL;
 -
 -              if (new_conn_state->crtc != &crtc->base)
 -                      continue;
 -
 -              if (crtc)
 -                      crtc_state = intel_atomic_get_new_crtc_state(state, crtc);
 -
 -              intel_connector_verify_state(crtc_state, new_conn_state);
 -
 -              I915_STATE_WARN(new_conn_state->best_encoder != encoder,
 -                   "connector's atomic encoder doesn't match legacy encoder\n");
 -      }
 -}
 -
 -static void
 -verify_encoder_state(struct drm_i915_private *dev_priv, struct intel_atomic_state *state)
 -{
 -      struct intel_encoder *encoder;
 -      struct drm_connector *connector;
 -      struct drm_connector_state *old_conn_state, *new_conn_state;
 -      int i;
 -
 -      for_each_intel_encoder(&dev_priv->drm, encoder) {
 -              bool enabled = false, found = false;
 -              enum pipe pipe;
 -
 -              drm_dbg_kms(&dev_priv->drm, "[ENCODER:%d:%s]\n",
 -                          encoder->base.base.id,
 -                          encoder->base.name);
 -
 -              for_each_oldnew_connector_in_state(&state->base, connector, old_conn_state,
 -                                                 new_conn_state, i) {
 -                      if (old_conn_state->best_encoder == &encoder->base)
 -                              found = true;
 -
 -                      if (new_conn_state->best_encoder != &encoder->base)
 -                              continue;
 -                      found = enabled = true;
 -
 -                      I915_STATE_WARN(new_conn_state->crtc !=
 -                                      encoder->base.crtc,
 -                           "connector's crtc doesn't match encoder crtc\n");
 -              }
 -
 -              if (!found)
 -                      continue;
 -
 -              I915_STATE_WARN(!!encoder->base.crtc != enabled,
 -                   "encoder's enabled state mismatch "
 -                   "(expected %i, found %i)\n",
 -                   !!encoder->base.crtc, enabled);
 -
 -              if (!encoder->base.crtc) {
 -                      bool active;
 -
 -                      active = encoder->get_hw_state(encoder, &pipe);
 -                      I915_STATE_WARN(active,
 -                           "encoder detached but still enabled on pipe %c.\n",
 -                           pipe_name(pipe));
 -              }
 -      }
 -}
 -
 -static void
 -verify_crtc_state(struct intel_crtc *crtc,
 -                struct intel_crtc_state *old_crtc_state,
 -                struct intel_crtc_state *new_crtc_state)
 -{
 -      struct drm_device *dev = crtc->base.dev;
 -      struct drm_i915_private *dev_priv = to_i915(dev);
 -      struct intel_encoder *encoder;
 -      struct intel_crtc_state *pipe_config = old_crtc_state;
 -      struct drm_atomic_state *state = old_crtc_state->uapi.state;
 -      struct intel_crtc *master_crtc;
 -
 -      __drm_atomic_helper_crtc_destroy_state(&old_crtc_state->uapi);
 -      intel_crtc_free_hw_state(old_crtc_state);
 -      intel_crtc_state_reset(old_crtc_state, crtc);
 -      old_crtc_state->uapi.state = state;
 -
 -      drm_dbg_kms(&dev_priv->drm, "[CRTC:%d:%s]\n", crtc->base.base.id,
 -                  crtc->base.name);
 -
 -      pipe_config->hw.enable = new_crtc_state->hw.enable;
 -
 -      intel_crtc_get_pipe_config(pipe_config);
 -
 -      /* we keep both pipes enabled on 830 */
 -      if (IS_I830(dev_priv) && pipe_config->hw.active)
 -              pipe_config->hw.active = new_crtc_state->hw.active;
 -
 -      I915_STATE_WARN(new_crtc_state->hw.active != pipe_config->hw.active,
 -                      "crtc active state doesn't match with hw state "
 -                      "(expected %i, found %i)\n",
 -                      new_crtc_state->hw.active, pipe_config->hw.active);
 -
 -      I915_STATE_WARN(crtc->active != new_crtc_state->hw.active,
 -                      "transitional active state does not match atomic hw state "
 -                      "(expected %i, found %i)\n",
 -                      new_crtc_state->hw.active, crtc->active);
 -
 -      master_crtc = intel_master_crtc(new_crtc_state);
 -
 -      for_each_encoder_on_crtc(dev, &master_crtc->base, encoder) {
 -              enum pipe pipe;
 -              bool active;
 -
 -              active = encoder->get_hw_state(encoder, &pipe);
 -              I915_STATE_WARN(active != new_crtc_state->hw.active,
 -                              "[ENCODER:%i] active %i with crtc active %i\n",
 -                              encoder->base.base.id, active,
 -                              new_crtc_state->hw.active);
 -
 -              I915_STATE_WARN(active && master_crtc->pipe != pipe,
 -                              "Encoder connected to wrong pipe %c\n",
 -                              pipe_name(pipe));
 -
 -              if (active)
 -                      intel_encoder_get_config(encoder, pipe_config);
 -      }
 -
 -      if (!new_crtc_state->hw.active)
 -              return;
 -
 -      intel_pipe_config_sanity_check(dev_priv, pipe_config);
 -
 -      if (!intel_pipe_config_compare(new_crtc_state,
 -                                     pipe_config, false)) {
 -              I915_STATE_WARN(1, "pipe state doesn't match!\n");
 -              intel_dump_pipe_config(pipe_config, NULL, "[hw state]");
 -              intel_dump_pipe_config(new_crtc_state, NULL, "[sw state]");
 -      }
 -}
 -
  static void
  intel_verify_planes(struct intel_atomic_state *state)
  {
                             plane_state->uapi.visible);
  }
  
 -static void
 -verify_single_dpll_state(struct drm_i915_private *dev_priv,
 -                       struct intel_shared_dpll *pll,
 -                       struct intel_crtc *crtc,
 -                       struct intel_crtc_state *new_crtc_state)
 -{
 -      struct intel_dpll_hw_state dpll_hw_state;
 -      u8 pipe_mask;
 -      bool active;
 -
 -      memset(&dpll_hw_state, 0, sizeof(dpll_hw_state));
 -
 -      drm_dbg_kms(&dev_priv->drm, "%s\n", pll->info->name);
 -
 -      active = intel_dpll_get_hw_state(dev_priv, pll, &dpll_hw_state);
 -
 -      if (!(pll->info->flags & INTEL_DPLL_ALWAYS_ON)) {
 -              I915_STATE_WARN(!pll->on && pll->active_mask,
 -                   "pll in active use but not on in sw tracking\n");
 -              I915_STATE_WARN(pll->on && !pll->active_mask,
 -                   "pll is on but not used by any active pipe\n");
 -              I915_STATE_WARN(pll->on != active,
 -                   "pll on state mismatch (expected %i, found %i)\n",
 -                   pll->on, active);
 -      }
 -
 -      if (!crtc) {
 -              I915_STATE_WARN(pll->active_mask & ~pll->state.pipe_mask,
 -                              "more active pll users than references: 0x%x vs 0x%x\n",
 -                              pll->active_mask, pll->state.pipe_mask);
 -
 -              return;
 -      }
 -
 -      pipe_mask = BIT(crtc->pipe);
 -
 -      if (new_crtc_state->hw.active)
 -              I915_STATE_WARN(!(pll->active_mask & pipe_mask),
 -                              "pll active mismatch (expected pipe %c in active mask 0x%x)\n",
 -                              pipe_name(crtc->pipe), pll->active_mask);
 -      else
 -              I915_STATE_WARN(pll->active_mask & pipe_mask,
 -                              "pll active mismatch (didn't expect pipe %c in active mask 0x%x)\n",
 -                              pipe_name(crtc->pipe), pll->active_mask);
 -
 -      I915_STATE_WARN(!(pll->state.pipe_mask & pipe_mask),
 -                      "pll enabled crtcs mismatch (expected 0x%x in 0x%x)\n",
 -                      pipe_mask, pll->state.pipe_mask);
 -
 -      I915_STATE_WARN(pll->on && memcmp(&pll->state.hw_state,
 -                                        &dpll_hw_state,
 -                                        sizeof(dpll_hw_state)),
 -                      "pll hw state mismatch\n");
 -}
 -
 -static void
 -verify_shared_dpll_state(struct intel_crtc *crtc,
 -                       struct intel_crtc_state *old_crtc_state,
 -                       struct intel_crtc_state *new_crtc_state)
 -{
 -      struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
 -
 -      if (new_crtc_state->shared_dpll)
 -              verify_single_dpll_state(dev_priv, new_crtc_state->shared_dpll, crtc, new_crtc_state);
 -
 -      if (old_crtc_state->shared_dpll &&
 -          old_crtc_state->shared_dpll != new_crtc_state->shared_dpll) {
 -              u8 pipe_mask = BIT(crtc->pipe);
 -              struct intel_shared_dpll *pll = old_crtc_state->shared_dpll;
 -
 -              I915_STATE_WARN(pll->active_mask & pipe_mask,
 -                              "pll active mismatch (didn't expect pipe %c in active mask (0x%x))\n",
 -                              pipe_name(crtc->pipe), pll->active_mask);
 -              I915_STATE_WARN(pll->state.pipe_mask & pipe_mask,
 -                              "pll enabled crtcs mismatch (found %x in enabled mask (0x%x))\n",
 -                              pipe_name(crtc->pipe), pll->state.pipe_mask);
 -      }
 -}
 -
 -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;
 -
 -      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,
 -                        struct intel_crtc_state *old_crtc_state,
 -                        struct intel_crtc_state *new_crtc_state)
 -{
 -      if (!intel_crtc_needs_modeset(new_crtc_state) && !new_crtc_state->update_pipe)
 -              return;
 -
 -      verify_wm_state(crtc, new_crtc_state);
 -      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
 -verify_disabled_dpll_state(struct drm_i915_private *dev_priv)
 -{
 -      int i;
 -
 -      for (i = 0; i < dev_priv->dpll.num_shared_dpll; i++)
 -              verify_single_dpll_state(dev_priv,
 -                                       &dev_priv->dpll.shared_dplls[i],
 -                                       NULL, NULL);
 -}
 -
 -static void
 -intel_modeset_verify_disabled(struct drm_i915_private *dev_priv,
 -                            struct intel_atomic_state *state)
 -{
 -      verify_encoder_state(dev_priv, state);
 -      verify_connector_state(state, NULL);
 -      verify_disabled_dpll_state(dev_priv);
 -}
 -
  int intel_modeset_all_pipes(struct intel_atomic_state *state)
  {
        struct drm_i915_private *dev_priv = to_i915(state->base.dev);
        return 0;
  }
  
 -static void
 -intel_crtc_update_active_timings(const struct intel_crtc_state *crtc_state)
 +void intel_crtc_update_active_timings(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);
@@@ -6822,7 -7733,7 +6822,7 @@@ static int intel_atomic_check(struct dr
                if (!new_crtc_state->hw.enable)
                        continue;
  
 -              ret = intel_modeset_pipe_config(state, new_crtc_state);
 +              ret = intel_modeset_pipe_config(state, crtc);
                if (ret)
                        goto fail;
  
                if (!intel_crtc_needs_modeset(new_crtc_state))
                        continue;
  
 -              ret = intel_modeset_pipe_config_late(new_crtc_state);
 +              ret = intel_modeset_pipe_config_late(state, crtc);
                if (ret)
                        goto fail;
  
                    !new_crtc_state->update_pipe)
                        continue;
  
 -              intel_dump_pipe_config(new_crtc_state, state,
 -                                     intel_crtc_needs_modeset(new_crtc_state) ?
 -                                     "[modeset]" : "[fastset]");
 +              intel_crtc_state_dump(new_crtc_state, state,
 +                                    intel_crtc_needs_modeset(new_crtc_state) ?
 +                                    "modeset" : "fastset");
        }
  
        return 0;
         */
        for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
                                            new_crtc_state, i)
 -              intel_dump_pipe_config(new_crtc_state, state, "[failed]");
 +              intel_crtc_state_dump(new_crtc_state, state, "failed");
  
        return ret;
  }
@@@ -7531,7 -8442,6 +7531,7 @@@ static void intel_atomic_commit_tail(st
        intel_atomic_commit_fence_wait(state);
  
        drm_atomic_helper_wait_for_dependencies(&state->base);
 +      drm_dp_mst_atomic_wait_for_dependencies(&state->base);
  
        if (state->modeset)
                wakeref = intel_display_power_get(dev_priv, POWER_DOMAIN_MODESET);
                                            new_crtc_state, i) {
                if (intel_crtc_needs_modeset(new_crtc_state) ||
                    new_crtc_state->update_pipe) {
 -                      modeset_get_crtc_power_domains(new_crtc_state, &put_domains[crtc->pipe]);
 +                      intel_modeset_get_crtc_power_domains(new_crtc_state, &put_domains[crtc->pipe]);
                }
        }
  
        for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
                intel_post_plane_update(state, crtc);
  
 -              modeset_put_crtc_power_domains(crtc, &put_domains[crtc->pipe]);
 +              intel_modeset_put_crtc_power_domains(crtc, &put_domains[crtc->pipe]);
  
                intel_modeset_verify_crtc(crtc, state, old_crtc_state, new_crtc_state);
  
        return ret;
  }
  
 +static const struct drm_mode_config_helper_funcs intel_mode_config_funcs = {
 +      .atomic_commit_setup = drm_dp_mst_atomic_setup_commit,
 +};
 +
  static void intel_mode_config_init(struct drm_i915_private *i915)
  {
        struct drm_mode_config *mode_config = &i915->drm.mode_config;
        mode_config->prefer_shadow = 1;
  
        mode_config->funcs = &intel_mode_funcs;
 +      mode_config->helper_private = &intel_mode_config_funcs;
  
        mode_config->async_page_flip = HAS_ASYNC_FLIPS(i915);
  
@@@ -8784,7 -9689,7 +8784,7 @@@ int intel_modeset_init_nogem(struct drm
        intel_setup_outputs(i915);
  
        drm_modeset_lock_all(dev);
 -      intel_modeset_setup_hw_state(dev, dev->mode_config.acquire_ctx);
 +      intel_modeset_setup_hw_state(i915, dev->mode_config.acquire_ctx);
        intel_acpi_assign_connector_fwnodes(i915);
        drm_modeset_unlock_all(dev);
  
@@@ -8937,17 -9842,580 +8937,17 @@@ void i830_disable_pipe(struct drm_i915_
        intel_de_posting_read(dev_priv, DPLL(pipe));
  }
  
 -static void
 -intel_sanitize_plane_mapping(struct drm_i915_private *dev_priv)
 -{
 -      struct intel_crtc *crtc;
 -
 -      if (DISPLAY_VER(dev_priv) >= 4)
 -              return;
 -
 -      for_each_intel_crtc(&dev_priv->drm, crtc) {
 -              struct intel_plane *plane =
 -                      to_intel_plane(crtc->base.primary);
 -              struct intel_crtc *plane_crtc;
 -              enum pipe pipe;
 -
 -              if (!plane->get_hw_state(plane, &pipe))
 -                      continue;
 -
 -              if (pipe == crtc->pipe)
 -                      continue;
 -
 -              drm_dbg_kms(&dev_priv->drm,
 -                          "[PLANE:%d:%s] attached to the wrong pipe, disabling plane\n",
 -                          plane->base.base.id, plane->base.name);
 -
 -              plane_crtc = intel_crtc_for_pipe(dev_priv, pipe);
 -              intel_plane_disable_noatomic(plane_crtc, plane);
 -      }
 -}
 -
 -static bool intel_crtc_has_encoders(struct intel_crtc *crtc)
 -{
 -      struct drm_device *dev = crtc->base.dev;
 -      struct intel_encoder *encoder;
 -
 -      for_each_encoder_on_crtc(dev, &crtc->base, encoder)
 -              return true;
 -
 -      return false;
 -}
 -
 -static struct intel_connector *intel_encoder_find_connector(struct intel_encoder *encoder)
 -{
 -      struct drm_device *dev = encoder->base.dev;
 -      struct intel_connector *connector;
 -
 -      for_each_connector_on_encoder(dev, &encoder->base, connector)
 -              return connector;
 -
 -      return NULL;
 -}
 -
 -static void intel_sanitize_crtc(struct intel_crtc *crtc,
 -                              struct drm_modeset_acquire_ctx *ctx)
 -{
 -      struct drm_device *dev = crtc->base.dev;
 -      struct drm_i915_private *dev_priv = to_i915(dev);
 -      struct intel_crtc_state *crtc_state = to_intel_crtc_state(crtc->base.state);
 -
 -      if (crtc_state->hw.active) {
 -              struct intel_plane *plane;
 -
 -              /* Disable everything but the primary plane */
 -              for_each_intel_plane_on_crtc(dev, crtc, plane) {
 -                      const struct intel_plane_state *plane_state =
 -                              to_intel_plane_state(plane->base.state);
 -
 -                      if (plane_state->uapi.visible &&
 -                          plane->base.type != DRM_PLANE_TYPE_PRIMARY)
 -                              intel_plane_disable_noatomic(crtc, plane);
 -              }
 -
 -              /* Disable any background color/etc. set by the BIOS */
 -              intel_color_commit_noarm(crtc_state);
 -              intel_color_commit_arm(crtc_state);
 -      }
 -
 -      /* Adjust the state of the output pipe according to whether we
 -       * have active connectors/encoders. */
 -      if (crtc_state->hw.active && !intel_crtc_has_encoders(crtc) &&
 -          !intel_crtc_is_bigjoiner_slave(crtc_state))
 -              intel_crtc_disable_noatomic(crtc, ctx);
 -
 -      if (crtc_state->hw.active || HAS_GMCH(dev_priv)) {
 -              /*
 -               * We start out with underrun reporting disabled to avoid races.
 -               * For correct bookkeeping mark this on active crtcs.
 -               *
 -               * Also on gmch platforms we dont have any hardware bits to
 -               * disable the underrun reporting. Which means we need to start
 -               * out with underrun reporting disabled also on inactive pipes,
 -               * since otherwise we'll complain about the garbage we read when
 -               * e.g. coming up after runtime pm.
 -               *
 -               * No protection against concurrent access is required - at
 -               * worst a fifo underrun happens which also sets this to false.
 -               */
 -              crtc->cpu_fifo_underrun_disabled = true;
 -              /*
 -               * We track the PCH trancoder underrun reporting state
 -               * within the crtc. With crtc for pipe A housing the underrun
 -               * reporting state for PCH transcoder A, crtc for pipe B housing
 -               * it for PCH transcoder B, etc. LPT-H has only PCH transcoder A,
 -               * and marking underrun reporting as disabled for the non-existing
 -               * PCH transcoders B and C would prevent enabling the south
 -               * error interrupt (see cpt_can_enable_serr_int()).
 -               */
 -              if (intel_has_pch_trancoder(dev_priv, crtc->pipe))
 -                      crtc->pch_fifo_underrun_disabled = true;
 -      }
 -}
 -
 -static bool has_bogus_dpll_config(const struct intel_crtc_state *crtc_state)
 -{
 -      struct drm_i915_private *dev_priv = to_i915(crtc_state->uapi.crtc->dev);
 -
 -      /*
 -       * Some SNB BIOSen (eg. ASUS K53SV) are known to misprogram
 -       * the hardware when a high res displays plugged in. DPLL P
 -       * divider is zero, and the pipe timings are bonkers. We'll
 -       * try to disable everything in that case.
 -       *
 -       * FIXME would be nice to be able to sanitize this state
 -       * without several WARNs, but for now let's take the easy
 -       * road.
 -       */
 -      return IS_SANDYBRIDGE(dev_priv) &&
 -              crtc_state->hw.active &&
 -              crtc_state->shared_dpll &&
 -              crtc_state->port_clock == 0;
 -}
 -
 -static void intel_sanitize_encoder(struct intel_encoder *encoder)
 -{
 -      struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 -      struct intel_connector *connector;
 -      struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc);
 -      struct intel_crtc_state *crtc_state = crtc ?
 -              to_intel_crtc_state(crtc->base.state) : NULL;
 -
 -      /* We need to check both for a crtc link (meaning that the
 -       * encoder is active and trying to read from a pipe) and the
 -       * pipe itself being active. */
 -      bool has_active_crtc = crtc_state &&
 -              crtc_state->hw.active;
 -
 -      if (crtc_state && has_bogus_dpll_config(crtc_state)) {
 -              drm_dbg_kms(&dev_priv->drm,
 -                          "BIOS has misprogrammed the hardware. Disabling pipe %c\n",
 -                          pipe_name(crtc->pipe));
 -              has_active_crtc = false;
 -      }
 -
 -      connector = intel_encoder_find_connector(encoder);
 -      if (connector && !has_active_crtc) {
 -              drm_dbg_kms(&dev_priv->drm,
 -                          "[ENCODER:%d:%s] has active connectors but no active pipe!\n",
 -                          encoder->base.base.id,
 -                          encoder->base.name);
 -
 -              /* Connector is active, but has no active pipe. This is
 -               * fallout from our resume register restoring. Disable
 -               * the encoder manually again. */
 -              if (crtc_state) {
 -                      struct drm_encoder *best_encoder;
 -
 -                      drm_dbg_kms(&dev_priv->drm,
 -                                  "[ENCODER:%d:%s] manually disabled\n",
 -                                  encoder->base.base.id,
 -                                  encoder->base.name);
 -
 -                      /* avoid oopsing in case the hooks consult best_encoder */
 -                      best_encoder = connector->base.state->best_encoder;
 -                      connector->base.state->best_encoder = &encoder->base;
 -
 -                      /* FIXME NULL atomic state passed! */
 -                      if (encoder->disable)
 -                              encoder->disable(NULL, encoder, crtc_state,
 -                                               connector->base.state);
 -                      if (encoder->post_disable)
 -                              encoder->post_disable(NULL, encoder, crtc_state,
 -                                                    connector->base.state);
 -
 -                      connector->base.state->best_encoder = best_encoder;
 -              }
 -              encoder->base.crtc = NULL;
 -
 -              /* Inconsistent output/port/pipe state happens presumably due to
 -               * a bug in one of the get_hw_state functions. Or someplace else
 -               * in our code, like the register restore mess on resume. Clamp
 -               * things to off as a safer default. */
 -
 -              connector->base.dpms = DRM_MODE_DPMS_OFF;
 -              connector->base.encoder = NULL;
 -      }
 -
 -      /* notify opregion of the sanitized encoder state */
 -      intel_opregion_notify_encoder(encoder, connector && has_active_crtc);
 -
 -      if (HAS_DDI(dev_priv))
 -              intel_ddi_sanitize_encoder_pll_mapping(encoder);
 -}
 -
 -/* FIXME read out full plane state for all planes */
 -static void readout_plane_state(struct drm_i915_private *dev_priv)
 -{
 -      struct intel_plane *plane;
 -      struct intel_crtc *crtc;
 -
 -      for_each_intel_plane(&dev_priv->drm, plane) {
 -              struct intel_plane_state *plane_state =
 -                      to_intel_plane_state(plane->base.state);
 -              struct intel_crtc_state *crtc_state;
 -              enum pipe pipe = PIPE_A;
 -              bool visible;
 -
 -              visible = plane->get_hw_state(plane, &pipe);
 -
 -              crtc = intel_crtc_for_pipe(dev_priv, pipe);
 -              crtc_state = to_intel_crtc_state(crtc->base.state);
 -
 -              intel_set_plane_visible(crtc_state, plane_state, visible);
 -
 -              drm_dbg_kms(&dev_priv->drm,
 -                          "[PLANE:%d:%s] hw state readout: %s, pipe %c\n",
 -                          plane->base.base.id, plane->base.name,
 -                          str_enabled_disabled(visible), pipe_name(pipe));
 -      }
 -
 -      for_each_intel_crtc(&dev_priv->drm, crtc) {
 -              struct intel_crtc_state *crtc_state =
 -                      to_intel_crtc_state(crtc->base.state);
 -
 -              fixup_plane_bitmasks(crtc_state);
 -      }
 -}
 -
 -static void intel_modeset_readout_hw_state(struct drm_device *dev)
 -{
 -      struct drm_i915_private *dev_priv = to_i915(dev);
 -      struct intel_cdclk_state *cdclk_state =
 -              to_intel_cdclk_state(dev_priv->cdclk.obj.state);
 -      struct intel_dbuf_state *dbuf_state =
 -              to_intel_dbuf_state(dev_priv->dbuf.obj.state);
 -      enum pipe pipe;
 -      struct intel_crtc *crtc;
 -      struct intel_encoder *encoder;
 -      struct intel_connector *connector;
 -      struct drm_connector_list_iter conn_iter;
 -      u8 active_pipes = 0;
 -
 -      for_each_intel_crtc(dev, crtc) {
 -              struct intel_crtc_state *crtc_state =
 -                      to_intel_crtc_state(crtc->base.state);
 -
 -              __drm_atomic_helper_crtc_destroy_state(&crtc_state->uapi);
 -              intel_crtc_free_hw_state(crtc_state);
 -              intel_crtc_state_reset(crtc_state, crtc);
 -
 -              intel_crtc_get_pipe_config(crtc_state);
 -
 -              crtc_state->hw.enable = crtc_state->hw.active;
 -
 -              crtc->base.enabled = crtc_state->hw.enable;
 -              crtc->active = crtc_state->hw.active;
 -
 -              if (crtc_state->hw.active)
 -                      active_pipes |= BIT(crtc->pipe);
 -
 -              drm_dbg_kms(&dev_priv->drm,
 -                          "[CRTC:%d:%s] hw state readout: %s\n",
 -                          crtc->base.base.id, crtc->base.name,
 -                          str_enabled_disabled(crtc_state->hw.active));
 -      }
 -
 -      cdclk_state->active_pipes = dbuf_state->active_pipes = active_pipes;
 -
 -      readout_plane_state(dev_priv);
 -
 -      for_each_intel_encoder(dev, encoder) {
 -              struct intel_crtc_state *crtc_state = NULL;
 -
 -              pipe = 0;
 -
 -              if (encoder->get_hw_state(encoder, &pipe)) {
 -                      crtc = intel_crtc_for_pipe(dev_priv, pipe);
 -                      crtc_state = to_intel_crtc_state(crtc->base.state);
 -
 -                      encoder->base.crtc = &crtc->base;
 -                      intel_encoder_get_config(encoder, crtc_state);
 -
 -                      /* read out to slave crtc as well for bigjoiner */
 -                      if (crtc_state->bigjoiner_pipes) {
 -                              struct intel_crtc *slave_crtc;
 -
 -                              /* encoder should read be linked to bigjoiner master */
 -                              WARN_ON(intel_crtc_is_bigjoiner_slave(crtc_state));
 -
 -                              for_each_intel_crtc_in_pipe_mask(&dev_priv->drm, slave_crtc,
 -                                                               intel_crtc_bigjoiner_slave_pipes(crtc_state)) {
 -                                      struct intel_crtc_state *slave_crtc_state;
 -
 -                                      slave_crtc_state = to_intel_crtc_state(slave_crtc->base.state);
 -                                      intel_encoder_get_config(encoder, slave_crtc_state);
 -                              }
 -                      }
 -              } else {
 -                      encoder->base.crtc = NULL;
 -              }
 -
 -              if (encoder->sync_state)
 -                      encoder->sync_state(encoder, crtc_state);
 -
 -              drm_dbg_kms(&dev_priv->drm,
 -                          "[ENCODER:%d:%s] hw state readout: %s, pipe %c\n",
 -                          encoder->base.base.id, encoder->base.name,
 -                          str_enabled_disabled(encoder->base.crtc),
 -                          pipe_name(pipe));
 -      }
 -
 -      intel_dpll_readout_hw_state(dev_priv);
 -
 -      drm_connector_list_iter_begin(dev, &conn_iter);
 -      for_each_intel_connector_iter(connector, &conn_iter) {
 -              if (connector->get_hw_state(connector)) {
 -                      struct intel_crtc_state *crtc_state;
 -                      struct intel_crtc *crtc;
 -
 -                      connector->base.dpms = DRM_MODE_DPMS_ON;
 -
 -                      encoder = intel_attached_encoder(connector);
 -                      connector->base.encoder = &encoder->base;
 -
 -                      crtc = to_intel_crtc(encoder->base.crtc);
 -                      crtc_state = crtc ? to_intel_crtc_state(crtc->base.state) : NULL;
 -
 -                      if (crtc_state && crtc_state->hw.active) {
 -                              /*
 -                               * This has to be done during hardware readout
 -                               * because anything calling .crtc_disable may
 -                               * rely on the connector_mask being accurate.
 -                               */
 -                              crtc_state->uapi.connector_mask |=
 -                                      drm_connector_mask(&connector->base);
 -                              crtc_state->uapi.encoder_mask |=
 -                                      drm_encoder_mask(&encoder->base);
 -                      }
 -              } else {
 -                      connector->base.dpms = DRM_MODE_DPMS_OFF;
 -                      connector->base.encoder = NULL;
 -              }
 -              drm_dbg_kms(&dev_priv->drm,
 -                          "[CONNECTOR:%d:%s] hw state readout: %s\n",
 -                          connector->base.base.id, connector->base.name,
 -                          str_enabled_disabled(connector->base.encoder));
 -      }
 -      drm_connector_list_iter_end(&conn_iter);
 -
 -      for_each_intel_crtc(dev, crtc) {
 -              struct intel_bw_state *bw_state =
 -                      to_intel_bw_state(dev_priv->bw_obj.state);
 -              struct intel_crtc_state *crtc_state =
 -                      to_intel_crtc_state(crtc->base.state);
 -              struct intel_plane *plane;
 -              int min_cdclk = 0;
 -
 -              if (crtc_state->hw.active) {
 -                      /*
 -                       * The initial mode needs to be set in order to keep
 -                       * the atomic core happy. It wants a valid mode if the
 -                       * crtc's enabled, so we do the above call.
 -                       *
 -                       * But we don't set all the derived state fully, hence
 -                       * set a flag to indicate that a full recalculation is
 -                       * needed on the next commit.
 -                       */
 -                      crtc_state->inherited = true;
 -
 -                      intel_crtc_update_active_timings(crtc_state);
 -
 -                      intel_crtc_copy_hw_to_uapi_state(crtc_state);
 -              }
 -
 -              for_each_intel_plane_on_crtc(&dev_priv->drm, crtc, plane) {
 -                      const struct intel_plane_state *plane_state =
 -                              to_intel_plane_state(plane->base.state);
 -
 -                      /*
 -                       * FIXME don't have the fb yet, so can't
 -                       * use intel_plane_data_rate() :(
 -                       */
 -                      if (plane_state->uapi.visible)
 -                              crtc_state->data_rate[plane->id] =
 -                                      4 * crtc_state->pixel_rate;
 -                      /*
 -                       * FIXME don't have the fb yet, so can't
 -                       * use plane->min_cdclk() :(
 -                       */
 -                      if (plane_state->uapi.visible && plane->min_cdclk) {
 -                              if (crtc_state->double_wide || DISPLAY_VER(dev_priv) >= 10)
 -                                      crtc_state->min_cdclk[plane->id] =
 -                                              DIV_ROUND_UP(crtc_state->pixel_rate, 2);
 -                              else
 -                                      crtc_state->min_cdclk[plane->id] =
 -                                              crtc_state->pixel_rate;
 -                      }
 -                      drm_dbg_kms(&dev_priv->drm,
 -                                  "[PLANE:%d:%s] min_cdclk %d kHz\n",
 -                                  plane->base.base.id, plane->base.name,
 -                                  crtc_state->min_cdclk[plane->id]);
 -              }
 -
 -              if (crtc_state->hw.active) {
 -                      min_cdclk = intel_crtc_compute_min_cdclk(crtc_state);
 -                      if (drm_WARN_ON(dev, min_cdclk < 0))
 -                              min_cdclk = 0;
 -              }
 -
 -              cdclk_state->min_cdclk[crtc->pipe] = min_cdclk;
 -              cdclk_state->min_voltage_level[crtc->pipe] =
 -                      crtc_state->min_voltage_level;
 -
 -              intel_bw_crtc_update(bw_state, crtc_state);
 -
 -              intel_pipe_config_sanity_check(dev_priv, crtc_state);
 -      }
 -}
 -
 -static void
 -get_encoder_power_domains(struct drm_i915_private *dev_priv)
 -{
 -      struct intel_encoder *encoder;
 -
 -      for_each_intel_encoder(&dev_priv->drm, encoder) {
 -              struct intel_crtc_state *crtc_state;
 -
 -              if (!encoder->get_power_domains)
 -                      continue;
 -
 -              /*
 -               * MST-primary and inactive encoders don't have a crtc state
 -               * and neither of these require any power domain references.
 -               */
 -              if (!encoder->base.crtc)
 -                      continue;
 -
 -              crtc_state = to_intel_crtc_state(encoder->base.crtc->state);
 -              encoder->get_power_domains(encoder, crtc_state);
 -      }
 -}
 -
 -static void intel_early_display_was(struct drm_i915_private *dev_priv)
 -{
 -      /*
 -       * Display WA #1185 WaDisableDARBFClkGating:glk,icl,ehl,tgl
 -       * Also known as Wa_14010480278.
 -       */
 -      if (IS_DISPLAY_VER(dev_priv, 10, 12))
 -              intel_de_write(dev_priv, GEN9_CLKGATE_DIS_0,
 -                             intel_de_read(dev_priv, GEN9_CLKGATE_DIS_0) | DARBF_GATING_DIS);
 -
 -      if (IS_HASWELL(dev_priv)) {
 -              /*
 -               * WaRsPkgCStateDisplayPMReq:hsw
 -               * System hang if this isn't done before disabling all planes!
 -               */
 -              intel_de_write(dev_priv, CHICKEN_PAR1_1,
 -                             intel_de_read(dev_priv, CHICKEN_PAR1_1) | FORCE_ARB_IDLE_PLANES);
 -      }
 -
 -      if (IS_KABYLAKE(dev_priv) || IS_COFFEELAKE(dev_priv) || IS_COMETLAKE(dev_priv)) {
 -              /* Display WA #1142:kbl,cfl,cml */
 -              intel_de_rmw(dev_priv, CHICKEN_PAR1_1,
 -                           KBL_ARB_FILL_SPARE_22, KBL_ARB_FILL_SPARE_22);
 -              intel_de_rmw(dev_priv, CHICKEN_MISC_2,
 -                           KBL_ARB_FILL_SPARE_13 | KBL_ARB_FILL_SPARE_14,
 -                           KBL_ARB_FILL_SPARE_14);
 -      }
 -}
 -
 -
 -/* Scan out the current hw modeset state,
 - * and sanitizes it to the current state
 - */
 -static void
 -intel_modeset_setup_hw_state(struct drm_device *dev,
 -                           struct drm_modeset_acquire_ctx *ctx)
 -{
 -      struct drm_i915_private *dev_priv = to_i915(dev);
 -      struct intel_encoder *encoder;
 -      struct intel_crtc *crtc;
 -      intel_wakeref_t wakeref;
 -
 -      wakeref = intel_display_power_get(dev_priv, POWER_DOMAIN_INIT);
 -
 -      intel_early_display_was(dev_priv);
 -      intel_modeset_readout_hw_state(dev);
 -
 -      /* HW state is read out, now we need to sanitize this mess. */
 -      get_encoder_power_domains(dev_priv);
 -
 -      intel_pch_sanitize(dev_priv);
 -
 -      /*
 -       * intel_sanitize_plane_mapping() may need to do vblank
 -       * waits, so we need vblank interrupts restored beforehand.
 -       */
 -      for_each_intel_crtc(&dev_priv->drm, crtc) {
 -              struct intel_crtc_state *crtc_state =
 -                      to_intel_crtc_state(crtc->base.state);
 -
 -              drm_crtc_vblank_reset(&crtc->base);
 -
 -              if (crtc_state->hw.active)
 -                      intel_crtc_vblank_on(crtc_state);
 -      }
 -
 -      intel_fbc_sanitize(dev_priv);
 -
 -      intel_sanitize_plane_mapping(dev_priv);
 -
 -      for_each_intel_encoder(dev, encoder)
 -              intel_sanitize_encoder(encoder);
 -
 -      for_each_intel_crtc(&dev_priv->drm, crtc) {
 -              struct intel_crtc_state *crtc_state =
 -                      to_intel_crtc_state(crtc->base.state);
 -
 -              intel_sanitize_crtc(crtc, ctx);
 -              intel_dump_pipe_config(crtc_state, NULL, "[setup_hw_state]");
 -      }
 -
 -      intel_modeset_update_connector_atomic_state(dev);
 -
 -      intel_dpll_sanitize_state(dev_priv);
 -
 -      if (IS_G4X(dev_priv)) {
 -              g4x_wm_get_hw_state(dev_priv);
 -              g4x_wm_sanitize(dev_priv);
 -      } else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) {
 -              vlv_wm_get_hw_state(dev_priv);
 -              vlv_wm_sanitize(dev_priv);
 -      } else if (DISPLAY_VER(dev_priv) >= 9) {
 -              skl_wm_get_hw_state(dev_priv);
 -              skl_wm_sanitize(dev_priv);
 -      } else if (HAS_PCH_SPLIT(dev_priv)) {
 -              ilk_wm_get_hw_state(dev_priv);
 -      }
 -
 -      for_each_intel_crtc(dev, crtc) {
 -              struct intel_crtc_state *crtc_state =
 -                      to_intel_crtc_state(crtc->base.state);
 -              struct intel_power_domain_mask put_domains;
 -
 -              modeset_get_crtc_power_domains(crtc_state, &put_domains);
 -              if (drm_WARN_ON(dev, !bitmap_empty(put_domains.bits, POWER_DOMAIN_NUM)))
 -                      modeset_put_crtc_power_domains(crtc, &put_domains);
 -      }
 -
 -      intel_display_power_put(dev_priv, POWER_DOMAIN_INIT, wakeref);
 -
 -      intel_power_domains_sanitize_state(dev_priv);
 -}
 -
  void intel_display_resume(struct drm_device *dev)
  {
 -      struct drm_i915_private *dev_priv = to_i915(dev);
 -      struct drm_atomic_state *state = dev_priv->modeset_restore_state;
 +      struct drm_i915_private *i915 = to_i915(dev);
 +      struct drm_atomic_state *state = i915->modeset_restore_state;
        struct drm_modeset_acquire_ctx ctx;
        int ret;
  
 -      if (!HAS_DISPLAY(dev_priv))
 +      if (!HAS_DISPLAY(i915))
                return;
  
 -      dev_priv->modeset_restore_state = NULL;
 +      i915->modeset_restore_state = NULL;
        if (state)
                state->acquire_ctx = &ctx;
  
        }
  
        if (!ret)
 -              ret = __intel_display_resume(dev, state, &ctx);
 +              ret = __intel_display_resume(i915, state, &ctx);
  
 -      intel_enable_ipc(dev_priv);
 +      intel_enable_ipc(i915);
        drm_modeset_drop_locks(&ctx);
        drm_modeset_acquire_fini(&ctx);
  
        if (ret)
 -              drm_err(&dev_priv->drm,
 +              drm_err(&i915->drm,
                        "Restoring old state failed with %i\n", ret);
        if (state)
                drm_atomic_state_put(state);
index fa537103623951fc92456bc2469f7968db498de1,e1daa7df3e58b4a7585b5eb17928bed044d7f8fd..cef251025d7a3b6098f66be74a1cd444b492c212
@@@ -45,7 -45,7 +45,7 @@@ struct drm_modeset_acquire_ctx
  struct drm_plane;
  struct drm_plane_state;
  struct i915_address_space;
- struct i915_ggtt_view;
+ struct i915_gtt_view;
  struct intel_atomic_state;
  struct intel_crtc;
  struct intel_crtc_state;
@@@ -56,7 -56,6 +56,7 @@@ struct intel_initial_plane_config
  struct intel_load_detect_pipe;
  struct intel_plane;
  struct intel_plane_state;
 +struct intel_power_domain_mask;
  struct intel_remapped_info;
  struct intel_rotation_info;
  struct pci_dev;
@@@ -193,7 -192,7 +193,7 @@@ enum plane_id 
  
  #define for_each_dbuf_slice(__dev_priv, __slice) \
        for ((__slice) = DBUF_S1; (__slice) < I915_MAX_DBUF_SLICES; (__slice)++) \
 -              for_each_if(INTEL_INFO(__dev_priv)->dbuf.slice_mask & BIT(__slice))
 +              for_each_if(INTEL_INFO(__dev_priv)->display.dbuf.slice_mask & BIT(__slice))
  
  #define for_each_dbuf_slice_in_mask(__dev_priv, __slice, __mask) \
        for_each_dbuf_slice((__dev_priv), (__slice)) \
@@@ -560,15 -559,8 +560,15 @@@ bool intel_crtc_is_bigjoiner_slave(cons
  bool intel_crtc_is_bigjoiner_master(const struct intel_crtc_state *crtc_state);
  u8 intel_crtc_bigjoiner_slave_pipes(const struct intel_crtc_state *crtc_state);
  struct intel_crtc *intel_master_crtc(const struct intel_crtc_state *crtc_state);
 +bool intel_crtc_get_pipe_config(struct intel_crtc_state *crtc_state);
 +bool intel_pipe_config_compare(const struct intel_crtc_state *current_config,
 +                             const struct intel_crtc_state *pipe_config,
 +                             bool fastset);
 +void intel_crtc_update_active_timings(const struct intel_crtc_state *crtc_state);
  
  void intel_plane_destroy(struct drm_plane *plane);
 +void i9xx_set_pipeconf(const struct intel_crtc_state *crtc_state);
 +void ilk_set_pipeconf(const struct intel_crtc_state *crtc_state);
  void intel_enable_transcoder(const struct intel_crtc_state *new_crtc_state);
  void intel_disable_transcoder(const struct intel_crtc_state *old_crtc_state);
  void i830_enable_pipe(struct drm_i915_private *dev_priv, enum pipe pipe);
@@@ -591,8 -583,6 +591,8 @@@ int intel_display_suspend(struct drm_de
  void intel_encoder_destroy(struct drm_encoder *encoder);
  struct drm_display_mode *
  intel_encoder_current_mode(struct intel_encoder *encoder);
 +void intel_encoder_get_config(struct intel_encoder *encoder,
 +                            struct intel_crtc_state *crtc_state);
  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);
  bool intel_phy_is_snps(struct drm_i915_private *dev_priv, enum phy phy);
@@@ -645,7 -635,6 +645,7 @@@ void intel_cpu_transcoder_get_m2_n2(str
  void i9xx_crtc_clock_get(struct intel_crtc *crtc,
                         struct intel_crtc_state *pipe_config);
  int intel_dotclock_calculate(int link_freq, const struct intel_link_m_n *m_n);
 +int intel_crtc_dotclock(const struct intel_crtc_state *pipe_config);
  enum intel_display_power_domain intel_port_to_power_domain(struct intel_digital_port *dig_port);
  enum intel_display_power_domain
  intel_aux_power_domain(struct intel_digital_port *dig_port);
@@@ -663,16 -652,10 +663,16 @@@ intel_get_crtc_new_encoder(const struc
                           const struct intel_crtc_state *crtc_state);
  void intel_plane_disable_noatomic(struct intel_crtc *crtc,
                                  struct intel_plane *plane);
 +void intel_set_plane_visible(struct intel_crtc_state *crtc_state,
 +                           struct intel_plane_state *plane_state,
 +                           bool visible);
 +void intel_plane_fixup_bitmasks(struct intel_crtc_state *crtc_state);
  
  void intel_display_driver_register(struct drm_i915_private *i915);
  void intel_display_driver_unregister(struct drm_i915_private *i915);
  
 +void intel_update_watermarks(struct drm_i915_private *i915);
 +
  /* modesetting */
  bool intel_modeset_probe_defer(struct pci_dev *pdev);
  void intel_modeset_init_hw(struct drm_i915_private *i915);
@@@ -684,10 -667,6 +684,10 @@@ void intel_modeset_driver_remove_noirq(
  void intel_modeset_driver_remove_nogem(struct drm_i915_private *i915);
  void intel_display_resume(struct drm_device *dev);
  int intel_modeset_all_pipes(struct intel_atomic_state *state);
 +void intel_modeset_get_crtc_power_domains(struct intel_crtc_state *crtc_state,
 +                                        struct intel_power_domain_mask *old_domains);
 +void intel_modeset_put_crtc_power_domains(struct intel_crtc *crtc,
 +                                        struct intel_power_domain_mask *domains);
  
  /* modesetting asserts */
  void assert_transcoder(struct drm_i915_private *dev_priv,
index 0da9b208d56e8b4d7449a936fe1e3e4b78279ada,e7da4a154c0636f87f9f1a5765b823bff06f6d1b..01977cd237eb0a306707edb06e17360e80494406
  #include <linux/pwm.h>
  #include <linux/sched/clock.h>
  
 -#include <drm/dp/drm_dp_dual_mode_helper.h>
 -#include <drm/dp/drm_dp_mst_helper.h>
 +#include <drm/display/drm_dp_dual_mode_helper.h>
 +#include <drm/display/drm_dp_mst_helper.h>
 +#include <drm/display/drm_dsc.h>
  #include <drm/drm_atomic.h>
  #include <drm/drm_crtc.h>
 -#include <drm/drm_dsc.h>
  #include <drm/drm_encoder.h>
  #include <drm/drm_fourcc.h>
 +#include <drm/drm_framebuffer.h>
  #include <drm/drm_probe_helper.h>
  #include <drm/drm_rect.h>
  #include <drm/drm_vblank.h>
@@@ -105,7 -104,7 +105,7 @@@ struct intel_fb_view 
         * In the normal view the FB object's backing store sg list is used
         * directly and hence the remap information here is not used.
         */
-       struct i915_ggtt_view gtt;
+       struct i915_gtt_view gtt;
  
        /*
         * The GTT view (gtt.type) specific information for each FB color
@@@ -280,76 -279,6 +280,76 @@@ struct intel_panel_bl_funcs 
        u32 (*hz_to_pwm)(struct intel_connector *connector, u32 hz);
  };
  
 +enum drrs_type {
 +      DRRS_TYPE_NONE,
 +      DRRS_TYPE_STATIC,
 +      DRRS_TYPE_SEAMLESS,
 +};
 +
 +struct intel_vbt_panel_data {
 +      struct drm_display_mode *lfp_lvds_vbt_mode; /* if any */
 +      struct drm_display_mode *sdvo_lvds_vbt_mode; /* if any */
 +
 +      /* Feature bits */
 +      unsigned int panel_type:4;
 +      unsigned int lvds_dither:1;
 +      unsigned int bios_lvds_val; /* initial [PCH_]LVDS reg val in VBIOS */
 +
 +      bool vrr;
 +
 +      u8 seamless_drrs_min_refresh_rate;
 +      enum drrs_type drrs_type;
 +
 +      struct {
 +              int max_link_rate;
 +              int rate;
 +              int lanes;
 +              int preemphasis;
 +              int vswing;
 +              int bpp;
 +              struct edp_power_seq pps;
 +              u8 drrs_msa_timing_delay;
 +              bool low_vswing;
 +              bool initialized;
 +              bool hobl;
 +      } edp;
 +
 +      struct {
 +              bool enable;
 +              bool full_link;
 +              bool require_aux_wakeup;
 +              int idle_frames;
 +              int tp1_wakeup_time_us;
 +              int tp2_tp3_wakeup_time_us;
 +              int psr2_tp2_tp3_wakeup_time_us;
 +      } psr;
 +
 +      struct {
 +              u16 pwm_freq_hz;
 +              u16 brightness_precision_bits;
 +              bool present;
 +              bool active_low_pwm;
 +              u8 min_brightness;      /* min_brightness/255 of max */
 +              u8 controller;          /* brightness controller number */
 +              enum intel_backlight_type type;
 +      } backlight;
 +
 +      /* MIPI DSI */
 +      struct {
 +              u16 panel_id;
 +              struct mipi_config *config;
 +              struct mipi_pps_data *pps;
 +              u16 bl_ports;
 +              u16 cabc_ports;
 +              u8 seq_version;
 +              u32 size;
 +              u8 *data;
 +              const u8 *sequence[MIPI_SEQ_MAX];
 +              u8 *deassert_seq; /* Used by fixup_mipi_sequences() */
 +              enum drm_panel_orientation orientation;
 +      } dsi;
 +};
 +
  struct intel_panel {
        struct list_head fixed_modes;
  
                const struct intel_panel_bl_funcs *pwm_funcs;
                void (*power)(struct intel_connector *, bool enable);
        } backlight;
 +
 +      struct intel_vbt_panel_data vbt;
  };
  
  struct intel_digital_port;
@@@ -1547,7 -1474,6 +1547,7 @@@ struct intel_pps 
        int backlight_off_delay;
        struct delayed_work panel_vdd_work;
        bool want_panel_vdd;
 +      bool initializing;
        unsigned long last_power_on;
        unsigned long last_backlight_off;
        ktime_t panel_power_off_time;
         */
        bool pps_reset;
        struct edp_power_seq pps_delays;
 +      struct edp_power_seq bios_pps_delays;
  };
  
  struct intel_psr {
@@@ -1802,14 -1727,13 +1802,14 @@@ static inline enum dpio_channe
  vlv_dig_port_to_channel(struct intel_digital_port *dig_port)
  {
        switch (dig_port->base.port) {
 +      default:
 +              MISSING_CASE(dig_port->base.port);
 +              fallthrough;
        case PORT_B:
        case PORT_D:
                return DPIO_CH0;
        case PORT_C:
                return DPIO_CH1;
 -      default:
 -              BUG();
        }
  }
  
@@@ -1817,14 -1741,13 +1817,14 @@@ static inline enum dpio_ph
  vlv_dig_port_to_phy(struct intel_digital_port *dig_port)
  {
        switch (dig_port->base.port) {
 +      default:
 +              MISSING_CASE(dig_port->base.port);
 +              fallthrough;
        case PORT_B:
        case PORT_C:
                return DPIO_PHY0;
        case PORT_D:
                return DPIO_PHY1;
 -      default:
 -              BUG();
        }
  }
  
@@@ -1832,14 -1755,13 +1832,14 @@@ static inline enum dpio_channe
  vlv_pipe_to_channel(enum pipe pipe)
  {
        switch (pipe) {
 +      default:
 +              MISSING_CASE(pipe);
 +              fallthrough;
        case PIPE_A:
        case PIPE_C:
                return DPIO_CH0;
        case PIPE_B:
                return DPIO_CH1;
 -      default:
 -              BUG();
        }
  }
  
index b191915ab351f7e7010ae79c5b7e30f7e3c976c8,ff69e5510a1381c228b29c385cf713256bd45136..eefa33c555acad61a958f2b6ee3e0fc327690510
@@@ -3,7 -3,6 +3,7 @@@
   * Copyright Â© 2021 Intel Corporation
   */
  
 +#include <drm/drm_blend.h>
  #include <drm/drm_framebuffer.h>
  #include <drm/drm_modeset_helper.h>
  
@@@ -1395,7 -1394,7 +1395,7 @@@ static u32 calc_plane_remap_info(const 
                               plane_view_height_tiles(fb, color_plane, dims, y));
        }
  
-       if (view->gtt.type == I915_GGTT_VIEW_ROTATED) {
+       if (view->gtt.type == I915_GTT_VIEW_ROTATED) {
                drm_WARN_ON(&i915->drm, remap_info->linear);
                check_array_bounds(i915, view->gtt.rotated.plane, color_plane);
  
                /* rotate the tile dimensions to match the GTT view */
                swap(tile_width, tile_height);
        } else {
-               drm_WARN_ON(&i915->drm, view->gtt.type != I915_GGTT_VIEW_REMAPPED);
+               drm_WARN_ON(&i915->drm, view->gtt.type != I915_GTT_VIEW_REMAPPED);
  
                check_array_bounds(i915, view->gtt.remapped.plane, color_plane);
  
@@@ -1503,12 -1502,12 +1503,12 @@@ calc_plane_normal_size(const struct int
  }
  
  static void intel_fb_view_init(struct drm_i915_private *i915, struct intel_fb_view *view,
-                              enum i915_ggtt_view_type view_type)
+                              enum i915_gtt_view_type view_type)
  {
        memset(view, 0, sizeof(*view));
        view->gtt.type = view_type;
  
-       if (view_type == I915_GGTT_VIEW_REMAPPED && IS_ALDERLAKE_P(i915))
+       if (view_type == I915_GTT_VIEW_REMAPPED && IS_ALDERLAKE_P(i915))
                view->gtt.remapped.plane_alignment = SZ_2M / PAGE_SIZE;
  }
  
@@@ -1530,16 -1529,16 +1530,16 @@@ int intel_fill_fb_info(struct drm_i915_
        int i, num_planes = fb->base.format->num_planes;
        unsigned int tile_size = intel_tile_size(i915);
  
-       intel_fb_view_init(i915, &fb->normal_view, I915_GGTT_VIEW_NORMAL);
+       intel_fb_view_init(i915, &fb->normal_view, I915_GTT_VIEW_NORMAL);
  
        drm_WARN_ON(&i915->drm,
                    intel_fb_supports_90_270_rotation(fb) &&
                    intel_fb_needs_pot_stride_remap(fb));
  
        if (intel_fb_supports_90_270_rotation(fb))
-               intel_fb_view_init(i915, &fb->rotated_view, I915_GGTT_VIEW_ROTATED);
+               intel_fb_view_init(i915, &fb->rotated_view, I915_GTT_VIEW_ROTATED);
        if (intel_fb_needs_pot_stride_remap(fb))
-               intel_fb_view_init(i915, &fb->remapped_view, I915_GGTT_VIEW_REMAPPED);
+               intel_fb_view_init(i915, &fb->remapped_view, I915_GTT_VIEW_REMAPPED);
  
        for (i = 0; i < num_planes; i++) {
                struct fb_plane_view_dims view_dims;
@@@ -1620,8 -1619,8 +1620,8 @@@ static void intel_plane_remap_gtt(struc
        u32 gtt_offset = 0;
  
        intel_fb_view_init(i915, &plane_state->view,
-                          drm_rotation_90_or_270(rotation) ? I915_GGTT_VIEW_ROTATED :
-                                                             I915_GGTT_VIEW_REMAPPED);
+                          drm_rotation_90_or_270(rotation) ? I915_GTT_VIEW_ROTATED :
+                                                             I915_GTT_VIEW_REMAPPED);
  
        src_x = plane_state->uapi.src.x1 >> 16;
        src_y = plane_state->uapi.src.y1 >> 16;
index bc9c432edffe036f3810eb1cf5bfdbbb0a4478cb,6f3ab7ade41ad9410a11eeb7da6f517d1871d4f5..f64a3deb12fce16ae8a4404ba454299c45316cd3
@@@ -297,7 -297,7 +297,7 @@@ static struct ttm_tt *i915_ttm_tt_creat
                i915_tt->is_shmem = true;
        }
  
-       if (HAS_FLAT_CCS(i915) && i915_gem_object_needs_ccs_pages(obj))
+       if (i915_gem_object_needs_ccs_pages(obj))
                ccs_pages = DIV_ROUND_UP(DIV_ROUND_UP(bo->base.size,
                                                      NUM_BYTES_PER_CCS_BYTE),
                                         PAGE_SIZE);
@@@ -361,6 -361,7 +361,6 @@@ static bool i915_ttm_eviction_valuable(
                                       const struct ttm_place *place)
  {
        struct drm_i915_gem_object *obj = i915_ttm_to_gem(bo);
 -      struct ttm_resource *res = bo->resource;
  
        if (!obj)
                return false;
        if (!i915_gem_object_evictable(obj))
                return false;
  
 -      switch (res->mem_type) {
 -      case I915_PL_LMEM0: {
 -              struct ttm_resource_manager *man =
 -                      ttm_manager_type(bo->bdev, res->mem_type);
 -              struct i915_ttm_buddy_resource *bman_res =
 -                      to_ttm_buddy_resource(res);
 -              struct drm_buddy *mm = bman_res->mm;
 -              struct drm_buddy_block *block;
 -
 -              if (!place->fpfn && !place->lpfn)
 -                      return true;
 -
 -              GEM_BUG_ON(!place->lpfn);
 -
 -              /*
 -               * If we just want something mappable then we can quickly check
 -               * if the current victim resource is using any of the CPU
 -               * visible portion.
 -               */
 -              if (!place->fpfn &&
 -                  place->lpfn == i915_ttm_buddy_man_visible_size(man))
 -                      return bman_res->used_visible_size > 0;
 -
 -              /* Real range allocation */
 -              list_for_each_entry(block, &bman_res->blocks, link) {
 -                      unsigned long fpfn =
 -                              drm_buddy_block_offset(block) >> PAGE_SHIFT;
 -                      unsigned long lpfn = fpfn +
 -                              (drm_buddy_block_size(mm, block) >> PAGE_SHIFT);
 -
 -                      if (place->fpfn < lpfn && place->lpfn > fpfn)
 -                              return true;
 -              }
 -              return false;
 -      } default:
 -              break;
 -      }
 -
 -      return true;
 +      return ttm_bo_eviction_valuable(bo, place);
  }
  
  static void i915_ttm_evict_flags(struct ttm_buffer_object *bo,
@@@ -1203,8 -1242,9 +1203,8 @@@ int __i915_gem_ttm_object_init(struct i
         * Similarly, in delayed_destroy, we can't call ttm_bo_put()
         * until successful initialization.
         */
 -      ret = ttm_bo_init_reserved(&i915->bdev, i915_gem_to_ttm(obj), size,
 -                                 bo_type, &i915_sys_placement,
 -                                 page_size >> PAGE_SHIFT,
 +      ret = ttm_bo_init_reserved(&i915->bdev, i915_gem_to_ttm(obj), bo_type,
 +                                 &i915_sys_placement, page_size >> PAGE_SHIFT,
                                   &ctx, NULL, NULL, i915_ttm_bo_destroy);
        if (ret)
                return i915_ttm_err_to_gem(ret);
index 4722d4b18ed196c86c46da79b428d0eb5162aeab,55d4b8f8e33ea98e2480ff3380e92a79b4de8e1d..b071973ac41c13815a546417737334dda9aad3cc
  #include "intel_guc_capture.h"
  #include "intel_guc_log.h"
  
+ #if defined(CONFIG_DRM_I915_DEBUG_GUC)
+ #define GUC_LOG_DEFAULT_CRASH_BUFFER_SIZE     SZ_2M
+ #define GUC_LOG_DEFAULT_DEBUG_BUFFER_SIZE     SZ_16M
+ #define GUC_LOG_DEFAULT_CAPTURE_BUFFER_SIZE   SZ_4M
+ #elif defined(CONFIG_DRM_I915_DEBUG_GEM)
+ #define GUC_LOG_DEFAULT_CRASH_BUFFER_SIZE     SZ_1M
+ #define GUC_LOG_DEFAULT_DEBUG_BUFFER_SIZE     SZ_2M
+ #define GUC_LOG_DEFAULT_CAPTURE_BUFFER_SIZE   SZ_4M
+ #else
+ #define GUC_LOG_DEFAULT_CRASH_BUFFER_SIZE     SZ_8K
+ #define GUC_LOG_DEFAULT_DEBUG_BUFFER_SIZE     SZ_64K
+ #define GUC_LOG_DEFAULT_CAPTURE_BUFFER_SIZE   SZ_2M
+ #endif
  static void guc_log_copy_debuglogs_for_relay(struct intel_guc_log *log);
  
+ struct guc_log_section {
+       u32 max;
+       u32 flag;
+       u32 default_val;
+       const char *name;
+ };
+ static s32 scale_log_param(struct intel_guc_log *log, const struct guc_log_section *section,
+                          s32 param)
+ {
+       /* -1 means default */
+       if (param < 0)
+               return section->default_val;
+       /* Check for 32-bit overflow */
+       if (param >= SZ_4K) {
+               drm_err(&guc_to_gt(log_to_guc(log))->i915->drm, "Size too large for GuC %s log: %dMB!",
+                       section->name, param);
+               return section->default_val;
+       }
+       /* Param units are 1MB */
+       return param * SZ_1M;
+ }
+ static void _guc_log_init_sizes(struct intel_guc_log *log)
+ {
+       struct intel_guc *guc = log_to_guc(log);
+       struct drm_i915_private *i915 = guc_to_gt(guc)->i915;
+       static const struct guc_log_section sections[GUC_LOG_SECTIONS_LIMIT] = {
+               {
+                       GUC_LOG_CRASH_MASK >> GUC_LOG_CRASH_SHIFT,
+                       GUC_LOG_LOG_ALLOC_UNITS,
+                       GUC_LOG_DEFAULT_CRASH_BUFFER_SIZE,
+                       "crash dump"
+               },
+               {
+                       GUC_LOG_DEBUG_MASK >> GUC_LOG_DEBUG_SHIFT,
+                       GUC_LOG_LOG_ALLOC_UNITS,
+                       GUC_LOG_DEFAULT_DEBUG_BUFFER_SIZE,
+                       "debug",
+               },
+               {
+                       GUC_LOG_CAPTURE_MASK >> GUC_LOG_CAPTURE_SHIFT,
+                       GUC_LOG_CAPTURE_ALLOC_UNITS,
+                       GUC_LOG_DEFAULT_CAPTURE_BUFFER_SIZE,
+                       "capture",
+               }
+       };
+       s32 params[GUC_LOG_SECTIONS_LIMIT] = {
+               GUC_LOG_DEFAULT_CRASH_BUFFER_SIZE / SZ_1M,
+               GUC_LOG_DEFAULT_DEBUG_BUFFER_SIZE / SZ_1M,
+               GUC_LOG_DEFAULT_CAPTURE_BUFFER_SIZE / SZ_1M,
+       };
+       int i;
+       for (i = 0; i < GUC_LOG_SECTIONS_LIMIT; i++)
+               log->sizes[i].bytes = scale_log_param(log, sections + i, params[i]);
+       /* If debug size > 1MB then bump default crash size to keep the same units */
+       if (log->sizes[GUC_LOG_SECTIONS_DEBUG].bytes >= SZ_1M &&
+           GUC_LOG_DEFAULT_CRASH_BUFFER_SIZE < SZ_1M)
+               log->sizes[GUC_LOG_SECTIONS_CRASH].bytes = SZ_1M;
+       /* Prepare the GuC API structure fields: */
+       for (i = 0; i < GUC_LOG_SECTIONS_LIMIT; i++) {
+               /* Convert to correct units */
+               if ((log->sizes[i].bytes % SZ_1M) == 0) {
+                       log->sizes[i].units = SZ_1M;
+                       log->sizes[i].flag = sections[i].flag;
+               } else {
+                       log->sizes[i].units = SZ_4K;
+                       log->sizes[i].flag = 0;
+               }
+               if (!IS_ALIGNED(log->sizes[i].bytes, log->sizes[i].units))
+                       drm_err(&i915->drm, "Mis-aligned GuC log %s size: 0x%X vs 0x%X!",
+                               sections[i].name, log->sizes[i].bytes, log->sizes[i].units);
+               log->sizes[i].count = log->sizes[i].bytes / log->sizes[i].units;
+               if (!log->sizes[i].count) {
+                       drm_err(&i915->drm, "Zero GuC log %s size!", sections[i].name);
+               } else {
+                       /* Size is +1 unit */
+                       log->sizes[i].count--;
+               }
+               /* Clip to field size */
+               if (log->sizes[i].count > sections[i].max) {
+                       drm_err(&i915->drm, "GuC log %s size too large: %d vs %d!",
+                               sections[i].name, log->sizes[i].count + 1, sections[i].max + 1);
+                       log->sizes[i].count = sections[i].max;
+               }
+       }
+       if (log->sizes[GUC_LOG_SECTIONS_CRASH].units != log->sizes[GUC_LOG_SECTIONS_DEBUG].units) {
+               drm_err(&i915->drm, "Unit mis-match for GuC log crash and debug sections: %d vs %d!",
+                       log->sizes[GUC_LOG_SECTIONS_CRASH].units,
+                       log->sizes[GUC_LOG_SECTIONS_DEBUG].units);
+               log->sizes[GUC_LOG_SECTIONS_CRASH].units = log->sizes[GUC_LOG_SECTIONS_DEBUG].units;
+               log->sizes[GUC_LOG_SECTIONS_CRASH].count = 0;
+       }
+       log->sizes_initialised = true;
+ }
+ static void guc_log_init_sizes(struct intel_guc_log *log)
+ {
+       if (log->sizes_initialised)
+               return;
+       _guc_log_init_sizes(log);
+ }
+ static u32 intel_guc_log_section_size_crash(struct intel_guc_log *log)
+ {
+       guc_log_init_sizes(log);
+       return log->sizes[GUC_LOG_SECTIONS_CRASH].bytes;
+ }
+ static u32 intel_guc_log_section_size_debug(struct intel_guc_log *log)
+ {
+       guc_log_init_sizes(log);
+       return log->sizes[GUC_LOG_SECTIONS_DEBUG].bytes;
+ }
+ u32 intel_guc_log_section_size_capture(struct intel_guc_log *log)
+ {
+       guc_log_init_sizes(log);
+       return log->sizes[GUC_LOG_SECTIONS_CAPTURE].bytes;
+ }
  static u32 intel_guc_log_size(struct intel_guc_log *log)
  {
        /*
         *  |         Capture logs          |
         *  +===============================+ + CAPTURE_SIZE
         */
-       return PAGE_SIZE + CRASH_BUFFER_SIZE + DEBUG_BUFFER_SIZE + CAPTURE_BUFFER_SIZE;
+       return PAGE_SIZE +
+               intel_guc_log_section_size_crash(log) +
+               intel_guc_log_section_size_debug(log) +
+               intel_guc_log_section_size_capture(log);
  }
  
  /**
@@@ -165,7 -317,8 +317,8 @@@ static void guc_move_to_next_buf(struc
        smp_wmb();
  
        /* All data has been written, so now move the offset of sub buffer. */
-       relay_reserve(log->relay.channel, log->vma->obj->base.size - CAPTURE_BUFFER_SIZE);
+       relay_reserve(log->relay.channel, log->vma->obj->base.size -
+                                         intel_guc_log_section_size_capture(log));
  
        /* Switch to the next sub buffer */
        relay_flush(log->relay.channel);
@@@ -210,15 -363,16 +363,16 @@@ bool intel_guc_check_log_buf_overflow(s
        return overflow;
  }
  
- unsigned int intel_guc_get_log_buffer_size(enum guc_log_buffer_type type)
+ unsigned int intel_guc_get_log_buffer_size(struct intel_guc_log *log,
+                                          enum guc_log_buffer_type type)
  {
        switch (type) {
        case GUC_DEBUG_LOG_BUFFER:
-               return DEBUG_BUFFER_SIZE;
+               return intel_guc_log_section_size_debug(log);
        case GUC_CRASH_DUMP_LOG_BUFFER:
-               return CRASH_BUFFER_SIZE;
+               return intel_guc_log_section_size_crash(log);
        case GUC_CAPTURE_LOG_BUFFER:
-               return CAPTURE_BUFFER_SIZE;
+               return intel_guc_log_section_size_capture(log);
        default:
                MISSING_CASE(type);
        }
        return 0;
  }
  
- size_t intel_guc_get_log_buffer_offset(enum guc_log_buffer_type type)
+ size_t intel_guc_get_log_buffer_offset(struct intel_guc_log *log,
+                                      enum guc_log_buffer_type type)
  {
        enum guc_log_buffer_type i;
        size_t offset = PAGE_SIZE;/* for the log_buffer_states */
        for (i = GUC_DEBUG_LOG_BUFFER; i < GUC_MAX_LOG_BUFFER; ++i) {
                if (i == type)
                        break;
-               offset += intel_guc_get_log_buffer_size(i);
+               offset += intel_guc_get_log_buffer_size(log, i);
        }
  
        return offset;
@@@ -285,7 -440,7 +440,7 @@@ static void _guc_log_copy_debuglogs_for
                 */
                memcpy(&log_buf_state_local, log_buf_state,
                       sizeof(struct guc_log_buffer_state));
-               buffer_size = intel_guc_get_log_buffer_size(type);
+               buffer_size = intel_guc_get_log_buffer_size(log, type);
                read_offset = log_buf_state_local.read_ptr;
                write_offset = log_buf_state_local.sampled_write_ptr;
                full_cnt = log_buf_state_local.buffer_full_cnt;
@@@ -400,7 -555,7 +555,7 @@@ static int guc_log_relay_create(struct 
          * Keep the size of sub buffers same as shared log buffer
          * but GuC log-events excludes the error-state-capture logs
          */
-       subbuf_size = log->vma->size - CAPTURE_BUFFER_SIZE;
+       subbuf_size = log->vma->size - intel_guc_log_section_size_capture(log);
  
        /*
         * Store up to 8 snapshots, which is large enough to buffer sufficient
@@@ -589,7 -744,7 +744,7 @@@ int intel_guc_log_relay_open(struct int
        /*
         * We require SSE 4.1 for fast reads from the GuC log buffer and
         * it should be present on the chipsets supporting GuC based
 -       * submisssions.
 +       * submissions.
         */
        if (!i915_has_memcpy_from_wc()) {
                ret = -ENXIO;
index 086bbe8945d6cbd53bb4e368a291dd69079439c1,0f35669015425d52fff22501c24396f18174eda3..7c0a34a33fec8e232b29c1481140404060ecb2b8
@@@ -37,6 -37,7 +37,6 @@@
  #include <drm/drm_connector.h>
  #include <drm/ttm/ttm_device.h>
  
 -#include "display/intel_bios.h"
  #include "display/intel_cdclk.h"
  #include "display/intel_display.h"
  #include "display/intel_display_power.h"
@@@ -193,6 -194,12 +193,6 @@@ struct drm_i915_display_funcs 
  
  #define I915_COLOR_UNEVICTABLE (-1) /* a non-vma sharing the address space */
  
 -enum drrs_type {
 -      DRRS_TYPE_NONE,
 -      DRRS_TYPE_STATIC,
 -      DRRS_TYPE_SEAMLESS,
 -};
 -
  #define QUIRK_LVDS_SSC_DISABLE (1<<1)
  #define QUIRK_INVERT_BRIGHTNESS (1<<2)
  #define QUIRK_BACKLIGHT_PRESENT (1<<3)
@@@ -301,19 -308,76 +301,19 @@@ struct intel_vbt_data 
        /* bdb version */
        u16 version;
  
 -      struct drm_display_mode *lfp_lvds_vbt_mode; /* if any */
 -      struct drm_display_mode *sdvo_lvds_vbt_mode; /* if any */
 -
        /* Feature bits */
        unsigned int int_tv_support:1;
 -      unsigned int lvds_dither:1;
        unsigned int int_crt_support:1;
        unsigned int lvds_use_ssc:1;
        unsigned int int_lvds_support:1;
        unsigned int display_clock_mode:1;
        unsigned int fdi_rx_polarity_inverted:1;
 -      unsigned int panel_type:4;
        int lvds_ssc_freq;
 -      unsigned int bios_lvds_val; /* initial [PCH_]LVDS reg val in VBIOS */
        enum drm_panel_orientation orientation;
  
        bool override_afc_startup;
        u8 override_afc_startup_val;
  
 -      u8 seamless_drrs_min_refresh_rate;
 -      enum drrs_type drrs_type;
 -
 -      struct {
 -              int rate;
 -              int lanes;
 -              int preemphasis;
 -              int vswing;
 -              int bpp;
 -              struct edp_power_seq pps;
 -              u8 drrs_msa_timing_delay;
 -              bool low_vswing;
 -              bool initialized;
 -              bool hobl;
 -      } edp;
 -
 -      struct {
 -              bool enable;
 -              bool full_link;
 -              bool require_aux_wakeup;
 -              int idle_frames;
 -              int tp1_wakeup_time_us;
 -              int tp2_tp3_wakeup_time_us;
 -              int psr2_tp2_tp3_wakeup_time_us;
 -      } psr;
 -
 -      struct {
 -              u16 pwm_freq_hz;
 -              u16 brightness_precision_bits;
 -              bool present;
 -              bool active_low_pwm;
 -              u8 min_brightness;      /* min_brightness/255 of max */
 -              u8 controller;          /* brightness controller number */
 -              enum intel_backlight_type type;
 -      } backlight;
 -
 -      /* MIPI DSI */
 -      struct {
 -              u16 panel_id;
 -              struct mipi_config *config;
 -              struct mipi_pps_data *pps;
 -              u16 bl_ports;
 -              u16 cabc_ports;
 -              u8 seq_version;
 -              u32 size;
 -              u8 *data;
 -              const u8 *sequence[MIPI_SEQ_MAX];
 -              u8 *deassert_seq; /* Used by fixup_mipi_sequences() */
 -              enum drm_panel_orientation orientation;
 -      } dsi;
 -
        int crt_ddc_pin;
  
        struct list_head display_devices;
@@@ -1345,16 -1409,11 +1345,13 @@@ IS_SUBPLATFORM(const struct drm_i915_pr
  
  /* Only valid when HAS_DISPLAY() is true */
  #define INTEL_DISPLAY_ENABLED(dev_priv) \
 -      (drm_WARN_ON(&(dev_priv)->drm, !HAS_DISPLAY(dev_priv)), !(dev_priv)->params.disable_display)
 +      (drm_WARN_ON(&(dev_priv)->drm, !HAS_DISPLAY(dev_priv)),         \
 +       !(dev_priv)->params.disable_display &&                         \
 +       !intel_opregion_headless_sku(dev_priv))
  
  #define HAS_GUC_DEPRIVILEGE(dev_priv) \
        (INTEL_INFO(dev_priv)->has_guc_deprivilege)
  
- #define HAS_PERCTX_PREEMPT_CTRL(i915) \
-       ((GRAPHICS_VER(i915) >= 9) &&  GRAPHICS_VER_FULL(i915) < IP_VER(12, 55))
  #define HAS_D12_PLANE_MINIMIZATION(dev_priv) (IS_ROCKETLAKE(dev_priv) || \
                                              IS_ALDERLAKE_S(dev_priv))
  
@@@ -1409,12 -1468,12 +1406,12 @@@ static inline void i915_gem_drain_workq
  struct i915_vma * __must_check
  i915_gem_object_ggtt_pin_ww(struct drm_i915_gem_object *obj,
                            struct i915_gem_ww_ctx *ww,
-                           const struct i915_ggtt_view *view,
+                           const struct i915_gtt_view *view,
                            u64 size, u64 alignment, u64 flags);
  
  struct i915_vma * __must_check
  i915_gem_object_ggtt_pin(struct drm_i915_gem_object *obj,
-                        const struct i915_ggtt_view *view,
+                        const struct i915_gtt_view *view,
                         u64 size, u64 alignment, u64 flags);
  
  int i915_gem_object_unbind(struct drm_i915_gem_object *obj,
index aacc10f2e73f45e715134b211035379306349f78,7b0384373e99cd653ac7022117a416a232182f06..59a579ed03bb14da44db9862475b8a5bd687e942
        .display.ver = (x)
  
  #define I845_PIPE_OFFSETS \
 -      .pipe_offsets = { \
 +      .display.pipe_offsets = { \
                [TRANSCODER_A] = PIPE_A_OFFSET, \
        }, \
 -      .trans_offsets = { \
 +      .display.trans_offsets = { \
                [TRANSCODER_A] = TRANSCODER_A_OFFSET, \
        }
  
  #define I9XX_PIPE_OFFSETS \
 -      .pipe_offsets = { \
 +      .display.pipe_offsets = { \
                [TRANSCODER_A] = PIPE_A_OFFSET, \
                [TRANSCODER_B] = PIPE_B_OFFSET, \
        }, \
 -      .trans_offsets = { \
 +      .display.trans_offsets = { \
                [TRANSCODER_A] = TRANSCODER_A_OFFSET, \
                [TRANSCODER_B] = TRANSCODER_B_OFFSET, \
        }
  
  #define IVB_PIPE_OFFSETS \
 -      .pipe_offsets = { \
 +      .display.pipe_offsets = { \
                [TRANSCODER_A] = PIPE_A_OFFSET, \
                [TRANSCODER_B] = PIPE_B_OFFSET, \
                [TRANSCODER_C] = PIPE_C_OFFSET, \
        }, \
 -      .trans_offsets = { \
 +      .display.trans_offsets = { \
                [TRANSCODER_A] = TRANSCODER_A_OFFSET, \
                [TRANSCODER_B] = TRANSCODER_B_OFFSET, \
                [TRANSCODER_C] = TRANSCODER_C_OFFSET, \
        }
  
  #define HSW_PIPE_OFFSETS \
 -      .pipe_offsets = { \
 +      .display.pipe_offsets = { \
                [TRANSCODER_A] = PIPE_A_OFFSET, \
                [TRANSCODER_B] = PIPE_B_OFFSET, \
                [TRANSCODER_C] = PIPE_C_OFFSET, \
                [TRANSCODER_EDP] = PIPE_EDP_OFFSET, \
        }, \
 -      .trans_offsets = { \
 +      .display.trans_offsets = { \
                [TRANSCODER_A] = TRANSCODER_A_OFFSET, \
                [TRANSCODER_B] = TRANSCODER_B_OFFSET, \
                [TRANSCODER_C] = TRANSCODER_C_OFFSET, \
        }
  
  #define CHV_PIPE_OFFSETS \
 -      .pipe_offsets = { \
 +      .display.pipe_offsets = { \
                [TRANSCODER_A] = PIPE_A_OFFSET, \
                [TRANSCODER_B] = PIPE_B_OFFSET, \
                [TRANSCODER_C] = CHV_PIPE_C_OFFSET, \
        }, \
 -      .trans_offsets = { \
 +      .display.trans_offsets = { \
                [TRANSCODER_A] = TRANSCODER_A_OFFSET, \
                [TRANSCODER_B] = TRANSCODER_B_OFFSET, \
                [TRANSCODER_C] = CHV_TRANSCODER_C_OFFSET, \
        }
  
  #define I845_CURSOR_OFFSETS \
 -      .cursor_offsets = { \
 +      .display.cursor_offsets = { \
                [PIPE_A] = CURSOR_A_OFFSET, \
        }
  
  #define I9XX_CURSOR_OFFSETS \
 -      .cursor_offsets = { \
 +      .display.cursor_offsets = { \
                [PIPE_A] = CURSOR_A_OFFSET, \
                [PIPE_B] = CURSOR_B_OFFSET, \
        }
  
  #define CHV_CURSOR_OFFSETS \
 -      .cursor_offsets = { \
 +      .display.cursor_offsets = { \
                [PIPE_A] = CURSOR_A_OFFSET, \
                [PIPE_B] = CURSOR_B_OFFSET, \
                [PIPE_C] = CHV_CURSOR_C_OFFSET, \
        }
  
  #define IVB_CURSOR_OFFSETS \
 -      .cursor_offsets = { \
 +      .display.cursor_offsets = { \
                [PIPE_A] = CURSOR_A_OFFSET, \
                [PIPE_B] = IVB_CURSOR_B_OFFSET, \
                [PIPE_C] = IVB_CURSOR_C_OFFSET, \
        }
  
  #define TGL_CURSOR_OFFSETS \
 -      .cursor_offsets = { \
 +      .display.cursor_offsets = { \
                [PIPE_A] = CURSOR_A_OFFSET, \
                [PIPE_B] = IVB_CURSOR_B_OFFSET, \
                [PIPE_C] = IVB_CURSOR_C_OFFSET, \
        }
  
  #define I9XX_COLORS \
 -      .color = { .gamma_lut_size = 256 }
 +      .display.color = { .gamma_lut_size = 256 }
  #define I965_COLORS \
 -      .color = { .gamma_lut_size = 129, \
 +      .display.color = { .gamma_lut_size = 129, \
                   .gamma_lut_tests = DRM_COLOR_LUT_NON_DECREASING, \
        }
  #define ILK_COLORS \
 -      .color = { .gamma_lut_size = 1024 }
 +      .display.color = { .gamma_lut_size = 1024 }
  #define IVB_COLORS \
 -      .color = { .degamma_lut_size = 1024, .gamma_lut_size = 1024 }
 +      .display.color = { .degamma_lut_size = 1024, .gamma_lut_size = 1024 }
  #define CHV_COLORS \
 -      .color = { .degamma_lut_size = 65, .gamma_lut_size = 257, \
 -                 .degamma_lut_tests = DRM_COLOR_LUT_NON_DECREASING, \
 -                 .gamma_lut_tests = DRM_COLOR_LUT_NON_DECREASING, \
 +      .display.color = { \
 +              .degamma_lut_size = 65, .gamma_lut_size = 257, \
 +              .degamma_lut_tests = DRM_COLOR_LUT_NON_DECREASING, \
 +              .gamma_lut_tests = DRM_COLOR_LUT_NON_DECREASING, \
        }
  #define GLK_COLORS \
 -      .color = { .degamma_lut_size = 33, .gamma_lut_size = 1024, \
 -                 .degamma_lut_tests = DRM_COLOR_LUT_NON_DECREASING | \
 -                                      DRM_COLOR_LUT_EQUAL_CHANNELS, \
 +      .display.color = { \
 +              .degamma_lut_size = 33, .gamma_lut_size = 1024, \
 +              .degamma_lut_tests = DRM_COLOR_LUT_NON_DECREASING | \
 +                                   DRM_COLOR_LUT_EQUAL_CHANNELS, \
        }
  #define ICL_COLORS \
 -      .color = { .degamma_lut_size = 33, .gamma_lut_size = 262145, \
 -                 .degamma_lut_tests = DRM_COLOR_LUT_NON_DECREASING | \
 -                                      DRM_COLOR_LUT_EQUAL_CHANNELS, \
 -                 .gamma_lut_tests = DRM_COLOR_LUT_NON_DECREASING, \
 +      .display.color = { \
 +              .degamma_lut_size = 33, .gamma_lut_size = 262145, \
 +              .degamma_lut_tests = DRM_COLOR_LUT_NON_DECREASING | \
 +                                   DRM_COLOR_LUT_EQUAL_CHANNELS, \
 +              .gamma_lut_tests = DRM_COLOR_LUT_NON_DECREASING, \
        }
  
  /* Keep in gen based order, and chronological order within a gen */
@@@ -539,7 -536,7 +539,7 @@@ static const struct intel_device_info v
        .has_snoop = true,
        .has_coherent_ggtt = false,
        .platform_engine_mask = BIT(RCS0) | BIT(VCS0) | BIT(BCS0),
 -      .display_mmio_offset = VLV_DISPLAY_BASE,
 +      .display.mmio_offset = VLV_DISPLAY_BASE,
        I9XX_PIPE_OFFSETS,
        I9XX_CURSOR_OFFSETS,
        I965_COLORS,
@@@ -637,7 -634,7 +637,7 @@@ static const struct intel_device_info c
        .has_reset_engine = 1,
        .has_snoop = true,
        .has_coherent_ggtt = false,
 -      .display_mmio_offset = VLV_DISPLAY_BASE,
 +      .display.mmio_offset = VLV_DISPLAY_BASE,
        CHV_PIPE_OFFSETS,
        CHV_CURSOR_OFFSETS,
        CHV_COLORS,
        .display.has_ipc = 1, \
        .display.has_psr = 1, \
        .display.has_psr_hw_tracking = 1, \
 -      .dbuf.size = 896 - 4, /* 4 blocks for bypass path allocation */ \
 -      .dbuf.slice_mask = BIT(DBUF_S1)
 +      .display.dbuf.size = 896 - 4, /* 4 blocks for bypass path allocation */ \
 +      .display.dbuf.slice_mask = BIT(DBUF_S1)
  
  #define SKL_PLATFORM \
        GEN9_FEATURES, \
@@@ -695,7 -692,7 +695,7 @@@ static const struct intel_device_info s
  #define GEN9_LP_FEATURES \
        GEN(9), \
        .is_lp = 1, \
 -      .dbuf.slice_mask = BIT(DBUF_S1), \
 +      .display.dbuf.slice_mask = BIT(DBUF_S1), \
        .display.has_hotplug = 1, \
        .platform_engine_mask = BIT(RCS0) | BIT(VCS0) | BIT(BCS0) | BIT(VECS0), \
        .display.pipe_mask = BIT(PIPE_A) | BIT(PIPE_B) | BIT(PIPE_C), \
  static const struct intel_device_info bxt_info = {
        GEN9_LP_FEATURES,
        PLATFORM(INTEL_BROXTON),
 -      .dbuf.size = 512 - 4, /* 4 blocks for bypass path allocation */
 +      .display.dbuf.size = 512 - 4, /* 4 blocks for bypass path allocation */
  };
  
  static const struct intel_device_info glk_info = {
        GEN9_LP_FEATURES,
        PLATFORM(INTEL_GEMINILAKE),
        .display.ver = 10,
 -      .dbuf.size = 1024 - 4, /* 4 blocks for bypass path allocation */
 +      .display.dbuf.size = 1024 - 4, /* 4 blocks for bypass path allocation */
        GLK_COLORS,
  };
  
@@@ -812,7 -809,7 +812,7 @@@ static const struct intel_device_info c
        .display.cpu_transcoder_mask = BIT(TRANSCODER_A) | BIT(TRANSCODER_B) | \
                BIT(TRANSCODER_C) | BIT(TRANSCODER_EDP) | \
                BIT(TRANSCODER_DSI_0) | BIT(TRANSCODER_DSI_1), \
 -      .pipe_offsets = { \
 +      .display.pipe_offsets = { \
                [TRANSCODER_A] = PIPE_A_OFFSET, \
                [TRANSCODER_B] = PIPE_B_OFFSET, \
                [TRANSCODER_C] = PIPE_C_OFFSET, \
                [TRANSCODER_DSI_0] = PIPE_DSI0_OFFSET, \
                [TRANSCODER_DSI_1] = PIPE_DSI1_OFFSET, \
        }, \
 -      .trans_offsets = { \
 +      .display.trans_offsets = { \
                [TRANSCODER_A] = TRANSCODER_A_OFFSET, \
                [TRANSCODER_B] = TRANSCODER_B_OFFSET, \
                [TRANSCODER_C] = TRANSCODER_C_OFFSET, \
        }, \
        GEN(11), \
        ICL_COLORS, \
 -      .dbuf.size = 2048, \
 -      .dbuf.slice_mask = BIT(DBUF_S1) | BIT(DBUF_S2), \
 +      .display.dbuf.size = 2048, \
 +      .display.dbuf.slice_mask = BIT(DBUF_S1) | BIT(DBUF_S2), \
        .display.has_dsc = 1, \
        .has_coherent_ggtt = false, \
        .has_logical_ring_elsq = 1
@@@ -865,7 -862,7 +865,7 @@@ static const struct intel_device_info j
        .display.cpu_transcoder_mask = BIT(TRANSCODER_A) | BIT(TRANSCODER_B) | \
                BIT(TRANSCODER_C) | BIT(TRANSCODER_D) | \
                BIT(TRANSCODER_DSI_0) | BIT(TRANSCODER_DSI_1), \
 -      .pipe_offsets = { \
 +      .display.pipe_offsets = { \
                [TRANSCODER_A] = PIPE_A_OFFSET, \
                [TRANSCODER_B] = PIPE_B_OFFSET, \
                [TRANSCODER_C] = PIPE_C_OFFSET, \
                [TRANSCODER_DSI_0] = PIPE_DSI0_OFFSET, \
                [TRANSCODER_DSI_1] = PIPE_DSI1_OFFSET, \
        }, \
 -      .trans_offsets = { \
 +      .display.trans_offsets = { \
                [TRANSCODER_A] = TRANSCODER_A_OFFSET, \
                [TRANSCODER_B] = TRANSCODER_B_OFFSET, \
                [TRANSCODER_C] = TRANSCODER_C_OFFSET, \
@@@ -940,15 -937,22 +940,15 @@@ static const struct intel_device_info a
        .dma_mask_size = 39,
  };
  
 -#define XE_LPD_CURSOR_OFFSETS \
 -      .cursor_offsets = { \
 -              [PIPE_A] = CURSOR_A_OFFSET, \
 -              [PIPE_B] = IVB_CURSOR_B_OFFSET, \
 -              [PIPE_C] = IVB_CURSOR_C_OFFSET, \
 -              [PIPE_D] = TGL_CURSOR_D_OFFSET, \
 -      }
 -
  #define XE_LPD_FEATURES \
        .display.abox_mask = GENMASK(1, 0),                                     \
 -      .color = { .degamma_lut_size = 128, .gamma_lut_size = 1024,             \
 -                 .degamma_lut_tests = DRM_COLOR_LUT_NON_DECREASING |          \
 -                                      DRM_COLOR_LUT_EQUAL_CHANNELS,           \
 +      .display.color = {                                                      \
 +              .degamma_lut_size = 128, .gamma_lut_size = 1024,                \
 +              .degamma_lut_tests = DRM_COLOR_LUT_NON_DECREASING |             \
 +                                   DRM_COLOR_LUT_EQUAL_CHANNELS,              \
        },                                                                      \
 -      .dbuf.size = 4096,                                                      \
 -      .dbuf.slice_mask = BIT(DBUF_S1) | BIT(DBUF_S2) | BIT(DBUF_S3) |         \
 +      .display.dbuf.size = 4096,                                              \
 +      .display.dbuf.slice_mask = BIT(DBUF_S1) | BIT(DBUF_S2) | BIT(DBUF_S3) | \
                BIT(DBUF_S4),                                                   \
        .display.has_ddi = 1,                                                   \
        .display.has_dmc = 1,                                                   \
        .display.has_psr = 1,                                                   \
        .display.ver = 13,                                                      \
        .display.pipe_mask = BIT(PIPE_A) | BIT(PIPE_B) | BIT(PIPE_C) | BIT(PIPE_D),     \
 -      .pipe_offsets = {                                                       \
 +      .display.pipe_offsets = {                                               \
                [TRANSCODER_A] = PIPE_A_OFFSET,                                 \
                [TRANSCODER_B] = PIPE_B_OFFSET,                                 \
                [TRANSCODER_C] = PIPE_C_OFFSET,                                 \
                [TRANSCODER_DSI_0] = PIPE_DSI0_OFFSET,                          \
                [TRANSCODER_DSI_1] = PIPE_DSI1_OFFSET,                          \
        },                                                                      \
 -      .trans_offsets = {                                                      \
 +      .display.trans_offsets = {                                              \
                [TRANSCODER_A] = TRANSCODER_A_OFFSET,                           \
                [TRANSCODER_B] = TRANSCODER_B_OFFSET,                           \
                [TRANSCODER_C] = TRANSCODER_C_OFFSET,                           \
                [TRANSCODER_DSI_0] = TRANSCODER_DSI0_OFFSET,                    \
                [TRANSCODER_DSI_1] = TRANSCODER_DSI1_OFFSET,                    \
        },                                                                      \
 -      XE_LPD_CURSOR_OFFSETS
 +      TGL_CURSOR_OFFSETS
  
  static const struct intel_device_info adl_p_info = {
        GEN12_FEATURES,
@@@ -1079,6 -1083,7 +1079,7 @@@ static const struct intel_device_info a
        DG2_FEATURES,
        .display = { 0 },
        .require_force_probe = 1,
+       .tuning_thread_rr_after_dep = 1,
  };
  
  #define XE_HPC_FEATURES \
index 23bf230aa10486a931a355881d86ae58c7fcf6a2,9cd912c2703cd9dfb30c383117eee20c2d1f727d..e681bc6ed8e92d4e75328a646b5ee958c391708a
@@@ -172,6 -172,7 +172,7 @@@ enum intel_ppgtt_type 
        func(has_runtime_pm); \
        func(has_snoop); \
        func(has_coherent_ggtt); \
+       func(tuning_thread_rr_after_dep); \
        func(unfenced_needs_alignment); \
        func(hws_needs_physical);
  
@@@ -219,6 -220,8 +220,6 @@@ struct intel_device_info 
  
        u32 memory_regions; /* regions supported by the HW */
  
 -      u32 display_mmio_offset;
 -
        u8 gt; /* GT number, 0 if undefined */
  
  #define DEFINE_FLAG(name) u8 name:1
                u8 fbc_mask;
                u8 abox_mask;
  
 +              struct {
 +                      u16 size; /* in blocks */
 +                      u8 slice_mask;
 +              } dbuf;
 +
  #define DEFINE_FLAG(name) u8 name:1
                DEV_INFO_DISPLAY_FOR_EACH_FLAG(DEFINE_FLAG);
  #undef DEFINE_FLAG
 -      } display;
  
 -      struct {
 -              u16 size; /* in blocks */
 -              u8 slice_mask;
 -      } dbuf;
 -
 -      /* Register offsets for the various display pipes and transcoders */
 -      int pipe_offsets[I915_MAX_TRANSCODERS];
 -      int trans_offsets[I915_MAX_TRANSCODERS];
 -      int cursor_offsets[I915_MAX_PIPES];
 -
 -      struct color_luts {
 -              u32 degamma_lut_size;
 -              u32 gamma_lut_size;
 -              u32 degamma_lut_tests;
 -              u32 gamma_lut_tests;
 -      } color;
 +              /* Global register offset for the display engine */
 +              u32 mmio_offset;
 +
 +              /* Register offsets for the various display pipes and transcoders */
 +              u32 pipe_offsets[I915_MAX_TRANSCODERS];
 +              u32 trans_offsets[I915_MAX_TRANSCODERS];
 +              u32 cursor_offsets[I915_MAX_PIPES];
 +
 +              struct {
 +                      u32 degamma_lut_size;
 +                      u32 gamma_lut_size;
 +                      u32 degamma_lut_tests;
 +                      u32 gamma_lut_tests;
 +              } color;
 +      } display;
  };
  
  struct intel_runtime_info {