[igt-dev] [PATCH i-g-t v5 2/3] lib/igt_fb.c: Update tile sizes for GEN12 CCS

Mika Kahola mika.kahola at intel.com
Tue Nov 12 11:55:37 UTC 2019


Update tile sizes for GEN12 CCS.

BSpec: 47709

v2: Realign main and aux surfaces (Imre)

Signed-off-by: Mika Kahola <mika.kahola at intel.com>
Reviewed-by: Radhakrishna Sripada <radhakrishna.sripada at intel.com>
---
 lib/igt_fb.c | 77 ++++++++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 66 insertions(+), 11 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 4adca967..be704abf 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -413,23 +413,56 @@ void igt_get_fb_tile_size(int fd, uint64_t modifier, int fb_bpp,
 			*height_ret = 32;
 		}
 		break;
-	case LOCAL_I915_FORMAT_MOD_Yf_TILED:
-	case LOCAL_I915_FORMAT_MOD_Yf_TILED_CCS:
+	case LOCAL_I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS:
 		igt_require_intel(fd);
 		switch (fb_bpp) {
 		case 8:
-			*width_ret = 64;
-			*height_ret = 64;
+			*width_ret = 512;
+			*height_ret = 32;
 			break;
 		case 16:
+			*width_ret = 256;
+			*height_ret = 32;
+			break;
 		case 32:
 			*width_ret = 128;
 			*height_ret = 32;
 			break;
 		case 64:
+			*width_ret = 64;
+			*height_ret = 32;
+			break;
 		case 128:
+			*width_ret = 32;
+			*height_ret = 32;
+			break;
+		default:
+			igt_assert(false);
+		}
+		break;
+	case LOCAL_I915_FORMAT_MOD_Yf_TILED:
+	case LOCAL_I915_FORMAT_MOD_Yf_TILED_CCS:
+		igt_require_intel(fd);
+		switch (fb_bpp) {
+		case 8:
+			*height_ret = 128;
+			*width_ret = 512;
+			break;
+		case 16:
+			*height_ret = 128;
 			*width_ret = 256;
-			*height_ret = 16;
+			break;
+		case 32:
+			*height_ret = 128;
+			*width_ret = 128;
+			break;
+		case 64:
+			*height_ret = 128;
+			*width_ret = 64;
+			break;
+		case 128:
+			*height_ret = 128;
+			*width_ret = 32;
 			break;
 		default:
 			igt_assert(false);
@@ -465,17 +498,26 @@ void igt_get_fb_tile_size(int fd, uint64_t modifier, int fb_bpp,
 	}
 }
 
+
+static bool is_gen12_ccs_modifier(uint64_t modifier)
+{
+	return modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS;
+}
+
 static bool is_ccs_modifier(uint64_t modifier)
 {
-	return modifier == LOCAL_I915_FORMAT_MOD_Y_TILED_CCS ||
-		modifier == LOCAL_I915_FORMAT_MOD_Yf_TILED_CCS;
+
+	return modifier == I915_FORMAT_MOD_Y_TILED_CCS ||
+		modifier == I915_FORMAT_MOD_Yf_TILED_CCS;
 }
 
 static unsigned fb_plane_width(const struct igt_fb *fb, int plane)
 {
 	const struct format_desc_struct *format = lookup_drm_format(fb->drm_format);
 
-	if (is_ccs_modifier(fb->modifier) && plane == 1)
+	if (is_gen12_ccs_modifier(fb->modifier) && plane == 1)
+		return DIV_ROUND_UP(fb->width, 128) * 64;
+	else if (is_ccs_modifier(fb->modifier) && plane == 1)
 		return DIV_ROUND_UP(fb->width, 1024) * 128;
 
 	if (plane == 0)
@@ -488,7 +530,9 @@ static unsigned fb_plane_bpp(const struct igt_fb *fb, int plane)
 {
 	const struct format_desc_struct *format = lookup_drm_format(fb->drm_format);
 
-	if (is_ccs_modifier(fb->modifier) && plane == 1)
+	if (is_gen12_ccs_modifier(fb->modifier) && plane == 1)
+		return 8;
+	else if (is_ccs_modifier(fb->modifier) && plane == 1)
 		return 8;
 	else
 		return format->plane_bpp[plane];
@@ -498,7 +542,9 @@ static unsigned fb_plane_height(const struct igt_fb *fb, int plane)
 {
 	const struct format_desc_struct *format = lookup_drm_format(fb->drm_format);
 
-	if (is_ccs_modifier(fb->modifier) && plane == 1)
+	if (is_gen12_ccs_modifier(fb->modifier) && plane == 1)
+		return DIV_ROUND_UP(fb->height, 128) * 4;
+	else if (is_ccs_modifier(fb->modifier) && plane == 1)
 		return DIV_ROUND_UP(fb->height, 512) * 32;
 
 	if (plane == 0)
@@ -572,6 +618,8 @@ static uint32_t calc_plane_stride(struct igt_fb *fb, int plane)
 		 * so the easiest way is to align the luma stride to 256.
 		 */
 		return ALIGN(min_stride, 256);
+	} else if (is_gen12_ccs_modifier(fb->modifier) && plane == 1) {
+		return ALIGN(min_stride, 64);
 	} else {
 		unsigned int tile_width, tile_height;
 
@@ -687,6 +735,7 @@ uint64_t igt_fb_mod_to_tiling(uint64_t modifier)
 		return I915_TILING_X;
 	case LOCAL_I915_FORMAT_MOD_Y_TILED:
 	case LOCAL_I915_FORMAT_MOD_Y_TILED_CCS:
+	case LOCAL_I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS:
 		return I915_TILING_Y;
 	case LOCAL_I915_FORMAT_MOD_Yf_TILED:
 	case LOCAL_I915_FORMAT_MOD_Yf_TILED_CCS:
@@ -1893,7 +1942,13 @@ static void init_buf(struct fb_blit_upload *blit,
 	buf->bpp = fb->plane_bpp[0];
 	buf->size = fb->size;
 
-	if (is_ccs_modifier(fb->modifier)) {
+	if (is_gen12_ccs_modifier(fb->modifier)) {
+		igt_assert_eq(fb->strides[0] & 127, 0);
+		igt_assert_eq(fb->strides[1] & 63, 0);
+
+		buf->aux.offset = fb->offsets[1];
+		buf->aux.stride = fb->strides[1];
+	} else if (is_ccs_modifier(fb->modifier)) {
 		igt_assert_eq(fb->strides[0] & 127, 0);
 		igt_assert_eq(fb->strides[1] & 127, 0);
 
-- 
2.17.1



More information about the igt-dev mailing list