All of lore.kernel.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Brian Welty <brian.welty@intel.com>
Subject: [igt-dev] [PATCH v3 3/3] tests/gem_render_copy: Add compressed src to compressed dst subtests
Date: Fri,  8 Nov 2019 17:09:16 +0200	[thread overview]
Message-ID: <20191108150916.28564-1-imre.deak@intel.com> (raw)
In-Reply-To: <20191105193454.4611-3-imre.deak@intel.com>

Add new subtests that blit from a compressed source to a compressed
destination buffer.

While at it also add descriptions for the subtests.

v2:
- Use the correct buffer when dumping the png for the compressed buf.
v3:
- Add subtest descriptions.

Cc: Mika Kahola <mika.kahola@intel.com>
Cc: Brian Welty <brian.welty@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 tests/i915/gem_render_copy.c | 164 +++++++++++++++++++++++++----------
 1 file changed, 117 insertions(+), 47 deletions(-)

diff --git a/tests/i915/gem_render_copy.c b/tests/i915/gem_render_copy.c
index fd139e91..7e6657b4 100644
--- a/tests/i915/gem_render_copy.c
+++ b/tests/i915/gem_render_copy.c
@@ -572,9 +572,13 @@ 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, uint64_t ccs_modifier)
+#define SRC_COMPRESSED	1
+#define DST_COMPRESSED	2
+
+static void test(data_t *data, uint32_t src_tiling, uint32_t dst_tiling,
+		 int flags)
 {
-	struct igt_buf dst, ccs, ref;
+	struct igt_buf dst, src_ccs, dst_ccs, ref;
 	struct {
 		struct igt_buf buf;
 		const char *filename;
@@ -602,22 +606,34 @@ static void test(data_t *data, uint32_t tiling, uint64_t ccs_modifier)
 			.x = 1, .y = 1,
 		},
 	};
-
 	int opt_dump_aub = igt_aub_dump_enabled();
 	int num_src = ARRAY_SIZE(src);
+	bool src_compressed = flags & SRC_COMPRESSED;
+	bool dst_compressed = flags & DST_COMPRESSED;
+
+	/*
+	 * The tiling for uncompressed source buffers is determined by the
+	 * tiling of the src[] buffers above.
+	 */
+	igt_assert(!src_tiling || src_compressed);
 
 	/* no Yf before gen9 */
 	if (intel_gen(data->devid) < 9)
 		num_src--;
 
-	if (tiling == I915_TILING_Yf || ccs_modifier)
+	if (src_tiling == I915_TILING_Yf || dst_tiling == I915_TILING_Yf ||
+	    src_compressed || dst_compressed)
 		igt_require(intel_gen(data->devid) >= 9);
 
 	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 (ccs_modifier)
-		scratch_buf_init(data, &ccs, WIDTH, HEIGHT, ccs_modifier, true);
+	scratch_buf_init(data, &dst, WIDTH, HEIGHT, dst_tiling, false);
+	if (src_compressed)
+		scratch_buf_init(data, &src_ccs, WIDTH, HEIGHT,
+				 src_tiling, true);
+	if (dst_compressed)
+		scratch_buf_init(data, &dst_ccs, WIDTH, HEIGHT,
+				 dst_tiling, true);
 	scratch_buf_init(data, &ref, WIDTH, HEIGHT, I915_TILING_NONE, false);
 
 	for (int i = 0; i < num_src; i++)
@@ -657,26 +673,45 @@ static void test(data_t *data, uint32_t tiling, uint64_t ccs_modifier)
 	 *	 |dst|src|
 	 *	  -------
 	 */
-	if (ccs_modifier)
+	if (src_compressed)
 		data->render_copy(data->batch, NULL,
 				  &dst, 0, 0, WIDTH, HEIGHT,
-				  &ccs, 0, 0);
+				  &src_ccs, 0, 0);
 
 	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,
-				  ccs_modifier ? &ccs : &dst, src[i].x, src[i].y);
+				  &src[i].buf,
+				  WIDTH/4, HEIGHT/4, WIDTH/2-2, HEIGHT/2-2,
+				  src_compressed ? &src_ccs : &dst,
+				  src[i].x, src[i].y);
 
-	if (ccs_modifier)
+	if (src_compressed || dst_compressed)
 		data->render_copy(data->batch, NULL,
-				  &ccs, 0, 0, WIDTH, HEIGHT,
-				  &dst, 0, 0);
+				  src_compressed ? &src_ccs : &dst,
+				  0, 0, WIDTH, HEIGHT,
+				  dst_compressed ? &dst_ccs : &dst,
+				  0, 0);
+
+	if (dst_compressed)
+		data->render_copy(data->batch, NULL,
+				  &dst_ccs,
+				  0, 0, WIDTH, HEIGHT,
+				  &dst,
+				  0, 0);
 
 	if (opt_dump_png){
 		scratch_buf_write_to_png(data, &dst, "result.png");
-		if (ccs_modifier) {
-			scratch_buf_write_to_png(data, &ccs, "compressed.png");
-			scratch_buf_aux_write_to_png(data, &ccs, "compressed-aux.png");
+		if (src_compressed) {
+			scratch_buf_write_to_png(data, &src_ccs,
+						 "compressed-src.png");
+			scratch_buf_aux_write_to_png(data, &src_ccs,
+						     "compressed-src-aux.png");
+		}
+		if (dst_compressed) {
+			scratch_buf_write_to_png(data, &dst_ccs,
+						 "compressed-dst.png");
+			scratch_buf_aux_write_to_png(data, &dst_ccs,
+						     "compressed-dst-aux.png");
 		}
 	}
 
@@ -694,12 +729,16 @@ static void test(data_t *data, uint32_t tiling, uint64_t ccs_modifier)
 		scratch_buf_check(data, &dst, &ref, WIDTH - 10, HEIGHT - 10);
 	}
 
-	if (ccs_modifier)
-		scratch_buf_aux_check(data, &ccs);
+	if (src_compressed)
+		scratch_buf_aux_check(data, &src_ccs);
+	if (dst_compressed)
+		scratch_buf_aux_check(data, &dst_ccs);
 
 	scratch_buf_fini(&ref);
-	if (ccs_modifier)
-		scratch_buf_fini(&ccs);
+	if (dst_compressed)
+		scratch_buf_fini(&dst_ccs);
+	if (src_compressed)
+		scratch_buf_fini(&src_ccs);
 	scratch_buf_fini(&dst);
 	for (int i = 0; i < num_src; i++)
 		scratch_buf_fini(&src[i].buf);
@@ -726,8 +765,49 @@ const char *help_str =
 	"  -a\tCheck all pixels\n"
 	;
 
