All of lore.kernel.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: "Juha-Pekka Heikkila" <juhapekka.heikkila@gmail.com>,
	"Ville Syrjälä" <ville.syrjala@linux.intel.com>
Subject: [Intel-gfx] [PATCH v4 03/11] drm/i915: Add tiling attribute to the modifier descriptor
Date: Wed, 20 Oct 2021 22:51:30 +0300	[thread overview]
Message-ID: <20211020195138.1841242-4-imre.deak@intel.com> (raw)
In-Reply-To: <20211020195138.1841242-1-imre.deak@intel.com>

Add a tiling atttribute to the modifier descriptor, which let's us
get the tiling without listing the modifiers twice.

v1-v2: Unchanged.
v3:
- Initialize .tiling to I915_TILING_NONE explicitly (Ville)
- Move from previous patch lookup_modifier() to here, where it's first
  used.

Cc: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
---
 drivers/gpu/drm/i915/display/intel_fb.c | 31 +++++++++++++++----------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_fb.c b/drivers/gpu/drm/i915/display/intel_fb.c
index 539c23c1c9990..8982cfa7205fe 100644
--- a/drivers/gpu/drm/i915/display/intel_fb.c
+++ b/drivers/gpu/drm/i915/display/intel_fb.c
@@ -120,6 +120,7 @@ struct intel_modifier_desc {
 	.formats = format_list, \
 	.format_count = ARRAY_SIZE(format_list)
 
+	u8 tiling;
 	u8 is_linear:1;
 
 	struct {
@@ -136,6 +137,7 @@ 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,
 
 		.ccs.type = INTEL_CCS_MC,
 
@@ -144,6 +146,7 @@ static const struct intel_modifier_desc intel_modifiers[] = {
 	{
 		.modifier = I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS,
 		.display_ver = { 12, 13 },
+		.tiling = I915_TILING_Y,
 
 		.ccs.type = INTEL_CCS_RC,
 
@@ -152,6 +155,7 @@ static const struct intel_modifier_desc intel_modifiers[] = {
 	{
 		.modifier = I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC,
 		.display_ver = { 12, 13 },
+		.tiling = I915_TILING_Y,
 
 		.ccs.type = INTEL_CCS_RC_CC,
 
@@ -168,6 +172,7 @@ static const struct intel_modifier_desc intel_modifiers[] = {
 	{
 		.modifier = I915_FORMAT_MOD_Y_TILED_CCS,
 		.display_ver = { 9, 11 },
+		.tiling = I915_TILING_Y,
 
 		.ccs.type = INTEL_CCS_RC,
 
@@ -180,14 +185,17 @@ static const struct intel_modifier_desc intel_modifiers[] = {
 	{
 		.modifier = I915_FORMAT_MOD_Y_TILED,
 		.display_ver = { 9, 13 },
+		.tiling = I915_TILING_Y,
 	},
 	{
 		.modifier = I915_FORMAT_MOD_X_TILED,
 		.display_ver = DISPLAY_VER_ALL,
+		.tiling = I915_TILING_X,
 	},
 	{
 		.modifier = DRM_FORMAT_MOD_LINEAR,
 		.display_ver = DISPLAY_VER_ALL,
+		.tiling = I915_TILING_NONE,
 
 		.is_linear = true,
 	},
@@ -204,6 +212,16 @@ static const struct intel_modifier_desc *lookup_modifier_or_null(u64 modifier)
 	return NULL;
 }
 
+static const struct intel_modifier_desc *lookup_modifier(u64 modifier)
+{
+	const struct intel_modifier_desc *md = lookup_modifier_or_null(modifier);
+
+	if (WARN_ON(!md))
+		return &intel_modifiers[0];
+
+	return md;
+}
+
 static const struct drm_format_info *
 lookup_format_info(const struct drm_format_info formats[],
 		   int num_formats, u32 format)
@@ -528,18 +546,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


  parent reply	other threads:[~2021-10-20 19:51 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-20 19:51 [Intel-gfx] [PATCH v4 00/11] drm/i915: Simplify handling of modifiers Imre Deak
2021-10-20 19:51 ` [Intel-gfx] [PATCH v4 01/11] drm/i915: Add a table with a descriptor for all i915 modifiers Imre Deak
2021-10-21 10:14   ` Jani Nikula
2021-10-21 10:49     ` Imre Deak
2021-10-20 19:51 ` [Intel-gfx] [PATCH v4 02/11] drm/i915: Move intel_get_format_info() to intel_fb.c Imre Deak
2021-10-20 19:51 ` Imre Deak [this message]
2021-10-20 19:51 ` [Intel-gfx] [PATCH v4 04/11] drm/i915: Simplify the modifier check for interlaced scanout support Imre Deak
2021-10-20 19:51 ` [Intel-gfx] [PATCH v4 05/11] drm/i915: Unexport is_semiplanar_uv_plane() Imre Deak
2021-10-20 19:51 ` [Intel-gfx] [PATCH v4 06/11] drm/i915: Move intel_format_info_is_yuv_semiplanar() to intel_fb.c Imre Deak
2021-10-20 19:51 ` [Intel-gfx] [PATCH v4 07/11] drm/i915: Add a platform independent way to get the RC CCS CC plane Imre Deak
2021-10-20 19:51 ` [Intel-gfx] [PATCH v4 08/11] drm/i915: Handle CCS CC planes separately from CCS AUX planes Imre Deak
2021-10-20 19:51 ` [Intel-gfx] [PATCH v4 09/11] drm/i915: Add a platform independent way to check for " Imre Deak
2021-10-20 19:51 ` [Intel-gfx] [PATCH v4 10/11] drm/i915: Move is_ccs_modifier() to intel_fb.c Imre Deak
2021-10-20 19:51 ` [Intel-gfx] [PATCH v4 11/11] drm/i915: Add functions to check for RC CCS CC and MC CCS modifiers Imre Deak
2021-10-20 20:22 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Simplify handling of modifiers (rev12) Patchwork
2021-10-20 20:24 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2021-10-20 20:51 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2021-10-21  0:34 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2021-10-21 19:00   ` Imre Deak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211020195138.1841242-4-imre.deak@intel.com \
    --to=imre.deak@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=juhapekka.heikkila@gmail.com \
    --cc=ville.syrjala@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.