static bool is_gen12_ccs_modifier(u64 modifier)
 {
-       return modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS;
+       return modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS ||
+              modifier == I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS;
+
 }
 
 static bool is_gen12_ccs_plane(const struct drm_framebuffer *fb, int plane)
 }
 
 /* Return either the main plane's CCS or - if not a CCS FB - UV plane */
-static int
-intel_main_to_aux_plane(const struct drm_framebuffer *fb, int main_plane)
+int intel_main_to_aux_plane(const struct drm_framebuffer *fb, int main_plane)
 {
        if (is_ccs_modifier(fb->modifier))
                return main_to_ccs_plane(fb, main_plane);
                        return 128;
                /* fall through */
        case I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS:
+       case I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS:
                if (is_ccs_plane(fb, color_plane))
                        return 64;
                /* fall through */
                if (INTEL_GEN(dev_priv) >= 9)
                        return 256 * 1024;
                return 0;
+       case I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS:
+               if (is_semiplanar_uv_plane(fb, color_plane))
+                       return intel_tile_row_size(fb, color_plane);
+               /* Fall-through */
        case I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS:
                return 16 * 1024;
        case I915_FORMAT_MOD_Y_TILED_CCS:
        case I915_FORMAT_MOD_Y_TILED:
        case I915_FORMAT_MOD_Y_TILED_CCS:
        case I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS:
+       case I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS:
                return I915_TILING_Y;
        default:
                return I915_TILING_NONE;
        { .format = DRM_FORMAT_ABGR8888, .depth = 32, .num_planes = 2,
          .char_per_block = { 4, 1 }, .block_w = { 1, 2 }, .block_h = { 1, 1 },
          .hsub = 1, .vsub = 1, .has_alpha = true },
+       { .format = DRM_FORMAT_YUYV, .num_planes = 2,
+         .char_per_block = { 2, 1 }, .block_w = { 1, 2 }, .block_h = { 1, 1 },
+         .hsub = 2, .vsub = 1, .is_yuv = true },
+       { .format = DRM_FORMAT_YVYU, .num_planes = 2,
+         .char_per_block = { 2, 1 }, .block_w = { 1, 2 }, .block_h = { 1, 1 },
+         .hsub = 2, .vsub = 1, .is_yuv = true },
+       { .format = DRM_FORMAT_UYVY, .num_planes = 2,
+         .char_per_block = { 2, 1 }, .block_w = { 1, 2 }, .block_h = { 1, 1 },
+         .hsub = 2, .vsub = 1, .is_yuv = true },
+       { .format = DRM_FORMAT_VYUY, .num_planes = 2,
+         .char_per_block = { 2, 1 }, .block_w = { 1, 2 }, .block_h = { 1, 1 },
+         .hsub = 2, .vsub = 1, .is_yuv = true },
+       { .format = DRM_FORMAT_NV12, .num_planes = 4,
+         .char_per_block = { 1, 2, 1, 1 }, .block_w = { 1, 1, 4, 4 }, .block_h = { 1, 1, 1, 1 },
+         .hsub = 2, .vsub = 2, .is_yuv = true },
+       { .format = DRM_FORMAT_P010, .num_planes = 4,
+         .char_per_block = { 2, 4, 1, 1 }, .block_w = { 1, 1, 2, 2 }, .block_h = { 1, 1, 1, 1 },
+         .hsub = 2, .vsub = 2, .is_yuv = true },
+       { .format = DRM_FORMAT_P012, .num_planes = 4,
+         .char_per_block = { 2, 4, 1, 1 }, .block_w = { 1, 1, 2, 2 }, .block_h = { 1, 1, 1, 1 },
+         .hsub = 2, .vsub = 2, .is_yuv = true },
+       { .format = DRM_FORMAT_P016, .num_planes = 4,
+         .char_per_block = { 2, 4, 1, 1 }, .block_w = { 1, 1, 2, 2 }, .block_h = { 1, 1, 1, 1 },
+         .hsub = 2, .vsub = 2, .is_yuv = true },
 };
 
 static const struct drm_format_info *
                                          ARRAY_SIZE(skl_ccs_formats),
                                          cmd->pixel_format);
        case I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS:
+       case I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS:
                return lookup_format_info(gen12_ccs_formats,
                                          ARRAY_SIZE(gen12_ccs_formats),
                                          cmd->pixel_format);
 bool is_ccs_modifier(u64 modifier)
 {
        return modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS ||
+              modifier == I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS ||
               modifier == I915_FORMAT_MOD_Y_TILED_CCS ||
               modifier == I915_FORMAT_MOD_Yf_TILED_CCS;
 }
        }
 
        tile_width = intel_tile_width_bytes(fb, color_plane);
-       if (is_ccs_modifier(fb->modifier) && color_plane == 0) {
+       if (is_ccs_modifier(fb->modifier)) {
                /*
                 * Display WA #0531: skl,bxt,kbl,glk
                 *
                 * require the entire fb to accommodate that to avoid
                 * potential runtime errors at plane configuration time.
                 */
-               if (IS_GEN(dev_priv, 9) && fb->width > 3840)
+               if (IS_GEN(dev_priv, 9) && color_plane == 0 && fb->width > 3840)
                        tile_width *= 4;
                /*
                 * The main surface pitch must be padded to a multiple of four
                        return 5120;
        case I915_FORMAT_MOD_Y_TILED_CCS:
        case I915_FORMAT_MOD_Yf_TILED_CCS:
+       case I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS:
                /* FIXME AUX plane? */
        case I915_FORMAT_MOD_Y_TILED:
        case I915_FORMAT_MOD_Yf_TILED:
        return 4320;
 }
 
-static bool skl_check_main_ccs_coordinates(struct intel_plane_state *plane_state,
-                                          int main_x, int main_y, u32 main_offset)
+static bool
+skl_check_main_ccs_coordinates(struct intel_plane_state *plane_state,
+                              int main_x, int main_y, u32 main_offset,
+                              int ccs_plane)
 {
        const struct drm_framebuffer *fb = plane_state->hw.fb;
-       int ccs_plane = main_to_ccs_plane(fb, 0);
        int aux_x = plane_state->color_plane[ccs_plane].x;
        int aux_y = plane_state->color_plane[ccs_plane].y;
        u32 aux_offset = plane_state->color_plane[ccs_plane].offset;
         * they match with the main surface x/y offsets.
         */
        if (is_ccs_modifier(fb->modifier)) {
-               while (!skl_check_main_ccs_coordinates(plane_state, x, y, offset)) {
+               while (!skl_check_main_ccs_coordinates(plane_state, x, y,
+                                                      offset, aux_plane)) {
                        if (offset == 0)
                                break;
 
 {
        const struct drm_framebuffer *fb = plane_state->hw.fb;
        unsigned int rotation = plane_state->hw.rotation;
-       int max_width = skl_max_plane_width(fb, 1, rotation);
+       int uv_plane = 1;
+       int max_width = skl_max_plane_width(fb, uv_plane, rotation);
        int max_height = 4096;
        int x = plane_state->uapi.src.x1 >> 17;
        int y = plane_state->uapi.src.y1 >> 17;
        int h = drm_rect_height(&plane_state->uapi.src) >> 17;
        u32 offset;
 
-       intel_add_fb_offsets(&x, &y, plane_state, 1);
-       offset = intel_plane_compute_aligned_offset(&x, &y, plane_state, 1);
+       intel_add_fb_offsets(&x, &y, plane_state, uv_plane);
+       offset = intel_plane_compute_aligned_offset(&x, &y,
+                                                   plane_state, uv_plane);
 
        /* FIXME not quite sure how/if these apply to the chroma plane */
        if (w > max_width || h > max_height) {
                return -EINVAL;
        }
 
-       plane_state->color_plane[1].offset = offset;
-       plane_state->color_plane[1].x = x;
-       plane_state->color_plane[1].y = y;
+       if (is_ccs_modifier(fb->modifier)) {
+               int ccs_plane = main_to_ccs_plane(fb, uv_plane);
+               int aux_offset = plane_state->color_plane[ccs_plane].offset;
+               int alignment = intel_surf_alignment(fb, uv_plane);
+
+               if (offset > aux_offset)
+                       offset = intel_plane_adjust_aligned_offset(&x, &y,
+                                                                  plane_state,
+                                                                  uv_plane,
+                                                                  offset,
+                                                                  aux_offset & ~(alignment - 1));
+
+               while (!skl_check_main_ccs_coordinates(plane_state, x, y,
+                                                      offset, ccs_plane)) {
+                       if (offset == 0)
+                               break;
+
+                       offset = intel_plane_adjust_aligned_offset(&x, &y,
+                                                                  plane_state,
+                                                                  uv_plane,
+                                                                  offset, offset - alignment);
+               }
+
+               if (x != plane_state->color_plane[ccs_plane].x ||
+                   y != plane_state->color_plane[ccs_plane].y) {
+                       DRM_DEBUG_KMS("Unable to find suitable display surface offset due to CCS\n");
+                       return -EINVAL;
+               }
+       }
+
+       plane_state->color_plane[uv_plane].offset = offset;
+       plane_state->color_plane[uv_plane].x = x;
+       plane_state->color_plane[uv_plane].y = y;
 
        return 0;
 }
        const struct drm_framebuffer *fb = plane_state->hw.fb;
        int src_x = plane_state->uapi.src.x1 >> 16;
        int src_y = plane_state->uapi.src.y1 >> 16;
-       int hsub;
-       int vsub;
-       int x;
-       int y;
        u32 offset;
+       int ccs_plane;
+
+       for (ccs_plane = 0; ccs_plane < fb->format->num_planes; ccs_plane++) {
+               int main_hsub, main_vsub;
+               int hsub, vsub;
+               int x, y;
 
-       intel_fb_plane_get_subsampling(&hsub, &vsub, fb, 1);
-       x = src_x / hsub;
-       y = src_y / vsub;
-       intel_add_fb_offsets(&x, &y, plane_state, 1);
-       offset = intel_plane_compute_aligned_offset(&x, &y, plane_state, 1);
+               if (!is_ccs_plane(fb, ccs_plane))
+                       continue;
+
+               intel_fb_plane_get_subsampling(&main_hsub, &main_vsub, fb,
+                                              ccs_to_main_plane(fb, ccs_plane));
+               intel_fb_plane_get_subsampling(&hsub, &vsub, fb, ccs_plane);
+
+               hsub *= main_hsub;
+               vsub *= main_vsub;
+               x = src_x / hsub;
+               y = src_y / vsub;
+
+               intel_add_fb_offsets(&x, &y, plane_state, ccs_plane);
 
-       plane_state->color_plane[1].offset = offset;
-       plane_state->color_plane[1].x = x * hsub + src_x % hsub;
-       plane_state->color_plane[1].y = y * vsub + src_y % vsub;
+               offset = intel_plane_compute_aligned_offset(&x, &y,
+                                                           plane_state,
+                                                           ccs_plane);
+
+               plane_state->color_plane[ccs_plane].offset = offset;
+               plane_state->color_plane[ccs_plane].x = (x * hsub +
+                                                        src_x % hsub) /
+                                                       main_hsub;
+               plane_state->color_plane[ccs_plane].y = (y * vsub +
+                                                        src_y % vsub) /
+                                                       main_vsub;
+       }
 
        return 0;
 }
 {
        const struct drm_framebuffer *fb = plane_state->hw.fb;
        int ret;
+       bool needs_aux = false;
 
        ret = intel_plane_compute_gtt(plane_state);
        if (ret)
                return 0;
 
        /*
-        * Handle the AUX surface first since
-        * the main surface setup depends on it.
+        * Handle the AUX surface first since the main surface setup depends on
+        * it.
         */
+       if (is_ccs_modifier(fb->modifier)) {
+               needs_aux = true;
+               ret = skl_check_ccs_aux_surface(plane_state);
+               if (ret)
+                       return ret;
+       }
+
        if (intel_format_info_is_yuv_semiplanar(fb->format,
                                                fb->modifier)) {
+               needs_aux = true;
                ret = skl_check_nv12_aux_surface(plane_state);
                if (ret)
                        return ret;
-       } else if (is_ccs_modifier(fb->modifier)) {
-               ret = skl_check_ccs_aux_surface(plane_state);
-               if (ret)
-                       return ret;
-       } else {
-               plane_state->color_plane[1].offset = ~0xfff;
-               plane_state->color_plane[1].x = 0;
-               plane_state->color_plane[1].y = 0;
+       }
+
+       if (!needs_aux) {
+               int i;
+
+               for (i = 1; i < fb->format->num_planes; i++) {
+                       plane_state->color_plane[i].offset = ~0xfff;
+                       plane_state->color_plane[i].x = 0;
+                       plane_state->color_plane[i].y = 0;
+               }
        }
 
        ret = skl_check_main_surface(plane_state);
                return PLANE_CTL_TILED_Y |
                       PLANE_CTL_RENDER_DECOMPRESSION_ENABLE |
                       PLANE_CTL_CLEAR_COLOR_DISABLE;
+       case I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS:
+               return PLANE_CTL_TILED_Y | PLANE_CTL_MEDIA_DECOMPRESSION_ENABLE;
        case I915_FORMAT_MOD_Yf_TILED:
                return PLANE_CTL_TILED_YF;
        case I915_FORMAT_MOD_Yf_TILED_CCS:
                        fb->modifier = INTEL_GEN(dev_priv) >= 12 ?
                                I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS :
                                I915_FORMAT_MOD_Y_TILED_CCS;
+               else if (val & PLANE_CTL_MEDIA_DECOMPRESSION_ENABLE)
+                       fb->modifier = I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS;
                else
                        fb->modifier = I915_FORMAT_MOD_Y_TILED;
                break;
 
        const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;
        u32 surf_addr = plane_state->color_plane[color_plane].offset;
        u32 stride = skl_plane_stride(plane_state, color_plane);
-       u32 aux_dist = plane_state->color_plane[1].offset - surf_addr;
-       u32 aux_stride = skl_plane_stride(plane_state, 1);
+       const struct drm_framebuffer *fb = plane_state->hw.fb;
+       int aux_plane = intel_main_to_aux_plane(fb, color_plane);
+       u32 aux_dist = plane_state->color_plane[aux_plane].offset - surf_addr;
+       u32 aux_stride = skl_plane_stride(plane_state, aux_plane);
        int crtc_x = plane_state->uapi.dst.x1;
        int crtc_y = plane_state->uapi.dst.y1;
        u32 x = plane_state->color_plane[color_plane].x;
        u32 y = plane_state->color_plane[color_plane].y;
        u32 src_w = drm_rect_width(&plane_state->uapi.src) >> 16;
        u32 src_h = drm_rect_height(&plane_state->uapi.src) >> 16;
-       const struct drm_framebuffer *fb = plane_state->hw.fb;
        u8 alpha = plane_state->hw.alpha >> 8;
        u32 plane_color_ctl = 0;
        unsigned long irqflags;
             fb->modifier == I915_FORMAT_MOD_Yf_TILED ||
             fb->modifier == I915_FORMAT_MOD_Y_TILED_CCS ||
             fb->modifier == I915_FORMAT_MOD_Yf_TILED_CCS ||
-            fb->modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS)) {
+            fb->modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS ||
+            fb->modifier == I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS)) {
                DRM_DEBUG_KMS("Y/Yf tiling not supported in IF-ID mode\n");
                return -EINVAL;
        }
        DRM_FORMAT_MOD_INVALID
 };
 
-static const u64 gen12_plane_format_modifiers_ccs[] = {
+static const u64 gen12_plane_format_modifiers_mc_ccs[] = {
+       I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS,
+       I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS,
+       I915_FORMAT_MOD_Y_TILED,
+       I915_FORMAT_MOD_X_TILED,
+       DRM_FORMAT_MOD_LINEAR,
+       DRM_FORMAT_MOD_INVALID
+};
+
+static const u64 gen12_plane_format_modifiers_rc_ccs[] = {
        I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS,
        I915_FORMAT_MOD_Y_TILED,
        I915_FORMAT_MOD_X_TILED,
        }
 }
 
+static bool gen12_plane_supports_mc_ccs(enum plane_id plane_id)
+{
+       return plane_id < PLANE_SPRITE4;
+}
+
 static bool gen12_plane_format_mod_supported(struct drm_plane *_plane,
                                             u32 format, u64 modifier)
 {
+       struct intel_plane *plane = to_intel_plane(_plane);
+
        switch (modifier) {
+       case I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS:
+               if (!gen12_plane_supports_mc_ccs(plane->id))
+                       return false;
+               /* fall through */
        case DRM_FORMAT_MOD_LINEAR:
        case I915_FORMAT_MOD_X_TILED:
        case I915_FORMAT_MOD_Y_TILED:
                if (is_ccs_modifier(modifier))
                        return true;
                /* fall through */
-       case DRM_FORMAT_RGB565:
-       case DRM_FORMAT_XRGB2101010:
-       case DRM_FORMAT_XBGR2101010:
-       case DRM_FORMAT_ARGB2101010:
-       case DRM_FORMAT_ABGR2101010:
        case DRM_FORMAT_YUYV:
        case DRM_FORMAT_YVYU:
        case DRM_FORMAT_UYVY:
        case DRM_FORMAT_P010:
        case DRM_FORMAT_P012:
        case DRM_FORMAT_P016:
+               if (modifier == I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS)
+                       return true;
+               /* fall through */
+       case DRM_FORMAT_RGB565:
+       case DRM_FORMAT_XRGB2101010:
+       case DRM_FORMAT_XBGR2101010:
+       case DRM_FORMAT_ARGB2101010:
+       case DRM_FORMAT_ABGR2101010:
        case DRM_FORMAT_XVYU2101010:
        case DRM_FORMAT_C8:
        case DRM_FORMAT_XBGR16161616F:
        }
 }
 
+static const u64 *gen12_get_plane_modifiers(enum plane_id plane_id)
+{
+       if (gen12_plane_supports_mc_ccs(plane_id))
+               return gen12_plane_format_modifiers_mc_ccs;
+       else
+               return gen12_plane_format_modifiers_rc_ccs;
+}
+
 static bool skl_plane_has_ccs(struct drm_i915_private *dev_priv,
                              enum pipe pipe, enum plane_id plane_id)
 {
 
        plane->has_ccs = skl_plane_has_ccs(dev_priv, pipe, plane_id);
        if (INTEL_GEN(dev_priv) >= 12) {
-               modifiers = gen12_plane_format_modifiers_ccs;
+               modifiers = gen12_get_plane_modifiers(plane_id);
                plane_funcs = &gen12_plane_funcs;
        } else {
                if (plane->has_ccs)