Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t] tests/kms_flip_tiling: remove cut'n'paste
@ 2020-06-22 13:59 Juha-Pekka Heikkila
  2020-06-22 15:42 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Juha-Pekka Heikkila @ 2020-06-22 13:59 UTC (permalink / raw)
  To: igt-dev

convert all tests to be created in nested for-loops which will create tests
for all flip changes.

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
---
 tests/kms_flip_tiling.c | 186 +++++++---------------------------------
 1 file changed, 33 insertions(+), 153 deletions(-)

diff --git a/tests/kms_flip_tiling.c b/tests/kms_flip_tiling.c
index fb79de15..329e0bda 100644
--- a/tests/kms_flip_tiling.c
+++ b/tests/kms_flip_tiling.c
@@ -153,6 +153,16 @@ igt_output_t *output;
 
 igt_main
 {
+	const struct {
+		uint64_t tiling_format;
+		const char*    name;
+	} tiling_formats[] = {
+		{ LOCAL_DRM_FORMAT_MOD_NONE, "linear"},
+		{ LOCAL_I915_FORMAT_MOD_X_TILED, "x-tiled"},
+		{ LOCAL_I915_FORMAT_MOD_Y_TILED, "y-tiled"},
+		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, "yf-tiled"},
+	};
+
 	igt_fixture {
 		data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
 		data.gen = intel_gen(intel_get_drm_devid(data.drm_fd));
@@ -165,160 +175,30 @@ igt_main
 		igt_display_require(&data.display, data.drm_fd);
 	}
 
-	/*
-	 * Test that a page flip from a tiled buffer to a linear one works
-	 * correctly. First, it sets the crtc with the linear buffer and
-	 * generates a reference crc for the pipe. Then, the crtc is set with
-	 * the tiled one and page flip to the linear one issued. A new crc is
-	 * generated and compared to the reference one.
-	 */
-
-	igt_subtest_f("flip-changes-tiling") {
-		uint64_t tiling[2] = { LOCAL_I915_FORMAT_MOD_X_TILED,
-				       LOCAL_DRM_FORMAT_MOD_NONE };
-		enum pipe pipe;
-
-		for (int i = 0; i < ARRAY_SIZE(tiling); i++)
-			igt_require(igt_display_has_format_mod(&data.display, data.testformat, tiling[i]));
-
-		for_each_pipe_with_valid_output(&data.display, pipe, output)
-			test_flip_tiling(&data, pipe, output, tiling);
-	}
-
-	igt_subtest_f("flip-changes-tiling-Y") {
-		uint64_t tiling[2] = { LOCAL_I915_FORMAT_MOD_Y_TILED,
-				       LOCAL_DRM_FORMAT_MOD_NONE };
-		enum pipe pipe;
-
-		igt_require_fb_modifiers(data.drm_fd);
-
-		for (int i = 0; i < ARRAY_SIZE(tiling); i++)
-			igt_require(igt_display_has_format_mod(&data.display, data.testformat, tiling[i]));
-
-		igt_require(data.gen >= 9);
-
-		for_each_pipe_with_valid_output(&data.display, pipe, output)
-			test_flip_tiling(&data, pipe, output, tiling);
-	}
-
-	igt_subtest_f("flip-changes-tiling-Yf") {
-		uint64_t tiling[2] = { LOCAL_I915_FORMAT_MOD_Yf_TILED,
-				       LOCAL_DRM_FORMAT_MOD_NONE };
-		enum pipe pipe;
-
-		igt_require_fb_modifiers(data.drm_fd);
-
-		for (int i = 0; i < ARRAY_SIZE(tiling); i++)
-			igt_require(igt_display_has_format_mod(&data.display, data.testformat, tiling[i]));
-
-		igt_require(data.gen >= 9);
-
-		for_each_pipe_with_valid_output(&data.display, pipe, output)
-			test_flip_tiling(&data, pipe, output, tiling);
-	}
-
-	/*
-	 * Test that a page flip from a tiled buffer to another tiled one works
-	 * correctly. First, it sets the crtc with the tiled buffer and
-	 * generates a reference crc for the pipe. Then a page flip to second
-	 * tiled buffer is issued. A new crc is generated and compared to the
-	 * reference one.
-	 */
-
-	igt_subtest_f("flip-X-tiled") {
-		uint64_t tiling[2] = { LOCAL_I915_FORMAT_MOD_X_TILED,
-				       LOCAL_I915_FORMAT_MOD_X_TILED };
-		enum pipe pipe;
-
-		for (int i = 0; i < ARRAY_SIZE(tiling); i++)
-			igt_require(igt_display_has_format_mod(&data.display, data.testformat, tiling[i]));
-
-		for_each_pipe_with_valid_output(&data.display, pipe, output)
-			test_flip_tiling(&data, pipe, output, tiling);
-	}
-
-	igt_subtest_f("flip-Y-tiled") {
-		uint64_t tiling[2] = { LOCAL_I915_FORMAT_MOD_Y_TILED,
-				       LOCAL_I915_FORMAT_MOD_Y_TILED };
-		enum pipe pipe;
-
-		igt_require_fb_modifiers(data.drm_fd);
-
-		for (int i = 0; i < ARRAY_SIZE(tiling); i++)
-			igt_require(igt_display_has_format_mod(&data.display, data.testformat, tiling[i]));
-
-		igt_require(data.gen >= 9);
-
-		for_each_pipe_with_valid_output(&data.display, pipe, output)
-			test_flip_tiling(&data, pipe, output, tiling);
-	}
-
-	igt_subtest_f("flip-Yf-tiled") {
-		uint64_t tiling[2] = { LOCAL_I915_FORMAT_MOD_Yf_TILED,
-				       LOCAL_I915_FORMAT_MOD_Yf_TILED };
-		enum pipe pipe;
-
-		igt_require_fb_modifiers(data.drm_fd);
-
-		for (int i = 0; i < ARRAY_SIZE(tiling); i++)
-			igt_require(igt_display_has_format_mod(&data.display, data.testformat, tiling[i]));
-
-		igt_require(data.gen >= 9);
-
-		for_each_pipe_with_valid_output(&data.display, pipe, output)
-			test_flip_tiling(&data, pipe, output, tiling);
-	}
-
-	/*
-	 * Test that a page flip from a linear buffer to a tiled one works
-	 * correctly. First, it sets the crtc with the linear buffer and
-	 * generates a reference crc for the pipe. Then a page flip to a tiled
-	 * buffer is issued. A new crc is generated and compared to the
-	 * reference one.
-	 */
-
-	igt_subtest_f("flip-to-X-tiled") {
-		uint64_t tiling[2] = { LOCAL_DRM_FORMAT_MOD_NONE,
-				       LOCAL_I915_FORMAT_MOD_X_TILED };
-		enum pipe pipe;
-
-		for (int i = 0; i < ARRAY_SIZE(tiling); i++)
-			igt_require(igt_display_has_format_mod(&data.display, data.testformat, tiling[i]));
-
-		for_each_pipe_with_valid_output(&data.display, pipe, output)
-			test_flip_tiling(&data, pipe, output, tiling);
-	}
-
-	igt_subtest_f("flip-to-Y-tiled") {
-		uint64_t tiling[2] = { LOCAL_DRM_FORMAT_MOD_NONE,
-				       LOCAL_I915_FORMAT_MOD_Y_TILED };
-		enum pipe pipe;
-
-		igt_require_fb_modifiers(data.drm_fd);
-
-		for (int i = 0; i < ARRAY_SIZE(tiling); i++)
-			igt_require(igt_display_has_format_mod(&data.display, data.testformat, tiling[i]));
-
-		igt_require(data.gen >= 9);
-
-		for_each_pipe_with_valid_output(&data.display, pipe, output)
-			test_flip_tiling(&data, pipe, output, tiling);
-	}
-
-	igt_subtest_f("flip-to-Yf-tiled") {
-		uint64_t tiling[2] = { LOCAL_DRM_FORMAT_MOD_NONE,
-				       LOCAL_I915_FORMAT_MOD_Yf_TILED };
-		enum pipe pipe;
-
-		igt_require_fb_modifiers(data.drm_fd);
-
-		for (int i = 0; i < ARRAY_SIZE(tiling); i++)
-			igt_require(igt_display_has_format_mod(&data.display, data.testformat, tiling[i]));
-
-		igt_require(data.gen >= 9);
+	for (int i = 0; i < ARRAY_SIZE(tiling_formats); i++) {
+		for (int j = 0; j < ARRAY_SIZE(tiling_formats); j++) {
+
+			igt_describe_f("Check using crcs flipping from %s fb to %s fb works correctly.\n",
+				     tiling_formats[i].name, tiling_formats[j].name);
+			igt_subtest_f("flip-%s-to-%s", tiling_formats[i].name, tiling_formats[j].name) {
+				uint64_t tiling[2] = { tiling_formats[i].tiling_format,
+						       tiling_formats[j].tiling_format };
+				enum pipe pipe;
+
+				for (int c = 0; c < ARRAY_SIZE(tiling); c++) {
+					if (tiling[c] != LOCAL_DRM_FORMAT_MOD_NONE &&
+					    tiling[c] != LOCAL_I915_FORMAT_MOD_X_TILED) {
+						igt_require(data.gen >= 9);
+						igt_require_fb_modifiers(data.drm_fd);
+					}
+					igt_require(igt_display_has_format_mod(&data.display, data.testformat, tiling[c]));
+				}
+
+				for_each_pipe_with_valid_output(&data.display, pipe, output)
+					test_flip_tiling(&data, pipe, output, tiling);
+			}
+		}
 
-		for_each_pipe_with_valid_output(&data.display, pipe, output)
-			test_flip_tiling(&data, pipe, output, tiling);
 	}
 
 	igt_fixture {
-- 
2.26.0

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

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

end of thread, other threads:[~2020-07-05 20:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-22 13:59 [igt-dev] [PATCH i-g-t] tests/kms_flip_tiling: remove cut'n'paste Juha-Pekka Heikkila
2020-06-22 15:42 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2020-06-22 16:47 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2020-06-23  7:03 ` [igt-dev] ✗ GitLab.Pipeline: warning " Patchwork
2020-06-24  6:17 ` [igt-dev] ✓ Fi.CI.IGT: success " Patchwork
2020-06-24 14:46 ` [igt-dev] [PATCH i-g-t] " B, Jeevan
2020-07-05 19:44   ` Juha-Pekka Heikkila
2020-07-05 20:44     ` Vudum, Lakshminarayana

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox