All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t 0/7] Use rendercopy for generating CCS buffers
@ 2019-02-21 14:41 Dhinakaran Pandiyan
  2019-02-21 14:41 ` [igt-dev] [PATCH i-g-t 1/7] lib/rendercopy: Add support for Yf/Ys tiling to gen9 rendercopy Dhinakaran Pandiyan
                   ` (8 more replies)
  0 siblings, 9 replies; 25+ messages in thread
From: Dhinakaran Pandiyan @ 2019-02-21 14:41 UTC (permalink / raw)
  To: igt-dev; +Cc: Dhinakaran Pandiyan

Series includes rebased version of patches from Ville's series -
https://patchwork.freedesktop.org/series/51770/
Modifier testing for kms_plane has been deliberately left out from the
above series as the combination Yf-CCS-BGR888 fails on ICL and needs
debug.

Dhinakaran Pandiyan (3):
  lib/igt_fb: Function to create a bo for passed in igt_fb
  tests/kms_ccs: Generate compressed surfaces with rendercopy
  tests/kms_ccs: Larger fb to fully cover up the primary plane

Ville Syrjälä (4):
  lib/rendercopy: Add support for Yf/Ys tiling to gen9 rendercopy
  tests/gem_render_copy: Test Yf tiling
  lib/igt_fb: Use rendercopy for rendering into compressed buffers
  lib/igt_fb: s/tiling/modifier/ where appropriate

 lib/gen8_render.h            |   6 +-
 lib/igt_fb.c                 | 239 ++++++++++++++++++++++++++--------
 lib/igt_fb.h                 |  25 ++--
 lib/rendercopy_gen9.c        |   8 +-
 tests/i915/gem_render_copy.c | 246 +++++++++++++++++++++++++++--------
 tests/kms_ccs.c              | 218 ++++++++-----------------------
 6 files changed, 458 insertions(+), 284 deletions(-)

-- 
2.17.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] [PATCH i-g-t 1/7] lib/rendercopy: Add support for Yf/Ys tiling to gen9 rendercopy
  2019-02-21 14:41 [igt-dev] [PATCH i-g-t 0/7] Use rendercopy for generating CCS buffers Dhinakaran Pandiyan
@ 2019-02-21 14:41 ` Dhinakaran Pandiyan
  2019-02-25 13:39   ` Katarzyna Dec
  2019-02-21 14:41 ` [igt-dev] [PATCH i-g-t 2/7] tests/gem_render_copy: Test Yf tiling Dhinakaran Pandiyan
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 25+ messages in thread
From: Dhinakaran Pandiyan @ 2019-02-21 14:41 UTC (permalink / raw)
  To: igt-dev; +Cc: Dhinakaran Pandiyan

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Set up the surface state accordingly to support Yf/Ys tiling.

From DK:
 Rebase.

Cc: Lukasz Kalamarz <lukasz.kalamarz@intel.com>
Cc: Katarzyna Dec <katarzyna.dec@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
---
 lib/gen8_render.h     | 6 ++++--
 lib/rendercopy_gen9.c | 8 +++++++-
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/lib/gen8_render.h b/lib/gen8_render.h
index c62047d8..372c5267 100644
--- a/lib/gen8_render.h
+++ b/lib/gen8_render.h
@@ -121,9 +121,11 @@ struct gen8_surface_state
 	struct {
 		uint32_t mip_count:4;
 		uint32_t min_lod:4;
-		uint32_t pad3:6;
+		uint32_t mip_tail_start_lod:4; /* gen9+ */
+		uint32_t pad3:2;
 		uint32_t coherency_type:1;
-		uint32_t pad2:5;
+		uint32_t pad2:3;
+		uint32_t trmode:2; /* gen9+ */
 		uint32_t ewa_disable_for_cube:1;
 		uint32_t y_offset:3;
 		uint32_t pad0:1;
diff --git a/lib/rendercopy_gen9.c b/lib/rendercopy_gen9.c
index e3d95a68..8514c991 100644
--- a/lib/rendercopy_gen9.c
+++ b/lib/rendercopy_gen9.c
@@ -204,9 +204,15 @@ gen8_bind_buf(struct intel_batchbuffer *batch, const struct igt_buf *buf,
 	ss->ss0.horizontal_alignment = 1; /* align 4 */
 	if (buf->tiling == I915_TILING_X)
 		ss->ss0.tiled_mode = 2;
-	else if (buf->tiling == I915_TILING_Y)
+	else if (buf->tiling != I915_TILING_NONE)
 		ss->ss0.tiled_mode = 3;
 
+	if (buf->tiling == I915_TILING_Yf)
+		ss->ss5.trmode = 1;
+	else if (buf->tiling == I915_TILING_Ys)
+		ss->ss5.trmode = 2;
+	ss->ss5.mip_tail_start_lod = 1; /* needed with trmode */
+
 	ss->ss8.base_addr = buf->bo->offset64;
 	ss->ss9.base_addr_hi = buf->bo->offset64 >> 32;
 
-- 
2.17.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] [PATCH i-g-t 2/7] tests/gem_render_copy: Test Yf tiling
  2019-02-21 14:41 [igt-dev] [PATCH i-g-t 0/7] Use rendercopy for generating CCS buffers Dhinakaran Pandiyan
  2019-02-21 14:41 ` [igt-dev] [PATCH i-g-t 1/7] lib/rendercopy: Add support for Yf/Ys tiling to gen9 rendercopy Dhinakaran Pandiyan
@ 2019-02-21 14:41 ` Dhinakaran Pandiyan
  2019-02-25 13:49   ` Katarzyna Dec
  2019-02-21 14:41 ` [igt-dev] [PATCH i-g-t 3/7] lib/igt_fb: Use rendercopy for rendering into compressed buffers Dhinakaran Pandiyan
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 25+ messages in thread
From: Dhinakaran Pandiyan @ 2019-02-21 14:41 UTC (permalink / raw)
  To: igt-dev; +Cc: Dhinakaran Pandiyan

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Let's test Yf tiling now that rendercopy can handle it.

v2: From DK
 Set bpp for Yf buffer and rebase.

Cc: Lukasz Kalamarz <lukasz.kalamarz@intel.com>
Cc: Katarzyna Dec <katarzyna.dec@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
---
 tests/i915/gem_render_copy.c | 246 +++++++++++++++++++++++++++--------
 1 file changed, 195 insertions(+), 51 deletions(-)

diff --git a/tests/i915/gem_render_copy.c b/tests/i915/gem_render_copy.c
index 0cd4e50f..afe2df05 100644
--- a/tests/i915/gem_render_copy.c
+++ b/tests/i915/gem_render_copy.c
@@ -72,11 +72,85 @@ static const char *make_filename(const char *filename)
 	return buf;
 }
 
-static void *linear_copy(data_t *data, struct igt_buf *buf)
+static void *yf_ptr(void *ptr,
+		    unsigned int x, unsigned int y,
+		    unsigned int stride, unsigned int cpp)
 {
-	void *map, *linear;
+       x *= cpp;
+
+       return ptr +
+	       ((y & ~0x1f) * stride) +
+	       ((y & 0x10) * 64) +
+	       ((y & 0x8) * 32) +
+	       ((y & 0x7) * 16) +
+	       ((x & ~0x3f) * 32) +
+	       ((x & 0x20) * 16) +
+	       ((x & 0x10) * 8) +
+	       (x & 0xf);
+}
 
-	igt_assert_eq(posix_memalign(&linear, 16, buf->bo->size), 0);
+static void copy_linear_to_yf(data_t *data, struct igt_buf *buf, const uint32_t *linear)
+{
+	int height = igt_buf_height(buf);
+	int width = igt_buf_width(buf);
+	void *map;
+
+	gem_set_domain(data->drm_fd, buf->bo->handle,
+		       I915_GEM_DOMAIN_CPU, I915_GEM_DOMAIN_CPU);
+	map = gem_mmap__cpu(data->drm_fd, buf->bo->handle, 0,
+			    buf->bo->size, PROT_READ | PROT_WRITE);
+
+	for (int y = 0; y < height; y++) {
+		for (int x = 0; x < width; x++) {
+			uint32_t *ptr = yf_ptr(map, x, y, buf->stride, 4);
+
+			*ptr = linear[y * width + x];
+		}
+	}
+
+	munmap(map, buf->bo->size);
+}
+
+static void copy_yf_to_linear(data_t *data, struct igt_buf *buf, uint32_t *linear)
+{
+	int height = igt_buf_height(buf);
+	int width = igt_buf_width(buf);
+	void *map;
+
+	gem_set_domain(data->drm_fd, buf->bo->handle,
+		       I915_GEM_DOMAIN_CPU, 0);
+	map = gem_mmap__cpu(data->drm_fd, buf->bo->handle, 0,
+			    buf->bo->size, PROT_READ);
+
+	for (int y = 0; y < height; y++) {
+		for (int x = 0; x < width; x++) {
+			uint32_t *ptr = yf_ptr(map, x, y, buf->stride, 4);
+
+			linear[y * width + x] = *ptr;
+		}
+	}
+
+	munmap(map, buf->bo->size);
+}
+
+static void copy_linear_to_gtt(data_t *data, struct igt_buf *buf, const uint32_t *linear)
+{
+	void *map;
+
+	gem_set_domain(data->drm_fd, buf->bo->handle,
+		       I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
+
+	map = gem_mmap__gtt(data->drm_fd, buf->bo->handle,
+			    buf->bo->size, PROT_READ | PROT_WRITE);
+
+	memcpy(map, linear, buf->bo->size);
+
+	munmap(map, buf->bo->size);
+}
+
+static void copy_gtt_to_linear(data_t *data, struct igt_buf *buf, uint32_t *linear)
+{
+	void *map;
 
 	gem_set_domain(data->drm_fd, buf->bo->handle,
 		       I915_GEM_DOMAIN_GTT, 0);
@@ -87,6 +161,18 @@ static void *linear_copy(data_t *data, struct igt_buf *buf)
 	igt_memcpy_from_wc(linear, map, buf->bo->size);
 
 	munmap(map, buf->bo->size);
+}
+
+static void *linear_copy(data_t *data, struct igt_buf *buf)
+{
+	void *linear;
+
+	igt_assert_eq(posix_memalign(&linear, 16, buf->bo->size), 0);
+
+	if (buf->tiling == I915_TILING_Yf)
+		copy_yf_to_linear(data, buf, linear);
+	else
+		copy_gtt_to_linear(data, buf, linear);
 
 	return linear;
 }
@@ -173,7 +259,7 @@ static void scratch_buf_draw_pattern(data_t *data, struct igt_buf *buf,
 	cairo_surface_t *surface;
 	cairo_pattern_t *pat;
 	cairo_t *cr;
-	void *map, *linear;
+	void *linear;
 
 	linear = linear_copy(data, buf);
 
@@ -216,15 +302,10 @@ static void scratch_buf_draw_pattern(data_t *data, struct igt_buf *buf,
 
 	cairo_surface_destroy(surface);
 
-	gem_set_domain(data->drm_fd, buf->bo->handle,
-		       I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
-
-	map = gem_mmap__gtt(data->drm_fd, buf->bo->handle,
-			    buf->bo->size, PROT_READ | PROT_WRITE);
-
-	memcpy(map, linear, buf->bo->size);
-
-	munmap(map, buf->bo->size);
+	if (buf->tiling == I915_TILING_Yf)
+		copy_linear_to_yf(data, buf, linear);
+	else
+		copy_linear_to_gtt(data, buf, linear);
 
 	free(linear);
 }
@@ -236,36 +317,59 @@ scratch_buf_copy(data_t *data,
 {
 	int width = igt_buf_width(dst);
 	int height  = igt_buf_height(dst);
-	uint32_t *linear_dst, *linear_src;
+	uint32_t *linear_dst;
 
 	igt_assert_eq(igt_buf_width(dst), igt_buf_width(src));
 	igt_assert_eq(igt_buf_height(dst), igt_buf_height(src));
 	igt_assert_eq(dst->bo->size, src->bo->size);
 
+	w = min(w, width - sx);
+	w = min(w, width - dx);
+
+	h = min(h, height - sy);
+	h = min(h, height - dy);
+
 	gem_set_domain(data->drm_fd, dst->bo->handle,
 		       I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
-	gem_set_domain(data->drm_fd, src->bo->handle,
-		       I915_GEM_DOMAIN_GTT, 0);
-
 	linear_dst = gem_mmap__gtt(data->drm_fd, dst->bo->handle,
 				   dst->bo->size, PROT_WRITE);
-	linear_src = gem_mmap__gtt(data->drm_fd, src->bo->handle,
-				   src->bo->size, PROT_READ);
 
-	w = min(w, width - sx);
-	w = min(w, width - dx);
+	if (src->tiling == I915_TILING_Yf) {
+		void *map;
 
-	h = min(h, height - sy);
-	h = min(h, height - dy);
+		gem_set_domain(data->drm_fd, src->bo->handle,
+			       I915_GEM_DOMAIN_CPU, 0);
+		map = gem_mmap__cpu(data->drm_fd, src->bo->handle, 0,
+				    src->bo->size, PROT_READ);
+
+		for (int y = 0; y < h; y++) {
+			for (int x = 0; x < w; x++) {
+				const uint32_t *ptr = yf_ptr(map, sx+x, sy+y, src->stride, 4);
+
+				linear_dst[(dy+y) * width + dx+x] = *ptr;
+			}
+		}
+
+		munmap(map, src->bo->size);
+	} else {
+		uint32_t *linear_src;
+
+		gem_set_domain(data->drm_fd, src->bo->handle,
+			       I915_GEM_DOMAIN_GTT, 0);
 
-	for (int y = 0; y < h; y++) {
-		igt_memcpy_from_wc(&linear_dst[(dy+y) * width + dx],
-				   &linear_src[(sy+y) * width + sx],
-				   w * 4);
+		linear_src = gem_mmap__gtt(data->drm_fd, src->bo->handle,
+					   src->bo->size, PROT_READ);
+
+		for (int y = 0; y < h; y++) {
+			igt_memcpy_from_wc(&linear_dst[(dy+y) * width + dx],
+					   &linear_src[(sy+y) * width + sx],
+					   w * 4);
+		}
+
+		munmap(linear_src, src->bo->size);
 	}
 
 	munmap(linear_dst, dst->bo->size);
-	munmap(linear_src, src->bo->size);
 }
 
 static void scratch_buf_init(data_t *data, struct igt_buf *buf,
@@ -282,7 +386,8 @@ static void scratch_buf_init(data_t *data, struct igt_buf *buf,
 		int size;
 
 		igt_require(intel_gen(data->devid) >= 9);
-		igt_assert_eq(tiling, I915_TILING_Y);
+		igt_assert(tiling == I915_TILING_Y ||
+			   tiling == I915_TILING_Yf);
 
 		buf->stride = ALIGN(width * 4, 128);
 		buf->size = buf->stride * height;
@@ -299,8 +404,21 @@ static void scratch_buf_init(data_t *data, struct igt_buf *buf,
 
 		buf->bo = drm_intel_bo_alloc(data->bufmgr, "", size, 4096);
 
-		drm_intel_bo_set_tiling(buf->bo, &tiling, buf->stride);
-		igt_assert_eq(tiling, req_tiling);
+		if (tiling == I915_TILING_Y) {
+			drm_intel_bo_set_tiling(buf->bo, &tiling, buf->stride);
+			igt_assert_eq(tiling, req_tiling);
+		}
+	} else if (req_tiling == I915_TILING_Yf) {
+		int size;
+
+		buf->stride = ALIGN(width * 4, 128);
+		buf->size = buf->stride * height;
+		buf->tiling = tiling;
+		buf->bpp = 32;
+
+		size = buf->stride * ALIGN(height, 32);
+
+		buf->bo = drm_intel_bo_alloc(data->bufmgr, "", size, 4096);
 	} else {
 		buf->bo = drm_intel_bo_alloc_tiled(data->bufmgr, "",
 						   width, height, 4,
@@ -396,7 +514,7 @@ static void scratch_buf_aux_check(data_t *data,
 		     "Aux surface indicates that nothing was compressed\n");
 }
 
-static void test(data_t *data, uint32_t tiling, bool test_ccs)
+static void test(data_t *data, uint32_t tiling, uint64_t ccs_modifier)
 {
 	struct igt_buf dst, ccs, ref;
 	struct {
@@ -404,7 +522,7 @@ static void test(data_t *data, uint32_t tiling, bool test_ccs)
 		const char *filename;
 		uint32_t tiling;
 		int x, y;
-	} src[3] = {
+	} src[] = {
 		{
 			.filename = "source-linear.png",
 			.tiling = I915_TILING_NONE,
@@ -420,18 +538,31 @@ static void test(data_t *data, uint32_t tiling, bool test_ccs)
 			.tiling = I915_TILING_Y,
 			.x = WIDTH/2+1, .y = 1,
 		},
+		{
+			.filename = "source-yf-tiled.png",
+			.tiling = I915_TILING_Yf,
+			.x = 1, .y = 1,
+		},
 	};
 
 	int opt_dump_aub = igt_aub_dump_enabled();
+	int num_src = ARRAY_SIZE(src);
+
+	/* no Yf before gen9 */
+	if (intel_gen(data->devid) < 9)
+		num_src--;
+
+	if (tiling == I915_TILING_Yf || ccs_modifier)
+		igt_require(intel_gen(data->devid) >= 9);
 
-	for (int i = 0; i < ARRAY_SIZE(src); i++)
+	for (int i = 0; i < num_src; i++)
 		scratch_buf_init(data, &src[i].buf, WIDTH, HEIGHT, src[i].tiling, false);
 	scratch_buf_init(data, &dst, WIDTH, HEIGHT, tiling, false);
-	if (test_ccs)
-		scratch_buf_init(data, &ccs, WIDTH, HEIGHT, I915_TILING_Y, true);
+	if (ccs_modifier)
+		scratch_buf_init(data, &ccs, WIDTH, HEIGHT, ccs_modifier, true);
 	scratch_buf_init(data, &ref, WIDTH, HEIGHT, I915_TILING_NONE, false);
 
-	for (int i = 0; i < ARRAY_SIZE(src); i++)
+	for (int i = 0; i < num_src; i++)
 		scratch_buf_draw_pattern(data, &src[i].buf,
 					 0, 0, WIDTH, HEIGHT,
 					 0, 0, WIDTH, HEIGHT, true);
@@ -442,13 +573,13 @@ static void test(data_t *data, uint32_t tiling, bool test_ccs)
 	scratch_buf_copy(data,
 			 &dst, 0, 0, WIDTH, HEIGHT,
 			 &ref, 0, 0);
-	for (int i = 0; i < ARRAY_SIZE(src); i++)
+	for (int i = 0; i < num_src; i++)
 		scratch_buf_copy(data,
 				 &src[i].buf, WIDTH/4, HEIGHT/4, WIDTH/2-2, HEIGHT/2-2,
 				 &ref, src[i].x, src[i].y);
 
 	if (opt_dump_png) {
-		for (int i = 0; i < ARRAY_SIZE(src); i++)
+		for (int i = 0; i < num_src; i++)
 			scratch_buf_write_to_png(data, &src[i].buf, src[i].filename);
 		scratch_buf_write_to_png(data, &dst, "destination.png");
 		scratch_buf_write_to_png(data, &ref, "reference.png");
@@ -468,24 +599,24 @@ static void test(data_t *data, uint32_t tiling, bool test_ccs)
 	 *	 |dst|src|
 	 *	  -------
 	 */
-	if (test_ccs)
+	if (ccs_modifier)
 		data->render_copy(data->batch, NULL,
 				  &dst, 0, 0, WIDTH, HEIGHT,
 				  &ccs, 0, 0);
 
-	for (int i = 0; i < ARRAY_SIZE(src); i++)
+	for (int i = 0; i < num_src; i++)
 		data->render_copy(data->batch, NULL,
 				  &src[i].buf, WIDTH/4, HEIGHT/4, WIDTH/2-2, HEIGHT/2-2,
-				  test_ccs ? &ccs : &dst, src[i].x, src[i].y);
+				  ccs_modifier ? &ccs : &dst, src[i].x, src[i].y);
 
-	if (test_ccs)
+	if (ccs_modifier)
 		data->render_copy(data->batch, NULL,
 				  &ccs, 0, 0, WIDTH, HEIGHT,
 				  &dst, 0, 0);
 
 	if (opt_dump_png){
 		scratch_buf_write_to_png(data, &dst, "result.png");
-		if (test_ccs) {
+		if (ccs_modifier) {
 			scratch_buf_write_to_png(data, &ccs, "compressed.png");
 			scratch_buf_aux_write_to_png(data, &ccs, "compressed-aux.png");
 		}
@@ -505,7 +636,7 @@ static void test(data_t *data, uint32_t tiling, bool test_ccs)
 		scratch_buf_check(data, &dst, &ref, WIDTH - 10, HEIGHT - 10);
 	}
 
-	if (test_ccs)
+	if (ccs_modifier)
 		scratch_buf_aux_check(data, &ccs);
 }
 
@@ -546,18 +677,31 @@ int main(int argc, char **argv)
 	}
 
 	igt_subtest("linear")
-		test(&data, I915_TILING_NONE, false);
+		test(&data, I915_TILING_NONE, 0);
 	igt_subtest("x-tiled")
-		test(&data, I915_TILING_X, false);
+		test(&data, I915_TILING_X, 0);
 	igt_subtest("y-tiled")
-		test(&data, I915_TILING_Y, false);
+		test(&data, I915_TILING_Y, 0);
+	igt_subtest("yf-tiled")
+		test(&data, I915_TILING_Yf, 0);
 
 	igt_subtest("y-tiled-ccs-to-linear")
-		test(&data, I915_TILING_NONE, true);
+		test(&data, I915_TILING_NONE, I915_TILING_Y);
 	igt_subtest("y-tiled-ccs-to-x-tiled")
-		test(&data, I915_TILING_X, true);
+		test(&data, I915_TILING_X, I915_TILING_Y);
 	igt_subtest("y-tiled-ccs-to-y-tiled")
-		test(&data, I915_TILING_Y, true);
+		test(&data, I915_TILING_Y, I915_TILING_Y);
+	igt_subtest("y-tiled-ccs-to-yf-tiled")
+		test(&data, I915_TILING_Yf, I915_TILING_Y);
+
+	igt_subtest("yf-tiled-ccs-to-linear")
+		test(&data, I915_TILING_NONE, I915_TILING_Yf);
+	igt_subtest("yf-tiled-ccs-to-x-tiled")
+		test(&data, I915_TILING_X, I915_TILING_Yf);
+	igt_subtest("yf-tiled-ccs-to-y-tiled")
+		test(&data, I915_TILING_Y, I915_TILING_Yf);
+	igt_subtest("yf-tiled-ccs-to-yf-tiled")
+		test(&data, I915_TILING_Yf, I915_TILING_Yf);
 
 	igt_fixture {
 		intel_batchbuffer_free(data.batch);
-- 
2.17.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] [PATCH i-g-t 3/7] lib/igt_fb: Use rendercopy for rendering into compressed buffers
  2019-02-21 14:41 [igt-dev] [PATCH i-g-t 0/7] Use rendercopy for generating CCS buffers Dhinakaran Pandiyan
  2019-02-21 14:41 ` [igt-dev] [PATCH i-g-t 1/7] lib/rendercopy: Add support for Yf/Ys tiling to gen9 rendercopy Dhinakaran Pandiyan
  2019-02-21 14:41 ` [igt-dev] [PATCH i-g-t 2/7] tests/gem_render_copy: Test Yf tiling Dhinakaran Pandiyan
@ 2019-02-21 14:41 ` Dhinakaran Pandiyan
  2019-02-21 18:04   ` [igt-dev] [PATCH i-g-t v2 3/8] " Dhinakaran Pandiyan
  2019-02-21 14:41 ` [igt-dev] [PATCH i-g-t 4/7] lib/igt_fb: s/tiling/modifier/ where appropriate Dhinakaran Pandiyan
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 25+ messages in thread
From: Dhinakaran Pandiyan @ 2019-02-21 14:41 UTC (permalink / raw)
  To: igt-dev; +Cc: Clinton Taylor, Dhinakaran Pandiyan

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Plug in rendercopy to the cairo surface stuff so that we can
generate compressed buffers with cairo.

v2: s/modifier_has_ccs/is_ccs_modifier/

v3: From DK
 Set buf.bpp when initializing and rebase.

Cc: Clinton Taylor <clinton.a.taylor@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
---
 lib/igt_fb.c | 144 +++++++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 134 insertions(+), 10 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 462afec2..61aa63e2 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -290,6 +290,7 @@ void igt_get_fb_tile_size(int fd, uint64_t tiling, int fb_bpp,
 		}
 		break;
 	case LOCAL_I915_FORMAT_MOD_Y_TILED:
+	case LOCAL_I915_FORMAT_MOD_Y_TILED_CCS:
 		igt_require_intel(fd);
 		if (intel_gen(intel_get_drm_devid(fd)) == 2) {
 			*width_ret = 128;
@@ -303,6 +304,7 @@ void igt_get_fb_tile_size(int fd, uint64_t tiling, int fb_bpp,
 		}
 		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:
@@ -328,10 +330,19 @@ void igt_get_fb_tile_size(int fd, uint64_t tiling, int fb_bpp,
 	}
 }
 
+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;
+}
+
 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->tiling) && plane == 1)
+		return DIV_ROUND_UP(fb->width, 1024) * 128;
+
 	if (plane == 0)
 		return fb->width;
 
@@ -342,13 +353,19 @@ static unsigned fb_plane_bpp(const struct igt_fb *fb, int plane)
 {
 	const struct format_desc_struct *format = lookup_drm_format(fb->drm_format);
 
-	return format->plane_bpp[plane];
+	if (is_ccs_modifier(fb->tiling) && plane == 1)
+		return 8;
+	else
+		return format->plane_bpp[plane];
 }
 
 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->tiling) && plane == 1)
+		return DIV_ROUND_UP(fb->height, 512) * 32;
+
 	if (plane == 0)
 		return fb->height;
 
@@ -359,7 +376,10 @@ static int fb_num_planes(const struct igt_fb *fb)
 {
 	const struct format_desc_struct *format = lookup_drm_format(fb->drm_format);
 
-	return format->num_planes;
+	if (is_ccs_modifier(fb->tiling))
+		return 2;
+	else
+		return format->num_planes;
 }
 
 static void fb_init(struct igt_fb *fb,
@@ -518,8 +538,10 @@ uint64_t igt_fb_mod_to_tiling(uint64_t modifier)
 	case LOCAL_I915_FORMAT_MOD_X_TILED:
 		return I915_TILING_X;
 	case LOCAL_I915_FORMAT_MOD_Y_TILED:
+	case LOCAL_I915_FORMAT_MOD_Y_TILED_CCS:
 		return I915_TILING_Y;
 	case LOCAL_I915_FORMAT_MOD_Yf_TILED:
+	case LOCAL_I915_FORMAT_MOD_Yf_TILED_CCS:
 		return I915_TILING_Yf;
 	default:
 		igt_assert(0);
@@ -1405,8 +1427,54 @@ struct fb_blit_upload {
 	int fd;
 	struct igt_fb *fb;
 	struct fb_blit_linear linear;
+	drm_intel_bufmgr *bufmgr;
+	struct intel_batchbuffer *batch;
 };
 
+static void init_buf(struct fb_blit_upload *blit,
+		     struct igt_buf *buf,
+		     const struct igt_fb *fb,
+		     const char *name)
+{
+	igt_assert_eq(fb->offsets[0], 0);
+
+	buf->bo = gem_handle_to_libdrm_bo(blit->bufmgr, blit->fd,
+					  name, fb->gem_handle);
+	buf->tiling = igt_fb_mod_to_tiling(fb->tiling);
+	buf->stride = fb->strides[0];
+	buf->bpp = fb->plane_bpp[0];
+	buf->size = fb->size;
+
+	if (is_ccs_modifier(fb->tiling)) {
+		igt_assert_eq(fb->strides[0] & 127, 0);
+		igt_assert_eq(fb->strides[1] & 127, 0);
+
+		buf->aux.offset = fb->offsets[1];
+		buf->aux.stride = fb->strides[1];
+	}
+}
+
+static void rendercopy(struct fb_blit_upload *blit,
+		       const struct igt_fb *dst_fb,
+		       const struct igt_fb *src_fb)
+{
+	struct igt_buf src = {}, dst = {};
+	igt_render_copyfunc_t render_copy =
+		igt_get_render_copyfunc(intel_get_drm_devid(blit->fd));
+
+	igt_require(render_copy);
+
+	igt_assert_eq(dst_fb->offsets[0], 0);
+	igt_assert_eq(src_fb->offsets[0], 0);
+
+	init_buf(blit, &src, src_fb, "cairo rendercopy src");
+	init_buf(blit, &dst, dst_fb, "cairo rendercopy dst");
+
+	render_copy(blit->batch, NULL,
+		    &src, 0, 0, dst_fb->plane_width[0], dst_fb->plane_height[0],
+		    &dst, 0, 0);
+}
+
 static void blitcopy(const struct igt_fb *dst_fb,
 		     const struct igt_fb *src_fb)
 {
@@ -1444,7 +1512,10 @@ static void free_linear_mapping(struct fb_blit_upload *blit)
 	gem_set_domain(fd, linear->fb.gem_handle,
 		       I915_GEM_DOMAIN_GTT, 0);
 
-	blitcopy(fb, &linear->fb);
+	if (blit->batch)
+		rendercopy(blit, fb, &linear->fb);
+	else
+		blitcopy(fb, &linear->fb);
 
 	gem_sync(fd, linear->fb.gem_handle);
 	gem_close(fd, linear->fb.gem_handle);
@@ -1461,8 +1532,26 @@ static void destroy_cairo_surface__blit(void *arg)
 	free(blit);
 }
 
-static void setup_linear_mapping(int fd, struct igt_fb *fb, struct fb_blit_linear *linear)
+static void destroy_cairo_surface__rendercopy(void *arg)
+{
+	struct fb_blit_upload *blit = arg;
+
+	blit->fb->cairo_surface = NULL;
+
+	free_linear_mapping(blit);
+
+	intel_batchbuffer_free(blit->batch);
+	drm_intel_bufmgr_destroy(blit->bufmgr);
+
+	free(blit);
+}
+
+static void setup_linear_mapping(struct fb_blit_upload *blit)
 {
+	int fd = blit->fd;
+	struct igt_fb *fb = blit->fb;
+	struct fb_blit_linear *linear = &blit->linear;
+
 	/*
 	 * We create a linear BO that we'll map for the CPU to write to (using
 	 * cairo). This linear bo will be then blitted to its final
@@ -1481,7 +1570,10 @@ static void setup_linear_mapping(int fd, struct igt_fb *fb, struct fb_blit_linea
 	gem_set_domain(fd, linear->fb.gem_handle,
 			I915_GEM_DOMAIN_GTT, 0);
 
-	blitcopy(&linear->fb, fb);
+	if (blit->batch)
+		rendercopy(blit, &linear->fb, fb);
+	else
+		blitcopy(&linear->fb, fb);
 
 	gem_sync(fd, linear->fb.gem_handle);
 
@@ -1498,12 +1590,12 @@ static void create_cairo_surface__blit(int fd, struct igt_fb *fb)
 	struct fb_blit_upload *blit;
 	cairo_format_t cairo_format;
 
-	blit = malloc(sizeof(*blit));
+	blit = calloc(1, sizeof(*blit));
 	igt_assert(blit);
 
 	blit->fd = fd;
 	blit->fb = fb;
-	setup_linear_mapping(fd, fb, &blit->linear);
+	setup_linear_mapping(blit);
 
 	cairo_format = drm_format_to_cairo(fb->drm_format);
 	fb->cairo_surface =
@@ -1518,6 +1610,36 @@ static void create_cairo_surface__blit(int fd, struct igt_fb *fb)
 				    blit, destroy_cairo_surface__blit);
 }
 
+static void create_cairo_surface__rendercopy(int fd, struct igt_fb *fb)
+{
+	struct fb_blit_upload *blit;
+	cairo_format_t cairo_format;
+
+	blit = calloc(1, sizeof(*blit));
+	igt_assert(blit);
+
+	blit->fd = fd;
+	blit->fb = fb;
+
+	blit->bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
+	blit->batch = intel_batchbuffer_alloc(blit->bufmgr,
+					      intel_get_drm_devid(fd));
+
+	setup_linear_mapping(blit);
+
+	cairo_format = drm_format_to_cairo(fb->drm_format);
+	fb->cairo_surface =
+		cairo_image_surface_create_for_data(blit->linear.map,
+						    cairo_format,
+						    fb->width, fb->height,
+						    blit->linear.fb.strides[0]);
+	fb->domain = I915_GEM_DOMAIN_GTT;
+
+	cairo_surface_set_user_data(fb->cairo_surface,
+				    (cairo_user_data_key_t *)create_cairo_surface__rendercopy,
+				    blit, destroy_cairo_surface__rendercopy);
+}
+
 /**
  * igt_dirty_fb:
  * @fd: open drm file descriptor
@@ -2278,7 +2400,7 @@ static void destroy_cairo_surface__convert(void *arg)
 
 static void create_cairo_surface__convert(int fd, struct igt_fb *fb)
 {
-	struct fb_convert_blit_upload *blit = malloc(sizeof(*blit));
+	struct fb_convert_blit_upload *blit = calloc(1, sizeof(*blit));
 	struct fb_convert cvt = { };
 	const struct format_desc_struct *f = lookup_drm_format(fb->drm_format);
 	unsigned drm_format;
@@ -2318,7 +2440,7 @@ static void create_cairo_surface__convert(int fd, struct igt_fb *fb)
 
 	if (fb->tiling == LOCAL_I915_FORMAT_MOD_Y_TILED ||
 	    fb->tiling == LOCAL_I915_FORMAT_MOD_Yf_TILED) {
-		setup_linear_mapping(fd, fb, &blit->base.linear);
+		setup_linear_mapping(&blit->base);
 	} else {
 		blit->base.linear.fb = *fb;
 		blit->base.linear.fb.gem_handle = 0;
@@ -2397,8 +2519,10 @@ cairo_surface_t *igt_get_cairo_surface(int fd, struct igt_fb *fb)
 		    ((f->cairo_id == CAIRO_FORMAT_INVALID) &&
 		     (f->pixman_id != PIXMAN_invalid)))
 			create_cairo_surface__convert(fd, fb);
+		else if (is_ccs_modifier(fb->tiling))
+			create_cairo_surface__rendercopy(fd, fb);
 		else if (fb->tiling == LOCAL_I915_FORMAT_MOD_Y_TILED ||
-		    fb->tiling == LOCAL_I915_FORMAT_MOD_Yf_TILED)
+			 fb->tiling == LOCAL_I915_FORMAT_MOD_Yf_TILED)
 			create_cairo_surface__blit(fd, fb);
 		else
 			create_cairo_surface__gtt(fd, fb);
-- 
2.17.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] [PATCH i-g-t 4/7] lib/igt_fb: s/tiling/modifier/ where appropriate
  2019-02-21 14:41 [igt-dev] [PATCH i-g-t 0/7] Use rendercopy for generating CCS buffers Dhinakaran Pandiyan
                   ` (2 preceding siblings ...)
  2019-02-21 14:41 ` [igt-dev] [PATCH i-g-t 3/7] lib/igt_fb: Use rendercopy for rendering into compressed buffers Dhinakaran Pandiyan
@ 2019-02-21 14:41 ` Dhinakaran Pandiyan
  2019-02-21 18:05   ` [igt-dev] [PATCH i-g-t v2 4/8] " Dhinakaran Pandiyan
  2019-02-21 14:41 ` [igt-dev] [PATCH i-g-t 5/7] lib/igt_fb: Function to create a bo for passed in igt_fb Dhinakaran Pandiyan
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 25+ messages in thread
From: Dhinakaran Pandiyan @ 2019-02-21 14:41 UTC (permalink / raw)
  To: igt-dev; +Cc: Clinton Taylor, Dhinakaran Pandiyan

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Rename the igt_fb.tiling to igt_fb.modifier to better reflect
what information it carries. Now it's clear whether we're talking
about a modifier or a i915 tiling thing.

Cc: Clinton Taylor <clinton.a.taylor@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
---
 lib/igt_fb.c    | 102 ++++++++++++++++++++++++------------------------
 lib/igt_fb.h    |  22 +++++------
 tests/kms_ccs.c |   2 +-
 3 files changed, 63 insertions(+), 63 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 61aa63e2..b475a686 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -259,7 +259,7 @@ static const struct format_desc_struct *lookup_drm_format(uint32_t drm_format)
 /**
  * igt_get_fb_tile_size:
  * @fd: the DRM file descriptor
- * @tiling: tiling layout of the framebuffer (as framebuffer modifier)
+ * @modifier: 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
@@ -267,10 +267,10 @@ static const struct format_desc_struct *lookup_drm_format(uint32_t drm_format)
  * 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,
+void igt_get_fb_tile_size(int fd, uint64_t modifier, int fb_bpp,
 			  unsigned *width_ret, unsigned *height_ret)
 {
-	switch (tiling) {
+	switch (modifier) {
 	case LOCAL_DRM_FORMAT_MOD_NONE:
 		if (is_i915_device(fd))
 			*width_ret = 64;
@@ -340,7 +340,7 @@ 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->tiling) && plane == 1)
+	if (is_ccs_modifier(fb->modifier) && plane == 1)
 		return DIV_ROUND_UP(fb->width, 1024) * 128;
 
 	if (plane == 0)
@@ -353,7 +353,7 @@ 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->tiling) && plane == 1)
+	if (is_ccs_modifier(fb->modifier) && plane == 1)
 		return 8;
 	else
 		return format->plane_bpp[plane];
@@ -363,7 +363,7 @@ 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->tiling) && plane == 1)
+	if (is_ccs_modifier(fb->modifier) && plane == 1)
 		return DIV_ROUND_UP(fb->height, 512) * 32;
 
 	if (plane == 0)
@@ -376,7 +376,7 @@ static int fb_num_planes(const struct igt_fb *fb)
 {
 	const struct format_desc_struct *format = lookup_drm_format(fb->drm_format);
 
-	if (is_ccs_modifier(fb->tiling))
+	if (is_ccs_modifier(fb->modifier))
 		return 2;
 	else
 		return format->num_planes;
@@ -397,7 +397,7 @@ static void fb_init(struct igt_fb *fb,
 
 	fb->width = width;
 	fb->height = height;
-	fb->tiling = modifier;
+	fb->modifier = modifier;
 	fb->drm_format = drm_format;
 	fb->fd = fd;
 	fb->num_planes = fb_num_planes(fb);
@@ -416,7 +416,7 @@ static uint32_t calc_plane_stride(struct igt_fb *fb, int plane)
 	uint32_t min_stride = fb->plane_width[plane] *
 		(fb->plane_bpp[plane] / 8);
 
-	if (fb->tiling != LOCAL_DRM_FORMAT_MOD_NONE &&
+	if (fb->modifier != LOCAL_DRM_FORMAT_MOD_NONE &&
 	    intel_gen(intel_get_drm_devid(fb->fd)) <= 3) {
 		uint32_t stride;
 
@@ -435,7 +435,7 @@ static uint32_t calc_plane_stride(struct igt_fb *fb, int plane)
 	} else {
 		unsigned int tile_width, tile_height;
 
-		igt_get_fb_tile_size(fb->fd, fb->tiling, fb->plane_bpp[plane],
+		igt_get_fb_tile_size(fb->fd, fb->modifier, fb->plane_bpp[plane],
 				     &tile_width, &tile_height);
 
 		return ALIGN(min_stride, tile_width);
@@ -444,7 +444,7 @@ static uint32_t calc_plane_stride(struct igt_fb *fb, int plane)
 
 static uint64_t calc_plane_size(struct igt_fb *fb, int plane)
 {
-	if (fb->tiling != LOCAL_DRM_FORMAT_MOD_NONE &&
+	if (fb->modifier != LOCAL_DRM_FORMAT_MOD_NONE &&
 	    intel_gen(intel_get_drm_devid(fb->fd)) <= 3) {
 		uint64_t min_size = (uint64_t) fb->strides[plane] *
 			fb->plane_height[plane];
@@ -465,7 +465,7 @@ static uint64_t calc_plane_size(struct igt_fb *fb, int plane)
 	} else {
 		unsigned int tile_width, tile_height;
 
-		igt_get_fb_tile_size(fb->fd, fb->tiling, fb->plane_bpp[plane],
+		igt_get_fb_tile_size(fb->fd, fb->modifier, fb->plane_bpp[plane],
 				     &tile_width, &tile_height);
 
 		return (uint64_t) fb->strides[plane] *
@@ -497,19 +497,19 @@ static uint64_t calc_fb_size(struct igt_fb *fb)
  * @width: width of the framebuffer in pixels
  * @height: height of the framebuffer in pixels
  * @format: drm fourcc pixel format code
- * @tiling: tiling layout of the framebuffer (as framebuffer modifier)
+ * @modifier: tiling layout of the framebuffer (as framebuffer modifier)
  * @size_ret: returned size for the framebuffer
  * @stride_ret: returned stride for the framebuffer
  *
  * This function returns valid stride and size values for a framebuffer with the
  * specified parameters.
  */
-void igt_calc_fb_size(int fd, int width, int height, uint32_t drm_format, uint64_t tiling,
+void igt_calc_fb_size(int fd, int width, int height, uint32_t drm_format, uint64_t modifier,
 		      uint64_t *size_ret, unsigned *stride_ret)
 {
 	struct igt_fb fb;
 
-	fb_init(&fb, fd, width, height, drm_format, tiling,
+	fb_init(&fb, fd, width, height, drm_format, modifier,
 		IGT_COLOR_YCBCR_BT709, IGT_COLOR_YCBCR_LIMITED_RANGE);
 
 	fb.size = calc_fb_size(&fb);
@@ -633,7 +633,7 @@ static int create_bo_for_fb(struct igt_fb *fb)
 	int fd = fb->fd;
 
 	if (is_i915_device(fd) &&
-	   (fb->tiling || fb->size || fb->strides[0] || igt_format_is_yuv(fb->drm_format))) {
+	    (fb->modifier || fb->size || fb->strides[0] || igt_format_is_yuv(fb->drm_format))) {
 		uint64_t size;
 
 		size = calc_fb_size(fb);
@@ -645,7 +645,7 @@ static int create_bo_for_fb(struct igt_fb *fb)
 		fb->is_dumb = false;
 		fb->gem_handle = gem_create(fd, fb->size);
 		gem_set_tiling(fd, fb->gem_handle,
-			       igt_fb_mod_to_tiling(fb->tiling),
+			       igt_fb_mod_to_tiling(fb->modifier),
 			       fb->strides[0]);
 
 		goto out;
@@ -1049,7 +1049,7 @@ void igt_paint_image(cairo_t *cr, const char *filename,
  * @width: width of the framebuffer in pixel
  * @height: height of the framebuffer in pixel
  * @format: drm fourcc pixel format code
- * @tiling: tiling layout of the framebuffer (as framebuffer modifier)
+ * @modifier: tiling layout of the framebuffer (as framebuffer modifier)
  * @fb: pointer to an #igt_fb structure
  * @bo_size: size of the backing bo (0 for automatic size)
  * @bo_stride: stride of the backing bo (0 for automatic stride)
@@ -1066,7 +1066,7 @@ void igt_paint_image(cairo_t *cr, const char *filename,
  */
 unsigned int
 igt_create_fb_with_bo_size(int fd, int width, int height,
-			   uint32_t format, uint64_t tiling,
+			   uint32_t format, uint64_t modifier,
 			   struct igt_fb *fb, uint64_t bo_size,
 			   unsigned bo_stride)
 {
@@ -1075,7 +1075,7 @@ igt_create_fb_with_bo_size(int fd, int width, int height,
 	enum igt_color_range color_range = IGT_COLOR_YCBCR_LIMITED_RANGE;
 	uint32_t flags = 0;
 
-	fb_init(fb, fd, width, height, format, tiling,
+	fb_init(fb, fd, width, height, format, modifier,
 		color_encoding, color_range);
 
 	for (int i = 0; i < fb->num_planes; i++)
@@ -1083,8 +1083,8 @@ igt_create_fb_with_bo_size(int fd, int width, int height,
 
 	fb->size = bo_size;
 
-	igt_debug("%s(width=%d, height=%d, format=0x%x, tiling=0x%"PRIx64", size=%"PRIu64")\n",
-		  __func__, width, height, format, tiling, bo_size);
+	igt_debug("%s(width=%d, height=%d, format=0x%x, modifier=0x%"PRIx64", size=%"PRIu64")\n",
+		  __func__, width, height, format, modifier, bo_size);
 
 	create_bo_for_fb(fb);
 	igt_assert(fb->gem_handle > 0);
@@ -1092,12 +1092,12 @@ igt_create_fb_with_bo_size(int fd, int width, int height,
 	igt_debug("%s(handle=%d, pitch=%d)\n",
 		  __func__, fb->gem_handle, fb->strides[0]);
 
-	if (fb->tiling || igt_has_fb_modifiers(fd))
+	if (fb->modifier || igt_has_fb_modifiers(fd))
 		flags = LOCAL_DRM_MODE_FB_MODIFIERS;
 
 	do_or_die(__kms_addfb(fb->fd, fb->gem_handle,
 			      fb->width, fb->height,
-			      fb->drm_format, fb->tiling,
+			      fb->drm_format, fb->modifier,
 			      fb->strides, fb->offsets, fb->num_planes, flags,
 			      &fb->fb_id));
 
@@ -1110,7 +1110,7 @@ igt_create_fb_with_bo_size(int fd, int width, int height,
  * @width: width of the framebuffer in pixel
  * @height: height of the framebuffer in pixel
  * @format: drm fourcc pixel format code
- * @tiling: tiling layout of the framebuffer
+ * @modifier: tiling layout of the framebuffer
  * @fb: pointer to an #igt_fb structure
  *
  * This function allocates a gem buffer object suitable to back a framebuffer
@@ -1124,9 +1124,9 @@ igt_create_fb_with_bo_size(int fd, int width, int height,
  * The kms id of the created framebuffer.
  */
 unsigned int igt_create_fb(int fd, int width, int height, uint32_t format,
-			   uint64_t tiling, struct igt_fb *fb)
+			   uint64_t modifier, struct igt_fb *fb)
 {
-	return igt_create_fb_with_bo_size(fd, width, height, format, tiling, fb,
+	return igt_create_fb_with_bo_size(fd, width, height, format, modifier, fb,
 					  0, 0);
 }
 
@@ -1136,7 +1136,7 @@ unsigned int igt_create_fb(int fd, int width, int height, uint32_t format,
  * @width: width of the framebuffer in pixel
  * @height: height of the framebuffer in pixel
  * @format: drm fourcc pixel format code
- * @tiling: tiling layout of the framebuffer
+ * @modifier: tiling layout of the framebuffer
  * @r: red value to use as fill color
  * @g: green value to use as fill color
  * @b: blue value to use as fill color
@@ -1154,14 +1154,14 @@ unsigned int igt_create_fb(int fd, int width, int height, uint32_t format,
  * failure.
  */
 unsigned int igt_create_color_fb(int fd, int width, int height,
-				 uint32_t format, uint64_t tiling,
+				 uint32_t format, uint64_t modifier,
 				 double r, double g, double b,
 				 struct igt_fb *fb /* out */)
 {
 	unsigned int fb_id;
 	cairo_t *cr;
 
-	fb_id = igt_create_fb(fd, width, height, format, tiling, fb);
+	fb_id = igt_create_fb(fd, width, height, format, modifier, fb);
 	igt_assert(fb_id);
 
 	cr = igt_get_cairo_ctx(fd, fb);
@@ -1177,7 +1177,7 @@ unsigned int igt_create_color_fb(int fd, int width, int height,
  * @width: width of the framebuffer in pixel
  * @height: height of the framebuffer in pixel
  * @format: drm fourcc pixel format code
- * @tiling: tiling layout of the framebuffer
+ * @modifier: tiling layout of the framebuffer
  * @fb: pointer to an #igt_fb structure
  *
  * This function allocates a gem buffer object suitable to back a framebuffer
@@ -1192,13 +1192,13 @@ unsigned int igt_create_color_fb(int fd, int width, int height,
  * failure.
  */
 unsigned int igt_create_pattern_fb(int fd, int width, int height,
-				   uint32_t format, uint64_t tiling,
+				   uint32_t format, uint64_t modifier,
 				   struct igt_fb *fb /* out */)
 {
 	unsigned int fb_id;
 	cairo_t *cr;
 
-	fb_id = igt_create_fb(fd, width, height, format, tiling, fb);
+	fb_id = igt_create_fb(fd, width, height, format, modifier, fb);
 	igt_assert(fb_id);
 
 	cr = igt_get_cairo_ctx(fd, fb);
@@ -1214,7 +1214,7 @@ unsigned int igt_create_pattern_fb(int fd, int width, int height,
  * @width: width of the framebuffer in pixel
  * @height: height of the framebuffer in pixel
  * @format: drm fourcc pixel format code
- * @tiling: tiling layout of the framebuffer
+ * @modifier: tiling layout of the framebuffer
  * @r: red value to use as fill color
  * @g: green value to use as fill color
  * @b: blue value to use as fill color
@@ -1233,14 +1233,14 @@ unsigned int igt_create_pattern_fb(int fd, int width, int height,
  * failure.
  */
 unsigned int igt_create_color_pattern_fb(int fd, int width, int height,
-					 uint32_t format, uint64_t tiling,
+					 uint32_t format, uint64_t modifier,
 					 double r, double g, double b,
 					 struct igt_fb *fb /* out */)
 {
 	unsigned int fb_id;
 	cairo_t *cr;
 
-	fb_id = igt_create_fb(fd, width, height, format, tiling, fb);
+	fb_id = igt_create_fb(fd, width, height, format, modifier, fb);
 	igt_assert(fb_id);
 
 	cr = igt_get_cairo_ctx(fd, fb);
@@ -1257,7 +1257,7 @@ unsigned int igt_create_color_pattern_fb(int fd, int width, int height,
  * @width: width of the framebuffer in pixel or 0
  * @height: height of the framebuffer in pixel or 0
  * @format: drm fourcc pixel format code
- * @tiling: tiling layout of the framebuffer
+ * @modifier: tiling layout of the framebuffer
  * @filename: filename of the png image to draw
  * @fb: pointer to an #igt_fb structure
  *
@@ -1269,7 +1269,7 @@ unsigned int igt_create_color_pattern_fb(int fd, int width, int height,
  * failure.
  */
 unsigned int igt_create_image_fb(int fd, int width, int height,
-				 uint32_t format, uint64_t tiling,
+				 uint32_t format, uint64_t modifier,
 				 const char *filename,
 				 struct igt_fb *fb /* out */)
 {
@@ -1285,7 +1285,7 @@ unsigned int igt_create_image_fb(int fd, int width, int height,
 		height = cairo_image_surface_get_height(image);
 	cairo_surface_destroy(image);
 
-	fb_id = igt_create_fb(fd, width, height, format, tiling, fb);
+	fb_id = igt_create_fb(fd, width, height, format, modifier, fb);
 
 	cr = igt_get_cairo_ctx(fd, fb);
 	igt_paint_image(cr, filename, 0, 0, width, height);
@@ -1361,7 +1361,7 @@ static void stereo_fb_layout_from_mode(struct stereo_fb_layout *layout,
  * @drm_fd: open i915 drm file descriptor
  * @mode: A stereo 3D mode.
  * @format: drm fourcc pixel format code
- * @tiling: tiling layout of the framebuffer
+ * @modifier: tiling layout of the framebuffer
  *
  * Create a framebuffer for use with the stereo 3D mode specified by @mode.
  *
@@ -1370,7 +1370,7 @@ static void stereo_fb_layout_from_mode(struct stereo_fb_layout *layout,
  * failure.
  */
 unsigned int igt_create_stereo_fb(int drm_fd, drmModeModeInfo *mode,
-				  uint32_t format, uint64_t tiling)
+				  uint32_t format, uint64_t modifier)
 {
 	struct stereo_fb_layout layout;
 	cairo_t *cr;
@@ -1379,7 +1379,7 @@ unsigned int igt_create_stereo_fb(int drm_fd, drmModeModeInfo *mode,
 
 	stereo_fb_layout_from_mode(&layout, mode);
 	fb_id = igt_create_fb(drm_fd, layout.fb_width, layout.fb_height, format,
-			      tiling, &fb);
+			      modifier, &fb);
 	cr = igt_get_cairo_ctx(drm_fd, &fb);
 
 	igt_paint_image(cr, "1080p-left.png",
@@ -1440,12 +1440,12 @@ static void init_buf(struct fb_blit_upload *blit,
 
 	buf->bo = gem_handle_to_libdrm_bo(blit->bufmgr, blit->fd,
 					  name, fb->gem_handle);
-	buf->tiling = igt_fb_mod_to_tiling(fb->tiling);
+	buf->tiling = igt_fb_mod_to_tiling(fb->modifier);
 	buf->stride = fb->strides[0];
 	buf->bpp = fb->plane_bpp[0];
 	buf->size = fb->size;
 
-	if (is_ccs_modifier(fb->tiling)) {
+	if (is_ccs_modifier(fb->modifier)) {
 		igt_assert_eq(fb->strides[0] & 127, 0);
 		igt_assert_eq(fb->strides[1] & 127, 0);
 
@@ -1490,14 +1490,14 @@ static void blitcopy(const struct igt_fb *dst_fb,
 					   src_fb->gem_handle,
 					   src_fb->offsets[i],
 					   src_fb->strides[i],
-					   igt_fb_mod_to_tiling(src_fb->tiling),
+					   igt_fb_mod_to_tiling(src_fb->modifier),
 					   0, 0, /* src_x, src_y */
 					   dst_fb->plane_width[i], dst_fb->plane_height[i],
 					   dst_fb->plane_bpp[i],
 					   dst_fb->gem_handle,
 					   dst_fb->offsets[i],
 					   dst_fb->strides[i],
-					   igt_fb_mod_to_tiling(dst_fb->tiling),
+					   igt_fb_mod_to_tiling(dst_fb->modifier),
 					   0, 0 /* dst_x, dst_y */);
 	}
 }
@@ -2438,8 +2438,8 @@ static void create_cairo_surface__convert(int fd, struct igt_fb *fb)
 							     &blit->shadow_fb);
 	igt_assert(blit->shadow_ptr);
 
-	if (fb->tiling == LOCAL_I915_FORMAT_MOD_Y_TILED ||
-	    fb->tiling == LOCAL_I915_FORMAT_MOD_Yf_TILED) {
+	if (fb->modifier == LOCAL_I915_FORMAT_MOD_Y_TILED ||
+	    fb->modifier == LOCAL_I915_FORMAT_MOD_Yf_TILED) {
 		setup_linear_mapping(&blit->base);
 	} else {
 		blit->base.linear.fb = *fb;
@@ -2519,10 +2519,10 @@ cairo_surface_t *igt_get_cairo_surface(int fd, struct igt_fb *fb)
 		    ((f->cairo_id == CAIRO_FORMAT_INVALID) &&
 		     (f->pixman_id != PIXMAN_invalid)))
 			create_cairo_surface__convert(fd, fb);
-		else if (is_ccs_modifier(fb->tiling))
+		else if (is_ccs_modifier(fb->modifier))
 			create_cairo_surface__rendercopy(fd, fb);
-		else if (fb->tiling == LOCAL_I915_FORMAT_MOD_Y_TILED ||
-			 fb->tiling == LOCAL_I915_FORMAT_MOD_Yf_TILED)
+		else if (fb->modifier == LOCAL_I915_FORMAT_MOD_Y_TILED ||
+			 fb->modifier == LOCAL_I915_FORMAT_MOD_Yf_TILED)
 			create_cairo_surface__blit(fd, fb);
 		else
 			create_cairo_surface__gtt(fd, fb);
diff --git a/lib/igt_fb.h b/lib/igt_fb.h
index 8c683db5..a5a1a2ba 100644
--- a/lib/igt_fb.h
+++ b/lib/igt_fb.h
@@ -53,7 +53,7 @@
  * @drm_format: DRM FOURCC code
  * @width: width in pixels
  * @height: height in pixels
- * @tiling: tiling mode as a DRM framebuffer modifier
+ * @modifier: tiling mode as a DRM framebuffer modifier
  * @size: size in bytes of the underlying backing storage
  * @cairo_surface: optionally attached cairo drawing surface
  * @domain: current domain for cache flushing tracking on i915.ko
@@ -76,7 +76,7 @@ typedef struct igt_fb {
 	int height;
 	enum igt_color_encoding color_encoding;
 	enum igt_color_range color_range;
-	uint64_t tiling;
+	uint64_t modifier;
 	uint64_t size;
 	cairo_surface_t *cairo_surface;
 	unsigned int domain;
@@ -108,34 +108,34 @@ enum igt_text_align {
 	align_hcenter	= 0x08,
 };
 
-void igt_get_fb_tile_size(int fd, uint64_t tiling, int fb_bpp,
+void igt_get_fb_tile_size(int fd, uint64_t modifier, int fb_bpp,
 			  unsigned *width_ret, unsigned *height_ret);
-void igt_calc_fb_size(int fd, int width, int height, uint32_t format, uint64_t tiling,
+void igt_calc_fb_size(int fd, int width, int height, uint32_t format, uint64_t modifier,
 		      uint64_t *size_ret, unsigned *stride_ret);
 unsigned int
 igt_create_fb_with_bo_size(int fd, int width, int height,
-			   uint32_t format, uint64_t tiling,
+			   uint32_t format, uint64_t modifier,
 			   struct igt_fb *fb, uint64_t bo_size,
 			   unsigned bo_stride);
 unsigned int igt_create_fb(int fd, int width, int height, uint32_t format,
-			   uint64_t tiling, struct igt_fb *fb);
+			   uint64_t modifier, struct igt_fb *fb);
 unsigned int igt_create_color_fb(int fd, int width, int height,
-				 uint32_t format, uint64_t tiling,
+				 uint32_t format, uint64_t modifier,
 				 double r, double g, double b,
 				 struct igt_fb *fb /* out */);
 unsigned int igt_create_pattern_fb(int fd, int width, int height,
-				   uint32_t format, uint64_t tiling,
+				   uint32_t format, uint64_t modifier,
 				   struct igt_fb *fb /* out */);
 unsigned int igt_create_color_pattern_fb(int fd, int width, int height,
-					 uint32_t format, uint64_t tiling,
+					 uint32_t format, uint64_t modifier,
 					 double r, double g, double b,
 					 struct igt_fb *fb /* out */);
 unsigned int igt_create_image_fb(int drm_fd,  int width, int height,
-				 uint32_t format, uint64_t tiling,
+				 uint32_t format, uint64_t modifier,
 				 const char *filename,
 				 struct igt_fb *fb /* out */);
 unsigned int igt_create_stereo_fb(int drm_fd, drmModeModeInfo *mode,
-				  uint32_t format, uint64_t tiling);
+				  uint32_t format, uint64_t modifier);
 unsigned int igt_fb_convert(struct igt_fb *dst, struct igt_fb *src,
 			    uint32_t dst_fourcc);
 void igt_remove_fb(int fd, struct igt_fb *fb);
diff --git a/tests/kms_ccs.c b/tests/kms_ccs.c
index 1ed2b4a0..42596a45 100644
--- a/tests/kms_ccs.c
+++ b/tests/kms_ccs.c
@@ -388,7 +388,7 @@ static void generate_fb(data_t *data, struct igt_fb *fb,
 	fb->width = f.width;
 	fb->height = f.height;
 	fb->strides[0] = f.pitches[0];
-	fb->tiling = f.modifier[0];
+	fb->modifier = f.modifier[0];
 	fb->size = size[0];
 	fb->cairo_surface = NULL;
 	fb->domain = 0;
-- 
2.17.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] [PATCH i-g-t 5/7] lib/igt_fb: Function to create a bo for passed in igt_fb
  2019-02-21 14:41 [igt-dev] [PATCH i-g-t 0/7] Use rendercopy for generating CCS buffers Dhinakaran Pandiyan
                   ` (3 preceding siblings ...)
  2019-02-21 14:41 ` [igt-dev] [PATCH i-g-t 4/7] lib/igt_fb: s/tiling/modifier/ where appropriate Dhinakaran Pandiyan
@ 2019-02-21 14:41 ` Dhinakaran Pandiyan
  2019-02-22 16:20   ` Ville Syrjälä
  2019-02-21 14:41 ` [igt-dev] [PATCH i-g-t 6/7] tests/kms_ccs: Generate compressed surfaces with rendercopy Dhinakaran Pandiyan
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 25+ messages in thread
From: Dhinakaran Pandiyan @ 2019-02-21 14:41 UTC (permalink / raw)
  To: igt-dev; +Cc: Clinton Taylor, Dhinakaran Pandiyan

In order to execute negative tests that validate fb creation, tests need to
be able to call the addfb ioctl themselves so that the arguments can be
manipulated. Add a library function to provide an initialized fb without
registering the fb with the kernel.

Cc: Clinton Taylor <clinton.a.taylor@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
---
 lib/igt_fb.c | 9 +++++++++
 lib/igt_fb.h | 3 +++
 2 files changed, 12 insertions(+)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index b475a686..81c48453 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -689,6 +689,15 @@ out:
 	return fb->gem_handle;
 }
 
+void igt_create_bo_for_fb(int fd, int width, int height,
+			  uint32_t format, uint64_t modifier,
+			  struct igt_fb *fb /* out */)
+{
+	fb_init(fb, fd, width, height, format, modifier,
+		IGT_COLOR_YCBCR_BT709, IGT_COLOR_YCBCR_LIMITED_RANGE);
+	create_bo_for_fb(fb);
+}
+
 /**
  * igt_create_bo_with_dimensions:
  * @fd: open drm file descriptor
diff --git a/lib/igt_fb.h b/lib/igt_fb.h
index a5a1a2ba..8645ab27 100644
--- a/lib/igt_fb.h
+++ b/lib/igt_fb.h
@@ -143,6 +143,9 @@ int igt_dirty_fb(int fd, struct igt_fb *fb);
 void *igt_fb_map_buffer(int fd, struct igt_fb *fb);
 void igt_fb_unmap_buffer(struct igt_fb *fb, void *buffer);
 
+void igt_create_bo_for_fb(int fd, int width, int height,
+			  uint32_t format, uint64_t modifier,
+			  struct igt_fb *fb);
 int igt_create_bo_with_dimensions(int fd, int width, int height, uint32_t format,
 				  uint64_t modifier, unsigned stride,
 				  uint64_t *size_ret, unsigned *stride_ret,
-- 
2.17.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] [PATCH i-g-t 6/7] tests/kms_ccs: Generate compressed surfaces with rendercopy
  2019-02-21 14:41 [igt-dev] [PATCH i-g-t 0/7] Use rendercopy for generating CCS buffers Dhinakaran Pandiyan
                   ` (4 preceding siblings ...)
  2019-02-21 14:41 ` [igt-dev] [PATCH i-g-t 5/7] lib/igt_fb: Function to create a bo for passed in igt_fb Dhinakaran Pandiyan
@ 2019-02-21 14:41 ` Dhinakaran Pandiyan
  2019-02-22 16:13   ` Ville Syrjälä
  2019-02-21 14:41 ` [igt-dev] [PATCH i-g-t 7/7] tests/kms_ccs: Larger fb to fully cover up the primary plane Dhinakaran Pandiyan
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 25+ messages in thread
From: Dhinakaran Pandiyan @ 2019-02-21 14:41 UTC (permalink / raw)
  To: igt-dev; +Cc: Clinton Taylor, Dhinakaran Pandiyan

lib/igt_fb.c now has capability to make use of rendercopy, which means
we do not have to handwrite compressed buffers.

Cc: Clinton Taylor <clinton.a.taylor@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
---
 tests/kms_ccs.c | 202 ++++++++++++------------------------------------
 1 file changed, 49 insertions(+), 153 deletions(-)

diff --git a/tests/kms_ccs.c b/tests/kms_ccs.c
index 42596a45..8cbf100f 100644
--- a/tests/kms_ccs.c
+++ b/tests/kms_ccs.c
@@ -60,13 +60,14 @@ typedef struct {
 	igt_pipe_crc_t *pipe_crc;
 } data_t;
 
-#define RED			0x00ff0000
-#define COMPRESSED_RED		0x0ff0000f
-#define GREEN			0x0000ff00
-#define COMPRESSED_GREEN	0x000ff00f
-
-#define CCS_UNCOMPRESSED	0x0
-#define CCS_COMPRESSED		0x55
+const struct {
+	double r;
+	double g;
+	double b;
+} colors[2] = {
+	{1.0, 0.0, 0.0},
+	{0.0, 1.0, 0.0}
+};
 
 /*
  * Limit maximum used sprite plane width so this test will not mistakenly
@@ -192,104 +193,32 @@ static bool plane_has_format_with_ccs(data_t *data, igt_plane_t *plane, uint32_t
 	return false;
 }
 
-static void render_fb(data_t *data, uint32_t gem_handle, unsigned int size,
-		      enum test_fb_flags fb_flags,
-		      int height, unsigned int stride)
+static void addfb_init(struct igt_fb *fb, struct drm_mode_fb_cmd2 *f)
 {
-	uint32_t *ptr;
-	unsigned int half_height, half_size;
-	uint32_t uncompressed_color = data->plane ? GREEN : RED;
-	uint32_t compressed_color =
-		data->plane ? COMPRESSED_GREEN : COMPRESSED_RED;
-	uint32_t bad_color = RED;
 	int i;
 
-	ptr = gem_mmap__cpu(data->drm_fd, gem_handle, 0, size,
-			    PROT_READ | PROT_WRITE);
+	f->width = fb->width;
+	f->height = fb->height;
+	f->pixel_format = fb->drm_format;
+	f->flags = LOCAL_DRM_MODE_FB_MODIFIERS;
 
-	if (fb_flags & FB_COMPRESSED) {
-		/* In the compressed case, we want the top half of the
-		 * surface to be uncompressed and the bottom half to be
-		 * compressed.
-		 *
-		 * We need to cut the surface on a CCS cache-line boundary,
-		 * otherwise, we're going to be in trouble when we try to
-		 * generate CCS data for the surface.  A cache line in the
-		 * CCS is 16x16 cache-line-pairs in the main surface.  16
-		 * cache lines is 64 rows high.
-		 */
-		half_height = ALIGN(height, 128) / 2;
-		half_size = half_height * stride;
-		for (i = 0; i < size / 4; i++) {
-			if (i < half_size / 4)
-				ptr[i] = uncompressed_color;
-			else
-				ptr[i] = compressed_color;
-		}
-	} else {
-		/* When we're displaying the primary plane underneath a
-		 * sprite plane, cut out a 128 x 128 area (less than the sprite)
-		 * plane size which we paint red, so we know easily if it's
-		 * bad.
-		 */
-		for (i = 0; i < size / 4; i++) {
-			if ((fb_flags & FB_HAS_PLANE) &&
-			    (i / (stride / 4)) < 128 &&
-			    (i % (stride / 4)) < 128) {
-				ptr[i] = bad_color;
-			} else {
-				ptr[i] = uncompressed_color;
-			}
-		}
+	for (i = 0; i < fb->num_planes; i++) {
+		f->handles[i] = fb->gem_handle;
+		f->modifier[i] = fb->modifier;
+		f->pitches[i] = fb->strides[i];
+		f->offsets[i] = fb->offsets[i];
 	}
-
-	munmap(ptr, size);
-}
-
-static unsigned int
-y_tile_y_pos(unsigned int offset, unsigned int stride)
-{
-	unsigned int y_tiles, y;
-	y_tiles = (offset / 4096) / (stride / 128);
-	y = y_tiles * 32 + ((offset & 0x1f0) >> 4);
-	return y;
-}
-
-static void render_ccs(data_t *data, uint32_t gem_handle,
-		       uint32_t offset, uint32_t size,
-		       int height, unsigned int ccs_stride)
-{
-	unsigned int half_height, ccs_half_height;
-	uint8_t *ptr;
-	int i;
-
-	half_height = ALIGN(height, 128) / 2;
-	ccs_half_height = half_height / 16;
-
-	ptr = gem_mmap__cpu(data->drm_fd, gem_handle, offset, size,
-			    PROT_READ | PROT_WRITE);
-
-	for (i = 0; i < size; i++) {
-		if (y_tile_y_pos(i, ccs_stride) < ccs_half_height)
-			ptr[i] = CCS_UNCOMPRESSED;
-		else
-			ptr[i] = CCS_COMPRESSED;
-	}
-
-	munmap(ptr, size);
 }
 
 static void generate_fb(data_t *data, struct igt_fb *fb,
 			int width, int height,
 			enum test_fb_flags fb_flags)
 {
-	struct local_drm_mode_fb_cmd2 f = {};
-	unsigned int size[2];
+	struct drm_mode_fb_cmd2 f = {0};
+	uint32_t format;
 	uint64_t modifier;
+	cairo_t *cr;
 	int ret;
-	uint32_t ccs_handle;
-
-	memset(fb, 0, sizeof(*fb));
 
 	/* Use either compressed or Y-tiled to test. However, given the lack of
 	 * available bandwidth, we use linear for the primary plane when
@@ -303,74 +232,52 @@ static void generate_fb(data_t *data, struct igt_fb *fb,
 	else
 		modifier = 0;
 
-	f.flags = LOCAL_DRM_MODE_FB_MODIFIERS;
-	f.width = width;
-	f.height = height;
-
 	if (data->flags & TEST_BAD_PIXEL_FORMAT)
-		f.pixel_format = DRM_FORMAT_RGB565;
+		format = DRM_FORMAT_RGB565;
 	else
-		f.pixel_format = DRM_FORMAT_XRGB8888;
+		format = DRM_FORMAT_XRGB8888;
 
-	f.pitches[0] = ALIGN(width * 4, 128);
-	f.modifier[0] = modifier;
-	f.offsets[0] = 0;
-	size[0] = f.pitches[0] * ALIGN(height, 32);
+	igt_create_bo_for_fb(data->drm_fd, width, height, format, modifier, fb);
+	igt_assert(fb->gem_handle > 0);
 
-	if (fb_flags & FB_COMPRESSED) {
-		/* From the Sky Lake PRM, Vol 12, "Color Control Surface":
-		 *
-		 *    "The compression state of the cache-line pair is
-		 *    specified by 2 bits in the CCS.  Each CCS cache-line
-		 *    represents an area on the main surface of 16x16 sets
-		 *    of 128 byte Y-tiled cache-line-pairs. CCS is always Y
-		 *    tiled."
-		 *
-		 * A "cache-line-pair" for a Y-tiled surface is two
-		 * horizontally adjacent cache lines.  When operating in
-		 * bytes and rows, this gives us a scale-down factor of
-		 * 32x16.  Since the main surface has a 32-bit format, we
-		 * need to multiply width by 4 to get bytes.
-		 */
-		int ccs_width = ALIGN(width * 4, 32) / 32;
-		int ccs_height = ALIGN(height, 16) / 16;
-		int ccs_pitches = ALIGN(ccs_width * 1, 128);
-		int ccs_offsets = size[0];
+	addfb_init(fb, &f);
 
+	if (fb_flags & FB_COMPRESSED) {
 		if (fb_flags & FB_MISALIGN_AUX_STRIDE) {
 			igt_skip_on_f(width <= 1024,
 				      "FB already has the smallest possible stride\n");
-			ccs_pitches -= 64;
+			f.pitches[1] -= 64;
 		}
-		else if (fb_flags & FB_SMALL_AUX_STRIDE) {
+
+		if (fb_flags & FB_SMALL_AUX_STRIDE) {
 			igt_skip_on_f(width <= 1024,
 				      "FB already has the smallest possible stride\n");
-			ccs_pitches = ALIGN(ccs_width/2, 128);
+			f.pitches[1] = ALIGN(f.pitches[1]/2, 128);
 		}
 
-		size[1] = ccs_pitches * ALIGN(ccs_height, 32);
-
-		f.handles[0] = gem_create(data->drm_fd, size[0] + size[1]);
-		if (data->flags & TEST_BAD_CCS_HANDLE) {
-			/* Put the CCS buffer on a different BO. */
-			ccs_handle = gem_create(data->drm_fd, size[0] + size[1]);
-		} else
-			ccs_handle = f.handles[0];
+		if (fb_flags & FB_ZERO_AUX_STRIDE)
+			f.pitches[1] = 0;
 
-		if (!(data->flags & TEST_NO_AUX_BUFFER)) {
-			f.modifier[1] = modifier;
-			f.handles[1] = ccs_handle;
-			f.offsets[1] = ccs_offsets;
-			f.pitches[1] = (fb_flags & FB_ZERO_AUX_STRIDE)? 0:ccs_pitches;
+		/* Put the CCS buffer on a different BO. */
+		if (data->flags & TEST_BAD_CCS_HANDLE)
+			f.handles[1] = gem_create(data->drm_fd, fb->size);
 
-			render_ccs(data, f.handles[1], f.offsets[1], size[1],
-				   height, ccs_pitches);
+		if (data->flags & TEST_NO_AUX_BUFFER) {
+			f.handles[1] = 0;
+			f.modifier[1] = 0;
+			f.pitches[1] = 0;
+			f.offsets[1] = 0;
 		}
-	} else {
-		f.handles[0] = gem_create(data->drm_fd, size[0]);
 	}
 
-	render_fb(data, f.handles[0], size[0], fb_flags, height, f.pitches[0]);
+	if (!(data->flags & TEST_BAD_PIXEL_FORMAT)) {
+		int c = !!data->plane;
+
+		cr = igt_get_cairo_ctx(data->drm_fd, fb);
+		igt_paint_color(cr, 0, 0, width, height,
+				colors[c].r, colors[c].g, colors[c].b);
+		igt_put_cairo_ctx(data->drm_fd, fb, cr);
+	}
 
 	ret = drmIoctl(data->drm_fd, LOCAL_DRM_IOCTL_MODE_ADDFB2, &f);
 	if (data->flags & TEST_FAIL_ON_ADDFB2) {
@@ -381,17 +288,6 @@ static void generate_fb(data_t *data, struct igt_fb *fb,
 		igt_assert_eq(ret, 0);
 
 	fb->fb_id = f.fb_id;
-	fb->fd = data->drm_fd;
-	fb->gem_handle = f.handles[0];
-	fb->is_dumb = false;
-	fb->drm_format = f.pixel_format;
-	fb->width = f.width;
-	fb->height = f.height;
-	fb->strides[0] = f.pitches[0];
-	fb->modifier = f.modifier[0];
-	fb->size = size[0];
-	fb->cairo_surface = NULL;
-	fb->domain = 0;
 }
 
 static bool try_config(data_t *data, enum test_fb_flags fb_flags,
-- 
2.17.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] [PATCH i-g-t 7/7] tests/kms_ccs: Larger fb to fully cover up the primary plane
  2019-02-21 14:41 [igt-dev] [PATCH i-g-t 0/7] Use rendercopy for generating CCS buffers Dhinakaran Pandiyan
                   ` (5 preceding siblings ...)
  2019-02-21 14:41 ` [igt-dev] [PATCH i-g-t 6/7] tests/kms_ccs: Generate compressed surfaces with rendercopy Dhinakaran Pandiyan
@ 2019-02-21 14:41 ` Dhinakaran Pandiyan
  2019-02-22 14:19   ` Juha-Pekka Heikkila
  2019-02-21 22:37 ` [igt-dev] ✓ Fi.CI.BAT: success for Use rendercopy for generating CCS buffers Patchwork
  2019-02-22 10:57 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
  8 siblings, 1 reply; 25+ messages in thread
From: Dhinakaran Pandiyan @ 2019-02-21 14:41 UTC (permalink / raw)
  To: igt-dev; +Cc: Clinton Taylor, Dhinakaran Pandiyan

This is a revert of commit 27fa97d16294 ("tests/kms_ccs: Avoid using plane
sizes which exceed hw capability"). The watermarks issue that the patch
refers to has been fixed as per the bugzilla, so let's use an fb that
covers the whole screen.

Cc: Clinton Taylor <clinton.a.taylor@intel.com>
Cc: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
References: https://bugs.freedesktop.org/show_bug.cgi?id=105458
Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
---
 tests/kms_ccs.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/tests/kms_ccs.c b/tests/kms_ccs.c
index 8cbf100f..48f10af0 100644
--- a/tests/kms_ccs.c
+++ b/tests/kms_ccs.c
@@ -69,15 +69,6 @@ const struct {
 	{0.0, 1.0, 0.0}
 };
 
-/*
- * Limit maximum used sprite plane width so this test will not mistakenly
- * fail on hardware limitations which are not interesting to this test.
- * On this test too wide sprite plane may fail during creation with dmesg
- * comment saying:
- * "Requested display configuration exceeds system watermark limitations"
- */
-#define MAX_SPRITE_PLANE_WIDTH 2000
-
 struct local_drm_format_modifier {
        /* Bitmask of formats in get_plane format list this info applies to. The
 	* offset allows a sliding window of which 64 formats (bits).
@@ -313,13 +304,12 @@ static bool try_config(data_t *data, enum test_fb_flags fb_flags,
 	if (data->plane && fb_flags & FB_COMPRESSED) {
 		if (!plane_has_format_with_ccs(data, data->plane, DRM_FORMAT_XRGB8888))
 			return false;
-		generate_fb(data, &fb, min(MAX_SPRITE_PLANE_WIDTH, drm_mode->hdisplay),
-			    drm_mode->vdisplay,
+		generate_fb(data, &fb, drm_mode->hdisplay, drm_mode->vdisplay,
 			    (fb_flags & ~FB_COMPRESSED) | FB_HAS_PLANE);
 		generate_fb(data, &fb_sprite, 256, 256, fb_flags);
 	} else {
-		generate_fb(data, &fb, min(MAX_SPRITE_PLANE_WIDTH, drm_mode->hdisplay),
-			    drm_mode->vdisplay, fb_flags);
+		generate_fb(data, &fb, drm_mode->hdisplay, drm_mode->vdisplay,
+			    fb_flags);
 	}
 
 	if (data->flags & TEST_FAIL_ON_ADDFB2)
-- 
2.17.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] [PATCH i-g-t v2 3/8] lib/igt_fb: Use rendercopy for rendering into compressed buffers
  2019-02-21 14:41 ` [igt-dev] [PATCH i-g-t 3/7] lib/igt_fb: Use rendercopy for rendering into compressed buffers Dhinakaran Pandiyan
@ 2019-02-21 18:04   ` Dhinakaran Pandiyan
  0 siblings, 0 replies; 25+ messages in thread
From: Dhinakaran Pandiyan @ 2019-02-21 18:04 UTC (permalink / raw)
  To: igt-dev; +Cc: Clinton Taylor, Dhinakaran Pandiyan

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Plug in rendercopy to the cairo surface stuff so that we can
generate compressed buffers with cairo.

v2: s/modifier_has_ccs/is_ccs_modifier/

v3: From DK
 Set buf.bpp when initializing and rebase.
v4: From DK
Fix Yf-tiled BGR formats

Cc: Clinton Taylor <clinton.a.taylor@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
---
 lib/igt_fb.c | 155 +++++++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 144 insertions(+), 11 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 462afec2..fdcadbcd 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -290,6 +290,7 @@ void igt_get_fb_tile_size(int fd, uint64_t tiling, int fb_bpp,
 		}
 		break;
 	case LOCAL_I915_FORMAT_MOD_Y_TILED:
+	case LOCAL_I915_FORMAT_MOD_Y_TILED_CCS:
 		igt_require_intel(fd);
 		if (intel_gen(intel_get_drm_devid(fd)) == 2) {
 			*width_ret = 128;
@@ -303,6 +304,7 @@ void igt_get_fb_tile_size(int fd, uint64_t tiling, int fb_bpp,
 		}
 		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:
@@ -328,10 +330,19 @@ void igt_get_fb_tile_size(int fd, uint64_t tiling, int fb_bpp,
 	}
 }
 
+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;
+}
+
 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->tiling) && plane == 1)
+		return DIV_ROUND_UP(fb->width, 1024) * 128;
+
 	if (plane == 0)
 		return fb->width;
 
@@ -342,13 +353,19 @@ static unsigned fb_plane_bpp(const struct igt_fb *fb, int plane)
 {
 	const struct format_desc_struct *format = lookup_drm_format(fb->drm_format);
 
-	return format->plane_bpp[plane];
+	if (is_ccs_modifier(fb->tiling) && plane == 1)
+		return 8;
+	else
+		return format->plane_bpp[plane];
 }
 
 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->tiling) && plane == 1)
+		return DIV_ROUND_UP(fb->height, 512) * 32;
+
 	if (plane == 0)
 		return fb->height;
 
@@ -359,7 +376,10 @@ static int fb_num_planes(const struct igt_fb *fb)
 {
 	const struct format_desc_struct *format = lookup_drm_format(fb->drm_format);
 
-	return format->num_planes;
+	if (is_ccs_modifier(fb->tiling))
+		return 2;
+	else
+		return format->num_planes;
 }
 
 static void fb_init(struct igt_fb *fb,
@@ -518,8 +538,10 @@ uint64_t igt_fb_mod_to_tiling(uint64_t modifier)
 	case LOCAL_I915_FORMAT_MOD_X_TILED:
 		return I915_TILING_X;
 	case LOCAL_I915_FORMAT_MOD_Y_TILED:
+	case LOCAL_I915_FORMAT_MOD_Y_TILED_CCS:
 		return I915_TILING_Y;
 	case LOCAL_I915_FORMAT_MOD_Yf_TILED:
+	case LOCAL_I915_FORMAT_MOD_Yf_TILED_CCS:
 		return I915_TILING_Yf;
 	default:
 		igt_assert(0);
@@ -1405,8 +1427,54 @@ struct fb_blit_upload {
 	int fd;
 	struct igt_fb *fb;
 	struct fb_blit_linear linear;
+	drm_intel_bufmgr *bufmgr;
+	struct intel_batchbuffer *batch;
 };
 
+static void init_buf(struct fb_blit_upload *blit,
+		     struct igt_buf *buf,
+		     const struct igt_fb *fb,
+		     const char *name)
+{
+	igt_assert_eq(fb->offsets[0], 0);
+
+	buf->bo = gem_handle_to_libdrm_bo(blit->bufmgr, blit->fd,
+					  name, fb->gem_handle);
+	buf->tiling = igt_fb_mod_to_tiling(fb->tiling);
+	buf->stride = fb->strides[0];
+	buf->bpp = fb->plane_bpp[0];
+	buf->size = fb->size;
+
+	if (is_ccs_modifier(fb->tiling)) {
+		igt_assert_eq(fb->strides[0] & 127, 0);
+		igt_assert_eq(fb->strides[1] & 127, 0);
+
+		buf->aux.offset = fb->offsets[1];
+		buf->aux.stride = fb->strides[1];
+	}
+}
+
+static void rendercopy(struct fb_blit_upload *blit,
+		       const struct igt_fb *dst_fb,
+		       const struct igt_fb *src_fb)
+{
+	struct igt_buf src = {}, dst = {};
+	igt_render_copyfunc_t render_copy =
+		igt_get_render_copyfunc(intel_get_drm_devid(blit->fd));
+
+	igt_require(render_copy);
+
+	igt_assert_eq(dst_fb->offsets[0], 0);
+	igt_assert_eq(src_fb->offsets[0], 0);
+
+	init_buf(blit, &src, src_fb, "cairo rendercopy src");
+	init_buf(blit, &dst, dst_fb, "cairo rendercopy dst");
+
+	render_copy(blit->batch, NULL,
+		    &src, 0, 0, dst_fb->plane_width[0], dst_fb->plane_height[0],
+		    &dst, 0, 0);
+}
+
 static void blitcopy(const struct igt_fb *dst_fb,
 		     const struct igt_fb *src_fb)
 {
@@ -1444,7 +1512,10 @@ static void free_linear_mapping(struct fb_blit_upload *blit)
 	gem_set_domain(fd, linear->fb.gem_handle,
 		       I915_GEM_DOMAIN_GTT, 0);
 
-	blitcopy(fb, &linear->fb);
+	if (blit->batch)
+		rendercopy(blit, fb, &linear->fb);
+	else
+		blitcopy(fb, &linear->fb);
 
 	gem_sync(fd, linear->fb.gem_handle);
 	gem_close(fd, linear->fb.gem_handle);
@@ -1461,8 +1532,26 @@ static void destroy_cairo_surface__blit(void *arg)
 	free(blit);
 }
 
-static void setup_linear_mapping(int fd, struct igt_fb *fb, struct fb_blit_linear *linear)
+static void destroy_cairo_surface__rendercopy(void *arg)
 {
+	struct fb_blit_upload *blit = arg;
+
+	blit->fb->cairo_surface = NULL;
+
+	free_linear_mapping(blit);
+
+	intel_batchbuffer_free(blit->batch);
+	drm_intel_bufmgr_destroy(blit->bufmgr);
+
+	free(blit);
+}
+
+static void setup_linear_mapping(struct fb_blit_upload *blit)
+{
+	int fd = blit->fd;
+	struct igt_fb *fb = blit->fb;
+	struct fb_blit_linear *linear = &blit->linear;
+
 	/*
 	 * We create a linear BO that we'll map for the CPU to write to (using
 	 * cairo). This linear bo will be then blitted to its final
@@ -1481,7 +1570,10 @@ static void setup_linear_mapping(int fd, struct igt_fb *fb, struct fb_blit_linea
 	gem_set_domain(fd, linear->fb.gem_handle,
 			I915_GEM_DOMAIN_GTT, 0);
 
-	blitcopy(&linear->fb, fb);
+	if (blit->batch)
+		rendercopy(blit, &linear->fb, fb);
+	else
+		blitcopy(&linear->fb, fb);
 
 	gem_sync(fd, linear->fb.gem_handle);
 
@@ -1498,12 +1590,12 @@ static void create_cairo_surface__blit(int fd, struct igt_fb *fb)
 	struct fb_blit_upload *blit;
 	cairo_format_t cairo_format;
 
-	blit = malloc(sizeof(*blit));
+	blit = calloc(1, sizeof(*blit));
 	igt_assert(blit);
 
 	blit->fd = fd;
 	blit->fb = fb;
-	setup_linear_mapping(fd, fb, &blit->linear);
+	setup_linear_mapping(blit);
 
 	cairo_format = drm_format_to_cairo(fb->drm_format);
 	fb->cairo_surface =
@@ -1518,6 +1610,36 @@ static void create_cairo_surface__blit(int fd, struct igt_fb *fb)
 				    blit, destroy_cairo_surface__blit);
 }
 
+static void create_cairo_surface__rendercopy(int fd, struct igt_fb *fb)
+{
+	struct fb_blit_upload *blit;
+	cairo_format_t cairo_format;
+
+	blit = calloc(1, sizeof(*blit));
+	igt_assert(blit);
+
+	blit->fd = fd;
+	blit->fb = fb;
+
+	blit->bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
+	blit->batch = intel_batchbuffer_alloc(blit->bufmgr,
+					      intel_get_drm_devid(fd));
+
+	setup_linear_mapping(blit);
+
+	cairo_format = drm_format_to_cairo(fb->drm_format);
+	fb->cairo_surface =
+		cairo_image_surface_create_for_data(blit->linear.map,
+						    cairo_format,
+						    fb->width, fb->height,
+						    blit->linear.fb.strides[0]);
+	fb->domain = I915_GEM_DOMAIN_GTT;
+
+	cairo_surface_set_user_data(fb->cairo_surface,
+				    (cairo_user_data_key_t *)create_cairo_surface__rendercopy,
+				    blit, destroy_cairo_surface__rendercopy);
+}
+
 /**
  * igt_dirty_fb:
  * @fd: open drm file descriptor
@@ -2278,7 +2400,7 @@ static void destroy_cairo_surface__convert(void *arg)
 
 static void create_cairo_surface__convert(int fd, struct igt_fb *fb)
 {
-	struct fb_convert_blit_upload *blit = malloc(sizeof(*blit));
+	struct fb_convert_blit_upload *blit = calloc(1, sizeof(*blit));
 	struct fb_convert cvt = { };
 	const struct format_desc_struct *f = lookup_drm_format(fb->drm_format);
 	unsigned drm_format;
@@ -2310,6 +2432,13 @@ static void create_cairo_surface__convert(int fd, struct igt_fb *fb)
 
 	blit->base.fd = fd;
 	blit->base.fb = fb;
+
+	if (is_ccs_modifier(fb->tiling)) {
+		blit->base.bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
+		blit->base.batch = intel_batchbuffer_alloc(blit->base.bufmgr,
+						   intel_get_drm_devid(fd));
+	}
+
 	blit->shadow_ptr = igt_fb_create_cairo_shadow_buffer(fd, drm_format,
 							     fb->width,
 							     fb->height,
@@ -2317,8 +2446,10 @@ static void create_cairo_surface__convert(int fd, struct igt_fb *fb)
 	igt_assert(blit->shadow_ptr);
 
 	if (fb->tiling == LOCAL_I915_FORMAT_MOD_Y_TILED ||
-	    fb->tiling == LOCAL_I915_FORMAT_MOD_Yf_TILED) {
-		setup_linear_mapping(fd, fb, &blit->base.linear);
+	    fb->tiling == LOCAL_I915_FORMAT_MOD_Yf_TILED ||
+	    fb->tiling == LOCAL_I915_FORMAT_MOD_Y_TILED_CCS ||
+	    fb->tiling == LOCAL_I915_FORMAT_MOD_Yf_TILED_CCS) {
+		setup_linear_mapping(&blit->base);
 	} else {
 		blit->base.linear.fb = *fb;
 		blit->base.linear.fb.gem_handle = 0;
@@ -2397,8 +2528,10 @@ cairo_surface_t *igt_get_cairo_surface(int fd, struct igt_fb *fb)
 		    ((f->cairo_id == CAIRO_FORMAT_INVALID) &&
 		     (f->pixman_id != PIXMAN_invalid)))
 			create_cairo_surface__convert(fd, fb);
+		else if (is_ccs_modifier(fb->tiling))
+			create_cairo_surface__rendercopy(fd, fb);
 		else if (fb->tiling == LOCAL_I915_FORMAT_MOD_Y_TILED ||
-		    fb->tiling == LOCAL_I915_FORMAT_MOD_Yf_TILED)
+			 fb->tiling == LOCAL_I915_FORMAT_MOD_Yf_TILED)
 			create_cairo_surface__blit(fd, fb);
 		else
 			create_cairo_surface__gtt(fd, fb);
-- 
2.17.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] [PATCH i-g-t v2 4/8] lib/igt_fb: s/tiling/modifier/ where appropriate
  2019-02-21 14:41 ` [igt-dev] [PATCH i-g-t 4/7] lib/igt_fb: s/tiling/modifier/ where appropriate Dhinakaran Pandiyan
@ 2019-02-21 18:05   ` Dhinakaran Pandiyan
  0 siblings, 0 replies; 25+ messages in thread
From: Dhinakaran Pandiyan @ 2019-02-21 18:05 UTC (permalink / raw)
  To: igt-dev; +Cc: Clinton Taylor, Dhinakaran Pandiyan

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Rename the igt_fb.tiling to igt_fb.modifier to better reflect
what information it carries. Now it's clear whether we're talking
about a modifier or a i915 tiling thing.

Cc: Clinton Taylor <clinton.a.taylor@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
---
 lib/igt_fb.c    | 108 ++++++++++++++++++++++++------------------------
 lib/igt_fb.h    |  22 +++++-----
 tests/kms_ccs.c |   2 +-
 3 files changed, 66 insertions(+), 66 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index fdcadbcd..1140ef0a 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -259,7 +259,7 @@ static const struct format_desc_struct *lookup_drm_format(uint32_t drm_format)
 /**
  * igt_get_fb_tile_size:
  * @fd: the DRM file descriptor
- * @tiling: tiling layout of the framebuffer (as framebuffer modifier)
+ * @modifier: 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
@@ -267,10 +267,10 @@ static const struct format_desc_struct *lookup_drm_format(uint32_t drm_format)
  * 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,
+void igt_get_fb_tile_size(int fd, uint64_t modifier, int fb_bpp,
 			  unsigned *width_ret, unsigned *height_ret)
 {
-	switch (tiling) {
+	switch (modifier) {
 	case LOCAL_DRM_FORMAT_MOD_NONE:
 		if (is_i915_device(fd))
 			*width_ret = 64;
@@ -340,7 +340,7 @@ 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->tiling) && plane == 1)
+	if (is_ccs_modifier(fb->modifier) && plane == 1)
 		return DIV_ROUND_UP(fb->width, 1024) * 128;
 
 	if (plane == 0)
@@ -353,7 +353,7 @@ 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->tiling) && plane == 1)
+	if (is_ccs_modifier(fb->modifier) && plane == 1)
 		return 8;
 	else
 		return format->plane_bpp[plane];
@@ -363,7 +363,7 @@ 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->tiling) && plane == 1)
+	if (is_ccs_modifier(fb->modifier) && plane == 1)
 		return DIV_ROUND_UP(fb->height, 512) * 32;
 
 	if (plane == 0)
@@ -376,7 +376,7 @@ static int fb_num_planes(const struct igt_fb *fb)
 {
 	const struct format_desc_struct *format = lookup_drm_format(fb->drm_format);
 
-	if (is_ccs_modifier(fb->tiling))
+	if (is_ccs_modifier(fb->modifier))
 		return 2;
 	else
 		return format->num_planes;
@@ -397,7 +397,7 @@ static void fb_init(struct igt_fb *fb,
 
 	fb->width = width;
 	fb->height = height;
-	fb->tiling = modifier;
+	fb->modifier = modifier;
 	fb->drm_format = drm_format;
 	fb->fd = fd;
 	fb->num_planes = fb_num_planes(fb);
@@ -416,7 +416,7 @@ static uint32_t calc_plane_stride(struct igt_fb *fb, int plane)
 	uint32_t min_stride = fb->plane_width[plane] *
 		(fb->plane_bpp[plane] / 8);
 
-	if (fb->tiling != LOCAL_DRM_FORMAT_MOD_NONE &&
+	if (fb->modifier != LOCAL_DRM_FORMAT_MOD_NONE &&
 	    intel_gen(intel_get_drm_devid(fb->fd)) <= 3) {
 		uint32_t stride;
 
@@ -435,7 +435,7 @@ static uint32_t calc_plane_stride(struct igt_fb *fb, int plane)
 	} else {
 		unsigned int tile_width, tile_height;
 
-		igt_get_fb_tile_size(fb->fd, fb->tiling, fb->plane_bpp[plane],
+		igt_get_fb_tile_size(fb->fd, fb->modifier, fb->plane_bpp[plane],
 				     &tile_width, &tile_height);
 
 		return ALIGN(min_stride, tile_width);
@@ -444,7 +444,7 @@ static uint32_t calc_plane_stride(struct igt_fb *fb, int plane)
 
 static uint64_t calc_plane_size(struct igt_fb *fb, int plane)
 {
-	if (fb->tiling != LOCAL_DRM_FORMAT_MOD_NONE &&
+	if (fb->modifier != LOCAL_DRM_FORMAT_MOD_NONE &&
 	    intel_gen(intel_get_drm_devid(fb->fd)) <= 3) {
 		uint64_t min_size = (uint64_t) fb->strides[plane] *
 			fb->plane_height[plane];
@@ -465,7 +465,7 @@ static uint64_t calc_plane_size(struct igt_fb *fb, int plane)
 	} else {
 		unsigned int tile_width, tile_height;
 
-		igt_get_fb_tile_size(fb->fd, fb->tiling, fb->plane_bpp[plane],
+		igt_get_fb_tile_size(fb->fd, fb->modifier, fb->plane_bpp[plane],
 				     &tile_width, &tile_height);
 
 		return (uint64_t) fb->strides[plane] *
@@ -497,19 +497,19 @@ static uint64_t calc_fb_size(struct igt_fb *fb)
  * @width: width of the framebuffer in pixels
  * @height: height of the framebuffer in pixels
  * @format: drm fourcc pixel format code
- * @tiling: tiling layout of the framebuffer (as framebuffer modifier)
+ * @modifier: tiling layout of the framebuffer (as framebuffer modifier)
  * @size_ret: returned size for the framebuffer
  * @stride_ret: returned stride for the framebuffer
  *
  * This function returns valid stride and size values for a framebuffer with the
  * specified parameters.
  */
-void igt_calc_fb_size(int fd, int width, int height, uint32_t drm_format, uint64_t tiling,
+void igt_calc_fb_size(int fd, int width, int height, uint32_t drm_format, uint64_t modifier,
 		      uint64_t *size_ret, unsigned *stride_ret)
 {
 	struct igt_fb fb;
 
-	fb_init(&fb, fd, width, height, drm_format, tiling,
+	fb_init(&fb, fd, width, height, drm_format, modifier,
 		IGT_COLOR_YCBCR_BT709, IGT_COLOR_YCBCR_LIMITED_RANGE);
 
 	fb.size = calc_fb_size(&fb);
@@ -633,7 +633,7 @@ static int create_bo_for_fb(struct igt_fb *fb)
 	int fd = fb->fd;
 
 	if (is_i915_device(fd) &&
-	   (fb->tiling || fb->size || fb->strides[0] || igt_format_is_yuv(fb->drm_format))) {
+	    (fb->modifier || fb->size || fb->strides[0] || igt_format_is_yuv(fb->drm_format))) {
 		uint64_t size;
 
 		size = calc_fb_size(fb);
@@ -645,7 +645,7 @@ static int create_bo_for_fb(struct igt_fb *fb)
 		fb->is_dumb = false;
 		fb->gem_handle = gem_create(fd, fb->size);
 		gem_set_tiling(fd, fb->gem_handle,
-			       igt_fb_mod_to_tiling(fb->tiling),
+			       igt_fb_mod_to_tiling(fb->modifier),
 			       fb->strides[0]);
 
 		goto out;
@@ -1049,7 +1049,7 @@ void igt_paint_image(cairo_t *cr, const char *filename,
  * @width: width of the framebuffer in pixel
  * @height: height of the framebuffer in pixel
  * @format: drm fourcc pixel format code
- * @tiling: tiling layout of the framebuffer (as framebuffer modifier)
+ * @modifier: tiling layout of the framebuffer (as framebuffer modifier)
  * @fb: pointer to an #igt_fb structure
  * @bo_size: size of the backing bo (0 for automatic size)
  * @bo_stride: stride of the backing bo (0 for automatic stride)
@@ -1066,7 +1066,7 @@ void igt_paint_image(cairo_t *cr, const char *filename,
  */
 unsigned int
 igt_create_fb_with_bo_size(int fd, int width, int height,
-			   uint32_t format, uint64_t tiling,
+			   uint32_t format, uint64_t modifier,
 			   struct igt_fb *fb, uint64_t bo_size,
 			   unsigned bo_stride)
 {
@@ -1075,7 +1075,7 @@ igt_create_fb_with_bo_size(int fd, int width, int height,
 	enum igt_color_range color_range = IGT_COLOR_YCBCR_LIMITED_RANGE;
 	uint32_t flags = 0;
 
-	fb_init(fb, fd, width, height, format, tiling,
+	fb_init(fb, fd, width, height, format, modifier,
 		color_encoding, color_range);
 
 	for (int i = 0; i < fb->num_planes; i++)
@@ -1083,8 +1083,8 @@ igt_create_fb_with_bo_size(int fd, int width, int height,
 
 	fb->size = bo_size;
 
-	igt_debug("%s(width=%d, height=%d, format=0x%x, tiling=0x%"PRIx64", size=%"PRIu64")\n",
-		  __func__, width, height, format, tiling, bo_size);
+	igt_debug("%s(width=%d, height=%d, format=0x%x, modifier=0x%"PRIx64", size=%"PRIu64")\n",
+		  __func__, width, height, format, modifier, bo_size);
 
 	create_bo_for_fb(fb);
 	igt_assert(fb->gem_handle > 0);
@@ -1092,12 +1092,12 @@ igt_create_fb_with_bo_size(int fd, int width, int height,
 	igt_debug("%s(handle=%d, pitch=%d)\n",
 		  __func__, fb->gem_handle, fb->strides[0]);
 
-	if (fb->tiling || igt_has_fb_modifiers(fd))
+	if (fb->modifier || igt_has_fb_modifiers(fd))
 		flags = LOCAL_DRM_MODE_FB_MODIFIERS;
 
 	do_or_die(__kms_addfb(fb->fd, fb->gem_handle,
 			      fb->width, fb->height,
-			      fb->drm_format, fb->tiling,
+			      fb->drm_format, fb->modifier,
 			      fb->strides, fb->offsets, fb->num_planes, flags,
 			      &fb->fb_id));
 
@@ -1110,7 +1110,7 @@ igt_create_fb_with_bo_size(int fd, int width, int height,
  * @width: width of the framebuffer in pixel
  * @height: height of the framebuffer in pixel
  * @format: drm fourcc pixel format code
- * @tiling: tiling layout of the framebuffer
+ * @modifier: tiling layout of the framebuffer
  * @fb: pointer to an #igt_fb structure
  *
  * This function allocates a gem buffer object suitable to back a framebuffer
@@ -1124,9 +1124,9 @@ igt_create_fb_with_bo_size(int fd, int width, int height,
  * The kms id of the created framebuffer.
  */
 unsigned int igt_create_fb(int fd, int width, int height, uint32_t format,
-			   uint64_t tiling, struct igt_fb *fb)
+			   uint64_t modifier, struct igt_fb *fb)
 {
-	return igt_create_fb_with_bo_size(fd, width, height, format, tiling, fb,
+	return igt_create_fb_with_bo_size(fd, width, height, format, modifier, fb,
 					  0, 0);
 }
 
@@ -1136,7 +1136,7 @@ unsigned int igt_create_fb(int fd, int width, int height, uint32_t format,
  * @width: width of the framebuffer in pixel
  * @height: height of the framebuffer in pixel
  * @format: drm fourcc pixel format code
- * @tiling: tiling layout of the framebuffer
+ * @modifier: tiling layout of the framebuffer
  * @r: red value to use as fill color
  * @g: green value to use as fill color
  * @b: blue value to use as fill color
@@ -1154,14 +1154,14 @@ unsigned int igt_create_fb(int fd, int width, int height, uint32_t format,
  * failure.
  */
 unsigned int igt_create_color_fb(int fd, int width, int height,
-				 uint32_t format, uint64_t tiling,
+				 uint32_t format, uint64_t modifier,
 				 double r, double g, double b,
 				 struct igt_fb *fb /* out */)
 {
 	unsigned int fb_id;
 	cairo_t *cr;
 
-	fb_id = igt_create_fb(fd, width, height, format, tiling, fb);
+	fb_id = igt_create_fb(fd, width, height, format, modifier, fb);
 	igt_assert(fb_id);
 
 	cr = igt_get_cairo_ctx(fd, fb);
@@ -1177,7 +1177,7 @@ unsigned int igt_create_color_fb(int fd, int width, int height,
  * @width: width of the framebuffer in pixel
  * @height: height of the framebuffer in pixel
  * @format: drm fourcc pixel format code
- * @tiling: tiling layout of the framebuffer
+ * @modifier: tiling layout of the framebuffer
  * @fb: pointer to an #igt_fb structure
  *
  * This function allocates a gem buffer object suitable to back a framebuffer
@@ -1192,13 +1192,13 @@ unsigned int igt_create_color_fb(int fd, int width, int height,
  * failure.
  */
 unsigned int igt_create_pattern_fb(int fd, int width, int height,
-				   uint32_t format, uint64_t tiling,
+				   uint32_t format, uint64_t modifier,
 				   struct igt_fb *fb /* out */)
 {
 	unsigned int fb_id;
 	cairo_t *cr;
 
-	fb_id = igt_create_fb(fd, width, height, format, tiling, fb);
+	fb_id = igt_create_fb(fd, width, height, format, modifier, fb);
 	igt_assert(fb_id);
 
 	cr = igt_get_cairo_ctx(fd, fb);
@@ -1214,7 +1214,7 @@ unsigned int igt_create_pattern_fb(int fd, int width, int height,
  * @width: width of the framebuffer in pixel
  * @height: height of the framebuffer in pixel
  * @format: drm fourcc pixel format code
- * @tiling: tiling layout of the framebuffer
+ * @modifier: tiling layout of the framebuffer
  * @r: red value to use as fill color
  * @g: green value to use as fill color
  * @b: blue value to use as fill color
@@ -1233,14 +1233,14 @@ unsigned int igt_create_pattern_fb(int fd, int width, int height,
  * failure.
  */
 unsigned int igt_create_color_pattern_fb(int fd, int width, int height,
-					 uint32_t format, uint64_t tiling,
+					 uint32_t format, uint64_t modifier,
 					 double r, double g, double b,
 					 struct igt_fb *fb /* out */)
 {
 	unsigned int fb_id;
 	cairo_t *cr;
 
-	fb_id = igt_create_fb(fd, width, height, format, tiling, fb);
+	fb_id = igt_create_fb(fd, width, height, format, modifier, fb);
 	igt_assert(fb_id);
 
 	cr = igt_get_cairo_ctx(fd, fb);
@@ -1257,7 +1257,7 @@ unsigned int igt_create_color_pattern_fb(int fd, int width, int height,
  * @width: width of the framebuffer in pixel or 0
  * @height: height of the framebuffer in pixel or 0
  * @format: drm fourcc pixel format code
- * @tiling: tiling layout of the framebuffer
+ * @modifier: tiling layout of the framebuffer
  * @filename: filename of the png image to draw
  * @fb: pointer to an #igt_fb structure
  *
@@ -1269,7 +1269,7 @@ unsigned int igt_create_color_pattern_fb(int fd, int width, int height,
  * failure.
  */
 unsigned int igt_create_image_fb(int fd, int width, int height,
-				 uint32_t format, uint64_t tiling,
+				 uint32_t format, uint64_t modifier,
 				 const char *filename,
 				 struct igt_fb *fb /* out */)
 {
@@ -1285,7 +1285,7 @@ unsigned int igt_create_image_fb(int fd, int width, int height,
 		height = cairo_image_surface_get_height(image);
 	cairo_surface_destroy(image);
 
-	fb_id = igt_create_fb(fd, width, height, format, tiling, fb);
+	fb_id = igt_create_fb(fd, width, height, format, modifier, fb);
 
 	cr = igt_get_cairo_ctx(fd, fb);
 	igt_paint_image(cr, filename, 0, 0, width, height);
@@ -1361,7 +1361,7 @@ static void stereo_fb_layout_from_mode(struct stereo_fb_layout *layout,
  * @drm_fd: open i915 drm file descriptor
  * @mode: A stereo 3D mode.
  * @format: drm fourcc pixel format code
- * @tiling: tiling layout of the framebuffer
+ * @modifier: tiling layout of the framebuffer
  *
  * Create a framebuffer for use with the stereo 3D mode specified by @mode.
  *
@@ -1370,7 +1370,7 @@ static void stereo_fb_layout_from_mode(struct stereo_fb_layout *layout,
  * failure.
  */
 unsigned int igt_create_stereo_fb(int drm_fd, drmModeModeInfo *mode,
-				  uint32_t format, uint64_t tiling)
+				  uint32_t format, uint64_t modifier)
 {
 	struct stereo_fb_layout layout;
 	cairo_t *cr;
@@ -1379,7 +1379,7 @@ unsigned int igt_create_stereo_fb(int drm_fd, drmModeModeInfo *mode,
 
 	stereo_fb_layout_from_mode(&layout, mode);
 	fb_id = igt_create_fb(drm_fd, layout.fb_width, layout.fb_height, format,
-			      tiling, &fb);
+			      modifier, &fb);
 	cr = igt_get_cairo_ctx(drm_fd, &fb);
 
 	igt_paint_image(cr, "1080p-left.png",
@@ -1440,12 +1440,12 @@ static void init_buf(struct fb_blit_upload *blit,
 
 	buf->bo = gem_handle_to_libdrm_bo(blit->bufmgr, blit->fd,
 					  name, fb->gem_handle);
-	buf->tiling = igt_fb_mod_to_tiling(fb->tiling);
+	buf->tiling = igt_fb_mod_to_tiling(fb->modifier);
 	buf->stride = fb->strides[0];
 	buf->bpp = fb->plane_bpp[0];
 	buf->size = fb->size;
 
-	if (is_ccs_modifier(fb->tiling)) {
+	if (is_ccs_modifier(fb->modifier)) {
 		igt_assert_eq(fb->strides[0] & 127, 0);
 		igt_assert_eq(fb->strides[1] & 127, 0);
 
@@ -1490,14 +1490,14 @@ static void blitcopy(const struct igt_fb *dst_fb,
 					   src_fb->gem_handle,
 					   src_fb->offsets[i],
 					   src_fb->strides[i],
-					   igt_fb_mod_to_tiling(src_fb->tiling),
+					   igt_fb_mod_to_tiling(src_fb->modifier),
 					   0, 0, /* src_x, src_y */
 					   dst_fb->plane_width[i], dst_fb->plane_height[i],
 					   dst_fb->plane_bpp[i],
 					   dst_fb->gem_handle,
 					   dst_fb->offsets[i],
 					   dst_fb->strides[i],
-					   igt_fb_mod_to_tiling(dst_fb->tiling),
+					   igt_fb_mod_to_tiling(dst_fb->modifier),
 					   0, 0 /* dst_x, dst_y */);
 	}
 }
@@ -2433,7 +2433,7 @@ static void create_cairo_surface__convert(int fd, struct igt_fb *fb)
 	blit->base.fd = fd;
 	blit->base.fb = fb;
 
-	if (is_ccs_modifier(fb->tiling)) {
+	if (is_ccs_modifier(fb->modifier)) {
 		blit->base.bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
 		blit->base.batch = intel_batchbuffer_alloc(blit->base.bufmgr,
 						   intel_get_drm_devid(fd));
@@ -2445,10 +2445,10 @@ static void create_cairo_surface__convert(int fd, struct igt_fb *fb)
 							     &blit->shadow_fb);
 	igt_assert(blit->shadow_ptr);
 
-	if (fb->tiling == LOCAL_I915_FORMAT_MOD_Y_TILED ||
-	    fb->tiling == LOCAL_I915_FORMAT_MOD_Yf_TILED ||
-	    fb->tiling == LOCAL_I915_FORMAT_MOD_Y_TILED_CCS ||
-	    fb->tiling == LOCAL_I915_FORMAT_MOD_Yf_TILED_CCS) {
+	if (fb->modifier == LOCAL_I915_FORMAT_MOD_Y_TILED ||
+	    fb->modifier == LOCAL_I915_FORMAT_MOD_Yf_TILED ||
+	    fb->modifier == LOCAL_I915_FORMAT_MOD_Y_TILED_CCS ||
+	    fb->modifier == LOCAL_I915_FORMAT_MOD_Yf_TILED_CCS) {
 		setup_linear_mapping(&blit->base);
 	} else {
 		blit->base.linear.fb = *fb;
@@ -2528,10 +2528,10 @@ cairo_surface_t *igt_get_cairo_surface(int fd, struct igt_fb *fb)
 		    ((f->cairo_id == CAIRO_FORMAT_INVALID) &&
 		     (f->pixman_id != PIXMAN_invalid)))
 			create_cairo_surface__convert(fd, fb);
-		else if (is_ccs_modifier(fb->tiling))
+		else if (is_ccs_modifier(fb->modifier))
 			create_cairo_surface__rendercopy(fd, fb);
-		else if (fb->tiling == LOCAL_I915_FORMAT_MOD_Y_TILED ||
-			 fb->tiling == LOCAL_I915_FORMAT_MOD_Yf_TILED)
+		else if (fb->modifier == LOCAL_I915_FORMAT_MOD_Y_TILED ||
+			 fb->modifier == LOCAL_I915_FORMAT_MOD_Yf_TILED)
 			create_cairo_surface__blit(fd, fb);
 		else
 			create_cairo_surface__gtt(fd, fb);
diff --git a/lib/igt_fb.h b/lib/igt_fb.h
index 8c683db5..a5a1a2ba 100644
--- a/lib/igt_fb.h
+++ b/lib/igt_fb.h
@@ -53,7 +53,7 @@
  * @drm_format: DRM FOURCC code
  * @width: width in pixels
  * @height: height in pixels
- * @tiling: tiling mode as a DRM framebuffer modifier
+ * @modifier: tiling mode as a DRM framebuffer modifier
  * @size: size in bytes of the underlying backing storage
  * @cairo_surface: optionally attached cairo drawing surface
  * @domain: current domain for cache flushing tracking on i915.ko
@@ -76,7 +76,7 @@ typedef struct igt_fb {
 	int height;
 	enum igt_color_encoding color_encoding;
 	enum igt_color_range color_range;
-	uint64_t tiling;
+	uint64_t modifier;
 	uint64_t size;
 	cairo_surface_t *cairo_surface;
 	unsigned int domain;
@@ -108,34 +108,34 @@ enum igt_text_align {
 	align_hcenter	= 0x08,
 };
 
-void igt_get_fb_tile_size(int fd, uint64_t tiling, int fb_bpp,
+void igt_get_fb_tile_size(int fd, uint64_t modifier, int fb_bpp,
 			  unsigned *width_ret, unsigned *height_ret);
-void igt_calc_fb_size(int fd, int width, int height, uint32_t format, uint64_t tiling,
+void igt_calc_fb_size(int fd, int width, int height, uint32_t format, uint64_t modifier,
 		      uint64_t *size_ret, unsigned *stride_ret);
 unsigned int
 igt_create_fb_with_bo_size(int fd, int width, int height,
-			   uint32_t format, uint64_t tiling,
+			   uint32_t format, uint64_t modifier,
 			   struct igt_fb *fb, uint64_t bo_size,
 			   unsigned bo_stride);
 unsigned int igt_create_fb(int fd, int width, int height, uint32_t format,
-			   uint64_t tiling, struct igt_fb *fb);
+			   uint64_t modifier, struct igt_fb *fb);
 unsigned int igt_create_color_fb(int fd, int width, int height,
-				 uint32_t format, uint64_t tiling,
+				 uint32_t format, uint64_t modifier,
 				 double r, double g, double b,
 				 struct igt_fb *fb /* out */);
 unsigned int igt_create_pattern_fb(int fd, int width, int height,
-				   uint32_t format, uint64_t tiling,
+				   uint32_t format, uint64_t modifier,
 				   struct igt_fb *fb /* out */);
 unsigned int igt_create_color_pattern_fb(int fd, int width, int height,
-					 uint32_t format, uint64_t tiling,
+					 uint32_t format, uint64_t modifier,
 					 double r, double g, double b,
 					 struct igt_fb *fb /* out */);
 unsigned int igt_create_image_fb(int drm_fd,  int width, int height,
-				 uint32_t format, uint64_t tiling,
+				 uint32_t format, uint64_t modifier,
 				 const char *filename,
 				 struct igt_fb *fb /* out */);
 unsigned int igt_create_stereo_fb(int drm_fd, drmModeModeInfo *mode,
-				  uint32_t format, uint64_t tiling);
+				  uint32_t format, uint64_t modifier);
 unsigned int igt_fb_convert(struct igt_fb *dst, struct igt_fb *src,
 			    uint32_t dst_fourcc);
 void igt_remove_fb(int fd, struct igt_fb *fb);
diff --git a/tests/kms_ccs.c b/tests/kms_ccs.c
index 1ed2b4a0..42596a45 100644
--- a/tests/kms_ccs.c
+++ b/tests/kms_ccs.c
@@ -388,7 +388,7 @@ static void generate_fb(data_t *data, struct igt_fb *fb,
 	fb->width = f.width;
 	fb->height = f.height;
 	fb->strides[0] = f.pitches[0];
-	fb->tiling = f.modifier[0];
+	fb->modifier = f.modifier[0];
 	fb->size = size[0];
 	fb->cairo_surface = NULL;
 	fb->domain = 0;
-- 
2.17.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] ✓ Fi.CI.BAT: success for Use rendercopy for generating CCS buffers
  2019-02-21 14:41 [igt-dev] [PATCH i-g-t 0/7] Use rendercopy for generating CCS buffers Dhinakaran Pandiyan
                   ` (6 preceding siblings ...)
  2019-02-21 14:41 ` [igt-dev] [PATCH i-g-t 7/7] tests/kms_ccs: Larger fb to fully cover up the primary plane Dhinakaran Pandiyan
@ 2019-02-21 22:37 ` Patchwork
  2019-02-22 10:57 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
  8 siblings, 0 replies; 25+ messages in thread
From: Patchwork @ 2019-02-21 22:37 UTC (permalink / raw)
  To: igt-dev

== Series Details ==

Series: Use rendercopy for generating CCS buffers
URL   : https://patchwork.freedesktop.org/series/57052/
State : success

== Summary ==

CI Bug Log - changes from IGT_4851 -> IGTPW_2480
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/57052/revisions/1/mbox/

Known issues
------------

  Here are the changes found in IGTPW_2480 that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@gem_exec_basic@readonly-bsd2:
    - fi-pnv-d510:        NOTRUN -> SKIP [fdo#109271] +76

  * igt@kms_busy@basic-flip-a:
    - fi-kbl-7567u:       PASS -> SKIP [fdo#109271] / [fdo#109278] +2
    - fi-gdg-551:         PASS -> FAIL [fdo#103182]

  * igt@kms_busy@basic-flip-c:
    - fi-pnv-d510:        NOTRUN -> SKIP [fdo#109271] / [fdo#109278]

  
#### Possible fixes ####

  * igt@kms_busy@basic-flip-b:
    - fi-gdg-551:         FAIL [fdo#103182] -> PASS

  
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  [fdo#103182]: https://bugs.freedesktop.org/show_bug.cgi?id=103182
  [fdo#105998]: https://bugs.freedesktop.org/show_bug.cgi?id=105998
  [fdo#108569]: https://bugs.freedesktop.org/show_bug.cgi?id=108569
  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#109276]: https://bugs.freedesktop.org/show_bug.cgi?id=109276
  [fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
  [fdo#109284]: https://bugs.freedesktop.org/show_bug.cgi?id=109284
  [fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
  [fdo#109289]: https://bugs.freedesktop.org/show_bug.cgi?id=109289
  [fdo#109294]: https://bugs.freedesktop.org/show_bug.cgi?id=109294
  [fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
  [fdo#109527]: https://bugs.freedesktop.org/show_bug.cgi?id=109527
  [fdo#109528]: https://bugs.freedesktop.org/show_bug.cgi?id=109528
  [fdo#109530]: https://bugs.freedesktop.org/show_bug.cgi?id=109530


Participating hosts (43 -> 39)
------------------------------

  Additional (2): fi-icl-y fi-pnv-d510 
  Missing    (6): fi-kbl-soraka fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-bdw-samus 


Build changes
-------------

    * IGT: IGT_4851 -> IGTPW_2480

  CI_DRM_5650: a4c5c4791699aeebfff694c222c76abb61900fca @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_2480: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2480/
  IGT_4851: 2b7dd10a4e2ea0cabff68421fd15e96c99be3cad @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools



== Testlist changes ==

+igt@gem_render_copy@yf-tiled
+igt@gem_render_copy@yf-tiled-ccs-to-linear
+igt@gem_render_copy@yf-tiled-ccs-to-x-tiled
+igt@gem_render_copy@yf-tiled-ccs-to-yf-tiled
+igt@gem_render_copy@yf-tiled-ccs-to-y-tiled
+igt@gem_render_copy@y-tiled-ccs-to-yf-tiled

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2480/
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] ✓ Fi.CI.IGT: success for Use rendercopy for generating CCS buffers
  2019-02-21 14:41 [igt-dev] [PATCH i-g-t 0/7] Use rendercopy for generating CCS buffers Dhinakaran Pandiyan
                   ` (7 preceding siblings ...)
  2019-02-21 22:37 ` [igt-dev] ✓ Fi.CI.BAT: success for Use rendercopy for generating CCS buffers Patchwork
@ 2019-02-22 10:57 ` Patchwork
  8 siblings, 0 replies; 25+ messages in thread
From: Patchwork @ 2019-02-22 10:57 UTC (permalink / raw)
  To: igt-dev

== Series Details ==

Series: Use rendercopy for generating CCS buffers
URL   : https://patchwork.freedesktop.org/series/57052/
State : success

== Summary ==

CI Bug Log - changes from IGT_4851_full -> IGTPW_2480_full
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/57052/revisions/1/mbox/

New tests
---------

  New tests have been introduced between IGT_4851_full and IGTPW_2480_full:

### New IGT tests (6) ###

  * igt@gem_render_copy@y-tiled-ccs-to-yf-tiled:
    - Statuses : 3 pass(s) 2 skip(s)
    - Exec time: [0.0, 0.24] s

  * igt@gem_render_copy@yf-tiled:
    - Statuses : 3 pass(s) 2 skip(s)
    - Exec time: [0.0, 0.24] s

  * igt@gem_render_copy@yf-tiled-ccs-to-linear:
    - Statuses : 3 pass(s) 2 skip(s)
    - Exec time: [0.0, 0.24] s

  * igt@gem_render_copy@yf-tiled-ccs-to-x-tiled:
    - Statuses : 3 pass(s) 2 skip(s)
    - Exec time: [0.0, 0.24] s

  * igt@gem_render_copy@yf-tiled-ccs-to-y-tiled:
    - Statuses : 3 pass(s) 2 skip(s)
    - Exec time: [0.0, 0.24] s

  * igt@gem_render_copy@yf-tiled-ccs-to-yf-tiled:
    - Statuses : 3 pass(s) 2 skip(s)
    - Exec time: [0.0, 0.24] s

  

Known issues
------------

  Here are the changes found in IGTPW_2480_full that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@gem_exec_schedule@preemptive-hang-bsd:
    - shard-kbl:          NOTRUN -> SKIP [fdo#109271] +5

  * igt@gem_exec_store@basic-bsd2:
    - shard-apl:          NOTRUN -> SKIP [fdo#109271] +35

  * igt@gem_render_copy@y-tiled-ccs-to-yf-tiled (NEW):
    - shard-snb:          NOTRUN -> SKIP [fdo#109271] +9
    - shard-hsw:          NOTRUN -> SKIP [fdo#109271] +5

  * igt@gem_tiled_swapping@non-threaded:
    - shard-hsw:          PASS -> INCOMPLETE [fdo#103540]

  * igt@gem_userptr_blits@process-exit-gtt:
    - shard-glk:          NOTRUN -> SKIP [fdo#109271] +24

  * igt@kms_busy@extended-pageflip-hang-newfb-render-e:
    - shard-apl:          NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +2
    - shard-glk:          NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +1

  * igt@kms_ccs@pipe-a-crc-sprite-planes-basic:
    - shard-glk:          PASS -> FAIL [fdo#108145]

  * igt@kms_color@pipe-b-legacy-gamma:
    - shard-apl:          PASS -> FAIL [fdo#104782]

  * igt@kms_cursor_crc@cursor-128x128-sliding:
    - shard-kbl:          PASS -> FAIL [fdo#103232]

  * igt@kms_cursor_crc@cursor-64x21-random:
    - shard-apl:          PASS -> FAIL [fdo#103232] +3

  * igt@kms_frontbuffer_tracking@fbc-2p-primscrn-cur-indfb-draw-blt:
    - shard-glk:          PASS -> FAIL [fdo#103167] +5

  * igt@kms_lease@lease_invalid_crtc:
    - shard-snb:          PASS -> SKIP [fdo#109271]

  * igt@kms_plane@pixel-format-pipe-a-planes-source-clamping:
    - shard-apl:          PASS -> FAIL [fdo#108948]

  * igt@kms_plane@pixel-format-pipe-c-planes-source-clamping:
    - shard-glk:          PASS -> FAIL [fdo#108948]

  * igt@kms_plane_alpha_blend@pipe-c-alpha-opaque-fb:
    - shard-apl:          PASS -> FAIL [fdo#108145]

  * igt@kms_plane_multiple@atomic-pipe-b-tiling-none:
    - shard-apl:          PASS -> FAIL [fdo#103166] +6

  * igt@kms_plane_multiple@atomic-pipe-b-tiling-y:
    - shard-glk:          PASS -> FAIL [fdo#103166] +7

  * igt@kms_plane_multiple@atomic-pipe-c-tiling-x:
    - shard-kbl:          PASS -> FAIL [fdo#103166]

  * igt@kms_rotation_crc@multiplane-rotation:
    - shard-kbl:          PASS -> INCOMPLETE [fdo#103665]

  * igt@kms_rotation_crc@multiplane-rotation-cropping-bottom:
    - shard-kbl:          PASS -> DMESG-FAIL [fdo#105763]

  * igt@kms_setmode@basic:
    - shard-apl:          PASS -> FAIL [fdo#99912]

  * igt@kms_vblank@pipe-a-ts-continuation-suspend:
    - shard-kbl:          PASS -> FAIL [fdo#104894] +1
    - shard-apl:          PASS -> FAIL [fdo#104894] +1

  
#### Possible fixes ####

  * igt@kms_color@pipe-a-degamma:
    - shard-kbl:          FAIL [fdo#104782] / [fdo#108145] -> PASS

  * igt@kms_color@pipe-a-gamma:
    - shard-kbl:          FAIL [fdo#104782] -> PASS

  * igt@kms_cursor_crc@cursor-128x128-dpms:
    - shard-kbl:          FAIL [fdo#103232] -> PASS +2

  * igt@kms_cursor_crc@cursor-64x21-sliding:
    - shard-apl:          FAIL [fdo#103232] -> PASS +6

  * igt@kms_cursor_crc@cursor-alpha-opaque:
    - shard-apl:          FAIL [fdo#109350] -> PASS

  * igt@kms_cursor_crc@cursor-size-change:
    - shard-glk:          FAIL [fdo#103232] -> PASS

  * igt@kms_flip@2x-flip-vs-expired-vblank-interruptible:
    - shard-glk:          FAIL [fdo#105363] -> PASS

  * igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-draw-mmap-cpu:
    - shard-glk:          FAIL [fdo#103167] -> PASS +1

  * igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-blt:
    - shard-kbl:          FAIL [fdo#103167] -> PASS +1

  * igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-gtt:
    - shard-apl:          FAIL [fdo#103167] -> PASS +4

  * igt@kms_frontbuffer_tracking@fbc-1p-rte:
    - shard-snb:          INCOMPLETE [fdo#105411] / [fdo#107469] -> PASS

  * igt@kms_plane@plane-position-covered-pipe-c-planes:
    - shard-apl:          FAIL [fdo#103166] -> PASS +3

  * igt@kms_plane_multiple@atomic-pipe-c-tiling-yf:
    - shard-glk:          FAIL [fdo#103166] -> PASS

  * igt@kms_setmode@basic:
    - shard-hsw:          FAIL [fdo#99912] -> PASS

  * igt@testdisplay:
    - shard-kbl:          INCOMPLETE [fdo#103665] -> PASS
    - shard-apl:          INCOMPLETE [fdo#103927] -> PASS

  
#### Warnings ####

  * igt@kms_frontbuffer_tracking@fbcpsr-2p-primscrn-cur-indfb-draw-mmap-wc:
    - shard-apl:          INCOMPLETE [fdo#103927] -> SKIP [fdo#109271]

  
  [fdo#103166]: https://bugs.freedesktop.org/show_bug.cgi?id=103166
  [fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
  [fdo#103232]: https://bugs.freedesktop.org/show_bug.cgi?id=103232
  [fdo#103540]: https://bugs.freedesktop.org/show_bug.cgi?id=103540
  [fdo#103665]: https://bugs.freedesktop.org/show_bug.cgi?id=103665
  [fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
  [fdo#104782]: https://bugs.freedesktop.org/show_bug.cgi?id=104782
  [fdo#104894]: https://bugs.freedesktop.org/show_bug.cgi?id=104894
  [fdo#105363]: https://bugs.freedesktop.org/show_bug.cgi?id=105363
  [fdo#105411]: https://bugs.freedesktop.org/show_bug.cgi?id=105411
  [fdo#105763]: https://bugs.freedesktop.org/show_bug.cgi?id=105763
  [fdo#107469]: https://bugs.freedesktop.org/show_bug.cgi?id=107469
  [fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
  [fdo#108948]: https://bugs.freedesktop.org/show_bug.cgi?id=108948
  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
  [fdo#109350]: https://bugs.freedesktop.org/show_bug.cgi?id=109350
  [fdo#99912]: https://bugs.freedesktop.org/show_bug.cgi?id=99912


Participating hosts (7 -> 5)
------------------------------

  Missing    (2): shard-skl shard-iclb 


Build changes
-------------

    * IGT: IGT_4851 -> IGTPW_2480

  CI_DRM_5650: a4c5c4791699aeebfff694c222c76abb61900fca @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_2480: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2480/
  IGT_4851: 2b7dd10a4e2ea0cabff68421fd15e96c99be3cad @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2480/
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH i-g-t 7/7] tests/kms_ccs: Larger fb to fully cover up the primary plane
  2019-02-21 14:41 ` [igt-dev] [PATCH i-g-t 7/7] tests/kms_ccs: Larger fb to fully cover up the primary plane Dhinakaran Pandiyan
@ 2019-02-22 14:19   ` Juha-Pekka Heikkila
  2019-02-22 16:18     ` Clinton Taylor
  0 siblings, 1 reply; 25+ messages in thread
From: Juha-Pekka Heikkila @ 2019-02-22 14:19 UTC (permalink / raw)
  To: Dhinakaran Pandiyan, igt-dev; +Cc: Clinton Taylor

I wouldn't go reverting this limitation. Idea of this test is to see if 
ccs work but not how big planes can be used with ccs. Matt's patch was 
to fix that two planes 1080p problem on APL but if you go see the 
machine https://intel-gfx-ci.01.org/hardware.html#fi-apl-guc you'll 
notice it support 4096x2160@60Hz at highest. After removing this 
limitation all you need to do to fail this test is to change the monitor.

This igt test was originally limited due to this machine 
https://intel-gfx-ci.01.org/hardware.html#fi-kbl-soraka which is meant 
to be Chromebook with 2400x1600 size display. Quickly looking it seems 
Soraka has not been recently running so much CI runs though.

/Juha-Pekka

On 21.2.2019 16.41, Dhinakaran Pandiyan wrote:
> This is a revert of commit 27fa97d16294 ("tests/kms_ccs: Avoid using plane
> sizes which exceed hw capability"). The watermarks issue that the patch
> refers to has been fixed as per the bugzilla, so let's use an fb that
> covers the whole screen.
> 
> Cc: Clinton Taylor <clinton.a.taylor@intel.com>
> Cc: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> References: https://bugs.freedesktop.org/show_bug.cgi?id=105458
> Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
> ---
>   tests/kms_ccs.c | 16 +++-------------
>   1 file changed, 3 insertions(+), 13 deletions(-)
> 
> diff --git a/tests/kms_ccs.c b/tests/kms_ccs.c
> index 8cbf100f..48f10af0 100644
> --- a/tests/kms_ccs.c
> +++ b/tests/kms_ccs.c
> @@ -69,15 +69,6 @@ const struct {
>   	{0.0, 1.0, 0.0}
>   };
>   
> -/*
> - * Limit maximum used sprite plane width so this test will not mistakenly
> - * fail on hardware limitations which are not interesting to this test.
> - * On this test too wide sprite plane may fail during creation with dmesg
> - * comment saying:
> - * "Requested display configuration exceeds system watermark limitations"
> - */
> -#define MAX_SPRITE_PLANE_WIDTH 2000
> -
>   struct local_drm_format_modifier {
>          /* Bitmask of formats in get_plane format list this info applies to. The
>   	* offset allows a sliding window of which 64 formats (bits).
> @@ -313,13 +304,12 @@ static bool try_config(data_t *data, enum test_fb_flags fb_flags,
>   	if (data->plane && fb_flags & FB_COMPRESSED) {
>   		if (!plane_has_format_with_ccs(data, data->plane, DRM_FORMAT_XRGB8888))
>   			return false;
> -		generate_fb(data, &fb, min(MAX_SPRITE_PLANE_WIDTH, drm_mode->hdisplay),
> -			    drm_mode->vdisplay,
> +		generate_fb(data, &fb, drm_mode->hdisplay, drm_mode->vdisplay,
>   			    (fb_flags & ~FB_COMPRESSED) | FB_HAS_PLANE);
>   		generate_fb(data, &fb_sprite, 256, 256, fb_flags);
>   	} else {
> -		generate_fb(data, &fb, min(MAX_SPRITE_PLANE_WIDTH, drm_mode->hdisplay),
> -			    drm_mode->vdisplay, fb_flags);
> +		generate_fb(data, &fb, drm_mode->hdisplay, drm_mode->vdisplay,
> +			    fb_flags);
>   	}
>   
>   	if (data->flags & TEST_FAIL_ON_ADDFB2)
> 

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH i-g-t 6/7] tests/kms_ccs: Generate compressed surfaces with rendercopy
  2019-02-21 14:41 ` [igt-dev] [PATCH i-g-t 6/7] tests/kms_ccs: Generate compressed surfaces with rendercopy Dhinakaran Pandiyan
@ 2019-02-22 16:13   ` Ville Syrjälä
  0 siblings, 0 replies; 25+ messages in thread
From: Ville Syrjälä @ 2019-02-22 16:13 UTC (permalink / raw)
  To: Dhinakaran Pandiyan; +Cc: igt-dev, Clinton Taylor

On Thu, Feb 21, 2019 at 06:41:08AM -0800, Dhinakaran Pandiyan wrote:
> lib/igt_fb.c now has capability to make use of rendercopy, which means
> we do not have to handwrite compressed buffers.
> 
> Cc: Clinton Taylor <clinton.a.taylor@intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
> ---
>  tests/kms_ccs.c | 202 ++++++++++++------------------------------------
>  1 file changed, 49 insertions(+), 153 deletions(-)
> 
> diff --git a/tests/kms_ccs.c b/tests/kms_ccs.c
> index 42596a45..8cbf100f 100644
> --- a/tests/kms_ccs.c
> +++ b/tests/kms_ccs.c
> @@ -60,13 +60,14 @@ typedef struct {
>  	igt_pipe_crc_t *pipe_crc;
>  } data_t;
>  
> -#define RED			0x00ff0000
> -#define COMPRESSED_RED		0x0ff0000f
> -#define GREEN			0x0000ff00
> -#define COMPRESSED_GREEN	0x000ff00f
> -
> -#define CCS_UNCOMPRESSED	0x0
> -#define CCS_COMPRESSED		0x55
> +const struct {

static

> +	double r;
> +	double g;
> +	double b;
> +} colors[2] = {
> +	{1.0, 0.0, 0.0},
> +	{0.0, 1.0, 0.0}
> +};
>  
>  /*
>   * Limit maximum used sprite plane width so this test will not mistakenly
> @@ -192,104 +193,32 @@ static bool plane_has_format_with_ccs(data_t *data, igt_plane_t *plane, uint32_t
>  	return false;
>  }
>  
> -static void render_fb(data_t *data, uint32_t gem_handle, unsigned int size,
> -		      enum test_fb_flags fb_flags,
> -		      int height, unsigned int stride)
> +static void addfb_init(struct igt_fb *fb, struct drm_mode_fb_cmd2 *f)
>  {
> -	uint32_t *ptr;
> -	unsigned int half_height, half_size;
> -	uint32_t uncompressed_color = data->plane ? GREEN : RED;
> -	uint32_t compressed_color =
> -		data->plane ? COMPRESSED_GREEN : COMPRESSED_RED;
> -	uint32_t bad_color = RED;
>  	int i;
>  
> -	ptr = gem_mmap__cpu(data->drm_fd, gem_handle, 0, size,
> -			    PROT_READ | PROT_WRITE);
> +	f->width = fb->width;
> +	f->height = fb->height;
> +	f->pixel_format = fb->drm_format;
> +	f->flags = LOCAL_DRM_MODE_FB_MODIFIERS;
>  
> -	if (fb_flags & FB_COMPRESSED) {
> -		/* In the compressed case, we want the top half of the
> -		 * surface to be uncompressed and the bottom half to be
> -		 * compressed.
> -		 *
> -		 * We need to cut the surface on a CCS cache-line boundary,
> -		 * otherwise, we're going to be in trouble when we try to
> -		 * generate CCS data for the surface.  A cache line in the
> -		 * CCS is 16x16 cache-line-pairs in the main surface.  16
> -		 * cache lines is 64 rows high.
> -		 */
> -		half_height = ALIGN(height, 128) / 2;
> -		half_size = half_height * stride;
> -		for (i = 0; i < size / 4; i++) {
> -			if (i < half_size / 4)
> -				ptr[i] = uncompressed_color;
> -			else
> -				ptr[i] = compressed_color;
> -		}
> -	} else {
> -		/* When we're displaying the primary plane underneath a
> -		 * sprite plane, cut out a 128 x 128 area (less than the sprite)
> -		 * plane size which we paint red, so we know easily if it's
> -		 * bad.
> -		 */
> -		for (i = 0; i < size / 4; i++) {
> -			if ((fb_flags & FB_HAS_PLANE) &&
> -			    (i / (stride / 4)) < 128 &&
> -			    (i % (stride / 4)) < 128) {
> -				ptr[i] = bad_color;
> -			} else {
> -				ptr[i] = uncompressed_color;
> -			}
> -		}
> +	for (i = 0; i < fb->num_planes; i++) {
> +		f->handles[i] = fb->gem_handle;
> +		f->modifier[i] = fb->modifier;
> +		f->pitches[i] = fb->strides[i];
> +		f->offsets[i] = fb->offsets[i];
>  	}
> -
> -	munmap(ptr, size);
> -}
> -
> -static unsigned int
> -y_tile_y_pos(unsigned int offset, unsigned int stride)
> -{
> -	unsigned int y_tiles, y;
> -	y_tiles = (offset / 4096) / (stride / 128);
> -	y = y_tiles * 32 + ((offset & 0x1f0) >> 4);
> -	return y;
> -}
> -
> -static void render_ccs(data_t *data, uint32_t gem_handle,
> -		       uint32_t offset, uint32_t size,
> -		       int height, unsigned int ccs_stride)
> -{
> -	unsigned int half_height, ccs_half_height;
> -	uint8_t *ptr;
> -	int i;
> -
> -	half_height = ALIGN(height, 128) / 2;
> -	ccs_half_height = half_height / 16;
> -
> -	ptr = gem_mmap__cpu(data->drm_fd, gem_handle, offset, size,
> -			    PROT_READ | PROT_WRITE);
> -
> -	for (i = 0; i < size; i++) {
> -		if (y_tile_y_pos(i, ccs_stride) < ccs_half_height)
> -			ptr[i] = CCS_UNCOMPRESSED;
> -		else
> -			ptr[i] = CCS_COMPRESSED;
> -	}
> -
> -	munmap(ptr, size);
>  }
>  
>  static void generate_fb(data_t *data, struct igt_fb *fb,
>  			int width, int height,
>  			enum test_fb_flags fb_flags)
>  {
> -	struct local_drm_mode_fb_cmd2 f = {};
> -	unsigned int size[2];
> +	struct drm_mode_fb_cmd2 f = {0};
> +	uint32_t format;
>  	uint64_t modifier;
> +	cairo_t *cr;
>  	int ret;
> -	uint32_t ccs_handle;
> -
> -	memset(fb, 0, sizeof(*fb));
>  
>  	/* Use either compressed or Y-tiled to test. However, given the lack of
>  	 * available bandwidth, we use linear for the primary plane when
> @@ -303,74 +232,52 @@ static void generate_fb(data_t *data, struct igt_fb *fb,
>  	else
>  		modifier = 0;
>  
> -	f.flags = LOCAL_DRM_MODE_FB_MODIFIERS;
> -	f.width = width;
> -	f.height = height;
> -
>  	if (data->flags & TEST_BAD_PIXEL_FORMAT)
> -		f.pixel_format = DRM_FORMAT_RGB565;
> +		format = DRM_FORMAT_RGB565;
>  	else
> -		f.pixel_format = DRM_FORMAT_XRGB8888;
> +		format = DRM_FORMAT_XRGB8888;
>  
> -	f.pitches[0] = ALIGN(width * 4, 128);
> -	f.modifier[0] = modifier;
> -	f.offsets[0] = 0;
> -	size[0] = f.pitches[0] * ALIGN(height, 32);
> +	igt_create_bo_for_fb(data->drm_fd, width, height, format, modifier, fb);

Hmm. So we're allocating the bo based on the original parameters. The
original code allocates based on the adjust aux stride for
FB_MISALIGN_AUX_STRIDE and FB_SMALL_AUX_STRIDE. But since those just
reduce the stride they can't fail spuriously since the original buffer
size will be big enough.

So looks like this should work just fine
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> +	igt_assert(fb->gem_handle > 0);
>  
> -	if (fb_flags & FB_COMPRESSED) {
> -		/* From the Sky Lake PRM, Vol 12, "Color Control Surface":
> -		 *
> -		 *    "The compression state of the cache-line pair is
> -		 *    specified by 2 bits in the CCS.  Each CCS cache-line
> -		 *    represents an area on the main surface of 16x16 sets
> -		 *    of 128 byte Y-tiled cache-line-pairs. CCS is always Y
> -		 *    tiled."
> -		 *
> -		 * A "cache-line-pair" for a Y-tiled surface is two
> -		 * horizontally adjacent cache lines.  When operating in
> -		 * bytes and rows, this gives us a scale-down factor of
> -		 * 32x16.  Since the main surface has a 32-bit format, we
> -		 * need to multiply width by 4 to get bytes.
> -		 */
> -		int ccs_width = ALIGN(width * 4, 32) / 32;
> -		int ccs_height = ALIGN(height, 16) / 16;
> -		int ccs_pitches = ALIGN(ccs_width * 1, 128);
> -		int ccs_offsets = size[0];
> +	addfb_init(fb, &f);
>  
> +	if (fb_flags & FB_COMPRESSED) {
>  		if (fb_flags & FB_MISALIGN_AUX_STRIDE) {
>  			igt_skip_on_f(width <= 1024,
>  				      "FB already has the smallest possible stride\n");
> -			ccs_pitches -= 64;
> +			f.pitches[1] -= 64;
>  		}
> -		else if (fb_flags & FB_SMALL_AUX_STRIDE) {
> +
> +		if (fb_flags & FB_SMALL_AUX_STRIDE) {
>  			igt_skip_on_f(width <= 1024,
>  				      "FB already has the smallest possible stride\n");
> -			ccs_pitches = ALIGN(ccs_width/2, 128);
> +			f.pitches[1] = ALIGN(f.pitches[1]/2, 128);
>  		}
>  
> -		size[1] = ccs_pitches * ALIGN(ccs_height, 32);
> -
> -		f.handles[0] = gem_create(data->drm_fd, size[0] + size[1]);
> -		if (data->flags & TEST_BAD_CCS_HANDLE) {
> -			/* Put the CCS buffer on a different BO. */
> -			ccs_handle = gem_create(data->drm_fd, size[0] + size[1]);
> -		} else
> -			ccs_handle = f.handles[0];
> +		if (fb_flags & FB_ZERO_AUX_STRIDE)
> +			f.pitches[1] = 0;
>  
> -		if (!(data->flags & TEST_NO_AUX_BUFFER)) {
> -			f.modifier[1] = modifier;
> -			f.handles[1] = ccs_handle;
> -			f.offsets[1] = ccs_offsets;
> -			f.pitches[1] = (fb_flags & FB_ZERO_AUX_STRIDE)? 0:ccs_pitches;
> +		/* Put the CCS buffer on a different BO. */
> +		if (data->flags & TEST_BAD_CCS_HANDLE)
> +			f.handles[1] = gem_create(data->drm_fd, fb->size);
>  
> -			render_ccs(data, f.handles[1], f.offsets[1], size[1],
> -				   height, ccs_pitches);
> +		if (data->flags & TEST_NO_AUX_BUFFER) {
> +			f.handles[1] = 0;
> +			f.modifier[1] = 0;
> +			f.pitches[1] = 0;
> +			f.offsets[1] = 0;
>  		}
> -	} else {
> -		f.handles[0] = gem_create(data->drm_fd, size[0]);
>  	}
>  
> -	render_fb(data, f.handles[0], size[0], fb_flags, height, f.pitches[0]);
> +	if (!(data->flags & TEST_BAD_PIXEL_FORMAT)) {
> +		int c = !!data->plane;
> +
> +		cr = igt_get_cairo_ctx(data->drm_fd, fb);
> +		igt_paint_color(cr, 0, 0, width, height,
> +				colors[c].r, colors[c].g, colors[c].b);
> +		igt_put_cairo_ctx(data->drm_fd, fb, cr);
> +	}
>  
>  	ret = drmIoctl(data->drm_fd, LOCAL_DRM_IOCTL_MODE_ADDFB2, &f);
>  	if (data->flags & TEST_FAIL_ON_ADDFB2) {
> @@ -381,17 +288,6 @@ static void generate_fb(data_t *data, struct igt_fb *fb,
>  		igt_assert_eq(ret, 0);
>  
>  	fb->fb_id = f.fb_id;
> -	fb->fd = data->drm_fd;
> -	fb->gem_handle = f.handles[0];
> -	fb->is_dumb = false;
> -	fb->drm_format = f.pixel_format;
> -	fb->width = f.width;
> -	fb->height = f.height;
> -	fb->strides[0] = f.pitches[0];
> -	fb->modifier = f.modifier[0];
> -	fb->size = size[0];
> -	fb->cairo_surface = NULL;
> -	fb->domain = 0;
>  }
>  
>  static bool try_config(data_t *data, enum test_fb_flags fb_flags,
> -- 
> 2.17.1

-- 
Ville Syrjälä
Intel
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH i-g-t 7/7] tests/kms_ccs: Larger fb to fully cover up the primary plane
  2019-02-22 14:19   ` Juha-Pekka Heikkila
@ 2019-02-22 16:18     ` Clinton Taylor
  2019-02-23 13:43       ` Juha-Pekka Heikkilä
  0 siblings, 1 reply; 25+ messages in thread
From: Clinton Taylor @ 2019-02-22 16:18 UTC (permalink / raw)
  To: juhapekka.heikkila, Dhinakaran Pandiyan, igt-dev


On 2/22/19 6:19 AM, Juha-Pekka Heikkila wrote:
> I wouldn't go reverting this limitation. Idea of this test is to see 
> if ccs work but not how big planes can be used with ccs. Matt's patch 
> was to fix that two planes 1080p problem on APL but if you go see the 
> machine https://intel-gfx-ci.01.org/hardware.html#fi-apl-guc you'll 
> notice it support 4096x2160@60Hz at highest. After removing this 
> limitation all you need to do to fail this test is to change the monitor.
>
The test has been changed to the current active size of the pipe and not 
the maximum size supported by the hardware.

-Clint


> This igt test was originally limited due to this machine 
> https://intel-gfx-ci.01.org/hardware.html#fi-kbl-soraka which is meant 
> to be Chromebook with 2400x1600 size display. Quickly looking it seems 
> Soraka has not been recently running so much CI runs though.
>
> /Juha-Pekka
>
> On 21.2.2019 16.41, Dhinakaran Pandiyan wrote:
>> This is a revert of commit 27fa97d16294 ("tests/kms_ccs: Avoid using 
>> plane
>> sizes which exceed hw capability"). The watermarks issue that the patch
>> refers to has been fixed as per the bugzilla, so let's use an fb that
>> covers the whole screen.
>>
>> Cc: Clinton Taylor <clinton.a.taylor@intel.com>
>> Cc: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
>> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
>> References: https://bugs.freedesktop.org/show_bug.cgi?id=105458
>> Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
>> ---
>>   tests/kms_ccs.c | 16 +++-------------
>>   1 file changed, 3 insertions(+), 13 deletions(-)
>>
>> diff --git a/tests/kms_ccs.c b/tests/kms_ccs.c
>> index 8cbf100f..48f10af0 100644
>> --- a/tests/kms_ccs.c
>> +++ b/tests/kms_ccs.c
>> @@ -69,15 +69,6 @@ const struct {
>>       {0.0, 1.0, 0.0}
>>   };
>>   -/*
>> - * Limit maximum used sprite plane width so this test will not 
>> mistakenly
>> - * fail on hardware limitations which are not interesting to this test.
>> - * On this test too wide sprite plane may fail during creation with 
>> dmesg
>> - * comment saying:
>> - * "Requested display configuration exceeds system watermark 
>> limitations"
>> - */
>> -#define MAX_SPRITE_PLANE_WIDTH 2000
>> -
>>   struct local_drm_format_modifier {
>>          /* Bitmask of formats in get_plane format list this info 
>> applies to. The
>>       * offset allows a sliding window of which 64 formats (bits).
>> @@ -313,13 +304,12 @@ static bool try_config(data_t *data, enum 
>> test_fb_flags fb_flags,
>>       if (data->plane && fb_flags & FB_COMPRESSED) {
>>           if (!plane_has_format_with_ccs(data, data->plane, 
>> DRM_FORMAT_XRGB8888))
>>               return false;
>> -        generate_fb(data, &fb, min(MAX_SPRITE_PLANE_WIDTH, 
>> drm_mode->hdisplay),
>> -                drm_mode->vdisplay,
>> +        generate_fb(data, &fb, drm_mode->hdisplay, drm_mode->vdisplay,
>>                   (fb_flags & ~FB_COMPRESSED) | FB_HAS_PLANE);
>>           generate_fb(data, &fb_sprite, 256, 256, fb_flags);
>>       } else {
>> -        generate_fb(data, &fb, min(MAX_SPRITE_PLANE_WIDTH, 
>> drm_mode->hdisplay),
>> -                drm_mode->vdisplay, fb_flags);
>> +        generate_fb(data, &fb, drm_mode->hdisplay, drm_mode->vdisplay,
>> +                fb_flags);
>>       }
>>         if (data->flags & TEST_FAIL_ON_ADDFB2)
>>
>
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH i-g-t 5/7] lib/igt_fb: Function to create a bo for passed in igt_fb
  2019-02-21 14:41 ` [igt-dev] [PATCH i-g-t 5/7] lib/igt_fb: Function to create a bo for passed in igt_fb Dhinakaran Pandiyan
@ 2019-02-22 16:20   ` Ville Syrjälä
  0 siblings, 0 replies; 25+ messages in thread
From: Ville Syrjälä @ 2019-02-22 16:20 UTC (permalink / raw)
  To: Dhinakaran Pandiyan; +Cc: igt-dev, Clinton Taylor

On Thu, Feb 21, 2019 at 06:41:07AM -0800, Dhinakaran Pandiyan wrote:
> In order to execute negative tests that validate fb creation, tests need to
> be able to call the addfb ioctl themselves so that the arguments can be
> manipulated. Add a library function to provide an initialized fb without
> registering the fb with the kernel.
> 
> Cc: Clinton Taylor <clinton.a.taylor@intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
> ---
>  lib/igt_fb.c | 9 +++++++++
>  lib/igt_fb.h | 3 +++
>  2 files changed, 12 insertions(+)
> 
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index b475a686..81c48453 100644
> --- a/lib/igt_fb.c
> +++ b/lib/igt_fb.c
> @@ -689,6 +689,15 @@ out:
>  	return fb->gem_handle;
>  }
>  
> +void igt_create_bo_for_fb(int fd, int width, int height,
> +			  uint32_t format, uint64_t modifier,
> +			  struct igt_fb *fb /* out */)
> +{
> +	fb_init(fb, fd, width, height, format, modifier,
> +		IGT_COLOR_YCBCR_BT709, IGT_COLOR_YCBCR_LIMITED_RANGE);
> +	create_bo_for_fb(fb);
> +}

Hmm. Ah igt_create_bo_with_dimensions() doesn't hand out the igt_fb.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> +
>  /**
>   * igt_create_bo_with_dimensions:
>   * @fd: open drm file descriptor
> diff --git a/lib/igt_fb.h b/lib/igt_fb.h
> index a5a1a2ba..8645ab27 100644
> --- a/lib/igt_fb.h
> +++ b/lib/igt_fb.h
> @@ -143,6 +143,9 @@ int igt_dirty_fb(int fd, struct igt_fb *fb);
>  void *igt_fb_map_buffer(int fd, struct igt_fb *fb);
>  void igt_fb_unmap_buffer(struct igt_fb *fb, void *buffer);
>  
> +void igt_create_bo_for_fb(int fd, int width, int height,
> +			  uint32_t format, uint64_t modifier,
> +			  struct igt_fb *fb);
>  int igt_create_bo_with_dimensions(int fd, int width, int height, uint32_t format,
>  				  uint64_t modifier, unsigned stride,
>  				  uint64_t *size_ret, unsigned *stride_ret,
> -- 
> 2.17.1

-- 
Ville Syrjälä
Intel
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH i-g-t 7/7] tests/kms_ccs: Larger fb to fully cover up the primary plane
  2019-02-22 16:18     ` Clinton Taylor
@ 2019-02-23 13:43       ` Juha-Pekka Heikkilä
  2019-02-27  7:50         ` Dhinakaran Pandiyan
  0 siblings, 1 reply; 25+ messages in thread
From: Juha-Pekka Heikkilä @ 2019-02-23 13:43 UTC (permalink / raw)
  To: Clinton Taylor, Dhinakaran Pandiyan, igt-dev



Clinton Taylor kirjoitti 22.2.2019 klo 18.18:
> 
> On 2/22/19 6:19 AM, Juha-Pekka Heikkila wrote:
>> I wouldn't go reverting this limitation. Idea of this test is to see 
>> if ccs work but not how big planes can be used with ccs. Matt's patch 
>> was to fix that two planes 1080p problem on APL but if you go see the 
>> machine https://intel-gfx-ci.01.org/hardware.html#fi-apl-guc you'll 
>> notice it support 4096x2160@60Hz at highest. After removing this 
>> limitation all you need to do to fail this test is to change the monitor.
>>
> The test has been changed to the current active size of the pipe and not 
> the maximum size supported by the hardware.
> 

I didn't understand the reasoning. This test did fail on different 
machines because of plane sizes which required more bandwith than was 
available in budget. Watermark calculation was adjusted but it doesn't 
change limitations on hardware.

Is there benefit in reindroducing this point of failure?

/Juha-Pekka

> 
> 
>> This igt test was originally limited due to this machine 
>> https://intel-gfx-ci.01.org/hardware.html#fi-kbl-soraka which is meant 
>> to be Chromebook with 2400x1600 size display. Quickly looking it seems 
>> Soraka has not been recently running so much CI runs though.
>>
>> /Juha-Pekka
>>
>> On 21.2.2019 16.41, Dhinakaran Pandiyan wrote:
>>> This is a revert of commit 27fa97d16294 ("tests/kms_ccs: Avoid using 
>>> plane
>>> sizes which exceed hw capability"). The watermarks issue that the patch
>>> refers to has been fixed as per the bugzilla, so let's use an fb that
>>> covers the whole screen.
>>>
>>> Cc: Clinton Taylor <clinton.a.taylor@intel.com>
>>> Cc: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
>>> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
>>> References: https://bugs.freedesktop.org/show_bug.cgi?id=105458
>>> Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
>>> ---
>>>   tests/kms_ccs.c | 16 +++-------------
>>>   1 file changed, 3 insertions(+), 13 deletions(-)
>>>
>>> diff --git a/tests/kms_ccs.c b/tests/kms_ccs.c
>>> index 8cbf100f..48f10af0 100644
>>> --- a/tests/kms_ccs.c
>>> +++ b/tests/kms_ccs.c
>>> @@ -69,15 +69,6 @@ const struct {
>>>       {0.0, 1.0, 0.0}
>>>   };
>>>   -/*
>>> - * Limit maximum used sprite plane width so this test will not 
>>> mistakenly
>>> - * fail on hardware limitations which are not interesting to this test.
>>> - * On this test too wide sprite plane may fail during creation with 
>>> dmesg
>>> - * comment saying:
>>> - * "Requested display configuration exceeds system watermark 
>>> limitations"
>>> - */
>>> -#define MAX_SPRITE_PLANE_WIDTH 2000
>>> -
>>>   struct local_drm_format_modifier {
>>>          /* Bitmask of formats in get_plane format list this info 
>>> applies to. The
>>>       * offset allows a sliding window of which 64 formats (bits).
>>> @@ -313,13 +304,12 @@ static bool try_config(data_t *data, enum 
>>> test_fb_flags fb_flags,
>>>       if (data->plane && fb_flags & FB_COMPRESSED) {
>>>           if (!plane_has_format_with_ccs(data, data->plane, 
>>> DRM_FORMAT_XRGB8888))
>>>               return false;
>>> -        generate_fb(data, &fb, min(MAX_SPRITE_PLANE_WIDTH, 
>>> drm_mode->hdisplay),
>>> -                drm_mode->vdisplay,
>>> +        generate_fb(data, &fb, drm_mode->hdisplay, drm_mode->vdisplay,
>>>                   (fb_flags & ~FB_COMPRESSED) | FB_HAS_PLANE);
>>>           generate_fb(data, &fb_sprite, 256, 256, fb_flags);
>>>       } else {
>>> -        generate_fb(data, &fb, min(MAX_SPRITE_PLANE_WIDTH, 
>>> drm_mode->hdisplay),
>>> -                drm_mode->vdisplay, fb_flags);
>>> +        generate_fb(data, &fb, drm_mode->hdisplay, drm_mode->vdisplay,
>>> +                fb_flags);
>>>       }
>>>         if (data->flags & TEST_FAIL_ON_ADDFB2)
>>>
>>
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH i-g-t 1/7] lib/rendercopy: Add support for Yf/Ys tiling to gen9 rendercopy
  2019-02-21 14:41 ` [igt-dev] [PATCH i-g-t 1/7] lib/rendercopy: Add support for Yf/Ys tiling to gen9 rendercopy Dhinakaran Pandiyan
@ 2019-02-25 13:39   ` Katarzyna Dec
  2019-02-26 21:00     ` Pandiyan, Dhinakaran
  0 siblings, 1 reply; 25+ messages in thread
From: Katarzyna Dec @ 2019-02-25 13:39 UTC (permalink / raw)
  To: Dhinakaran Pandiyan, Ville Syrjälä; +Cc: igt-dev

On Thu, Feb 21, 2019 at 06:41:03AM -0800, Dhinakaran Pandiyan wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Set up the surface state accordingly to support Yf/Ys tiling.
> 
> From DK:
>  Rebase.
> 
> Cc: Lukasz Kalamarz <lukasz.kalamarz@intel.com>
> Cc: Katarzyna Dec <katarzyna.dec@intel.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
> ---
>  lib/gen8_render.h     | 6 ++++--
>  lib/rendercopy_gen9.c | 8 +++++++-
>  2 files changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/gen8_render.h b/lib/gen8_render.h
> index c62047d8..372c5267 100644
> --- a/lib/gen8_render.h
> +++ b/lib/gen8_render.h
I do not like the idea of adding gen9+ things to gen8 library. We have
gen9_render.h already, maybe you could add this stuct there?
Kasia
> @@ -121,9 +121,11 @@ struct gen8_surface_state
>  	struct {
>  		uint32_t mip_count:4;
>  		uint32_t min_lod:4;
> -		uint32_t pad3:6;
> +		uint32_t mip_tail_start_lod:4; /* gen9+ */
> +		uint32_t pad3:2;
>  		uint32_t coherency_type:1;
> -		uint32_t pad2:5;
> +		uint32_t pad2:3;
> +		uint32_t trmode:2; /* gen9+ */
>  		uint32_t ewa_disable_for_cube:1;
>  		uint32_t y_offset:3;
>  		uint32_t pad0:1;
> diff --git a/lib/rendercopy_gen9.c b/lib/rendercopy_gen9.c
> index e3d95a68..8514c991 100644
> --- a/lib/rendercopy_gen9.c
> +++ b/lib/rendercopy_gen9.c
> @@ -204,9 +204,15 @@ gen8_bind_buf(struct intel_batchbuffer *batch, const struct igt_buf *buf,
>  	ss->ss0.horizontal_alignment = 1; /* align 4 */
>  	if (buf->tiling == I915_TILING_X)
>  		ss->ss0.tiled_mode = 2;
> -	else if (buf->tiling == I915_TILING_Y)
> +	else if (buf->tiling != I915_TILING_NONE)
>  		ss->ss0.tiled_mode = 3;
>  
> +	if (buf->tiling == I915_TILING_Yf)
> +		ss->ss5.trmode = 1;
> +	else if (buf->tiling == I915_TILING_Ys)
> +		ss->ss5.trmode = 2;
> +	ss->ss5.mip_tail_start_lod = 1; /* needed with trmode */
> +
>  	ss->ss8.base_addr = buf->bo->offset64;
>  	ss->ss9.base_addr_hi = buf->bo->offset64 >> 32;
>  
> -- 
> 2.17.1
> 
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH i-g-t 2/7] tests/gem_render_copy: Test Yf tiling
  2019-02-21 14:41 ` [igt-dev] [PATCH i-g-t 2/7] tests/gem_render_copy: Test Yf tiling Dhinakaran Pandiyan
@ 2019-02-25 13:49   ` Katarzyna Dec
  2019-03-05  1:50     ` Dhinakaran Pandiyan
  0 siblings, 1 reply; 25+ messages in thread
From: Katarzyna Dec @ 2019-02-25 13:49 UTC (permalink / raw)
  To: Dhinakaran Pandiyan, Ville Syrjälä, lukasz.kalamarz; +Cc: igt-dev

On Thu, Feb 21, 2019 at 06:41:04AM -0800, Dhinakaran Pandiyan wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Let's test Yf tiling now that rendercopy can handle it.
> 
> v2: From DK
>  Set bpp for Yf buffer and rebase.
> 
> Cc: Lukasz Kalamarz <lukasz.kalamarz@intel.com>
> Cc: Katarzyna Dec <katarzyna.dec@intel.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
> ---
>  tests/i915/gem_render_copy.c | 246 +++++++++++++++++++++++++++--------
>  1 file changed, 195 insertions(+), 51 deletions(-)
> 
> diff --git a/tests/i915/gem_render_copy.c b/tests/i915/gem_render_copy.c
> index 0cd4e50f..afe2df05 100644
> --- a/tests/i915/gem_render_copy.c
> +++ b/tests/i915/gem_render_copy.c
> @@ -72,11 +72,85 @@ static const char *make_filename(const char *filename)
>  	return buf;
>  }
>  
> -static void *linear_copy(data_t *data, struct igt_buf *buf)
> +static void *yf_ptr(void *ptr,
> +		    unsigned int x, unsigned int y,
> +		    unsigned int stride, unsigned int cpp)
>  {
> -	void *map, *linear;
> +       x *= cpp;
> +
> +       return ptr +
> +	       ((y & ~0x1f) * stride) +
> +	       ((y & 0x10) * 64) +
> +	       ((y & 0x8) * 32) +
> +	       ((y & 0x7) * 16) +
> +	       ((x & ~0x3f) * 32) +
> +	       ((x & 0x20) * 16) +
> +	       ((x & 0x10) * 8) +
> +	       (x & 0xf);
It would be nice to have comments on these ^^^ values (e.g. y & ??). I have no
idea what are they. If something goes wrong and less experienced person will be
debugging it can take ages.

For more detailed review Lukasz Kalamarz will be better person.
Kasia :)
> +}
>  
> -	igt_assert_eq(posix_memalign(&linear, 16, buf->bo->size), 0);
> +static void copy_linear_to_yf(data_t *data, struct igt_buf *buf, const uint32_t *linear)
> +{
> +	int height = igt_buf_height(buf);
> +	int width = igt_buf_width(buf);
> +	void *map;
> +
> +	gem_set_domain(data->drm_fd, buf->bo->handle,
> +		       I915_GEM_DOMAIN_CPU, I915_GEM_DOMAIN_CPU);
> +	map = gem_mmap__cpu(data->drm_fd, buf->bo->handle, 0,
> +			    buf->bo->size, PROT_READ | PROT_WRITE);
> +
> +	for (int y = 0; y < height; y++) {
> +		for (int x = 0; x < width; x++) {
> +			uint32_t *ptr = yf_ptr(map, x, y, buf->stride, 4);
> +
> +			*ptr = linear[y * width + x];
> +		}
> +	}
> +
> +	munmap(map, buf->bo->size);
> +}
> +
> +static void copy_yf_to_linear(data_t *data, struct igt_buf *buf, uint32_t *linear)
> +{
> +	int height = igt_buf_height(buf);
> +	int width = igt_buf_width(buf);
> +	void *map;
> +
> +	gem_set_domain(data->drm_fd, buf->bo->handle,
> +		       I915_GEM_DOMAIN_CPU, 0);
> +	map = gem_mmap__cpu(data->drm_fd, buf->bo->handle, 0,
> +			    buf->bo->size, PROT_READ);
> +
> +	for (int y = 0; y < height; y++) {
> +		for (int x = 0; x < width; x++) {
> +			uint32_t *ptr = yf_ptr(map, x, y, buf->stride, 4);
> +
> +			linear[y * width + x] = *ptr;
> +		}
> +	}
> +
> +	munmap(map, buf->bo->size);
> +}
> +
> +static void copy_linear_to_gtt(data_t *data, struct igt_buf *buf, const uint32_t *linear)
> +{
> +	void *map;
> +
> +	gem_set_domain(data->drm_fd, buf->bo->handle,
> +		       I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
> +
> +	map = gem_mmap__gtt(data->drm_fd, buf->bo->handle,
> +			    buf->bo->size, PROT_READ | PROT_WRITE);
> +
> +	memcpy(map, linear, buf->bo->size);
> +
> +	munmap(map, buf->bo->size);
> +}
> +
> +static void copy_gtt_to_linear(data_t *data, struct igt_buf *buf, uint32_t *linear)
> +{
> +	void *map;
>  
>  	gem_set_domain(data->drm_fd, buf->bo->handle,
>  		       I915_GEM_DOMAIN_GTT, 0);
> @@ -87,6 +161,18 @@ static void *linear_copy(data_t *data, struct igt_buf *buf)
>  	igt_memcpy_from_wc(linear, map, buf->bo->size);
>  
>  	munmap(map, buf->bo->size);
> +}
> +
> +static void *linear_copy(data_t *data, struct igt_buf *buf)
> +{
> +	void *linear;
> +
> +	igt_assert_eq(posix_memalign(&linear, 16, buf->bo->size), 0);
> +
> +	if (buf->tiling == I915_TILING_Yf)
> +		copy_yf_to_linear(data, buf, linear);
> +	else
> +		copy_gtt_to_linear(data, buf, linear);
>  
>  	return linear;
>  }
> @@ -173,7 +259,7 @@ static void scratch_buf_draw_pattern(data_t *data, struct igt_buf *buf,
>  	cairo_surface_t *surface;
>  	cairo_pattern_t *pat;
>  	cairo_t *cr;
> -	void *map, *linear;
> +	void *linear;
>  
>  	linear = linear_copy(data, buf);
>  
> @@ -216,15 +302,10 @@ static void scratch_buf_draw_pattern(data_t *data, struct igt_buf *buf,
>  
>  	cairo_surface_destroy(surface);
>  
> -	gem_set_domain(data->drm_fd, buf->bo->handle,
> -		       I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
> -
> -	map = gem_mmap__gtt(data->drm_fd, buf->bo->handle,
> -			    buf->bo->size, PROT_READ | PROT_WRITE);
> -
> -	memcpy(map, linear, buf->bo->size);
> -
> -	munmap(map, buf->bo->size);
> +	if (buf->tiling == I915_TILING_Yf)
> +		copy_linear_to_yf(data, buf, linear);
> +	else
> +		copy_linear_to_gtt(data, buf, linear);
>  
>  	free(linear);
>  }
> @@ -236,36 +317,59 @@ scratch_buf_copy(data_t *data,
>  {
>  	int width = igt_buf_width(dst);
>  	int height  = igt_buf_height(dst);
> -	uint32_t *linear_dst, *linear_src;
> +	uint32_t *linear_dst;
>  
>  	igt_assert_eq(igt_buf_width(dst), igt_buf_width(src));
>  	igt_assert_eq(igt_buf_height(dst), igt_buf_height(src));
>  	igt_assert_eq(dst->bo->size, src->bo->size);
>  
> +	w = min(w, width - sx);
> +	w = min(w, width - dx);
> +
> +	h = min(h, height - sy);
> +	h = min(h, height - dy);
> +
>  	gem_set_domain(data->drm_fd, dst->bo->handle,
>  		       I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
> -	gem_set_domain(data->drm_fd, src->bo->handle,
> -		       I915_GEM_DOMAIN_GTT, 0);
> -
>  	linear_dst = gem_mmap__gtt(data->drm_fd, dst->bo->handle,
>  				   dst->bo->size, PROT_WRITE);
> -	linear_src = gem_mmap__gtt(data->drm_fd, src->bo->handle,
> -				   src->bo->size, PROT_READ);
>  
> -	w = min(w, width - sx);
> -	w = min(w, width - dx);
> +	if (src->tiling == I915_TILING_Yf) {
> +		void *map;
>  
> -	h = min(h, height - sy);
> -	h = min(h, height - dy);
> +		gem_set_domain(data->drm_fd, src->bo->handle,
> +			       I915_GEM_DOMAIN_CPU, 0);
> +		map = gem_mmap__cpu(data->drm_fd, src->bo->handle, 0,
> +				    src->bo->size, PROT_READ);
> +
> +		for (int y = 0; y < h; y++) {
> +			for (int x = 0; x < w; x++) {
> +				const uint32_t *ptr = yf_ptr(map, sx+x, sy+y, src->stride, 4);
> +
> +				linear_dst[(dy+y) * width + dx+x] = *ptr;
> +			}
> +		}
> +
> +		munmap(map, src->bo->size);
> +	} else {
> +		uint32_t *linear_src;
> +
> +		gem_set_domain(data->drm_fd, src->bo->handle,
> +			       I915_GEM_DOMAIN_GTT, 0);
>  
> -	for (int y = 0; y < h; y++) {
> -		igt_memcpy_from_wc(&linear_dst[(dy+y) * width + dx],
> -				   &linear_src[(sy+y) * width + sx],
> -				   w * 4);
> +		linear_src = gem_mmap__gtt(data->drm_fd, src->bo->handle,
> +					   src->bo->size, PROT_READ);
> +
> +		for (int y = 0; y < h; y++) {
> +			igt_memcpy_from_wc(&linear_dst[(dy+y) * width + dx],
> +					   &linear_src[(sy+y) * width + sx],
> +					   w * 4);
> +		}
> +
> +		munmap(linear_src, src->bo->size);
>  	}
>  
>  	munmap(linear_dst, dst->bo->size);
> -	munmap(linear_src, src->bo->size);
>  }
>  
>  static void scratch_buf_init(data_t *data, struct igt_buf *buf,
> @@ -282,7 +386,8 @@ static void scratch_buf_init(data_t *data, struct igt_buf *buf,
>  		int size;
>  
>  		igt_require(intel_gen(data->devid) >= 9);
> -		igt_assert_eq(tiling, I915_TILING_Y);
> +		igt_assert(tiling == I915_TILING_Y ||
> +			   tiling == I915_TILING_Yf);
>  
>  		buf->stride = ALIGN(width * 4, 128);
>  		buf->size = buf->stride * height;
> @@ -299,8 +404,21 @@ static void scratch_buf_init(data_t *data, struct igt_buf *buf,
>  
>  		buf->bo = drm_intel_bo_alloc(data->bufmgr, "", size, 4096);
>  
> -		drm_intel_bo_set_tiling(buf->bo, &tiling, buf->stride);
> -		igt_assert_eq(tiling, req_tiling);
> +		if (tiling == I915_TILING_Y) {
> +			drm_intel_bo_set_tiling(buf->bo, &tiling, buf->stride);
> +			igt_assert_eq(tiling, req_tiling);
> +		}
> +	} else if (req_tiling == I915_TILING_Yf) {
> +		int size;
> +
> +		buf->stride = ALIGN(width * 4, 128);
> +		buf->size = buf->stride * height;
> +		buf->tiling = tiling;
> +		buf->bpp = 32;
> +
> +		size = buf->stride * ALIGN(height, 32);
> +
> +		buf->bo = drm_intel_bo_alloc(data->bufmgr, "", size, 4096);
>  	} else {
>  		buf->bo = drm_intel_bo_alloc_tiled(data->bufmgr, "",
>  						   width, height, 4,
> @@ -396,7 +514,7 @@ static void scratch_buf_aux_check(data_t *data,
>  		     "Aux surface indicates that nothing was compressed\n");
>  }
>  
> -static void test(data_t *data, uint32_t tiling, bool test_ccs)
> +static void test(data_t *data, uint32_t tiling, uint64_t ccs_modifier)
>  {
>  	struct igt_buf dst, ccs, ref;
>  	struct {
> @@ -404,7 +522,7 @@ static void test(data_t *data, uint32_t tiling, bool test_ccs)
>  		const char *filename;
>  		uint32_t tiling;
>  		int x, y;
> -	} src[3] = {
> +	} src[] = {
>  		{
>  			.filename = "source-linear.png",
>  			.tiling = I915_TILING_NONE,
> @@ -420,18 +538,31 @@ static void test(data_t *data, uint32_t tiling, bool test_ccs)
>  			.tiling = I915_TILING_Y,
>  			.x = WIDTH/2+1, .y = 1,
>  		},
> +		{
> +			.filename = "source-yf-tiled.png",
> +			.tiling = I915_TILING_Yf,
> +			.x = 1, .y = 1,
> +		},
>  	};
>  
>  	int opt_dump_aub = igt_aub_dump_enabled();
> +	int num_src = ARRAY_SIZE(src);
> +
> +	/* no Yf before gen9 */
> +	if (intel_gen(data->devid) < 9)
> +		num_src--;
> +
> +	if (tiling == I915_TILING_Yf || ccs_modifier)
> +		igt_require(intel_gen(data->devid) >= 9);
>  
> -	for (int i = 0; i < ARRAY_SIZE(src); i++)
> +	for (int i = 0; i < num_src; i++)
>  		scratch_buf_init(data, &src[i].buf, WIDTH, HEIGHT, src[i].tiling, false);
>  	scratch_buf_init(data, &dst, WIDTH, HEIGHT, tiling, false);
> -	if (test_ccs)
> -		scratch_buf_init(data, &ccs, WIDTH, HEIGHT, I915_TILING_Y, true);
> +	if (ccs_modifier)
> +		scratch_buf_init(data, &ccs, WIDTH, HEIGHT, ccs_modifier, true);
>  	scratch_buf_init(data, &ref, WIDTH, HEIGHT, I915_TILING_NONE, false);
>  
> -	for (int i = 0; i < ARRAY_SIZE(src); i++)
> +	for (int i = 0; i < num_src; i++)
>  		scratch_buf_draw_pattern(data, &src[i].buf,
>  					 0, 0, WIDTH, HEIGHT,
>  					 0, 0, WIDTH, HEIGHT, true);
> @@ -442,13 +573,13 @@ static void test(data_t *data, uint32_t tiling, bool test_ccs)
>  	scratch_buf_copy(data,
>  			 &dst, 0, 0, WIDTH, HEIGHT,
>  			 &ref, 0, 0);
> -	for (int i = 0; i < ARRAY_SIZE(src); i++)
> +	for (int i = 0; i < num_src; i++)
>  		scratch_buf_copy(data,
>  				 &src[i].buf, WIDTH/4, HEIGHT/4, WIDTH/2-2, HEIGHT/2-2,
>  				 &ref, src[i].x, src[i].y);
>  
>  	if (opt_dump_png) {
> -		for (int i = 0; i < ARRAY_SIZE(src); i++)
> +		for (int i = 0; i < num_src; i++)
>  			scratch_buf_write_to_png(data, &src[i].buf, src[i].filename);
>  		scratch_buf_write_to_png(data, &dst, "destination.png");
>  		scratch_buf_write_to_png(data, &ref, "reference.png");
> @@ -468,24 +599,24 @@ static void test(data_t *data, uint32_t tiling, bool test_ccs)
>  	 *	 |dst|src|
>  	 *	  -------
>  	 */
> -	if (test_ccs)
> +	if (ccs_modifier)
>  		data->render_copy(data->batch, NULL,
>  				  &dst, 0, 0, WIDTH, HEIGHT,
>  				  &ccs, 0, 0);
>  
> -	for (int i = 0; i < ARRAY_SIZE(src); i++)
> +	for (int i = 0; i < num_src; i++)
>  		data->render_copy(data->batch, NULL,
>  				  &src[i].buf, WIDTH/4, HEIGHT/4, WIDTH/2-2, HEIGHT/2-2,
> -				  test_ccs ? &ccs : &dst, src[i].x, src[i].y);
> +				  ccs_modifier ? &ccs : &dst, src[i].x, src[i].y);
>  
> -	if (test_ccs)
> +	if (ccs_modifier)
>  		data->render_copy(data->batch, NULL,
>  				  &ccs, 0, 0, WIDTH, HEIGHT,
>  				  &dst, 0, 0);
>  
>  	if (opt_dump_png){
>  		scratch_buf_write_to_png(data, &dst, "result.png");
> -		if (test_ccs) {
> +		if (ccs_modifier) {
>  			scratch_buf_write_to_png(data, &ccs, "compressed.png");
>  			scratch_buf_aux_write_to_png(data, &ccs, "compressed-aux.png");
>  		}
> @@ -505,7 +636,7 @@ static void test(data_t *data, uint32_t tiling, bool test_ccs)
>  		scratch_buf_check(data, &dst, &ref, WIDTH - 10, HEIGHT - 10);
>  	}
>  
> -	if (test_ccs)
> +	if (ccs_modifier)
>  		scratch_buf_aux_check(data, &ccs);
>  }
>  
> @@ -546,18 +677,31 @@ int main(int argc, char **argv)
>  	}
>  
>  	igt_subtest("linear")
> -		test(&data, I915_TILING_NONE, false);
> +		test(&data, I915_TILING_NONE, 0);
>  	igt_subtest("x-tiled")
> -		test(&data, I915_TILING_X, false);
> +		test(&data, I915_TILING_X, 0);
>  	igt_subtest("y-tiled")
> -		test(&data, I915_TILING_Y, false);
> +		test(&data, I915_TILING_Y, 0);
> +	igt_subtest("yf-tiled")
> +		test(&data, I915_TILING_Yf, 0);
>  
>  	igt_subtest("y-tiled-ccs-to-linear")
> -		test(&data, I915_TILING_NONE, true);
> +		test(&data, I915_TILING_NONE, I915_TILING_Y);
>  	igt_subtest("y-tiled-ccs-to-x-tiled")
> -		test(&data, I915_TILING_X, true);
> +		test(&data, I915_TILING_X, I915_TILING_Y);
>  	igt_subtest("y-tiled-ccs-to-y-tiled")
> -		test(&data, I915_TILING_Y, true);
> +		test(&data, I915_TILING_Y, I915_TILING_Y);
> +	igt_subtest("y-tiled-ccs-to-yf-tiled")
> +		test(&data, I915_TILING_Yf, I915_TILING_Y);
> +
> +	igt_subtest("yf-tiled-ccs-to-linear")
> +		test(&data, I915_TILING_NONE, I915_TILING_Yf);
> +	igt_subtest("yf-tiled-ccs-to-x-tiled")
> +		test(&data, I915_TILING_X, I915_TILING_Yf);
> +	igt_subtest("yf-tiled-ccs-to-y-tiled")
> +		test(&data, I915_TILING_Y, I915_TILING_Yf);
> +	igt_subtest("yf-tiled-ccs-to-yf-tiled")
> +		test(&data, I915_TILING_Yf, I915_TILING_Yf);
>  
>  	igt_fixture {
>  		intel_batchbuffer_free(data.batch);
> -- 
> 2.17.1
> 
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH i-g-t 1/7] lib/rendercopy: Add support for Yf/Ys tiling to gen9 rendercopy
  2019-02-25 13:39   ` Katarzyna Dec
@ 2019-02-26 21:00     ` Pandiyan, Dhinakaran
  2019-02-27 12:56       ` Katarzyna Dec
  0 siblings, 1 reply; 25+ messages in thread
From: Pandiyan, Dhinakaran @ 2019-02-26 21:00 UTC (permalink / raw)
  To: ville.syrjala, Dec, Katarzyna, Kalamarz, Lukasz; +Cc: igt-dev

On Mon, 2019-02-25 at 14:39 +0100, Katarzyna Dec wrote:
> On Thu, Feb 21, 2019 at 06:41:03AM -0800, Dhinakaran Pandiyan wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > Set up the surface state accordingly to support Yf/Ys tiling.
> > 
> > From DK:
> >  Rebase.
> > 
> > Cc: Lukasz Kalamarz <lukasz.kalamarz@intel.com>
> > Cc: Katarzyna Dec <katarzyna.dec@intel.com>
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
> > ---
> >  lib/gen8_render.h     | 6 ++++--
> >  lib/rendercopy_gen9.c | 8 +++++++-
> >  2 files changed, 11 insertions(+), 3 deletions(-)
> > 
> > diff --git a/lib/gen8_render.h b/lib/gen8_render.h
> > index c62047d8..372c5267 100644
> > --- a/lib/gen8_render.h
> > +++ b/lib/gen8_render.h
> 
> I do not like the idea of adding gen9+ things to gen8 library. We
> have
> gen9_render.h already, maybe you could add this stuct there?

That can be done, but looking at the git log history, I see that the
convention has been to be reuse older definitions whenever possible.
And in this case, the definitions do not conflict with the existing
gen-8 bits.

Also, given that there is already a history of adding gen9+ definitions
(AUX_CCS_E) in this struct, I'm inclined to keep the patch as is.

If you insist, I think we should move other gen-9 definitions in this
struct as well and do it as a separate patch.

-DK 

> Kasia
> > @@ -121,9 +121,11 @@ struct gen8_surface_state
> >  	struct {
> >  		uint32_t mip_count:4;
> >  		uint32_t min_lod:4;
> > -		uint32_t pad3:6;
> > +		uint32_t mip_tail_start_lod:4; /* gen9+ */
> > +		uint32_t pad3:2;
> >  		uint32_t coherency_type:1;
> > -		uint32_t pad2:5;
> > +		uint32_t pad2:3;
> > +		uint32_t trmode:2; /* gen9+ */
> >  		uint32_t ewa_disable_for_cube:1;
> >  		uint32_t y_offset:3;
> >  		uint32_t pad0:1;
> > diff --git a/lib/rendercopy_gen9.c b/lib/rendercopy_gen9.c
> > index e3d95a68..8514c991 100644
> > --- a/lib/rendercopy_gen9.c
> > +++ b/lib/rendercopy_gen9.c
> > @@ -204,9 +204,15 @@ gen8_bind_buf(struct intel_batchbuffer *batch,
> > const struct igt_buf *buf,
> >  	ss->ss0.horizontal_alignment = 1; /* align 4 */
> >  	if (buf->tiling == I915_TILING_X)
> >  		ss->ss0.tiled_mode = 2;
> > -	else if (buf->tiling == I915_TILING_Y)
> > +	else if (buf->tiling != I915_TILING_NONE)
> >  		ss->ss0.tiled_mode = 3;
> >  
> > +	if (buf->tiling == I915_TILING_Yf)
> > +		ss->ss5.trmode = 1;
> > +	else if (buf->tiling == I915_TILING_Ys)
> > +		ss->ss5.trmode = 2;
> > +	ss->ss5.mip_tail_start_lod = 1; /* needed with trmode */
> > +
> >  	ss->ss8.base_addr = buf->bo->offset64;
> >  	ss->ss9.base_addr_hi = buf->bo->offset64 >> 32;
> >  
> > -- 
> > 2.17.1
> > 
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH i-g-t 7/7] tests/kms_ccs: Larger fb to fully cover up the primary plane
  2019-02-23 13:43       ` Juha-Pekka Heikkilä
@ 2019-02-27  7:50         ` Dhinakaran Pandiyan
  2019-02-27 14:18           ` Ville Syrjälä
  0 siblings, 1 reply; 25+ messages in thread
From: Dhinakaran Pandiyan @ 2019-02-27  7:50 UTC (permalink / raw)
  To: Juha-Pekka Heikkilä, Clinton Taylor, igt-dev

On Sat, 2019-02-23 at 15:43 +0200, Juha-Pekka Heikkilä wrote:
> 
> Clinton Taylor kirjoitti 22.2.2019 klo 18.18:
> > 
> > On 2/22/19 6:19 AM, Juha-Pekka Heikkila wrote:
> > > I wouldn't go reverting this limitation. Idea of this test is to
> > > see 
> > > if ccs work but not how big planes can be used with ccs. Matt's
> > > patch 
> > > was to fix that two planes 1080p problem on APL but if you go see
> > > the 
> > > machine https://intel-gfx-ci.01.org/hardware.html#fi-apl-guc
> > > you'll 
> > > notice it support 4096x2160@60Hz at highest. After removing this 
> > > limitation all you need to do to fail this test is to change the
> > > monitor.
> > > 
> > 
> > The test has been changed to the current active size of the pipe
> > and not 
> > the maximum size supported by the hardware.
> > 
> 
> I didn't understand the reasoning. This test did fail on different 
> machines because of plane sizes which required more bandwith than
> was 
> available in budget.

There is just 
 one primary plane scanning out a fb sized to match connector's default
mode
 an overlay scanning out a fb of size 256x256. 

This to me is a reasonable configuration that should not exceeding any
hardware limits. The commit that changes the primary fb size does not
specifically call out which platforms the problem was on and what exact
hardware limit the test exceeds. 

>  Watermark calculation was adjusted but it doesn't 
> change limitations on hardware.

Looking at the bug, it does seem like the real problem was the second
plane not meeting the minimum watermark limits due to a buggy watermark
algorithm. And that problem has been fixed. If you see the original
list of failures, it is across all platforms and the test fails only
when both primary and sprite plane are enabled. 

> 
> Is there benefit in reindroducing this point of failure?
There is not much point in testing an artificial configuration (2000 *
vdisplay) in order to make the test pass. We should know when a sane
configuration fails so that it can be debugged.

> 
> /Juha-Pekka
> 
> > 
> > 
> > > This igt test was originally limited due to this machine 
> > > https://intel-gfx-ci.01.org/hardware.html#fi-kbl-soraka which is
> > > meant 
> > > to be Chromebook with 2400x1600 size display. Quickly looking it
> > > seems 
> > > Soraka has not been recently running so much CI runs though.
> > > 
> > > /Juha-Pekka
> > > 
> > > On 21.2.2019 16.41, Dhinakaran Pandiyan wrote:
> > > > This is a revert of commit 27fa97d16294 ("tests/kms_ccs: Avoid
> > > > using 
> > > > plane
> > > > sizes which exceed hw capability"). The watermarks issue that
> > > > the patch
> > > > refers to has been fixed as per the bugzilla, so let's use an
> > > > fb that
> > > > covers the whole screen.
> > > > 
> > > > Cc: Clinton Taylor <clinton.a.taylor@intel.com>
> > > > Cc: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
> > > > Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > > References: https://bugs.freedesktop.org/show_bug.cgi?id=105458
> > > > Signed-off-by: Dhinakaran Pandiyan <
> > > > dhinakaran.pandiyan@intel.com>
> > > > ---
> > > >   tests/kms_ccs.c | 16 +++-------------
> > > >   1 file changed, 3 insertions(+), 13 deletions(-)
> > > > 
> > > > diff --git a/tests/kms_ccs.c b/tests/kms_ccs.c
> > > > index 8cbf100f..48f10af0 100644
> > > > --- a/tests/kms_ccs.c
> > > > +++ b/tests/kms_ccs.c
> > > > @@ -69,15 +69,6 @@ const struct {
> > > >       {0.0, 1.0, 0.0}
> > > >   };
> > > >   -/*
> > > > - * Limit maximum used sprite plane width so this test will
> > > > not 
> > > > mistakenly
> > > > - * fail on hardware limitations which are not interesting to
> > > > this test.
> > > > - * On this test too wide sprite plane may fail during creation
> > > > with 
> > > > dmesg
> > > > - * comment saying:
> > > > - * "Requested display configuration exceeds system watermark 
> > > > limitations"
> > > > - */
> > > > -#define MAX_SPRITE_PLANE_WIDTH 2000
> > > > -
> > > >   struct local_drm_format_modifier {
> > > >          /* Bitmask of formats in get_plane format list this
> > > > info 
> > > > applies to. The
> > > >       * offset allows a sliding window of which 64 formats
> > > > (bits).
> > > > @@ -313,13 +304,12 @@ static bool try_config(data_t *data,
> > > > enum 
> > > > test_fb_flags fb_flags,
> > > >       if (data->plane && fb_flags & FB_COMPRESSED) {
> > > >           if (!plane_has_format_with_ccs(data, data->plane, 
> > > > DRM_FORMAT_XRGB8888))
> > > >               return false;
> > > > -        generate_fb(data, &fb, min(MAX_SPRITE_PLANE_WIDTH, 
> > > > drm_mode->hdisplay),
> > > > -                drm_mode->vdisplay,
> > > > +        generate_fb(data, &fb, drm_mode->hdisplay, drm_mode-
> > > > >vdisplay,
> > > >                   (fb_flags & ~FB_COMPRESSED) | FB_HAS_PLANE);
> > > >           generate_fb(data, &fb_sprite, 256, 256, fb_flags);
> > > >       } else {
> > > > -        generate_fb(data, &fb, min(MAX_SPRITE_PLANE_WIDTH, 
> > > > drm_mode->hdisplay),
> > > > -                drm_mode->vdisplay, fb_flags);
> > > > +        generate_fb(data, &fb, drm_mode->hdisplay, drm_mode-
> > > > >vdisplay,
> > > > +                fb_flags);
> > > >       }
> > > >         if (data->flags & TEST_FAIL_ON_ADDFB2)
> > > > 

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH i-g-t 1/7] lib/rendercopy: Add support for Yf/Ys tiling to gen9 rendercopy
  2019-02-26 21:00     ` Pandiyan, Dhinakaran
@ 2019-02-27 12:56       ` Katarzyna Dec
  2019-03-01 20:17         ` Dhinakaran Pandiyan
  0 siblings, 1 reply; 25+ messages in thread
From: Katarzyna Dec @ 2019-02-27 12:56 UTC (permalink / raw)
  To: Pandiyan, Dhinakaran, ville.syrjala; +Cc: igt-dev

On Tue, Feb 26, 2019 at 09:00:33PM +0000, Pandiyan, Dhinakaran wrote:
> On Mon, 2019-02-25 at 14:39 +0100, Katarzyna Dec wrote:
> > On Thu, Feb 21, 2019 at 06:41:03AM -0800, Dhinakaran Pandiyan wrote:
> > > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > 
> > > Set up the surface state accordingly to support Yf/Ys tiling.
> > > 
> > > From DK:
> > >  Rebase.
> > > 
> > > Cc: Lukasz Kalamarz <lukasz.kalamarz@intel.com>
> > > Cc: Katarzyna Dec <katarzyna.dec@intel.com>
> > > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
> > > ---
> > >  lib/gen8_render.h     | 6 ++++--
> > >  lib/rendercopy_gen9.c | 8 +++++++-
> > >  2 files changed, 11 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/lib/gen8_render.h b/lib/gen8_render.h
> > > index c62047d8..372c5267 100644
> > > --- a/lib/gen8_render.h
> > > +++ b/lib/gen8_render.h
> > 
> > I do not like the idea of adding gen9+ things to gen8 library. We
> > have
> > gen9_render.h already, maybe you could add this stuct there?
> 
> That can be done, but looking at the git log history, I see that the
> convention has been to be reuse older definitions whenever possible.
> And in this case, the definitions do not conflict with the existing
> gen-8 bits.
> 
> Also, given that there is already a history of adding gen9+ definitions
> (AUX_CCS_E) in this struct, I'm inclined to keep the patch as is.
> 
> If you insist, I think we should move other gen-9 definitions in this
> struct as well and do it as a separate patch.
> 
> -DK

There was a time when together with Lukasz K we were doing refactoring of
rendercopy/gpgpu_fill and media_fill. Gpgpu_fill and media_fill changes are
done, but I think that Lukasz did not finish with rendercopy for some reasons.
I'd preffer to have this change in gen9 file together with moving
' # define GEN9_3DSTATE_MULTISAMPLE_NUMSAMPLES_16                 (4 << 1)'
there. As I see it is the only change gen9 related in gen8 for now.
Let's try to clean up. It will be easier to maintain and understand to others.

Thanks,
Kasia
> 
> > Kasia
> > > @@ -121,9 +121,11 @@ struct gen8_surface_state
> > >  	struct {
> > >  		uint32_t mip_count:4;
> > >  		uint32_t min_lod:4;
> > > -		uint32_t pad3:6;
> > > +		uint32_t mip_tail_start_lod:4; /* gen9+ */
> > > +		uint32_t pad3:2;
> > >  		uint32_t coherency_type:1;
> > > -		uint32_t pad2:5;
> > > +		uint32_t pad2:3;
> > > +		uint32_t trmode:2; /* gen9+ */
> > >  		uint32_t ewa_disable_for_cube:1;
> > >  		uint32_t y_offset:3;
> > >  		uint32_t pad0:1;
> > > diff --git a/lib/rendercopy_gen9.c b/lib/rendercopy_gen9.c
> > > index e3d95a68..8514c991 100644
> > > --- a/lib/rendercopy_gen9.c
> > > +++ b/lib/rendercopy_gen9.c
> > > @@ -204,9 +204,15 @@ gen8_bind_buf(struct intel_batchbuffer *batch,
> > > const struct igt_buf *buf,
> > >  	ss->ss0.horizontal_alignment = 1; /* align 4 */
> > >  	if (buf->tiling == I915_TILING_X)
> > >  		ss->ss0.tiled_mode = 2;
> > > -	else if (buf->tiling == I915_TILING_Y)
> > > +	else if (buf->tiling != I915_TILING_NONE)
> > >  		ss->ss0.tiled_mode = 3;
> > >  
> > > +	if (buf->tiling == I915_TILING_Yf)
> > > +		ss->ss5.trmode = 1;
> > > +	else if (buf->tiling == I915_TILING_Ys)
> > > +		ss->ss5.trmode = 2;
> > > +	ss->ss5.mip_tail_start_lod = 1; /* needed with trmode */
> > > +
> > >  	ss->ss8.base_addr = buf->bo->offset64;
> > >  	ss->ss9.base_addr_hi = buf->bo->offset64 >> 32;
> > >  
> > > -- 
> > > 2.17.1
> > > 
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH i-g-t 7/7] tests/kms_ccs: Larger fb to fully cover up the primary plane
  2019-02-27  7:50         ` Dhinakaran Pandiyan
@ 2019-02-27 14:18           ` Ville Syrjälä
  0 siblings, 0 replies; 25+ messages in thread
From: Ville Syrjälä @ 2019-02-27 14:18 UTC (permalink / raw)
  To: Dhinakaran Pandiyan; +Cc: Clinton Taylor, igt-dev

On Tue, Feb 26, 2019 at 11:50:23PM -0800, Dhinakaran Pandiyan wrote:
> On Sat, 2019-02-23 at 15:43 +0200, Juha-Pekka Heikkilä wrote:
> > 
> > Clinton Taylor kirjoitti 22.2.2019 klo 18.18:
> > > 
> > > On 2/22/19 6:19 AM, Juha-Pekka Heikkila wrote:
> > > > I wouldn't go reverting this limitation. Idea of this test is to
> > > > see 
> > > > if ccs work but not how big planes can be used with ccs. Matt's
> > > > patch 
> > > > was to fix that two planes 1080p problem on APL but if you go see
> > > > the 
> > > > machine https://intel-gfx-ci.01.org/hardware.html#fi-apl-guc
> > > > you'll 
> > > > notice it support 4096x2160@60Hz at highest. After removing this 
> > > > limitation all you need to do to fail this test is to change the
> > > > monitor.
> > > > 
> > > 
> > > The test has been changed to the current active size of the pipe
> > > and not 
> > > the maximum size supported by the hardware.
> > > 
> > 
> > I didn't understand the reasoning. This test did fail on different 
> > machines because of plane sizes which required more bandwith than
> > was 
> > available in budget.
> 
> There is just 
>  one primary plane scanning out a fb sized to match connector's default
> mode
>  an overlay scanning out a fb of size 256x256. 
> 
> This to me is a reasonable configuration that should not exceeding any
> hardware limits. 

Let's not guess. Ie. you should calculate the max configuration we can
actually support. If that exceeds your typical 4k@60 display then I
guess we can revert this. Otherwise we're just arming CI to explode
when when someone decides that we need a bigger display on the BXT.

Also double check whether the test actually turns off the other pipes
or not. If not we have even bigger problems.

> The commit that changes the primary fb size does not
> specifically call out which platforms the problem was on and what exact
> hardware limit the test exceeds. 
> 
> >  Watermark calculation was adjusted but it doesn't 
> > change limitations on hardware.
> 
> Looking at the bug, it does seem like the real problem was the second
> plane not meeting the minimum watermark limits due to a buggy watermark
> algorithm. And that problem has been fixed. If you see the original
> list of failures, it is across all platforms and the test fails only
> when both primary and sprite plane are enabled. 
> 
> > 
> > Is there benefit in reindroducing this point of failure?
> There is not much point in testing an artificial configuration (2000 *
> vdisplay) in order to make the test pass. We should know when a sane
> configuration fails so that it can be debugged.
> 
> > 
> > /Juha-Pekka
> > 
> > > 
> > > 
> > > > This igt test was originally limited due to this machine 
> > > > https://intel-gfx-ci.01.org/hardware.html#fi-kbl-soraka which is
> > > > meant 
> > > > to be Chromebook with 2400x1600 size display. Quickly looking it
> > > > seems 
> > > > Soraka has not been recently running so much CI runs though.
> > > > 
> > > > /Juha-Pekka
> > > > 
> > > > On 21.2.2019 16.41, Dhinakaran Pandiyan wrote:
> > > > > This is a revert of commit 27fa97d16294 ("tests/kms_ccs: Avoid
> > > > > using 
> > > > > plane
> > > > > sizes which exceed hw capability"). The watermarks issue that
> > > > > the patch
> > > > > refers to has been fixed as per the bugzilla, so let's use an
> > > > > fb that
> > > > > covers the whole screen.
> > > > > 
> > > > > Cc: Clinton Taylor <clinton.a.taylor@intel.com>
> > > > > Cc: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
> > > > > Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > > > References: https://bugs.freedesktop.org/show_bug.cgi?id=105458
> > > > > Signed-off-by: Dhinakaran Pandiyan <
> > > > > dhinakaran.pandiyan@intel.com>
> > > > > ---
> > > > >   tests/kms_ccs.c | 16 +++-------------
> > > > >   1 file changed, 3 insertions(+), 13 deletions(-)
> > > > > 
> > > > > diff --git a/tests/kms_ccs.c b/tests/kms_ccs.c
> > > > > index 8cbf100f..48f10af0 100644
> > > > > --- a/tests/kms_ccs.c
> > > > > +++ b/tests/kms_ccs.c
> > > > > @@ -69,15 +69,6 @@ const struct {
> > > > >       {0.0, 1.0, 0.0}
> > > > >   };
> > > > >   -/*
> > > > > - * Limit maximum used sprite plane width so this test will
> > > > > not 
> > > > > mistakenly
> > > > > - * fail on hardware limitations which are not interesting to
> > > > > this test.
> > > > > - * On this test too wide sprite plane may fail during creation
> > > > > with 
> > > > > dmesg
> > > > > - * comment saying:
> > > > > - * "Requested display configuration exceeds system watermark 
> > > > > limitations"
> > > > > - */
> > > > > -#define MAX_SPRITE_PLANE_WIDTH 2000
> > > > > -
> > > > >   struct local_drm_format_modifier {
> > > > >          /* Bitmask of formats in get_plane format list this
> > > > > info 
> > > > > applies to. The
> > > > >       * offset allows a sliding window of which 64 formats
> > > > > (bits).
> > > > > @@ -313,13 +304,12 @@ static bool try_config(data_t *data,
> > > > > enum 
> > > > > test_fb_flags fb_flags,
> > > > >       if (data->plane && fb_flags & FB_COMPRESSED) {
> > > > >           if (!plane_has_format_with_ccs(data, data->plane, 
> > > > > DRM_FORMAT_XRGB8888))
> > > > >               return false;
> > > > > -        generate_fb(data, &fb, min(MAX_SPRITE_PLANE_WIDTH, 
> > > > > drm_mode->hdisplay),
> > > > > -                drm_mode->vdisplay,
> > > > > +        generate_fb(data, &fb, drm_mode->hdisplay, drm_mode-
> > > > > >vdisplay,
> > > > >                   (fb_flags & ~FB_COMPRESSED) | FB_HAS_PLANE);
> > > > >           generate_fb(data, &fb_sprite, 256, 256, fb_flags);
> > > > >       } else {
> > > > > -        generate_fb(data, &fb, min(MAX_SPRITE_PLANE_WIDTH, 
> > > > > drm_mode->hdisplay),
> > > > > -                drm_mode->vdisplay, fb_flags);
> > > > > +        generate_fb(data, &fb, drm_mode->hdisplay, drm_mode-
> > > > > >vdisplay,
> > > > > +                fb_flags);
> > > > >       }
> > > > >         if (data->flags & TEST_FAIL_ON_ADDFB2)
> > > > > 

-- 
Ville Syrjälä
Intel
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH i-g-t 1/7] lib/rendercopy: Add support for Yf/Ys tiling to gen9 rendercopy
  2019-02-27 12:56       ` Katarzyna Dec
@ 2019-03-01 20:17         ` Dhinakaran Pandiyan
  0 siblings, 0 replies; 25+ messages in thread
From: Dhinakaran Pandiyan @ 2019-03-01 20:17 UTC (permalink / raw)
  To: Katarzyna Dec, ville.syrjala; +Cc: igt-dev

On Wed, 2019-02-27 at 13:56 +0100, Katarzyna Dec wrote:
> There was a time when together with Lukasz K we were doing
> refactoring of
> rendercopy/gpgpu_fill and media_fill. Gpgpu_fill and media_fill
> changes are
> done, but I think that Lukasz did not finish with rendercopy for some
> reasons.
> I'd preffer to have this change in gen9 file together with moving
> ' # define GEN9_3DSTATE_MULTISAMPLE_NUMSAMPLES_16                 (4
> << 1)'
> there. As I see it is the only change gen9 related in gen8 for now.
> Let's try to clean up. It will be easier to maintain and understand
> to others.

Okay, I can incorporate that change in this patch. But, I'll wait for
patch 2 to be reviewed before doing that.

-DK

> 
> Thanks,
> Kasia

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH i-g-t 2/7] tests/gem_render_copy: Test Yf tiling
  2019-02-25 13:49   ` Katarzyna Dec
@ 2019-03-05  1:50     ` Dhinakaran Pandiyan
  0 siblings, 0 replies; 25+ messages in thread
From: Dhinakaran Pandiyan @ 2019-03-05  1:50 UTC (permalink / raw)
  To: Katarzyna Dec, Ville Syrjälä, lukasz.kalamarz; +Cc: igt-dev

On Mon, 2019-02-25 at 14:49 +0100, Katarzyna Dec wrote:
> On Thu, Feb 21, 2019 at 06:41:04AM -0800, Dhinakaran Pandiyan wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > Let's test Yf tiling now that rendercopy can handle it.
> > 
> > v2: From DK
> >  Set bpp for Yf buffer and rebase.
> > 
> > Cc: Lukasz Kalamarz <lukasz.kalamarz@intel.com>
> > Cc: Katarzyna Dec <katarzyna.dec@intel.com>
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
> > ---
> >  tests/i915/gem_render_copy.c | 246 +++++++++++++++++++++++++++--
> > ------
> >  1 file changed, 195 insertions(+), 51 deletions(-)
> > 
> > diff --git a/tests/i915/gem_render_copy.c
> > b/tests/i915/gem_render_copy.c
> > index 0cd4e50f..afe2df05 100644
> > --- a/tests/i915/gem_render_copy.c
> > +++ b/tests/i915/gem_render_copy.c
> > @@ -72,11 +72,85 @@ static const char *make_filename(const char
> > *filename)
> >  	return buf;
> >  }
> >  
> > -static void *linear_copy(data_t *data, struct igt_buf *buf)
> > +static void *yf_ptr(void *ptr,
> > +		    unsigned int x, unsigned int y,
> > +		    unsigned int stride, unsigned int cpp)
> >  {
> > -	void *map, *linear;
> > +       x *= cpp;
> > +
> > +       return ptr +
> > +	       ((y & ~0x1f) * stride) +
> > +	       ((y & 0x10) * 64) +
> > +	       ((y & 0x8) * 32) +
> > +	       ((y & 0x7) * 16) +
> > +	       ((x & ~0x3f) * 32) +
> > +	       ((x & 0x20) * 16) +
> > +	       ((x & 0x10) * 8) +
> > +	       (x & 0xf);
> 
> It would be nice to have comments on these ^^^ values (e.g. y & ??).
> I have no
> idea what are they. If something goes wrong and less experienced
> person will be
> debugging it can take ages.
It's just the tiling format and is directly available in bspec under
Tile Formats -> Tiling Algorithm

-DK

> 
> For more detailed review Lukasz Kalamarz will be better person.
> Kasia :)
> > +}

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

end of thread, other threads:[~2019-03-05  1:50 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-21 14:41 [igt-dev] [PATCH i-g-t 0/7] Use rendercopy for generating CCS buffers Dhinakaran Pandiyan
2019-02-21 14:41 ` [igt-dev] [PATCH i-g-t 1/7] lib/rendercopy: Add support for Yf/Ys tiling to gen9 rendercopy Dhinakaran Pandiyan
2019-02-25 13:39   ` Katarzyna Dec
2019-02-26 21:00     ` Pandiyan, Dhinakaran
2019-02-27 12:56       ` Katarzyna Dec
2019-03-01 20:17         ` Dhinakaran Pandiyan
2019-02-21 14:41 ` [igt-dev] [PATCH i-g-t 2/7] tests/gem_render_copy: Test Yf tiling Dhinakaran Pandiyan
2019-02-25 13:49   ` Katarzyna Dec
2019-03-05  1:50     ` Dhinakaran Pandiyan
2019-02-21 14:41 ` [igt-dev] [PATCH i-g-t 3/7] lib/igt_fb: Use rendercopy for rendering into compressed buffers Dhinakaran Pandiyan
2019-02-21 18:04   ` [igt-dev] [PATCH i-g-t v2 3/8] " Dhinakaran Pandiyan
2019-02-21 14:41 ` [igt-dev] [PATCH i-g-t 4/7] lib/igt_fb: s/tiling/modifier/ where appropriate Dhinakaran Pandiyan
2019-02-21 18:05   ` [igt-dev] [PATCH i-g-t v2 4/8] " Dhinakaran Pandiyan
2019-02-21 14:41 ` [igt-dev] [PATCH i-g-t 5/7] lib/igt_fb: Function to create a bo for passed in igt_fb Dhinakaran Pandiyan
2019-02-22 16:20   ` Ville Syrjälä
2019-02-21 14:41 ` [igt-dev] [PATCH i-g-t 6/7] tests/kms_ccs: Generate compressed surfaces with rendercopy Dhinakaran Pandiyan
2019-02-22 16:13   ` Ville Syrjälä
2019-02-21 14:41 ` [igt-dev] [PATCH i-g-t 7/7] tests/kms_ccs: Larger fb to fully cover up the primary plane Dhinakaran Pandiyan
2019-02-22 14:19   ` Juha-Pekka Heikkila
2019-02-22 16:18     ` Clinton Taylor
2019-02-23 13:43       ` Juha-Pekka Heikkilä
2019-02-27  7:50         ` Dhinakaran Pandiyan
2019-02-27 14:18           ` Ville Syrjälä
2019-02-21 22:37 ` [igt-dev] ✓ Fi.CI.BAT: success for Use rendercopy for generating CCS buffers Patchwork
2019-02-22 10:57 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

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.