Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jeevan B <jeevan.b@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Jeevan B <jeevan.b@intel.com>
Subject: [PATCH i-g-t] RFC: tests/kms_plane_lowres: Refactor test to handle tiling formats dynamically
Date: Thu, 14 Nov 2024 15:33:32 +0530	[thread overview]
Message-ID: <20241114100332.1490538-1-jeevan.b@intel.com> (raw)

Refactored the test to dynamically handle different tiling formats.
Removed the hardcoded list of subtests and instead automatically checks
which tiling formats are supported for each plane.

Signed-off-by: Jeevan B <jeevan.b@intel.com>
---
 tests/kms_plane_lowres.c | 105 ++++++++++++++-------------------------
 1 file changed, 36 insertions(+), 69 deletions(-)

diff --git a/tests/kms_plane_lowres.c b/tests/kms_plane_lowres.c
index ef85e8fb9..a2b81a129 100644
--- a/tests/kms_plane_lowres.c
+++ b/tests/kms_plane_lowres.c
@@ -42,21 +42,10 @@
 #include <time.h>
 
 /**
- * SUBTEST: tiling-none
+ * SUBTEST: tiling
  * Description: Tests the visibility of the planes when switching between high
- *              and low resolution with Linear buffer (no tiling)
+ *              and low resolution with Supported Tiling Formats
  * Functionality: plane
- *
- * SUBTEST: tiling-%s
- * Description: Tests the visibility of the planes when switching between high
- *              and low resolution with %arg[1]
- *
- * arg[1]:
- *
- * @4:           4-tiling
- * @x:           x-tiling
- * @y:           y-tiling
- * @yf:          yf-tiling
  */
 
 IGT_TEST_DESCRIPTION("Test atomic mode setting with a plane by switching between high and low resolutions");
@@ -290,57 +279,6 @@ static void test_cleanup(data_t *data)
 	igt_display_commit2(&data->display, COMMIT_ATOMIC);
 }
 
-static void run_test(data_t *data, uint64_t modifier)
-{
-	enum pipe pipe;
-	igt_output_t *output;
-
-	if(!igt_display_has_format_mod(&data->display, DRM_FORMAT_XRGB8888, modifier))
-		return;
-
-	for_each_pipe(&data->display, pipe) {
-		for_each_valid_output_on_pipe(&data->display, pipe, output) {
-			data->pipe = pipe;
-			data->output = output;
-
-			igt_display_reset(&data->display);
-			igt_output_set_pipe(data->output, data->pipe);
-
-			if (!intel_pipe_output_combo_valid(&data->display))
-				continue;
-
-			data->pipe_crc = igt_pipe_crc_new(data->drm_fd, data->pipe,
-							  IGT_PIPE_CRC_SOURCE_AUTO);
-
-			igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(pipe), data->output->name)
-				test_planes_on_pipe(data, modifier);
-
-			test_cleanup(data);
-		}
-	}
-}
-
-static const struct {
-	const char *name;
-	uint64_t modifier;
-} subtests[] = {
-	{ .name = "tiling-none",
-	  .modifier = DRM_FORMAT_MOD_LINEAR,
-	},
-	{ .name = "tiling-x",
-	  .modifier = I915_FORMAT_MOD_X_TILED,
-	},
-	{ .name = "tiling-y",
-	  .modifier = I915_FORMAT_MOD_Y_TILED,
-	},
-	{ .name = "tiling-yf",
-	  .modifier = I915_FORMAT_MOD_Yf_TILED,
-	},
-	{ .name = "tiling-4",
-	  .modifier = I915_FORMAT_MOD_4_TILED,
-	},
-};
-
 igt_main
 {
 	data_t data = {};
@@ -358,12 +296,41 @@ igt_main
 		igt_require(data.display.is_atomic);
 	}
 
-	for (int i = 0; i < ARRAY_SIZE(subtests); i++) {
-		igt_describe_f("Tests the visibility of the planes when switching between "
-			       "high and low resolution with %s\n", subtests[i].name);
+	igt_describe("Tests the visibility of the planes when switching between "
+		     "high and low resolution\n");
+	igt_subtest_with_dynamic("tiling") {
+		enum pipe pipe;
+		igt_output_t *output;
+
+		for_each_pipe(&data.display, pipe) {
+			for_each_valid_output_on_pipe(&data.display, pipe, output) {
+				igt_plane_t *plane;
+				data.pipe = pipe;
+				data.output = output;
+
+				igt_display_reset(&data.display);
+				igt_output_set_pipe(data.output, data.pipe);
 
-		igt_subtest_with_dynamic(subtests[i].name)
-			run_test(&data, subtests[i].modifier);
+				if (!intel_pipe_output_combo_valid(&data.display))
+					continue;
+
+				data.pipe_crc = igt_pipe_crc_new(data.drm_fd, data.pipe,
+								  IGT_PIPE_CRC_SOURCE_AUTO);
+
+				plane = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
+
+				for (int i = 0; i < plane->format_mod_count; i++) {
+					if (plane->formats[i] != DRM_FORMAT_XRGB8888)
+						continue;
+
+		                        igt_dynamic_f("%s-pipe-%s-%s", igt_fb_modifier_name(plane->modifiers[i]),
+						      kmstest_pipe_name(pipe), data.output->name);
+					test_planes_on_pipe(&data, plane->modifiers[i]);
+
+					test_cleanup(&data);
+				}
+			}
+		}
 	}
 
 	igt_fixture {
-- 
2.25.1


             reply	other threads:[~2024-11-14  9:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-14 10:03 Jeevan B [this message]
2024-11-14 10:30 ` ✓ CI.xeBAT: success for RFC: tests/kms_plane_lowres: Refactor test to handle tiling formats dynamically Patchwork
2024-11-14 10:31 ` ✓ Fi.CI.BAT: " Patchwork
2024-11-14 12:20 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-11-14 19:36 ` ✗ CI.xeFULL: " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2025-05-14  8:59 [PATCH i-g-t] " Jeevan B

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=20241114100332.1490538-1-jeevan.b@intel.com \
    --to=jeevan.b@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox