[PATCH i-g-t v2 1/4] lib/intel_blt: Add blitter tile to legacy tile id helper

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Wed Mar 6 15:02:16 UTC 2024


Due to differences between supported tilings on newer hardware (xe)
we use for_each_tiling() macro in blitter tests. Assuming these
tilings are also valid for render pipeline we need to convert
them to legacy tilings (I915_TILING_*). Add helper which does
this job allowing to iterate on supported tilings using blitter macros.

Cc: Matthew Auld <matthew.auld at intel.com>
Reviewed-by: Matthew Auld <matthew.auld at intel.com>
Link: https://lore.kernel.org/r/20240305054056.139691-2-zbigniew.kempczynski@intel.com
Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
---
 lib/intel_blt.c | 25 +++++++++++++++++++++++++
 lib/intel_blt.h |  2 ++
 2 files changed, 27 insertions(+)

diff --git a/lib/intel_blt.c b/lib/intel_blt.c
index 3c26faba2d..fe0a45cb8e 100644
--- a/lib/intel_blt.c
+++ b/lib/intel_blt.c
@@ -521,6 +521,31 @@ static int __block_tiling(enum blt_tiling_type tiling)
 	return 0;
 }
 
+/**
+ * blt_tile_to_fb_tile:
+ * @tiling: tiling id
+ *
+ * Returns:
+ * id of tiling introduced in i915 like I915_TILING_* used for example
+ * in render-copy code.
+ */
+int blt_tile_to_fb_tile(enum blt_tiling_type tiling)
+{
+	switch (tiling) {
+	case T_LINEAR: return I915_TILING_NONE;
+	case T_XMAJOR: return I915_TILING_X;
+	case T_YMAJOR: return I915_TILING_Y;
+	case T_TILE4:  return I915_TILING_4;
+	case T_TILE64: return I915_TILING_64;
+	case T_YFMAJOR: return I915_TILING_Yf;
+	default:
+		break;
+	}
+
+	igt_warn("invalid tiling passed: %d\n", tiling);
+	return 0;
+}
+
 /**
  * blt_get_min_stride
  * @width: width in pixels
diff --git a/lib/intel_blt.h b/lib/intel_blt.h
index 077283a088..1f6c713596 100644
--- a/lib/intel_blt.h
+++ b/lib/intel_blt.h
@@ -212,6 +212,8 @@ bool blt_block_copy_supports_compression(int fd);
 bool blt_uses_extended_block_copy(int fd);
 
 const char *blt_tiling_name(enum blt_tiling_type tiling);
+int blt_tile_to_fb_tile(enum blt_tiling_type tiling);
+
 uint32_t blt_get_min_stride(uint32_t width, uint32_t bpp,
 			    enum blt_tiling_type tiling);
 uint32_t blt_get_aligned_height(uint32_t height, uint32_t bpp,
-- 
2.34.1



More information about the igt-dev mailing list