Skip to contentSkip to conversation

Add Y-tiling support into IGTs

PATCH Superseded Praveen Paneri 3 participants 15 messages Mar 17, 2017 – Apr 27, 2017 Library code

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover Add Y-tiling support into IGTs

This series adds Y-tiled buffer creation support into IGT libraries and goes on to use this capability to add support into FBC tests to use Y-tiled buffers.

Akash Goel (1):
lib/igt_draw: Add Y-tiling support for IGT_DRAW_BLT method

Paulo Zanoni (1):
tests/kms_draw_crc: add support for Y tiling

Praveen Paneri (5):
lib/igt_fb: Let others use igt_get_fb_tile_size lib/igt_fb: Add helper function for tile_to_mod lib/igt_draw: Add Y-tiling support igt/kms_frontbuffer_tracking: Add Y-tiling support igt/kms_fbc_crc.c : Add Y-tile tests

 lib/igt_draw.c                   | 167 ++++++++++++++++++++++++++++-----------
 lib/igt_fb.c                     |  29 ++++++-
 lib/igt_fb.h                     |   4 +-
 tests/kms_draw_crc.c             |  58 ++++++++++----
 tests/kms_fbc_crc.c              |  71 +++++++++--------
 tests/kms_frontbuffer_tracking.c |  46 ++++++-----
 6 files changed, 262 insertions(+), 113 deletions(-)
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH 1/7 lib/igt_fb: Let others use igt_get_fb_tile_size

This function can be used by igt_draw to get accurate tile dimensions for all tile formats.

---
 lib/igt_fb.c | 2 +-
 lib/igt_fb.h | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
lib/igt_fb.c +1 -1
index d2b7e9e..6ecc36b 100644
@@ -74,7 +74,7 @@ static struct format_desc_struct {
 #define for_each_format(f)	\
 	for (f = format_desc; f - format_desc < ARRAY_SIZE(format_desc); f++)
 
-static void igt_get_fb_tile_size(int fd, uint64_t tiling, int fb_bpp,
+void igt_get_fb_tile_size(int fd, uint64_t tiling, int fb_bpp,
 				 unsigned *width_ret, unsigned *height_ret)
 {
 	switch (tiling) {
lib/igt_fb.h +2 -1
index 4a680ce..b178eba 100644
@@ -94,7 +94,8 @@ enum igt_text_align {
 	align_vcenter	= 0x04,
 	align_hcenter	= 0x08,
 };
-
+void igt_get_fb_tile_size(int fd, uint64_t tiling, int fb_bpp,
+			unsigned *width_ret, unsigned *height_ret);
 void igt_calc_fb_size(int fd, int width, int height, int bpp, uint64_t tiling,
 		      unsigned *size_ret, unsigned *stride_ret);
 unsigned int
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

Re: [PATCH 1/7] lib/igt_fb: Let others use igt_get_fb_tile_size

Quoted 14 lines · Praveen Paneri

This function can be used by igt_draw to get accurate tile dimensions for all tile formats.

---
 lib/igt_fb.c | 2 +-
 lib/igt_fb.h | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
lib/igt_fb.c +0 -0
index d2b7e9e..6ecc36b 100644

lib/igt_fb.c static struct format_desc_struct { · line 78

Quoted 6 lines
lib/igt_fb.c +1 -1
@@ -74,7 +74,7 @@ static struct format_desc_struct {
 #define for_each_format(f)	\
 	for (f = format_desc; f - format_desc < ARRAY_SIZE(format_desc); f++)
 
-static void igt_get_fb_tile_size(int fd, uint64_t tiling, int fb_bpp,
+void igt_get_fb_tile_size(int fd, uint64_t tiling, int fb_bpp,
 				 unsigned *width_ret, unsigned *height_ret)

Documentation seems missing here.
-Daniel

Quoted 23 lines
lib/igt_fb.c +0 -0
 {
 	switch (tiling) {
lib/igt_fb.h +2 -1
index 4a680ce..b178eba 100644
@@ -94,7 +94,8 @@ enum igt_text_align {
 	align_vcenter	= 0x04,
 	align_hcenter	= 0x08,
 };
-
+void igt_get_fb_tile_size(int fd, uint64_t tiling, int fb_bpp,
+			unsigned *width_ret, unsigned *height_ret);
 void igt_calc_fb_size(int fd, int width, int height, int bpp, uint64_t tiling,
 		      unsigned *size_ret, unsigned *stride_ret);
 unsigned int
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

Re: [PATCH 1/7] lib/igt_fb: Let others use igt_get_fb_tile_size

Quoted 18 lines · Daniel Vetter
Quoted 17 lines · Praveen Paneri

This function can be used by igt_draw to get accurate tile dimensions for all tile formats.

---
  lib/igt_fb.c | 2 +-
  lib/igt_fb.h | 3 ++-
  2 files changed, 3 insertions(+), 2 deletions(-)
lib/igt_fb.c +0 -0
index d2b7e9e..6ecc36b 100644
@@ -74,7 +74,7 @@ static struct format_desc_struct {
  #define for_each_format(f)	\
  	for (f = format_desc; f - format_desc < ARRAY_SIZE(format_desc); f++)
 
Quoted 6 lines

lib/igt_fb.c static struct format_desc_struct { · line 78

Quoted 3 lines
lib/igt_fb.c +1 -1
-static void igt_get_fb_tile_size(int fd, uint64_t tiling, int fb_bpp,
+void igt_get_fb_tile_size(int fd, uint64_t tiling, int fb_bpp,
  				 unsigned *width_ret, unsigned *height_ret)

Documentation seems missing here.
-Daniel

Sure. I will add it.

Thanks
Praveen

Quoted 20 lines
Quoted 20 lines
lib/igt_fb.c +0 -0
  {
  	switch (tiling) {
lib/igt_fb.h +2 -2
index 4a680ce..b178eba 100644
@@ -94,7 +94,8 @@ enum igt_text_align {
  	align_vcenter	= 0x04,
  	align_hcenter	= 0x08,
  };
-
+void igt_get_fb_tile_size(int fd, uint64_t tiling, int fb_bpp,
+			unsigned *width_ret, unsigned *height_ret);
  void igt_calc_fb_size(int fd, int width, int height, int bpp, uint64_t tiling,
  		      unsigned *size_ret, unsigned *stride_ret);
  unsigned int
--

2.7.4

Quoted 5 lines
Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw

PATCH 2/7 lib/igt_fb: Add helper function for tile_to_mod

In reply to Praveen Paneri

igt_get_fb_tile_size function takes modifer as an argument This helper function will let users to convert tiling to modifier and use igt_get_fb_tile_size()

---
 lib/igt_fb.c | 27 +++++++++++++++++++++++++++
 lib/igt_fb.h |  1 +
 2 files changed, 28 insertions(+)
lib/igt_fb.c +27 -0
index 6ecc36b..31fb918 100644
@@ -206,6 +206,33 @@ uint64_t igt_fb_mod_to_tiling(uint64_t modifier)
 	}
 }
 
+/**
+ * igt_fb_tiling_to_mod:
+ * @tiling: DRM framebuffer tiling
+ *
+ * This function converts a DRM framebuffer tiling to its corresponding
+ * modifier constant.
+ *
+ * Returns:
+ * A tiling constant
+ */
+uint64_t igt_fb_tiling_to_mod(uint64_t tiling)
+{
+	switch (tiling) {
+	case I915_TILING_NONE:
+		return LOCAL_DRM_FORMAT_MOD_NONE;
+	case I915_TILING_X:
+		return LOCAL_I915_FORMAT_MOD_X_TILED;
+	case I915_TILING_Y:
+		return LOCAL_I915_FORMAT_MOD_Y_TILED;
+	case I915_TILING_Yf:
+		return LOCAL_I915_FORMAT_MOD_Yf_TILED;
+	default:
+		igt_assert(0);
+	}
+}
+
+
 /* helpers to create nice-looking framebuffers */
 static int create_bo_for_fb(int fd, int width, int height, uint32_t format,
 			    uint64_t tiling, unsigned size, unsigned stride,
lib/igt_fb.h +1 -0
index b178eba..6972a80 100644
@@ -131,6 +131,7 @@ int igt_create_bo_with_dimensions(int fd, int width, int height, uint32_t format
 				  bool *is_dumb);
 
 uint64_t igt_fb_mod_to_tiling(uint64_t modifier);
+uint64_t igt_fb_tiling_to_mod(uint64_t tiling);
 
 /* cairo-based painting */
 cairo_t *igt_get_cairo_ctx(int fd, struct igt_fb *fb);
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw

PATCH 3/7 lib/igt_draw: Add Y-tiling support

In reply to Praveen Paneri

This patch adds Y-tiling support for igt_draw_rect function.

v2:
Use helper function to get tile sizes (Ville)

---
 lib/igt_draw.c | 132 +++++++++++++++++++++++++++++++++++++--------------------
 1 file changed, 87 insertions(+), 45 deletions(-)
lib/igt_draw.c +87 -45
index 29aec85..fcf8fba 100644
@@ -136,32 +136,47 @@ static int swizzle_addr(int addr, int swizzle)
 
 /* It's all in "pixel coordinates", so make sure you multiply/divide by the bpp
  * if you need to. */
-static int linear_x_y_to_tiled_pos(int x, int y, uint32_t stride, int swizzle,
-				   int bpp)
+static int linear_x_y_to_tiled_pos(int fd, int x, int y, uint32_t stride, int swizzle,
+				   int bpp, int tiling)
 {
-	int x_tile_size, y_tile_size;
-	int x_tile_n, y_tile_n, x_tile_off, y_tile_off;
-	int line_size, tile_size;
+	uint32_t tile_width, tile_height, tile_size;
+	int tile_x, tile_y; /* Co-ordinates of the tile holding the pixel */
+	int tile_x_off, tile_y_off; /* pixel position inside the tile */
 	int tile_n, tile_off;
-	int tiled_pos, tiles_per_line;
+	int line_size, tiles_per_line;
+	int tiled_pos;
 	int pixel_size = bpp / 8;
 
+	igt_get_fb_tile_size(fd, (uint64_t)igt_fb_tiling_to_mod(tiling), bpp,
+			&tile_width, &tile_height);
+
 	line_size = stride;
-	x_tile_size = 512;
-	y_tile_size = 8;
-	tile_size = x_tile_size * y_tile_size;
-	tiles_per_line = line_size / x_tile_size;
+	tile_size = tile_width * tile_height;
+	tiles_per_line = line_size / tile_width;
 
-	y_tile_n = y / y_tile_size;
-	y_tile_off = y % y_tile_size;
+	tile_y = y / tile_height;
+	tile_y_off = y % tile_height;
 
-	x_tile_n = (x * pixel_size) / x_tile_size;
-	x_tile_off = (x * pixel_size) % x_tile_size;
+	tile_x = (x * pixel_size) / tile_width;
+	tile_x_off = (x * pixel_size) % tile_width;
 
-	tile_n = y_tile_n * tiles_per_line + x_tile_n;
-	tile_off = y_tile_off * x_tile_size + x_tile_off;
-	tiled_pos = tile_n * tile_size + tile_off;
+	tile_n = tile_y * tiles_per_line + tile_x;
+
+	if (tiling == I915_TILING_X ) {
+		tile_off = tile_y_off * tile_width + tile_x_off;
+	} else { /* (tiling == I915_TILING_Y ) */
+		int x_oword_n, x_oword_off;
+		int oword_size = 16;
+
+		/* computation inside the tile */
+		x_oword_n = tile_x_off / oword_size;
+		x_oword_off = tile_x_off % oword_size;
+		tile_off = x_oword_n * tile_height * oword_size
+			   + tile_y_off * oword_size
+			   + x_oword_off;
+	}
 
+	tiled_pos = tile_n * tile_size + tile_off;
 	tiled_pos = swizzle_addr(tiled_pos, swizzle);
 
 	return tiled_pos / pixel_size;
@@ -169,34 +184,49 @@ static int linear_x_y_to_tiled_pos(int x, int y, uint32_t stride, int swizzle,
 
 /* It's all in "pixel coordinates", so make sure you multiply/divide by the bpp
  * if you need to. */
-static void tiled_pos_to_x_y_linear(int tiled_pos, uint32_t stride,
-				    int swizzle, int bpp, int *x, int *y)
+static void tiled_pos_to_x_y_linear(int fd, int tiled_pos, uint32_t stride,
+				    int swizzle, int bpp, int *x, int *y,
+				    int tiling)
 {
-	int tile_n, tile_off, tiles_per_line, line_size;
-	int x_tile_off, y_tile_off;
-	int x_tile_n, y_tile_n;
-	int x_tile_size, y_tile_size, tile_size;
+	uint32_t tile_width, tile_height, tile_size;
+	int tile_x, tile_y; /* Co-ordinates of the tile holding the pixel */
+	int tile_x_off, tile_y_off; /* pixel position inside the tile */
+	int tile_n, tile_off;
+	int line_size, tiles_per_line;
 	int pixel_size = bpp / 8;
 
+	igt_get_fb_tile_size(fd, (uint64_t)igt_fb_tiling_to_mod(tiling), bpp,
+                                 &tile_width, &tile_height);
 	tiled_pos = swizzle_addr(tiled_pos, swizzle);
 
 	line_size = stride;
-	x_tile_size = 512;
-	y_tile_size = 8;
-	tile_size = x_tile_size * y_tile_size;
-	tiles_per_line = line_size / x_tile_size;
+	tile_size = tile_width * tile_height;
+	tiles_per_line = line_size / tile_width;
 
 	tile_n = tiled_pos / tile_size;
 	tile_off = tiled_pos % tile_size;
 
-	y_tile_off = tile_off / x_tile_size;
-	x_tile_off = tile_off % x_tile_size;
+	tile_x = tile_n % tiles_per_line;
+	tile_y = tile_n / tiles_per_line;
 
-	x_tile_n = tile_n % tiles_per_line;
-	y_tile_n = tile_n / tiles_per_line;
+	if (tiling == I915_TILING_X ) {
 
-	*x = (x_tile_n * x_tile_size + x_tile_off) / pixel_size;
-	*y = y_tile_n * y_tile_size + y_tile_off;
+		tile_y_off = tile_off / tile_width;
+		tile_x_off = tile_off % tile_width;
+	} else {
+		int x_oword_n, x_oword_off;
+		int oword_size = 16;
+
+		x_oword_n = tile_off / (oword_size * tile_height);
+		x_oword_off = tile_off % oword_size;
+
+		tile_x_off = x_oword_n * oword_size + x_oword_off;
+		tile_y_off = (tile_off - x_oword_n * oword_size * tile_height)
+			     / oword_size;
+	}
+
+	*x = (tile_x * tile_width + tile_x_off) / pixel_size;
+	*y = tile_y * tile_height + tile_y_off;
 }
 
 static void set_pixel(void *_ptr, int index, uint32_t color, int bpp)
@@ -224,15 +254,16 @@ static void draw_rect_ptr_linear(void *ptr, uint32_t stride,
 	}
 }
 
-static void draw_rect_ptr_tiled(void *ptr, uint32_t stride, int swizzle,
-				struct rect *rect, uint32_t color, int bpp)
+static void draw_rect_ptr_tiled(int fd, void *ptr, uint32_t stride, int swizzle,
+				struct rect *rect, uint32_t color, int bpp,
+				int tiling)
 {
 	int x, y, pos;
 
 	for (y = rect->y; y < rect->y + rect->h; y++) {
 		for (x = rect->x; x < rect->x + rect->w; x++) {
-			pos = linear_x_y_to_tiled_pos(x, y, stride, swizzle,
-						      bpp);
+			pos = linear_x_y_to_tiled_pos(fd, x, y, stride, swizzle,
+						      bpp, tiling);
 			set_pixel(ptr, pos, color, bpp);
 		}
 	}
@@ -259,8 +290,12 @@ static void draw_rect_mmap_cpu(int fd, struct buf_data *buf, struct rect *rect,
 		draw_rect_ptr_linear(ptr, buf->stride, rect, color, buf->bpp);
 		break;
 	case I915_TILING_X:
-		draw_rect_ptr_tiled(ptr, buf->stride, swizzle, rect, color,
-				    buf->bpp);
+		draw_rect_ptr_tiled(fd, ptr, buf->stride, swizzle, rect, color,
+				    buf->bpp, tiling);
+		break;
+	case I915_TILING_Y:
+		draw_rect_ptr_tiled(fd, ptr, buf->stride, swizzle, rect, color,
+				    buf->bpp, tiling);
 		break;
 	default:
 		igt_assert(false);
@@ -309,8 +344,12 @@ static void draw_rect_mmap_wc(int fd, struct buf_data *buf, struct rect *rect,
 		draw_rect_ptr_linear(ptr, buf->stride, rect, color, buf->bpp);
 		break;
 	case I915_TILING_X:
-		draw_rect_ptr_tiled(ptr, buf->stride, swizzle, rect, color,
-				    buf->bpp);
+		draw_rect_ptr_tiled(fd, ptr, buf->stride, swizzle, rect, color,
+				    buf->bpp, tiling);
+		break;
+	case I915_TILING_Y:
+		draw_rect_ptr_tiled(fd, ptr, buf->stride, swizzle, rect, color,
+				    buf->bpp, tiling);
 		break;
 	default:
 		igt_assert(false);
@@ -338,7 +377,7 @@ static void draw_rect_pwrite_untiled(int fd, struct buf_data *buf,
 
 static void draw_rect_pwrite_tiled(int fd, struct buf_data *buf,
 				   struct rect *rect, uint32_t color,
-				   uint32_t swizzle)
+				   uint32_t swizzle, int tiling)
 {
 	int i;
 	int tiled_pos, x, y, pixel_size;
@@ -361,8 +400,8 @@ static void draw_rect_pwrite_tiled(int fd, struct buf_data *buf,
 		set_pixel(tmp, i, color, buf->bpp);
 
 	for (tiled_pos = 0; tiled_pos < buf->size; tiled_pos += pixel_size) {
-		tiled_pos_to_x_y_linear(tiled_pos, buf->stride, swizzle,
-					buf->bpp, &x, &y);
+		tiled_pos_to_x_y_linear(fd, tiled_pos, buf->stride, swizzle,
+					buf->bpp, &x, &y, tiling);
 
 		if (x >= rect->x && x < rect->x + rect->w &&
 		    y >= rect->y && y < rect->y + rect->h) {
@@ -399,7 +438,10 @@ static void draw_rect_pwrite(int fd, struct buf_data *buf,
 		draw_rect_pwrite_untiled(fd, buf, rect, color);
 		break;
 	case I915_TILING_X:
-		draw_rect_pwrite_tiled(fd, buf, rect, color, swizzle);
+		draw_rect_pwrite_tiled(fd, buf, rect, color, swizzle, tiling);
+		break;
+	case I915_TILING_Y:
+		draw_rect_pwrite_tiled(fd, buf, rect, color, swizzle, tiling);
 		break;
 	default:
 		igt_assert(false);
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw

PATCH 4/7 lib/igt_draw: Add Y-tiling support for IGT_DRAW_BLT method

In reply to Praveen Paneri

From: Akash Goel <[email protected]>

---
 lib/igt_draw.c | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
lib/igt_draw.c +35 -0
index fcf8fba..17011d8 100644
@@ -31,6 +31,7 @@
 #include "igt_core.h"
 #include "igt_fb.h"
 #include "ioctl_wrappers.h"
+#include "i830_reg.h"
 
 /**
  * SECTION:igt_draw
@@ -487,6 +488,23 @@ static void draw_rect_blt(int fd, struct cmd_data *cmd_data,
 	blt_cmd_tiling = (tiling) ? XY_COLOR_BLT_TILED : 0;
 	pitch = (tiling) ? buf->stride / 4 : buf->stride;
 
+	if (tiling == I915_TILING_Y) {
+		/* To change the tile register, insert an MI_FLUSH_DW followed by an MI_LOAD_REGISTER_IMM */
+		BEGIN_BATCH(4, 0);
+		OUT_BATCH(MI_FLUSH_DW | 2);
+		OUT_BATCH(0x0);
+		OUT_BATCH(0x0);
+		OUT_BATCH(0x0);
+		ADVANCE_BATCH();
+
+		BEGIN_BATCH(4, 0);
+		OUT_BATCH(MI_LOAD_REGISTER_IMM);
+		OUT_BATCH(0x22200); /* BCS_SWCTRL */
+		OUT_BATCH(((0x3 << 16) | 0x3)); /* enable the Y tiling */
+		OUT_BATCH(MI_NOOP);
+		ADVANCE_BATCH();
+	}
+
 	BEGIN_BATCH(6, 1);
 	OUT_BATCH(XY_COLOR_BLT_CMD_NOLEN | XY_COLOR_BLT_WRITE_ALPHA |
 		  XY_COLOR_BLT_WRITE_RGB | blt_cmd_tiling | blt_cmd_len);
@@ -497,6 +515,23 @@ static void draw_rect_blt(int fd, struct cmd_data *cmd_data,
 	OUT_BATCH(color);
 	ADVANCE_BATCH();
 
+	if (tiling == I915_TILING_Y) {
+		/* To change the tile register, insert an MI_FLUSH_DW followed by an MI_LOAD_REGISTER_IMM */
+		BEGIN_BATCH(4, 0);
+		OUT_BATCH(MI_FLUSH_DW | 2);
+		OUT_BATCH(0x0);
+		OUT_BATCH(0x0);
+		OUT_BATCH(0x0);
+		ADVANCE_BATCH();
+
+		BEGIN_BATCH(4, 0);
+		OUT_BATCH(MI_LOAD_REGISTER_IMM);
+		OUT_BATCH(0x22200); /* BCS_SWCTRL */
+		OUT_BATCH((0x3 << 16)); /* Reset back to X-Tiling (default) */
+		OUT_BATCH(MI_NOOP);
+		ADVANCE_BATCH();
+	}
+
 	intel_batchbuffer_flush(batch);
 	intel_batchbuffer_free(batch);
 }
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw

Re: [PATCH 4/7] lib/igt_draw: Add Y-tiling support for IGT_DRAW_BLT method

Em Sáb, 2017-03-18 às 00:45 +0530, Praveen Paneri escreveu:

Quoted 69 lines

From: Akash Goel <[email protected]>

---
 lib/igt_draw.c | 35 +++++++++++++++++++++++++++++++++++

 1 file changed, 35 insertions(+)
lib/igt_draw.c +1 -0
index fcf8fba..17011d8 100644
@@ -31,6 +31,7 @@
  #include "igt_core.h"
  #include "igt_fb.h"
  #include "ioctl_wrappers.h"
+#include "i830_reg.h"


 /**
  * SECTION:igt_draw

lib/igt_draw.c +0 -0
@@ -487,6 +488,23 @@ static void draw_rect_blt(int fd, struct
 cmd_data *cmd_data,
  	blt_cmd_tiling = (tiling) ? XY_COLOR_BLT_TILED : 0;
  	pitch = (tiling) ? buf->stride / 4 : buf->stride;

lib/igt_draw.c +2 -0
+	if (tiling == I915_TILING_Y) {
+		/* To change the tile register, insert an

MI_FLUSH_DW followed by an MI_LOAD_REGISTER_IMM */

lib/igt_draw.c +11 -0
+		BEGIN_BATCH(4, 0);
+		OUT_BATCH(MI_FLUSH_DW | 2);
+		OUT_BATCH(0x0);
+		OUT_BATCH(0x0);
+		OUT_BATCH(0x0);
+		ADVANCE_BATCH();
+
+		BEGIN_BATCH(4, 0);
+		OUT_BATCH(MI_LOAD_REGISTER_IMM);
+		OUT_BATCH(0x22200); /* BCS_SWCTRL */
+		OUT_BATCH(((0x3 << 16) | 0x3)); /* enable the Y

tiling */

lib/igt_draw.c +4 -0
+		OUT_BATCH(MI_NOOP);
+		ADVANCE_BATCH();
+	}
+

  BEGIN_BATCH(6, 1); OUT_BATCH(XY_COLOR_BLT_CMD_NOLEN | XY_COLOR_BLT_WRITE_ALPHA |
    XY_COLOR_BLT_WRITE_RGB | blt_cmd_tiling | blt_cmd_len);

lib/igt_draw.c +0 -0
@@ -497,6 +515,23 @@ static void draw_rect_blt(int fd, struct
 cmd_data *cmd_data,
  	OUT_BATCH(color);
  	ADVANCE_BATCH();

lib/igt_draw.c +2 -0
+	if (tiling == I915_TILING_Y) {
+		/* To change the tile register, insert an

MI_FLUSH_DW followed by an MI_LOAD_REGISTER_IMM */

lib/igt_draw.c +11 -0
+		BEGIN_BATCH(4, 0);
+		OUT_BATCH(MI_FLUSH_DW | 2);
+		OUT_BATCH(0x0);
+		OUT_BATCH(0x0);
+		OUT_BATCH(0x0);
+		ADVANCE_BATCH();
+
+		BEGIN_BATCH(4, 0);
+		OUT_BATCH(MI_LOAD_REGISTER_IMM);
+		OUT_BATCH(0x22200); /* BCS_SWCTRL */
+		OUT_BATCH((0x3 << 16)); /* Reset back to X-Tiling

(default) */

lib/igt_draw.c static void draw_rect_blt(int fd, struct cmd_data *cmd_data, · line 506

Quoted 3 lines
lib/igt_draw.c +3 -0
+		OUT_BATCH(MI_NOOP);
+		ADVANCE_BATCH();
+	}

These are two almost identical copies of the same code. Please extract them to a function that takes the tiling as the argument.

Quoted 4 lines

+
  intel_batchbuffer_flush(batch);
  intel_batchbuffer_free(batch);
 }

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#8 lore raw

PATCH 5/7 tests/kms_draw_crc: add support for Y tiling

In reply to Praveen Paneri

From: Paulo Zanoni <[email protected]>

This is the program that's supposed to test lib/igt_draw. We just added Y tiling support for the library, so add the tests now.

---
 tests/kms_draw_crc.c | 58 ++++++++++++++++++++++++++++++++++++++--------------
 1 file changed, 43 insertions(+), 15 deletions(-)
tests/kms_draw_crc.c +43 -15
index e163981..d434c56 100644
@@ -47,6 +47,13 @@ static const uint32_t formats[N_FORMATS] = {
 	DRM_FORMAT_XRGB2101010,
 };
 
+#define N_TILING_METHODS 3
+static const uint64_t tilings[N_TILING_METHODS] = {
+	LOCAL_DRM_FORMAT_MOD_NONE,
+	LOCAL_I915_FORMAT_MOD_X_TILED,
+	LOCAL_I915_FORMAT_MOD_Y_TILED,
+};
+
 struct base_crc {
 	bool set;
 	igt_crc_t crc;
@@ -151,6 +158,11 @@ static void draw_method_subtest(enum igt_draw_method method,
 {
 	igt_crc_t crc;
 
+	if (tiling == LOCAL_I915_FORMAT_MOD_Y_TILED)
+		igt_require(intel_gen(intel_get_drm_devid(drm_fd)) >= 9);
+
+	kmstest_unset_all_crtcs(drm_fd, drm_res);
+
 	/* Use IGT_DRAW_MMAP_GTT on an untiled buffer as the parameter for
 	 * comparison. Cache the value so we don't recompute it for every single
 	 * subtest. */
@@ -208,6 +220,12 @@ static void fill_fb_subtest(void)
 	get_fill_crc(LOCAL_I915_FORMAT_MOD_X_TILED, &crc);
 	igt_assert_crc_equal(&crc, &base_crc);
 
+	if (intel_gen(intel_get_drm_devid(drm_fd)) >= 9) {
+		get_fill_crc(LOCAL_I915_FORMAT_MOD_Y_TILED, &crc);
+		igt_assert_crc_equal(&crc, &base_crc);
+	}
+
+	kmstest_unset_all_crtcs(drm_fd, drm_res);
 	igt_remove_fb(drm_fd, &fb);
 }
 
@@ -265,28 +283,38 @@ static const char *format_str(int format_index)
 	}
 }
 
+static const char *tiling_str(int tiling_index)
+{
+	switch (tilings[tiling_index]) {
+	case LOCAL_DRM_FORMAT_MOD_NONE:
+		return "untiled";
+	case LOCAL_I915_FORMAT_MOD_X_TILED:
+		return "xtiled";
+	case LOCAL_I915_FORMAT_MOD_Y_TILED:
+		return "ytiled";
+	default:
+		igt_assert(false);
+	}
+}
+
 igt_main
 {
 	enum igt_draw_method method;
-	int format_index;
+	int format_idx, tiling_idx;
 
 	igt_fixture
 		setup_environment();
 
-	for (format_index = 0; format_index < N_FORMATS; format_index++) {
-		for (method = 0; method < IGT_DRAW_METHOD_COUNT; method++) {
-			igt_subtest_f("draw-method-%s-%s-untiled",
-				      format_str(format_index),
-				      igt_draw_get_method_name(method))
-				draw_method_subtest(method, format_index,
-						    LOCAL_DRM_FORMAT_MOD_NONE);
-			igt_subtest_f("draw-method-%s-%s-tiled",
-				      format_str(format_index),
-				      igt_draw_get_method_name(method))
-				draw_method_subtest(method, format_index,
-						LOCAL_I915_FORMAT_MOD_X_TILED);
-		}
-	}
+	for (format_idx = 0; format_idx < N_FORMATS; format_idx++) {
+	for (method = 0; method < IGT_DRAW_METHOD_COUNT; method++) {
+	for (tiling_idx = 0; tiling_idx < N_TILING_METHODS; tiling_idx++) {
+		igt_subtest_f("draw-method-%s-%s-%s",
+			      format_str(format_idx),
+			      igt_draw_get_method_name(method),
+			      tiling_str(tiling_idx))
+			draw_method_subtest(method, format_idx,
+					    tilings[tiling_idx]);
+	} } }
 
 	igt_subtest("fill-fb")
 		fill_fb_subtest();
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#9 lore raw

PATCH 6/7 igt/kms_frontbuffer_tracking: Add Y-tiling support

In reply to Praveen Paneri

Allow tests to create Y-tiled bufferes using a separate argument to the test without increasing the number of subtests.

---
 tests/kms_frontbuffer_tracking.c | 46 +++++++++++++++++++++++-----------------
 1 file changed, 27 insertions(+), 19 deletions(-)
tests/kms_frontbuffer_tracking.c +27 -19
index 03c7710..0597f10 100644
@@ -250,6 +250,7 @@ struct {
 	int only_pipes;
 	int shared_fb_x_offset;
 	int shared_fb_y_offset;
+	uint64_t tiling;
 } opt = {
 	.check_status = true,
 	.check_crc = true,
@@ -262,6 +263,7 @@ struct {
 	.only_pipes = PIPE_COUNT,
 	.shared_fb_x_offset = 500,
 	.shared_fb_y_offset = 500,
+	.tiling = LOCAL_I915_FORMAT_MOD_X_TILED,
 };
 
 struct modeset_params {
@@ -576,7 +578,7 @@ static void create_fb(enum pixel_format pformat, int width, int height,
 	if (plane == PLANE_CUR)
 		tiling_for_size = LOCAL_DRM_FORMAT_MOD_NONE;
 	else
-		tiling_for_size = LOCAL_I915_FORMAT_MOD_X_TILED;
+		tiling_for_size = opt.tiling;
 
 	igt_calc_fb_size(drm.fd, width, height, bpp, tiling_for_size, &size,
 			 &stride);
@@ -708,7 +710,7 @@ static void create_shared_fb(enum pixel_format format)
 
 	big_h = prim_h + scnd_h + offs_h + opt.shared_fb_y_offset;
 
-	create_fb(format, big_w, big_h, LOCAL_I915_FORMAT_MOD_X_TILED,
+	create_fb(format, big_w, big_h, opt.tiling,
 		  PLANE_PRI, &s->big);
 }
 
@@ -742,16 +744,16 @@ static void create_fbs(enum pixel_format format)
 
 	create_fb(format, prim_mode_params.mode->hdisplay,
 		  prim_mode_params.mode->vdisplay,
-		  LOCAL_I915_FORMAT_MOD_X_TILED, PLANE_PRI, &s->prim_pri);
+		  opt.tiling, PLANE_PRI, &s->prim_pri);
 	create_fb(format, prim_mode_params.cursor.w,
 		  prim_mode_params.cursor.h, LOCAL_DRM_FORMAT_MOD_NONE,
 		  PLANE_CUR, &s->prim_cur);
 	create_fb(format, prim_mode_params.sprite.w,
-		  prim_mode_params.sprite.h, LOCAL_I915_FORMAT_MOD_X_TILED,
+		  prim_mode_params.sprite.h, opt.tiling,
 		  PLANE_SPR, &s->prim_spr);
 
 	create_fb(format, offscreen_fb.w, offscreen_fb.h,
-		  LOCAL_I915_FORMAT_MOD_X_TILED, PLANE_PRI, &s->offscreen);
+		  opt.tiling, PLANE_PRI, &s->offscreen);
 
 	create_shared_fb(format);
 
@@ -760,11 +762,11 @@ static void create_fbs(enum pixel_format format)
 
 	create_fb(format, scnd_mode_params.mode->hdisplay,
 		  scnd_mode_params.mode->vdisplay,
-		  LOCAL_I915_FORMAT_MOD_X_TILED, PLANE_PRI, &s->scnd_pri);
+		  opt.tiling, PLANE_PRI, &s->scnd_pri);
 	create_fb(format, scnd_mode_params.cursor.w, scnd_mode_params.cursor.h,
 		  LOCAL_DRM_FORMAT_MOD_NONE, PLANE_CUR, &s->scnd_cur);
 	create_fb(format, scnd_mode_params.sprite.w, scnd_mode_params.sprite.h,
-		  LOCAL_I915_FORMAT_MOD_X_TILED, PLANE_SPR, &s->scnd_spr);
+		  opt.tiling, PLANE_SPR, &s->scnd_spr);
 }
 
 static bool set_mode_for_params(struct modeset_params *params)
@@ -1241,7 +1243,7 @@ static void init_blue_crc(enum pixel_format format, bool mandatory_sink_crc)
 
 	create_fb(format, prim_mode_params.mode->hdisplay,
 		  prim_mode_params.mode->vdisplay,
-		  LOCAL_I915_FORMAT_MOD_X_TILED, PLANE_PRI, &blue);
+		  opt.tiling, PLANE_PRI, &blue);
 
 	fill_fb(&blue, COLOR_PRIM_BG);
 
@@ -1276,7 +1278,7 @@ static void init_crcs(enum pixel_format format,
 	for (r = 0; r < pattern->n_rects; r++)
 		create_fb(format, prim_mode_params.mode->hdisplay,
 			  prim_mode_params.mode->vdisplay,
-			  LOCAL_I915_FORMAT_MOD_X_TILED, PLANE_PRI, &tmp_fbs[r]);
+			  opt.tiling, PLANE_PRI, &tmp_fbs[r]);
 
 	for (r = 0; r < pattern->n_rects; r++)
 		fill_fb(&tmp_fbs[r], COLOR_PRIM_BG);
@@ -2374,7 +2376,7 @@ static void flip_subtest(const struct test_mode *t)
 	prepare_subtest(t, pattern);
 
 	create_fb(t->format, params->fb.fb->width, params->fb.fb->height,
-		  LOCAL_I915_FORMAT_MOD_X_TILED, t->plane, &fb2);
+		  opt.tiling, t->plane, &fb2);
 	fill_fb(&fb2, bg_color);
 	orig_fb = params->fb.fb;
 
@@ -2420,7 +2422,7 @@ static void fliptrack_subtest(const struct test_mode *t, enum flip_type type)
 	prepare_subtest(t, pattern);
 
 	create_fb(t->format, params->fb.fb->width, params->fb.fb->height,
-		  LOCAL_I915_FORMAT_MOD_X_TILED, t->plane, &fb2);
+		  opt.tiling, t->plane, &fb2);
 	fill_fb(&fb2, COLOR_PRIM_BG);
 	orig_fb = params->fb.fb;
 
@@ -2631,7 +2633,7 @@ static void fullscreen_plane_subtest(const struct test_mode *t)
 	prepare_subtest(t, pattern);
 
 	rect = pattern->get_rect(&params->fb, 0);
-	create_fb(t->format, rect.w, rect.h, LOCAL_I915_FORMAT_MOD_X_TILED,
+	create_fb(t->format, rect.w, rect.h, opt.tiling,
 		  t->plane, &fullscreen_fb);
 	/* Call pick_color() again since PRI and SPR may not support the same
 	 * pixel formats. */
@@ -2710,7 +2712,7 @@ static void scaledprimary_subtest(const struct test_mode *t)
 	old_fb = params->fb.fb;
 
 	create_fb(t->format, params->fb.fb->width, params->fb.fb->height,
-		  LOCAL_I915_FORMAT_MOD_X_TILED,
+		  opt.tiling,
 		  t->plane, &new_fb);
 	fill_fb(&new_fb, COLOR_BLUE);
 
@@ -2820,7 +2822,7 @@ static void modesetfrombusy_subtest(const struct test_mode *t)
 	prepare_subtest(t, NULL);
 
 	create_fb(t->format, params->fb.fb->width, params->fb.fb->height,
-		  LOCAL_I915_FORMAT_MOD_X_TILED, t->plane, &fb2);
+		  opt.tiling, t->plane, &fb2);
 	fill_fb(&fb2, COLOR_PRIM_BG);
 
 	start_busy_thread(params->fb.fb);
@@ -2925,7 +2927,7 @@ static void farfromfence_subtest(const struct test_mode *t)
 	target = pick_target(t, params);
 
 	create_fb(t->format, params->mode->hdisplay, max_height,
-		  LOCAL_I915_FORMAT_MOD_X_TILED, t->plane, &tall_fb);
+		  opt.tiling, t->plane, &tall_fb);
 
 	fill_fb(&tall_fb, COLOR_PRIM_BG);
 
@@ -3000,7 +3002,7 @@ static void badstride_subtest(const struct test_mode *t)
 	old_fb = params->fb.fb;
 
 	create_fb(t->format, params->fb.fb->width + 4096, params->fb.fb->height,
-		  LOCAL_I915_FORMAT_MOD_X_TILED, t->plane, &wide_fb);
+		  opt.tiling, t->plane, &wide_fb);
 	igt_assert(wide_fb.stride > 16384);
 
 	fill_fb(&wide_fb, COLOR_PRIM_BG);
@@ -3067,7 +3069,7 @@ static void stridechange_subtest(const struct test_mode *t)
 	old_fb = params->fb.fb;
 
 	create_fb(t->format, params->fb.fb->width + 512, params->fb.fb->height,
-		  LOCAL_I915_FORMAT_MOD_X_TILED, t->plane, &new_fb);
+		  opt.tiling, t->plane, &new_fb);
 	fill_fb(&new_fb, COLOR_PRIM_BG);
 
 	igt_assert(old_fb->stride != new_fb.stride);
@@ -3186,7 +3188,7 @@ static void basic_subtest(const struct test_mode *t)
 	prepare_subtest(t, pattern);
 
 	create_fb(t->format, params->fb.fb->width, params->fb.fb->height,
-		  LOCAL_I915_FORMAT_MOD_X_TILED, t->plane, &fb2);
+		  opt.tiling, t->plane, &fb2);
 	fb1 = params->fb.fb;
 
 	for (r = 0, method = 0; method < IGT_DRAW_METHOD_COUNT; method++, r++) {
@@ -3255,6 +3257,10 @@ static int opt_handler(int option, int option_index, void *data)
 		igt_assert_eq(opt.only_pipes, PIPE_COUNT);
 		opt.only_pipes = PIPE_DUAL;
 		break;
+	case 'l':
+		igt_assert_eq(strtol(optarg, NULL, 0), I915_TILING_Y);
+		opt.tiling = igt_fb_tiling_to_mod((uint64_t)strtol(optarg, NULL, 0));
+		break;
 	default:
 		igt_assert(false);
 	}
@@ -3274,7 +3280,8 @@ const char *help_str =
 "  --shared-fb-x offset        Use 'offset' as the X offset for the shared FB\n"
 "  --shared-fb-y offset        Use 'offset' as the Y offset for the shared FB\n"
 "  --1p-only                   Only run subtests that use 1 pipe\n"
-"  --2p-only                   Only run subtests that use 2 pipes\n";
+"  --2p-only                   Only run subtests that use 2 pipes\n"
+"  --tiling		       give 2 for y-tiled, default is x-tiled\n";
 
 static const char *pipes_str(int pipes)
 {
@@ -3413,6 +3420,7 @@ int main(int argc, char *argv[])
 		{ "shared-fb-y",              1, 0, 'y'},
 		{ "1p-only",                  0, 0, '1'},
 		{ "2p-only",                  0, 0, '2'},
+		{ "tiling",                   1, 0, 'l'},
 		{ 0, 0, 0, 0 }
 	};
 
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#10 lore raw

Re: [PATCH 6/7] igt/kms_frontbuffer_tracking: Add Y-tiling support

Em Sáb, 2017-03-18 às 00:45 +0530, Praveen Paneri escreveu:

Quoted 221 lines

Allow tests to create Y-tiled bufferes using a separate argument to the test without increasing the number of subtests.

---
 tests/kms_frontbuffer_tracking.c | 46 +++++++++++++++++++++++-------
----------

 1 file changed, 27 insertions(+), 19 deletions(-)
tests/kms_frontbuffer_tracking.c +2 -0
index 03c7710..0597f10 100644
@@ -250,6 +250,7 @@ struct {
  	int only_pipes;
  	int shared_fb_x_offset;
  	int shared_fb_y_offset;
+	uint64_t tiling;
  } opt = {
  	.check_status = true,
  	.check_crc = true,
@@ -262,6 +263,7 @@ struct {
  	.only_pipes = PIPE_COUNT,
  	.shared_fb_x_offset = 500,
  	.shared_fb_y_offset = 500,
+	.tiling = LOCAL_I915_FORMAT_MOD_X_TILED,
  };


 struct modeset_params {

tests/kms_frontbuffer_tracking.c +0 -0
@@ -576,7 +578,7 @@ static void create_fb(enum pixel_format pformat,
 int width, int height,
  	if (plane == PLANE_CUR)
  		tiling_for_size = LOCAL_DRM_FORMAT_MOD_NONE;

  else

tests/kms_frontbuffer_tracking.c +1 -1
-		tiling_for_size = LOCAL_I915_FORMAT_MOD_X_TILED;
+		tiling_for_size = opt.tiling;


  igt_calc_fb_size(drm.fd, width, height, bpp, tiling_for_size, &size,
   &stride);

tests/kms_frontbuffer_tracking.c +0 -0
@@ -708,7 +710,7 @@ static void create_shared_fb(enum pixel_format
 format)


  big_h = prim_h + scnd_h + offs_h + opt.shared_fb_y_offset;

tests/kms_frontbuffer_tracking.c +0 -1
-	create_fb(format, big_w, big_h,

LOCAL_I915_FORMAT_MOD_X_TILED,

tests/kms_frontbuffer_tracking.c +1 -0
+	create_fb(format, big_w, big_h, opt.tiling,

    PLANE_PRI, &s->big);
 }

tests/kms_frontbuffer_tracking.c +0 -0
@@ -742,16 +744,16 @@ static void create_fbs(enum pixel_format
 format)


  create_fb(format, prim_mode_params.mode->hdisplay, prim_mode_params.mode->vdisplay,

tests/kms_frontbuffer_tracking.c +0 -1
-		  LOCAL_I915_FORMAT_MOD_X_TILED, PLANE_PRI, &s-
Quoted 1 line

prim_pri);

tests/kms_frontbuffer_tracking.c +1 -0
+		  opt.tiling, PLANE_PRI, &s->prim_pri);

  create_fb(format, prim_mode_params.cursor.w, prim_mode_params.cursor.h, LOCAL_DRM_FORMAT_MOD_NONE,
    PLANE_CUR, &s->prim_cur); create_fb(format, prim_mode_params.sprite.w,

tests/kms_frontbuffer_tracking.c +0 -1
-		  prim_mode_params.sprite.h,

LOCAL_I915_FORMAT_MOD_X_TILED,

tests/kms_frontbuffer_tracking.c +1 -0
+		  prim_mode_params.sprite.h, opt.tiling,

    PLANE_SPR, &s->prim_spr);

  create_fb(format, offscreen_fb.w, offscreen_fb.h,

tests/kms_frontbuffer_tracking.c +0 -1
-		  LOCAL_I915_FORMAT_MOD_X_TILED, PLANE_PRI, &s-
Quoted 1 line

offscreen);

tests/kms_frontbuffer_tracking.c +1 -0
+		  opt.tiling, PLANE_PRI, &s->offscreen);


  create_shared_fb(format);

tests/kms_frontbuffer_tracking.c +0 -0
@@ -760,11 +762,11 @@ static void create_fbs(enum pixel_format
 format)


  create_fb(format, scnd_mode_params.mode->hdisplay, scnd_mode_params.mode->vdisplay,

tests/kms_frontbuffer_tracking.c +0 -1
-		  LOCAL_I915_FORMAT_MOD_X_TILED, PLANE_PRI, &s-
Quoted 1 line

scnd_pri);

tests/kms_frontbuffer_tracking.c +1 -0
+		  opt.tiling, PLANE_PRI, &s->scnd_pri);

  create_fb(format, scnd_mode_params.cursor.w, scnd_mode_params.cursor.h, LOCAL_DRM_FORMAT_MOD_NONE, PLANE_CUR, &s-

Quoted 1 line

scnd_cur);

  create_fb(format, scnd_mode_params.sprite.w, scnd_mode_params.sprite.h,

tests/kms_frontbuffer_tracking.c +0 -1
-		  LOCAL_I915_FORMAT_MOD_X_TILED, PLANE_SPR, &s-
Quoted 1 line

scnd_spr);

tests/kms_frontbuffer_tracking.c +1 -0
+		  opt.tiling, PLANE_SPR, &s->scnd_spr);

 }

 static bool set_mode_for_params(struct modeset_params *params)

tests/kms_frontbuffer_tracking.c +0 -0
@@ -1241,7 +1243,7 @@ static void init_blue_crc(enum pixel_format
 format, bool mandatory_sink_crc)


  create_fb(format, prim_mode_params.mode->hdisplay, prim_mode_params.mode->vdisplay,

tests/kms_frontbuffer_tracking.c +1 -1
-		  LOCAL_I915_FORMAT_MOD_X_TILED, PLANE_PRI, &blue);
+		  opt.tiling, PLANE_PRI, &blue);


  fill_fb(&blue, COLOR_PRIM_BG);

tests/kms_frontbuffer_tracking.c +1 -1
@@ -1276,7 +1278,7 @@ static void init_crcs(enum pixel_format format,
  	for (r = 0; r < pattern->n_rects; r++)
  		create_fb(format, prim_mode_params.mode->hdisplay,
  			  prim_mode_params.mode->vdisplay,
-			  LOCAL_I915_FORMAT_MOD_X_TILED, PLANE_PRI,
 &tmp_fbs[r]);
+			  opt.tiling, PLANE_PRI, &tmp_fbs[r]);


  for (r = 0; r < pattern->n_rects; r++) fill_fb(&tmp_fbs[r], COLOR_PRIM_BG);

tests/kms_frontbuffer_tracking.c +0 -0
@@ -2374,7 +2376,7 @@ static void flip_subtest(const struct test_mode
 *t)
  	prepare_subtest(t, pattern);


  create_fb(t->format, params->fb.fb->width, params->fb.fb-

Quoted 1 line

height,

tests/kms_frontbuffer_tracking.c +1 -1
-		  LOCAL_I915_FORMAT_MOD_X_TILED, t->plane, &fb2);
+		  opt.tiling, t->plane, &fb2);

  fill_fb(&fb2, bg_color);
  orig_fb = params->fb.fb;

tests/kms_frontbuffer_tracking.c +0 -0
@@ -2420,7 +2422,7 @@ static void fliptrack_subtest(const struct
 test_mode *t, enum flip_type type)
  	prepare_subtest(t, pattern);


  create_fb(t->format, params->fb.fb->width, params->fb.fb-

Quoted 1 line

height,

tests/kms_frontbuffer_tracking.c +1 -1
-		  LOCAL_I915_FORMAT_MOD_X_TILED, t->plane, &fb2);
+		  opt.tiling, t->plane, &fb2);

  fill_fb(&fb2, COLOR_PRIM_BG);
  orig_fb = params->fb.fb;

tests/kms_frontbuffer_tracking.c +0 -0
@@ -2631,7 +2633,7 @@ static void fullscreen_plane_subtest(const
 struct test_mode *t)
  	prepare_subtest(t, pattern);


  rect = pattern->get_rect(&params->fb, 0);

tests/kms_frontbuffer_tracking.c +0 -1
-	create_fb(t->format, rect.w, rect.h,

LOCAL_I915_FORMAT_MOD_X_TILED,

tests/kms_frontbuffer_tracking.c +1 -0
+	create_fb(t->format, rect.w, rect.h, opt.tiling,

    t->plane, &fullscreen_fb);
  /* Call pick_color() again since PRI and SPR may not support the same
   * pixel formats. */

tests/kms_frontbuffer_tracking.c +0 -0
@@ -2710,7 +2712,7 @@ static void scaledprimary_subtest(const struct
 test_mode *t)
  	old_fb = params->fb.fb;


  create_fb(t->format, params->fb.fb->width, params->fb.fb-

Quoted 1 line

height,

tests/kms_frontbuffer_tracking.c +1 -1
-		  LOCAL_I915_FORMAT_MOD_X_TILED,
+		  opt.tiling,

    t->plane, &new_fb);
  fill_fb(&new_fb, COLOR_BLUE);

tests/kms_frontbuffer_tracking.c +0 -0
@@ -2820,7 +2822,7 @@ static void modesetfrombusy_subtest(const
 struct test_mode *t)
  	prepare_subtest(t, NULL);


  create_fb(t->format, params->fb.fb->width, params->fb.fb-

Quoted 1 line

height,

tests/kms_frontbuffer_tracking.c +1 -1
-		  LOCAL_I915_FORMAT_MOD_X_TILED, t->plane, &fb2);
+		  opt.tiling, t->plane, &fb2);

  fill_fb(&fb2, COLOR_PRIM_BG);

  start_busy_thread(params->fb.fb);

tests/kms_frontbuffer_tracking.c +0 -0
@@ -2925,7 +2927,7 @@ static void farfromfence_subtest(const struct
 test_mode *t)
  	target = pick_target(t, params);


  create_fb(t->format, params->mode->hdisplay, max_height,

tests/kms_frontbuffer_tracking.c +0 -1
-		  LOCAL_I915_FORMAT_MOD_X_TILED, t->plane,

&tall_fb);

tests/kms_frontbuffer_tracking.c +1 -0
+		  opt.tiling, t->plane, &tall_fb);


  fill_fb(&tall_fb, COLOR_PRIM_BG);

tests/kms_frontbuffer_tracking.c +0 -0
@@ -3000,7 +3002,7 @@ static void badstride_subtest(const struct
 test_mode *t)
  	old_fb = params->fb.fb;


  create_fb(t->format, params->fb.fb->width + 4096, params-

Quoted 1 line

fb.fb->height,

tests/kms_frontbuffer_tracking.c +0 -1
-		  LOCAL_I915_FORMAT_MOD_X_TILED, t->plane,

&wide_fb);

tests/kms_frontbuffer_tracking.c +1 -0
+		  opt.tiling, t->plane, &wide_fb);

  igt_assert(wide_fb.stride > 16384);

  fill_fb(&wide_fb, COLOR_PRIM_BG);

tests/kms_frontbuffer_tracking.c +0 -0
@@ -3067,7 +3069,7 @@ static void stridechange_subtest(const struct
 test_mode *t)
  	old_fb = params->fb.fb;


  create_fb(t->format, params->fb.fb->width + 512, params-

Quoted 1 line

fb.fb->height,

tests/kms_frontbuffer_tracking.c +1 -1
-		  LOCAL_I915_FORMAT_MOD_X_TILED, t->plane, &new_fb);
+		  opt.tiling, t->plane, &new_fb);

  fill_fb(&new_fb, COLOR_PRIM_BG);

  igt_assert(old_fb->stride != new_fb.stride);

tests/kms_frontbuffer_tracking.c +0 -0
@@ -3186,7 +3188,7 @@ static void basic_subtest(const struct
 test_mode *t)
  	prepare_subtest(t, pattern);


  create_fb(t->format, params->fb.fb->width, params->fb.fb-

Quoted 1 line

height,

tests/kms_frontbuffer_tracking.c +1 -1
-		  LOCAL_I915_FORMAT_MOD_X_TILED, t->plane, &fb2);
+		  opt.tiling, t->plane, &fb2);

  fb1 = params->fb.fb;

  for (r = 0, method = 0; method < IGT_DRAW_METHOD_COUNT; method++, r++) {

tests/kms_frontbuffer_tracking.c static int opt_handler(int option, int · line 3263

Quoted 7 lines
tests/kms_frontbuffer_tracking.c +2 -0
@@ -3255,6 +3257,10 @@ static int opt_handler(int option, int
 option_index, void *data)
  		igt_assert_eq(opt.only_pipes, PIPE_COUNT);
  		opt.only_pipes = PIPE_DUAL;
  		break;
+	case 'l':
+		igt_assert_eq(strtol(optarg, NULL, 0),
 I915_TILING_Y);

???

tests/kms_frontbuffer_tracking.c static int opt_handler(int option, int · line 3265

Quoted 2 lines
tests/kms_frontbuffer_tracking.c +1 -0
+		opt.tiling =
 igt_fb_tiling_to_mod((uint64_t)strtol(optarg, NULL, 0));

This looks a little bit awkward. Please make the option just be a
string: --tiling x, --tiling y, so later we can add --tiling yf and such. With this, we'll be able to avoid the igt_fb_tiling_to_mod call.

Quoted 7 lines
tests/kms_frontbuffer_tracking.c +1 -0
+		break;

  default:
  igt_assert(false);
  }

tests/kms_frontbuffer_tracking.c +0 -0
@@ -3274,7 +3280,8 @@ const char *help_str =

 "  --shared-fb-x offset        Use 'offset' as the X offset for the shared FB\n"

Quoted 8 lines

 "  --shared-fb-y offset        Use 'offset' as the Y offset for the shared FB\n"
 "  --1p-only                   Only run subtests that use 1 pipe\n" -"  --2p-only                   Only run subtests that use 2 pipes\n";
+"  --2p-only                   Only run subtests that use 2 pipes\n"
+"  --tiling        give 2 for y-tiled, default is x-
tiled\n";

Keep the same coding style, please: no tabs are being used here.

Quoted 11 lines


 static const char *pipes_str(int pipes)
 {

tests/kms_frontbuffer_tracking.c +1 -0
@@ -3413,6 +3420,7 @@ int main(int argc, char *argv[])
  		{ "shared-fb-y",              1, 0, 'y'},
  		{ "1p-only",                  0, 0, '1'},
  		{ "2p-only",                  0, 0, '2'},
+		{ "tiling",                   1, 0, 'l'},
  		{ 0, 0, 0, 0 }
  	};

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#11 lore raw

PATCH 7/7 igt/kms_fbc_crc.c : Add Y-tile tests

In reply to Praveen Paneri

Now that we have support for Y-tiled buffers, add another iteration of tests for Y-tiled buffers.

---
 tests/kms_fbc_crc.c | 71 +++++++++++++++++++++++++++++------------------------
 1 file changed, 39 insertions(+), 32 deletions(-)
tests/kms_fbc_crc.c +39 -32
index 96af06a..e0f9bf6 100644
@@ -318,12 +318,10 @@ static void prepare_crtc(data_t *data)
 	igt_output_set_pipe(output, data->pipe);
 }
 
-static void create_fbs(data_t *data, bool tiled, struct igt_fb *fbs)
+static void create_fbs(data_t *data, uint64_t tiling, struct igt_fb *fbs)
 {
 	int rc;
 	drmModeModeInfo *mode = igt_output_get_mode(data->output);
-	uint64_t tiling = tiled ? LOCAL_I915_FORMAT_MOD_X_TILED :
-				  LOCAL_DRM_FORMAT_MOD_NONE;
 
 	rc = igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
 				 DRM_FORMAT_XRGB8888, tiling,
@@ -344,8 +342,8 @@ static void get_ref_crcs(data_t *data)
 	struct igt_fb fbs[4];
 	int i;
 
-	create_fbs(data, false, &fbs[0]);
-	create_fbs(data, false, &fbs[2]);
+	create_fbs(data, LOCAL_DRM_FORMAT_MOD_NONE, &fbs[0]);
+	create_fbs(data, LOCAL_DRM_FORMAT_MOD_NONE, &fbs[2]);
 
 	fill_mmap_gtt(data, fbs[2].gem_handle, 0xff);
 	fill_mmap_gtt(data, fbs[3].gem_handle, 0xff);
@@ -366,7 +364,7 @@ static void get_ref_crcs(data_t *data)
 		igt_remove_fb(data->drm_fd, &fbs[i]);
 }
 
-static bool prepare_test(data_t *data, enum test_mode test_mode)
+static bool prepare_test(data_t *data, enum test_mode test_mode, uint64_t tiling)
 {
 	igt_display_t *display = &data->display;
 	igt_output_t *output = data->output;
@@ -374,7 +372,7 @@ static bool prepare_test(data_t *data, enum test_mode test_mode)
 
 	data->primary = igt_output_get_plane_type(data->output, DRM_PLANE_TYPE_PRIMARY);
 
-	create_fbs(data, true, data->fb);
+	create_fbs(data, tiling, data->fb);
 
 	igt_pipe_crc_free(data->pipe_crc);
 	data->pipe_crc = NULL;
@@ -484,32 +482,41 @@ static void run_test(data_t *data, enum test_mode mode)
 
 	reset_display(data);
 
-	for_each_pipe_with_valid_output(display, data->pipe, data->output) {
-		prepare_crtc(data);
-
-		igt_info("Beginning %s on pipe %s, connector %s\n",
-			  igt_subtest_name(),
-			  kmstest_pipe_name(data->pipe),
-			  igt_output_name(data->output));
-
-		if (!prepare_test(data, mode)) {
-			igt_info("%s on pipe %s, connector %s: SKIPPED\n",
-				  igt_subtest_name(),
-				  kmstest_pipe_name(data->pipe),
-				  igt_output_name(data->output));
-			continue;
+	for (int tiling = I915_TILING_X;
+	     tiling <= I915_TILING_Y; tiling++) {
+		for_each_pipe_with_valid_output(display,
+						data->pipe, data->output) {
+			prepare_crtc(data);
+
+			igt_info("Beginning %s on pipe %s, connector "
+					"%s, %s-tiled\n",
+					igt_subtest_name(),
+					kmstest_pipe_name(data->pipe),
+					igt_output_name(data->output),
+					(tiling == I915_TILING_X) ? "x":"y" );
+
+			if (!prepare_test(data, mode,
+					  igt_fb_tiling_to_mod(tiling))) {
+				igt_info("%s on pipe %s, connector %s: SKIPPED\n",
+						igt_subtest_name(),
+						kmstest_pipe_name(data->pipe),
+						igt_output_name(data->output));
+				continue;
+			}
+
+			valid_tests++;
+
+			test_crc(data, mode);
+
+			igt_info("%s on pipe %s, connector %s"
+					"%s-tiled: PASSED\n",
+					igt_subtest_name(),
+					kmstest_pipe_name(data->pipe),
+					igt_output_name(data->output),
+					(tiling == I915_TILING_X) ? "x":"y" );
+
+			finish_crtc(data, mode);
 		}
-
-		valid_tests++;
-
-		test_crc(data, mode);
-
-		igt_info("%s on pipe %s, connector %s: PASSED\n",
-			  igt_subtest_name(),
-			  kmstest_pipe_name(data->pipe),
-			  igt_output_name(data->output));
-
-		finish_crtc(data, mode);
 	}
 
 	igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#12 lore raw
In reply to Praveen Paneri

Em Sáb, 2017-03-18 às 00:45 +0530, Praveen Paneri escreveu:

Quoted 4 lines

This series adds Y-tiled buffer creation support into IGT libraries and
goes on to use this capability to add support into FBC tests to use Y-tiled buffers.

I applied this series and the Kernel patch. If I try to run kms_draw_crc it just gets stuck eating 100% of the CPU. I suppose this needs to be debugged, maybe some patch is wrong. Can you reproduce this behavior?

Quoted 14 lines

Akash Goel (1):
  lib/igt_draw: Add Y-tiling support for IGT_DRAW_BLT method

Paulo Zanoni (1):
  tests/kms_draw_crc: add support for Y tiling

Praveen Paneri (5):
  lib/igt_fb: Let others use igt_get_fb_tile_size lib/igt_fb: Add helper function for tile_to_mod lib/igt_draw: Add Y-tiling support igt/kms_frontbuffer_tracking: Add Y-tiling support igt/kms_fbc_crc.c : Add Y-tile tests

Quoted 9 lines

 lib/igt_draw.c                   | 167 ++++++++++++++++++++++++++++-
----------
 lib/igt_fb.c                     |  29 ++++++- lib/igt_fb.h                     |   4 +- tests/kms_draw_crc.c             |  58 ++++++++++---- tests/kms_fbc_crc.c              |  71 +++++++++-------- tests/kms_frontbuffer_tracking.c |  46 ++++++-----

 6 files changed, 262 insertions(+), 113 deletions(-)

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#13 lore raw

Em Qua, 2017-04-26 às 10:46 -0300, Paulo Zanoni escreveu:

Quoted 7 lines

Em Sáb, 2017-03-18 às 00:45 +0530, Praveen Paneri escreveu:

Quoted 5 lines

This series adds Y-tiled buffer creation support into IGT libraries and
goes on to use this capability to add support into FBC tests to use Y-tiled buffers.

Quoted 6 lines

I applied this series and the Kernel patch. If I try to run kms_draw_crc it just gets stuck eating 100% of the CPU. I suppose this
needs to be debugged, maybe some patch is wrong. Can you reproduce this
behavior?

Just as a note, I tested on SKL. Maybe that's relevant.

Quoted 26 lines
Quoted 24 lines

Akash Goel (1):
  lib/igt_draw: Add Y-tiling support for IGT_DRAW_BLT method

Paulo Zanoni (1):
  tests/kms_draw_crc: add support for Y tiling

Praveen Paneri (5):
  lib/igt_fb: Let others use igt_get_fb_tile_size lib/igt_fb: Add helper function for tile_to_mod lib/igt_draw: Add Y-tiling support igt/kms_frontbuffer_tracking: Add Y-tiling support igt/kms_fbc_crc.c : Add Y-tile tests

 lib/igt_draw.c                   | 167
++++++++++++++++++++++++++++-
----------
 lib/igt_fb.c                     |  29 ++++++- lib/igt_fb.h                     |   4 +- tests/kms_draw_crc.c             |  58 ++++++++++---- tests/kms_fbc_crc.c              |  71 +++++++++-------- tests/kms_frontbuffer_tracking.c |  46 ++++++-----

Quoted 2 lines
 6 files changed, 262 insertions(+), 113 deletions(-)
Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#14 lore raw

Hi Paulo,

Thanks for your review.

Quoted 8 lines · Paulo Zanoni

Em Qua, 2017-04-26 às 10:46 -0300, Paulo Zanoni escreveu:

Quoted 7 lines

Em Sáb, 2017-03-18 às 00:45 +0530, Praveen Paneri escreveu:

Quoted 5 lines

This series adds Y-tiled buffer creation support into IGT libraries and
goes on to use this capability to add support into FBC tests to use Y-tiled buffers.

Quoted 8 lines
Quoted 6 lines

I applied this series and the Kernel patch. If I try to run kms_draw_crc it just gets stuck eating 100% of the CPU. I suppose this
needs to be debugged, maybe some patch is wrong. Can you reproduce this
behavior?

Just as a note, I tested on SKL. Maybe that's relevant.

I had tested this on APL and it was working fine. I will try to run it on SKL as well. Will address your comments the resend this series soon.

thanks,
Praveen

Quoted 27 lines
Quoted 27 lines
Quoted 27 lines

Akash Goel (1):
lib/igt_draw: Add Y-tiling support for IGT_DRAW_BLT method

Paulo Zanoni (1):
tests/kms_draw_crc: add support for Y tiling

Praveen Paneri (5):
lib/igt_fb: Let others use igt_get_fb_tile_size lib/igt_fb: Add helper function for tile_to_mod lib/igt_draw: Add Y-tiling support igt/kms_frontbuffer_tracking: Add Y-tiling support igt/kms_fbc_crc.c : Add Y-tile tests

 lib/igt_draw.c                   | 167
++++++++++++++++++++++++++++-
----------
 lib/igt_fb.c                     |  29 ++++++-
 lib/igt_fb.h                     |   4 +-
 tests/kms_draw_crc.c             |  58 ++++++++++----
 tests/kms_fbc_crc.c              |  71 +++++++++--------
 tests/kms_frontbuffer_tracking.c |  46 ++++++-----
 6 files changed, 262 insertions(+), 113 deletions(-)
Quoted 4 lines
Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx