All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t v3 0/5] Add Y-tiling support into IGTs
@ 2017-07-18 17:22 Praveen Paneri
  2017-07-18 17:22 ` [PATCH i-g-t v3 1/5] lib/igt_fb: Let others use igt_get_fb_tile_size Praveen Paneri
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Praveen Paneri @ 2017-07-18 17:22 UTC (permalink / raw)
  To: intel-gfx; +Cc: paulo.r.zanoni, Praveen Paneri

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.

v2: Adressed review comments
v3: Included original patches from Paulo and addressed more comments

Paulo Zanoni (2):
  lib/igt_draw: add support for Y tiling
  tests/kms_draw_crc: add support for Y tiling

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

 lib/igt_draw.c       | 171 ++++++++++++++++++++++++++++++++++++---------------
 lib/igt_fb.c         |  41 +++++++++++-
 lib/igt_fb.h         |   3 +
 tests/kms_draw_crc.c |  55 ++++++++++++-----
 tests/kms_fbc_crc.c  |  73 +++++++++++++---------
 5 files changed, 246 insertions(+), 97 deletions(-)

-- 
1.9.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH i-g-t v3 1/5] lib/igt_fb: Let others use igt_get_fb_tile_size
  2017-07-18 17:22 [PATCH i-g-t v3 0/5] Add Y-tiling support into IGTs Praveen Paneri
@ 2017-07-18 17:22 ` Praveen Paneri
  2017-07-18 17:22 ` [PATCH i-g-t v3 2/5] lib/igt_fb: Add helper function for tile_to_mod Praveen Paneri
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Praveen Paneri @ 2017-07-18 17:22 UTC (permalink / raw)
  To: intel-gfx; +Cc: paulo.r.zanoni, Praveen Paneri

From: Praveen Paneri <praveen.paneri@intel.com>

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

v2: Added comments to function igt_get_fb_tile_size (Daniel)
v3: Fixed errors in comments and coding style (Paulo)

Signed-off-by: Praveen Paneri <praveen.paneri@intel.com>
---
 lib/igt_fb.c | 15 +++++++++++++--
 lib/igt_fb.h |  2 ++
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index d2b7e9e..c94f95e 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -74,8 +74,19 @@ 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,
-				 unsigned *width_ret, unsigned *height_ret)
+/**
+ * igt_get_fb_tile_size:
+ * @fd: the DRM file descriptor
+ * @tiling: tiling layout of the framebuffer (as framebuffer modifier)
+ * @fb_bpp: bits per pixel of the framebuffer
+ * @width_ret: width of the tile in bytes
+ * @height_ret: height of the tile in lines
+ *
+ * This function returns width and height of a tile based on the given tiling
+ * format.
+ */
+void igt_get_fb_tile_size(int fd, uint64_t tiling, int fb_bpp,
+			  unsigned *width_ret, unsigned *height_ret)
 {
 	switch (tiling) {
 	case LOCAL_DRM_FORMAT_MOD_NONE:
diff --git a/lib/igt_fb.h b/lib/igt_fb.h
index 4a680ce..010ed3a 100644
--- a/lib/igt_fb.h
+++ b/lib/igt_fb.h
@@ -95,6 +95,8 @@ enum igt_text_align {
 	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
-- 
1.9.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH i-g-t v3 2/5] lib/igt_fb: Add helper function for tile_to_mod
  2017-07-18 17:22 [PATCH i-g-t v3 0/5] Add Y-tiling support into IGTs Praveen Paneri
  2017-07-18 17:22 ` [PATCH i-g-t v3 1/5] lib/igt_fb: Let others use igt_get_fb_tile_size Praveen Paneri
@ 2017-07-18 17:22 ` Praveen Paneri
  2017-07-18 17:22 ` [PATCH i-g-t v3 3/5] lib/igt_draw: add support for Y tiling Praveen Paneri
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Praveen Paneri @ 2017-07-18 17:22 UTC (permalink / raw)
  To: intel-gfx; +Cc: paulo.r.zanoni, Praveen Paneri

From: Praveen Paneri <praveen.paneri@intel.com>

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()

v2: Improved code comment (Paulo)

Signed-off-by: Praveen Paneri <praveen.paneri@intel.com>
---
 lib/igt_fb.c | 26 ++++++++++++++++++++++++++
 lib/igt_fb.h |  1 +
 2 files changed, 27 insertions(+)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index c94f95e..042b413 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -217,6 +217,32 @@ 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 modifier 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,
diff --git a/lib/igt_fb.h b/lib/igt_fb.h
index 010ed3a..9b8ec8a 100644
--- a/lib/igt_fb.h
+++ b/lib/igt_fb.h
@@ -132,6 +132,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);
-- 
1.9.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH i-g-t v3 3/5] lib/igt_draw: add support for Y tiling
  2017-07-18 17:22 [PATCH i-g-t v3 0/5] Add Y-tiling support into IGTs Praveen Paneri
  2017-07-18 17:22 ` [PATCH i-g-t v3 1/5] lib/igt_fb: Let others use igt_get_fb_tile_size Praveen Paneri
  2017-07-18 17:22 ` [PATCH i-g-t v3 2/5] lib/igt_fb: Add helper function for tile_to_mod Praveen Paneri
@ 2017-07-18 17:22 ` Praveen Paneri
  2017-07-18 17:22 ` [PATCH i-g-t v3 4/5] tests/kms_draw_crc: " Praveen Paneri
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Praveen Paneri @ 2017-07-18 17:22 UTC (permalink / raw)
  To: intel-gfx; +Cc: paulo.r.zanoni, Praveen Paneri

From: Paulo Zanoni <paulo.r.zanoni@intel.com>

From: Paulo Zanoni <paulo.r.zanoni@intel.com>

Most of the patch is to change the tile/untile functions so they can
work with Y-major tiling.

v2: (Praveen) No skipping on BLT for Y-tile now as we have a fix
 for that.

Reviewed-by: Praveen Paneri <praveen.paneri@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Praveen Paneri <praveen.paneri@intel.com>
---
 lib/igt_draw.c | 171 ++++++++++++++++++++++++++++++++++++++++-----------------
 1 file changed, 121 insertions(+), 50 deletions(-)

diff --git a/lib/igt_draw.c b/lib/igt_draw.c
index db55cd9..76ffb6c 100644
--- a/lib/igt_draw.c
+++ b/lib/igt_draw.c
@@ -135,71 +135,118 @@ static int swizzle_addr(int addr, int swizzle)
 	return addr;
 }
 
-/* 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 tile(int x, int y, uint32_t x_tile_size, uint32_t y_tile_size,
+		uint32_t line_size, bool xmajor)
 {
-	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;
-	int tile_n, tile_off;
-	int tiled_pos, tiles_per_line;
-	int pixel_size = bpp / 8;
+	int tile_size, tiles_per_line, x_tile_n, y_tile_n, tile_off, pos;
+	int tile_n, x_tile_off, y_tile_off;
 
-	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 = x_tile_size * y_tile_size;
 
+	x_tile_n = x / x_tile_size;
 	y_tile_n = y / y_tile_size;
-	y_tile_off = y % y_tile_size;
+	tile_n = y_tile_n * tiles_per_line + x_tile_n;
 
-	x_tile_n = (x * pixel_size) / x_tile_size;
-	x_tile_off = (x * pixel_size) % x_tile_size;
+	x_tile_off = x % x_tile_size;
+	y_tile_off = y % y_tile_size;
 
-	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;
+	if (xmajor)
+		tile_off = y_tile_off * x_tile_size + x_tile_off;
+	else
+		tile_off = x_tile_off * y_tile_size + y_tile_off;
 
-	tiled_pos = swizzle_addr(tiled_pos, swizzle);
+	pos = tile_n * tile_size + tile_off;
 
-	return tiled_pos / pixel_size;
+	return pos;
 }
 
-/* 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 untile(int tiled_pos, int x_tile_size, int y_tile_size,
+		   uint32_t line_size, bool xmajor, int *x, int *y)
 {
-	int tile_n, tile_off, tiles_per_line, line_size;
+	int tile_n, tile_off, tiles_per_line;
 	int x_tile_off, y_tile_off;
 	int x_tile_n, y_tile_n;
-	int x_tile_size, y_tile_size, tile_size;
-	int pixel_size = bpp / 8;
-
-	tiled_pos = swizzle_addr(tiled_pos, swizzle);
+	int tile_size;
 
-	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_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;
+	if (xmajor) {
+		y_tile_off = tile_off / x_tile_size;
+		x_tile_off = tile_off % x_tile_size;
+	} else {
+		y_tile_off = tile_off % y_tile_size;
+		x_tile_off = tile_off / y_tile_size;
+	}
 
 	x_tile_n = tile_n % tiles_per_line;
 	y_tile_n = tile_n / tiles_per_line;
 
-	*x = (x_tile_n * x_tile_size + x_tile_off) / pixel_size;
+	*x = (x_tile_n * x_tile_size + x_tile_off);
 	*y = y_tile_n * y_tile_size + y_tile_off;
 }
 
+static int linear_x_y_to_xtiled_pos(int x, int y, uint32_t stride, int swizzle,
+				    int bpp)
+{
+	int pos;
+	int pixel_size = bpp / 8;
+
+	x *= pixel_size;
+	pos = tile(x, y, 512, 8, stride, true);
+	pos = swizzle_addr(pos, swizzle);
+	return pos / pixel_size;
+}
+
+static int linear_x_y_to_ytiled_pos(int x, int y, uint32_t stride, int swizzle,
+				    int bpp)
+{
+	int ow_tile_n, pos;
+	int ow_size = 16;
+	int pixel_size = bpp / 8;
+
+	/* We have an Y tiling of OWords, so use the tile() function to get the
+	 * OW number, then adjust to the fact that the OW may have more than one
+	 * pixel. */
+	x *= pixel_size;
+	ow_tile_n = tile(x / ow_size, y, 128 / ow_size, 32,
+			 stride / ow_size, false);
+	pos = ow_tile_n * ow_size + (x % ow_size);
+	pos = swizzle_addr(pos, swizzle);
+	return pos / pixel_size;
+}
+
+static void xtiled_pos_to_x_y_linear(int tiled_pos, uint32_t stride,
+				     int swizzle, int bpp, int *x, int *y)
+{
+	int pixel_size = bpp / 8;
+
+	tiled_pos = swizzle_addr(tiled_pos, swizzle);
+
+	untile(tiled_pos, 512, 8, stride, true, x, y);
+	*x /= pixel_size;
+}
+
+static void ytiled_pos_to_x_y_linear(int tiled_pos, uint32_t stride,
+				     int swizzle, int bpp, int *x, int *y)
+{
+	int ow_tile_n;
+	int ow_size = 16;
+	int pixel_size = bpp / 8;
+
+	tiled_pos = swizzle_addr(tiled_pos, swizzle);
+
+	ow_tile_n = tiled_pos / ow_size;
+	untile(ow_tile_n, 128 / ow_size, 32, stride / ow_size, false, x, y);
+	*x *= ow_size;
+	*x += tiled_pos % ow_size;
+	*x /= pixel_size;
+}
+
 static void set_pixel(void *_ptr, int index, uint32_t color, int bpp)
 {
 	if (bpp == 16) {
@@ -254,15 +301,26 @@ 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(void *ptr, uint32_t stride, uint32_t tiling,
+				int swizzle, struct rect *rect, uint32_t color,
+				int bpp)
 {
 	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);
+			switch (tiling) {
+			case I915_TILING_X:
+				pos = linear_x_y_to_xtiled_pos(x, y, stride,
+							       swizzle, bpp);
+				break;
+			case I915_TILING_Y:
+				pos = linear_x_y_to_ytiled_pos(x, y, stride,
+							       swizzle, bpp);
+				break;
+			default:
+				igt_assert(false);
+			}
 			set_pixel(ptr, pos, color, bpp);
 		}
 	}
@@ -289,8 +347,9 @@ 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);
+	case I915_TILING_Y:
+		draw_rect_ptr_tiled(ptr, buf->stride, tiling, swizzle, rect,
+				    color, buf->bpp);
 		break;
 	default:
 		igt_assert(false);
@@ -339,8 +398,9 @@ 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);
+	case I915_TILING_Y:
+		draw_rect_ptr_tiled(ptr, buf->stride, tiling, swizzle, rect,
+				    color, buf->bpp);
 		break;
 	default:
 		igt_assert(false);
@@ -367,8 +427,8 @@ 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 tiling, struct rect *rect,
+				   uint32_t color, uint32_t swizzle)
 {
 	int i;
 	int tiled_pos, x, y, pixel_size;
@@ -391,8 +451,18 @@ 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);
+		switch (tiling) {
+		case I915_TILING_X:
+			xtiled_pos_to_x_y_linear(tiled_pos, buf->stride,
+						 swizzle, buf->bpp, &x, &y);
+			break;
+		case I915_TILING_Y:
+			ytiled_pos_to_x_y_linear(tiled_pos, buf->stride,
+						 swizzle, buf->bpp, &x, &y);
+			break;
+		default:
+			igt_assert(false);
+		}
 
 		if (x >= rect->x && x < rect->x + rect->w &&
 		    y >= rect->y && y < rect->y + rect->h) {
@@ -429,7 +499,8 @@ 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);
+	case I915_TILING_Y:
+		draw_rect_pwrite_tiled(fd, buf, tiling, rect, color, swizzle);
 		break;
 	default:
 		igt_assert(false);
-- 
1.9.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH i-g-t v3 4/5] tests/kms_draw_crc: add support for Y tiling
  2017-07-18 17:22 [PATCH i-g-t v3 0/5] Add Y-tiling support into IGTs Praveen Paneri
                   ` (2 preceding siblings ...)
  2017-07-18 17:22 ` [PATCH i-g-t v3 3/5] lib/igt_draw: add support for Y tiling Praveen Paneri
