.formats = format_list, \
.format_count = ARRAY_SIZE(format_list)
- u8 tiling;
- u8 is_linear:1;
+ u8 plane_caps;
struct {
-#define INTEL_CCS_RC BIT(0)
-#define INTEL_CCS_RC_CC BIT(1)
-#define INTEL_CCS_MC BIT(2)
-
-#define INTEL_CCS_ANY (INTEL_CCS_RC | INTEL_CCS_RC_CC | INTEL_CCS_MC)
- u8 type:3;
u8 cc_planes:3;
u8 packed_aux_planes:4;
u8 planar_aux_planes:4;
} ccs;
};
+#define INTEL_PLANE_CAP_CCS_MASK (INTEL_PLANE_CAP_CCS_RC | \
+ INTEL_PLANE_CAP_CCS_RC_CC | \
+ INTEL_PLANE_CAP_CCS_MC)
+#define INTEL_PLANE_CAP_TILING_MASK (INTEL_PLANE_CAP_TILING_X | \
+ INTEL_PLANE_CAP_TILING_Y | \
+ INTEL_PLANE_CAP_TILING_Yf)
+#define INTEL_PLANE_CAP_TILING_NONE 0
+
static const struct intel_modifier_desc intel_modifiers[] = {
{
.modifier = I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS,
.display_ver = { 12, 13 },
- .tiling = I915_TILING_Y,
+ .plane_caps = INTEL_PLANE_CAP_TILING_Y | INTEL_PLANE_CAP_CCS_MC,
- .ccs.type = INTEL_CCS_MC,
.ccs.packed_aux_planes = BIT(1),
.ccs.planar_aux_planes = BIT(2) | BIT(3),
}, {
.modifier = I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS,
.display_ver = { 12, 13 },
- .tiling = I915_TILING_Y,
+ .plane_caps = INTEL_PLANE_CAP_TILING_Y | INTEL_PLANE_CAP_CCS_RC,
- .ccs.type = INTEL_CCS_RC,
.ccs.packed_aux_planes = BIT(1),
FORMAT_OVERRIDE(gen12_ccs_formats),
}, {
.modifier = I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC,
.display_ver = { 12, 13 },
- .tiling = I915_TILING_Y,
+ .plane_caps = INTEL_PLANE_CAP_TILING_Y | INTEL_PLANE_CAP_CCS_RC_CC,
- .ccs.type = INTEL_CCS_RC_CC,
.ccs.cc_planes = BIT(2),
.ccs.packed_aux_planes = BIT(1),
}, {
.modifier = I915_FORMAT_MOD_Yf_TILED_CCS,
.display_ver = { 9, 11 },
- .tiling = I915_TILING_NONE,
+ .plane_caps = INTEL_PLANE_CAP_TILING_Yf | INTEL_PLANE_CAP_CCS_RC,
- .ccs.type = INTEL_CCS_RC,
.ccs.packed_aux_planes = BIT(1),
FORMAT_OVERRIDE(skl_ccs_formats),
}, {
.modifier = I915_FORMAT_MOD_Y_TILED_CCS,
.display_ver = { 9, 11 },
- .tiling = I915_TILING_Y,
+ .plane_caps = INTEL_PLANE_CAP_TILING_Y | INTEL_PLANE_CAP_CCS_RC,
- .ccs.type = INTEL_CCS_RC,
.ccs.packed_aux_planes = BIT(1),
FORMAT_OVERRIDE(skl_ccs_formats),
}, {
.modifier = I915_FORMAT_MOD_Yf_TILED,
.display_ver = { 9, 11 },
- .tiling = I915_TILING_NONE,
+ .plane_caps = INTEL_PLANE_CAP_TILING_Yf,
}, {
.modifier = I915_FORMAT_MOD_Y_TILED,
.display_ver = { 9, 13 },
- .tiling = I915_TILING_Y,
+ .plane_caps = INTEL_PLANE_CAP_TILING_Y,
}, {
.modifier = I915_FORMAT_MOD_X_TILED,
.display_ver = DISPLAY_VER_ALL,
- .tiling = I915_TILING_X,
+ .plane_caps = INTEL_PLANE_CAP_TILING_X,
}, {
.modifier = DRM_FORMAT_MOD_LINEAR,
.display_ver = DISPLAY_VER_ALL,
- .tiling = I915_TILING_NONE,
-
- .is_linear = true,
},
};
return lookup_format_info(md->formats, md->format_count, cmd->pixel_format);
}
-static bool is_ccs_type_modifier(const struct intel_modifier_desc *md, u8 ccs_type)
+static bool plane_caps_contain_any(u8 caps, u8 mask)
+{
+ return caps & mask;
+}
+
+static bool plane_caps_contain_all(u8 caps, u8 mask)
{
- return md->ccs.type & ccs_type;
+ return (caps & mask) == mask;
}
/**
*/
bool intel_fb_is_ccs_modifier(u64 modifier)
{
- return is_ccs_type_modifier(lookup_modifier(modifier), INTEL_CCS_ANY);
+ return plane_caps_contain_any(lookup_modifier(modifier)->plane_caps,
+ INTEL_PLANE_CAP_CCS_MASK);
}
/**
*/
bool intel_fb_is_rc_ccs_cc_modifier(u64 modifier)
{
- return is_ccs_type_modifier(lookup_modifier(modifier), INTEL_CCS_RC_CC);
+ return plane_caps_contain_any(lookup_modifier(modifier)->plane_caps,
+ INTEL_PLANE_CAP_CCS_RC_CC);
}
/**
*/
bool intel_fb_is_mc_ccs_modifier(u64 modifier)
{
- return is_ccs_type_modifier(lookup_modifier(modifier), INTEL_CCS_MC);
+ return plane_caps_contain_any(lookup_modifier(modifier)->plane_caps,
+ INTEL_PLANE_CAP_CCS_MC);
}
static bool check_modifier_display_ver_range(const struct intel_modifier_desc *md,
if (!IS_DISPLAY_VER(i915, md->display_ver.from, md->display_ver.until))
return false;
- if (!md->is_linear &&
- !(plane_caps & PLANE_HAS_TILING))
- return false;
-
- if (is_ccs_type_modifier(md, INTEL_CCS_RC | INTEL_CCS_RC_CC) &&
- !(plane_caps & PLANE_HAS_CCS_RC))
- return false;
-
- if (is_ccs_type_modifier(md, INTEL_CCS_MC) &&
- !(plane_caps & PLANE_HAS_CCS_MC))
+ if (!plane_caps_contain_all(plane_caps, md->plane_caps))
return false;
return true;
if (!info->is_yuv)
return false;
- if (is_ccs_type_modifier(md, INTEL_CCS_ANY))
+ if (plane_caps_contain_any(md->plane_caps, INTEL_PLANE_CAP_CCS_MASK))
yuv_planes = 4;
else
yuv_planes = 2;
static unsigned int intel_fb_modifier_to_tiling(u64 fb_modifier)
{
- return lookup_modifier(fb_modifier)->tiling;
+ u8 tiling_caps = lookup_modifier(fb_modifier)->plane_caps &
+ INTEL_PLANE_CAP_TILING_MASK;
+
+ switch (tiling_caps) {
+ case INTEL_PLANE_CAP_TILING_Y:
+ return I915_TILING_Y;
+ case INTEL_PLANE_CAP_TILING_X:
+ return I915_TILING_X;
+ case INTEL_PLANE_CAP_TILING_Yf:
+ case INTEL_PLANE_CAP_TILING_NONE:
+ return I915_TILING_NONE;
+ default:
+ MISSING_CASE(tiling_caps);
+ return I915_TILING_NONE;
+ }
}
unsigned int intel_cursor_alignment(const struct drm_i915_private *i915)
return plane_id < PLANE_SPRITE4;
}
+static u8 skl_get_plane_caps(struct drm_i915_private *i915,
+ enum pipe pipe, enum plane_id plane_id)
+{
+ u8 caps = INTEL_PLANE_CAP_TILING_X;
+
+ if (DISPLAY_VER(i915) < 13 || IS_ALDERLAKE_P(i915))
+ caps |= INTEL_PLANE_CAP_TILING_Y;
+ if (DISPLAY_VER(i915) < 12)
+ caps |= INTEL_PLANE_CAP_TILING_Yf;
+
+ if (skl_plane_has_rc_ccs(i915, pipe, plane_id)) {
+ caps |= INTEL_PLANE_CAP_CCS_RC;
+ if (DISPLAY_VER(i915) >= 12)
+ caps |= INTEL_PLANE_CAP_CCS_RC_CC;
+ }
+
+ if (gen12_plane_has_mc_ccs(i915, plane_id))
+ caps |= INTEL_PLANE_CAP_CCS_MC;
+
+ return caps;
+}
+
struct intel_plane *
skl_universal_plane_create(struct drm_i915_private *dev_priv,
enum pipe pipe, enum plane_id plane_id)
const struct drm_plane_funcs *plane_funcs;
struct intel_plane *plane;
enum drm_plane_type plane_type;
- u8 plane_caps;
unsigned int supported_rotations;
unsigned int supported_csc;
const u64 *modifiers;
else
plane_type = DRM_PLANE_TYPE_OVERLAY;
- plane_caps = PLANE_HAS_TILING;
- if (skl_plane_has_rc_ccs(dev_priv, pipe, plane_id))
- plane_caps |= PLANE_HAS_CCS_RC;
-
- if (gen12_plane_has_mc_ccs(dev_priv, plane_id))
- plane_caps |= PLANE_HAS_CCS_MC;
-
- modifiers = intel_fb_plane_get_modifiers(dev_priv, plane_caps);
+ modifiers = intel_fb_plane_get_modifiers(dev_priv,
+ skl_get_plane_caps(dev_priv, pipe, plane_id));
ret = drm_universal_plane_init(&dev_priv->drm, &plane->base,
0, plane_funcs,