+static const char *buf_mode_str(uint32_t tiling, bool compressed)
+{
+	switch (tiling) {
+	default:
+	case I915_TILING_NONE:
+		return "linear";
+	case I915_TILING_X:
+		return "x-tiled";
+	case I915_TILING_Y:
+		return compressed ? "y-tiled-ccs" : "y-tiled";
+	case I915_TILING_Yf:
+		return compressed ? "yf-tiled-ccs" : "yf-tiled";
+	}
+}
+
 igt_main_args("da", NULL, help_str, opt_handler, NULL)
 {
+	static const struct test_desc {
+		int src_tiling;
+		int dst_tiling;
+		int flags;
+	} tests[] = {
+		{ I915_TILING_NONE, I915_TILING_X,    0 },
+		{ I915_TILING_NONE, I915_TILING_Y,    0 },
+		{ I915_TILING_NONE, I915_TILING_Yf,   0 },
+
+		{ I915_TILING_Y,    I915_TILING_NONE, SRC_COMPRESSED },
+		{ I915_TILING_Y,    I915_TILING_X,    SRC_COMPRESSED },
+		{ I915_TILING_Y,    I915_TILING_Y,    SRC_COMPRESSED },
+		{ I915_TILING_Y,    I915_TILING_Yf,   SRC_COMPRESSED },
+
+		{ I915_TILING_Yf,   I915_TILING_NONE, SRC_COMPRESSED },
+		{ I915_TILING_Yf,   I915_TILING_X,    SRC_COMPRESSED },
+		{ I915_TILING_Yf,   I915_TILING_Y,    SRC_COMPRESSED },
+		{ I915_TILING_Yf,   I915_TILING_Yf,   SRC_COMPRESSED },
+
+		{ I915_TILING_Y,    I915_TILING_Y,    SRC_COMPRESSED | DST_COMPRESSED },
+		{ I915_TILING_Yf,   I915_TILING_Yf,   SRC_COMPRESSED | DST_COMPRESSED },
+		{ I915_TILING_Y,    I915_TILING_Yf,   SRC_COMPRESSED | DST_COMPRESSED },
+		{ I915_TILING_Yf,   I915_TILING_Y,    SRC_COMPRESSED | DST_COMPRESSED },
+	};
+	int i;
+
 	data_t data = {0, };
 
 	igt_fixture {
@@ -748,32 +828,22 @@ igt_main_args("da", NULL, help_str, opt_handler, NULL)
 		igt_fork_hang_detector(data.drm_fd);
 	}
 
-	igt_subtest("linear")
-		test(&data, I915_TILING_NONE, 0);
-	igt_subtest("x-tiled")
-		test(&data, I915_TILING_X, 0);
-	igt_subtest("y-tiled")
-		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, I915_TILING_Y);
-	igt_subtest("y-tiled-ccs-to-x-tiled")
-		test(&data, I915_TILING_X, I915_TILING_Y);
-	igt_subtest("y-tiled-ccs-to-y-tiled")
-		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);
+	for (i = 0; i < ARRAY_SIZE(tests); i++) {
+		const struct test_desc *t = &tests[i];
+		const char *src_mode = buf_mode_str(t->src_tiling,
+						    t->flags & SRC_COMPRESSED);
+		const char *dst_mode = buf_mode_str(t->dst_tiling,
+						    t->flags & DST_COMPRESSED);
+
+		igt_describe_f("Test render_copy() from a %s to a %s buffer.",
+			       src_mode, dst_mode);
+
+		igt_subtest_f("%s%s%s",
+			      t->flags ? src_mode : "",
+			      t->flags ? "-to-" : "",
+			      dst_mode)
+			test(&data, t->src_tiling, t->dst_tiling, t->flags);
+	}
 
 	igt_fixture {
 		igt_stop_hang_detector();
-- 
2.17.1

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

  reply	other threads:[~2019-11-08 15:11 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-05 19:34 [igt-dev] [PATCH v2 1/3] lib/rendercopy: Add AUX page table support Imre Deak
2019-11-05 19:34 ` [igt-dev] [PATCH v2 2/3] tests/gem_render_copy: Adjust the tgl+ compressed buf alignments Imre Deak
2019-11-05 19:34 ` [igt-dev] [PATCH v2 3/3] tests/gem_render_copy: Add compressed src to compressed dst subtests Imre Deak
2019-11-08 15:09   ` Imre Deak [this message]
2019-11-13 14:32     ` [igt-dev] [PATCH v4 " Imre Deak
2019-11-12 20:15   ` [igt-dev] [PATCH v2 " Brian Welty
2019-11-13 14:34     ` Imre Deak
2019-11-05 20:14 ` [igt-dev] ✗ GitLab.Pipeline: failure for series starting with [v2,1/3] lib/rendercopy: Add AUX page table support Patchwork
2019-11-05 20:27 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2019-11-05 21:42 ` [igt-dev] [PATCH v3 1/3] " Imre Deak
2019-11-05 22:24   ` Chris Wilson
2019-11-05 22:33     ` Imre Deak
2019-11-06  6:53   ` [igt-dev] [PATCH v4 " Imre Deak
2019-11-07 18:36     ` [igt-dev] [PATCH v5 " Imre Deak
2019-11-06 11:11   ` [igt-dev] [PATCH v3 " Chris Wilson
2019-11-06 16:00     ` Imre Deak
2019-11-06 16:14       ` Chris Wilson
2019-11-06 16:36         ` Imre Deak
2019-11-06 17:02           ` Chris Wilson
2019-11-06 19:04             ` Imre Deak
2019-11-06 21:25               ` Chris Wilson
2019-11-07 12:41                 ` Chris Wilson
2019-11-07 18:37                   ` Imre Deak
2019-11-05 21:59 ` [igt-dev] ✗ GitLab.Pipeline: failure for series starting with [v3,1/3] lib/rendercopy: Add AUX page table support (rev2) Patchwork
2019-11-05 22:11 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2019-11-06  7:17 ` [igt-dev] ✗ GitLab.Pipeline: failure for series starting with [v4,1/3] lib/rendercopy: Add AUX page table support (rev3) Patchwork
2019-11-06  7:36 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2019-11-06 16:57 ` [igt-dev] ✓ Fi.CI.IGT: success for series starting with [v2,1/3] lib/rendercopy: Add AUX page table support Patchwork
2019-11-06 18:50 ` [igt-dev] ✗ Fi.CI.IGT: failure for series starting with [v3,1/3] lib/rendercopy: Add AUX page table support (rev2) Patchwork
2019-11-07  0:23 ` [igt-dev] ✓ Fi.CI.IGT: success for series starting with [v4,1/3] lib/rendercopy: Add AUX page table support (rev3) Patchwork
2019-11-07 19:13 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [v5,1/3] lib/rendercopy: Add AUX page table support (rev4) Patchwork
2019-11-07 19:15 ` [igt-dev] ✗ GitLab.Pipeline: failure " Patchwork
2019-11-08 16:25 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [v5,1/3] lib/rendercopy: Add AUX page table support (rev5) Patchwork
2019-11-09  0:57 ` [igt-dev] ✓ Fi.CI.IGT: success for series starting with [v5,1/3] lib/rendercopy: Add AUX page table support (rev4) Patchwork
2019-11-10  7:23 ` [igt-dev] ✗ Fi.CI.IGT: failure for series starting with [v5,1/3] lib/rendercopy: Add AUX page table support (rev5) Patchwork
2019-11-13 15:36 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [v5,1/3] lib/rendercopy: Add AUX page table support (rev6) Patchwork
2019-11-14  4:52 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-11-14 16:15   ` Imre Deak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191108150916.28564-1-imre.deak@intel.com \
    --to=imre.deak@intel.com \
    --cc=brian.welty@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.