@ 2017-07-18 17:22 ` Praveen Paneri
  2017-07-18 17:23 ` [PATCH i-g-t v3 5/5] igt/kms_fbc_crc.c : Add Y-tile tests Praveen Paneri
  2017-07-25 15:18 ` [PATCH i-g-t v3 0/5] Add Y-tiling support into IGTs Paulo Zanoni
  5 siblings, 0 replies; 8+ messages in thread
From: Praveen Paneri @ 2017-07-18 17:22 UTC (permalink / raw)
  To: intel-gfx; +Cc: paulo.r.zanoni, Praveen Paneri

From: Paulo Zanoni <paulo.r.zanoni@intel.com>

From: Paulo Zanoni <paulo.r.zanoni@intel.com>

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.

Reviewed-by: Praveen Paneri <praveen.paneri@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Praveen Paneri <praveen.paneri@intel.com>
---
 tests/kms_draw_crc.c | 55 ++++++++++++++++++++++++++++++++++++++--------------
 1 file changed, 40 insertions(+), 15 deletions(-)

diff --git a/tests/kms_draw_crc.c b/tests/kms_draw_crc.c
index c57d3a3..906d89f 100644
--- a/tests/kms_draw_crc.c
+++ b/tests/kms_draw_crc.c
@@ -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,9 @@ 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);
+
 	/* 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 +218,11 @@ 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);
+	}
+
 	igt_remove_fb(drm_fd, &fb);
 }
 
@@ -265,28 +280,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();
-- 
1.9.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH i-g-t v3 5/5] igt/kms_fbc_crc.c : Add Y-tile tests
  2017-07-18 17:22 [PATCH i-g-t v3 0/5] Add Y-tiling support into IGTs Praveen Paneri
                   ` (3 preceding siblings ...)
  2017-07-18 17:22 ` [PATCH i-g-t v3 4/5] tests/kms_draw_crc: " Praveen Paneri
@ 2017-07-18 17:23 ` Praveen Paneri
  2017-07-25 15:18 ` [PATCH i-g-t v3 0/5] Add Y-tiling support into IGTs Paulo Zanoni
  5 siblings, 0 replies; 8+ messages in thread
From: Praveen Paneri @ 2017-07-18 17:23 UTC (permalink / raw)
  To: intel-gfx; +Cc: paulo.r.zanoni, Praveen Paneri

From: Praveen Paneri <praveen.paneri@intel.com>

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

v3:
 - Iterate over tiling modifier instead of tiling constant (Paulo)
 - Improved logging and fixed indentation (Paulo)

Signed-off-by: Praveen Paneri <praveen.paneri@intel.com>
---
 tests/kms_fbc_crc.c | 69 ++++++++++++++++++++++++++++++++++-------------------
 1 file changed, 44 insertions(+), 25 deletions(-)

diff --git a/tests/kms_fbc_crc.c b/tests/kms_fbc_crc.c
index 7964e05..74debfb 100644
--- a/tests/kms_fbc_crc.c
+++ b/tests/kms_fbc_crc.c
@@ -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;
@@ -475,6 +473,7 @@ static void run_test(data_t *data, enum test_mode mode)
 {
 	igt_display_t *display = &data->display;
 	int valid_tests = 0;
+       uint64_t tiling_methods[] = {LOCAL_I915_FORMAT_MOD_X_TILED, LOCAL_I915_FORMAT_MOD_Y_TILED};
 
 	if (mode == TEST_CONTEXT || mode == TEST_PAGE_FLIP_AND_CONTEXT) {
 		drm_intel_context *ctx = drm_intel_gem_context_create(data->bufmgr);
@@ -484,32 +483,52 @@ 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);
+	for (int i=0; i < (sizeof(tiling_methods)/sizeof(tiling_methods[0]));
+	     i++) {
+		uint64_t tiling = tiling_methods[i];
 
-		igt_info("Beginning %s on pipe %s, connector %s\n",
-			  igt_subtest_name(),
-			  kmstest_pipe_name(data->pipe),
-			  igt_output_name(data->output));
+		if(intel_gen(intel_get_drm_devid(data->drm_fd)) < 9 &&
+				tiling == LOCAL_I915_FORMAT_MOD_Y_TILED) {
+			igt_info("Y-tiling not supported for this platform\n");
+			continue;
+		}
+
+		for_each_pipe_with_valid_output(display,
+						data->pipe, data->output) {
+			const char *tiling_name =
+					(tiling == LOCAL_I915_FORMAT_MOD_Y_TILED) ? "x":"y";
+			prepare_crtc(data);
 
-		if (!prepare_test(data, mode)) {
-			igt_info("%s on pipe %s, connector %s: SKIPPED\n",
+			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));
-			continue;
-		}
+				  igt_output_name(data->output),
+				  tiling_name);
 
-		valid_tests++;
+			if (!prepare_test(data, mode, tiling)) {
+				igt_info("%s on pipe %s, connector "
+					  "%s, %s-tiled: SKIPPED\n",
+					  igt_subtest_name(),
+					  kmstest_pipe_name(data->pipe),
+					  igt_output_name(data->output),
+					  tiling_name);
+				continue;
+			}
 
-		test_crc(data, mode);
+			valid_tests++;
 
-		igt_info("%s on pipe %s, connector %s: PASSED\n",
-			  igt_subtest_name(),
-			  kmstest_pipe_name(data->pipe),
-			  igt_output_name(data->output));
+			test_crc(data, mode);
 
-		finish_crtc(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_name);
+
+			finish_crtc(data, mode);
+		}
 	}
 
 	igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
-- 
1.9.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH i-g-t v3 0/5] Add Y-tiling support into IGTs
  2017-07-18 17:22 [PATCH i-g-t v3 0/5] Add Y-tiling support into IGTs Praveen Paneri
                   ` (4 preceding siblings ...)
  2017-07-18 17:23 ` [PATCH i-g-t v3 5/5] igt/kms_fbc_crc.c : Add Y-tile tests Praveen Paneri
@ 2017-07-25 15:18 ` Paulo Zanoni
  2017-07-25 15:37   ` Praveen Paneri
  5 siblings, 1 reply; 8+ messages in thread
From: Paulo Zanoni @ 2017-07-25 15:18 UTC (permalink / raw)
  To: Praveen Paneri, intel-gfx

Em Ter, 2017-07-18 às 22:52 +0530, Praveen Paneri escreveu:
> 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.

Everything reviewed & merged. Thanks for the patches.

Patch 5 contained a few coding style problems, which I fixed before
merging. Please try to keep the coding style used by the files touched.

> 
> v2: Adressed review comments
> v3: Included original patches from Paulo and addressed more comments
> 
> Paulo Zanoni (2):
>   lib/igt_draw: add support for Y tiling
>   tests/kms_draw_crc: add support for Y tiling
> 
> Praveen Paneri (3):
>   lib/igt_fb: Let others use igt_get_fb_tile_size
>   lib/igt_fb: Add helper function for tile_to_mod
>   igt/kms_fbc_crc.c : Add Y-tile tests
> 
>  lib/igt_draw.c       | 171 ++++++++++++++++++++++++++++++++++++-----
> ----------
>  lib/igt_fb.c         |  41 +++++++++++-
>  lib/igt_fb.h         |   3 +
>  tests/kms_draw_crc.c |  55 ++++++++++++-----
>  tests/kms_fbc_crc.c  |  73 +++++++++++++---------
>  5 files changed, 246 insertions(+), 97 deletions(-)
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH i-g-t v3 0/5] Add Y-tiling support into IGTs
  2017-07-25 15:18 ` [PATCH i-g-t v3 0/5] Add Y-tiling support into IGTs Paulo Zanoni
@ 2017-07-25 15:37   ` Praveen Paneri
  0 siblings, 0 replies; 8+ messages in thread
From: Praveen Paneri @ 2017-07-25 15:37 UTC (permalink / raw)
  To: Paulo Zanoni, intel-gfx



On Tuesday 25 July 2017 08:48 PM, Paulo Zanoni wrote:
> Em Ter, 2017-07-18 às 22:52 +0530, Praveen Paneri escreveu:
>> 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.
>
> Everything reviewed & merged. Thanks for the patches.
Thanks Paulo :)
>
> Patch 5 contained a few coding style problems, which I fixed before
> merging. Please try to keep the coding style used by the files touched.
Will take care going fwd.
Regards,
Praveen
>
>>
>> v2: Adressed review comments
>> v3: Included original patches from Paulo and addressed more comments
>>
>> Paulo Zanoni (2):
>>   lib/igt_draw: add support for Y tiling
>>   tests/kms_draw_crc: add support for Y tiling
>>
>> Praveen Paneri (3):
>>   lib/igt_fb: Let others use igt_get_fb_tile_size
>>   lib/igt_fb: Add helper function for tile_to_mod
>>   igt/kms_fbc_crc.c : Add Y-tile tests
>>
>>  lib/igt_draw.c       | 171 ++++++++++++++++++++++++++++++++++++-----
>> ----------
>>  lib/igt_fb.c         |  41 +++++++++++-
>>  lib/igt_fb.h         |   3 +
>>  tests/kms_draw_crc.c |  55 ++++++++++++-----
>>  tests/kms_fbc_crc.c  |  73 +++++++++++++---------
>>  5 files changed, 246 insertions(+), 97 deletions(-)
>>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-07-25 15:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-18 17:22 [PATCH i-g-t v3 0/5] Add Y-tiling support into IGTs Praveen Paneri
2017-07-18 17:22 ` [PATCH i-g-t v3 1/5] lib/igt_fb: Let others use igt_get_fb_tile_size Praveen Paneri
2017-07-18 17:22 ` [PATCH i-g-t v3 2/5] lib/igt_fb: Add helper function for tile_to_mod Praveen Paneri
2017-07-18 17:22 ` [PATCH i-g-t v3 3/5] lib/igt_draw: add support for Y tiling Praveen Paneri
2017-07-18 17:22 ` [PATCH i-g-t v3 4/5] tests/kms_draw_crc: " Praveen Paneri
2017-07-18 17:23 ` [PATCH i-g-t v3 5/5] igt/kms_fbc_crc.c : Add Y-tile tests Praveen Paneri
2017-07-25 15:18 ` [PATCH i-g-t v3 0/5] Add Y-tiling support into IGTs Paulo Zanoni
2017-07-25 15:37   ` Praveen Paneri

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.