Add a tiling atttribute to the modifier descriptor, which let's us get the tiling without listing the modifiers twice. Signed-off-by: Imre Deak <imre.deak@xxxxxxxxx> --- drivers/gpu/drm/i915/display/intel_fb.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_fb.c b/drivers/gpu/drm/i915/display/intel_fb.c index 920de857ffa28..c15d17d2983d4 100644 --- a/drivers/gpu/drm/i915/display/intel_fb.c +++ b/drivers/gpu/drm/i915/display/intel_fb.c @@ -116,6 +116,7 @@ const struct intel_modifier_desc { const struct drm_format_info *formats; int format_count; u8 is_linear:1; + u8 tiling; struct { #define INTEL_CCS_RC BIT(0) @@ -134,10 +135,12 @@ const struct intel_modifier_desc { { .id = I915_FORMAT_MOD_X_TILED, .display_versions = DISPLAY_VER_MASK_ALL, + .tiling = I915_TILING_X, }, { .id = I915_FORMAT_MOD_Y_TILED, .display_versions = DISPLAY_VER_MASK(9, 13), + .tiling = I915_TILING_Y, }, { .id = I915_FORMAT_MOD_Yf_TILED, @@ -146,6 +149,7 @@ const struct intel_modifier_desc { { .id = I915_FORMAT_MOD_Y_TILED_CCS, .display_versions = DISPLAY_VER_MASK(9, 11), + .tiling = I915_TILING_Y, .ccs.type = INTEL_CCS_RC, @@ -162,6 +166,7 @@ const struct intel_modifier_desc { { .id = I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS, .display_versions = DISPLAY_VER_MASK(12, 13), + .tiling = I915_TILING_Y, .ccs.type = INTEL_CCS_RC, @@ -170,6 +175,7 @@ const struct intel_modifier_desc { { .id = I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC, .display_versions = DISPLAY_VER_MASK(12, 13), + .tiling = I915_TILING_Y, .ccs.type = INTEL_CCS_RC_CC, @@ -178,6 +184,7 @@ const struct intel_modifier_desc { { .id = I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS, .display_versions = DISPLAY_VER_MASK(12, 13), + .tiling = I915_TILING_Y, .ccs.type = INTEL_CCS_MC, @@ -529,18 +536,7 @@ intel_fb_align_height(const struct drm_framebuffer *fb, static unsigned int intel_fb_modifier_to_tiling(u64 fb_modifier) { - switch (fb_modifier) { - case I915_FORMAT_MOD_X_TILED: - return I915_TILING_X; - 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_RC_CCS_CC: - case I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS: - return I915_TILING_Y; - default: - return I915_TILING_NONE; - } + return lookup_modifier(fb_modifier)->tiling; } unsigned int intel_cursor_alignment(const struct drm_i915_private *i915) -- 2.27.0