public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Sowmiya S <sowmiya.s@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: suraj.kandpal@intel.com, swati2.sharma@intel.com,
	Sowmiya S <sowmiya.s@intel.com>
Subject: [PATCH i-g-t v5 5/6] tests/kms_writeback: Refactor writeback-fb-id subtest
Date: Thu,  8 Jan 2026 21:18:16 +0530	[thread overview]
Message-ID: <20260108154817.48665-6-sowmiya.s@intel.com> (raw)
In-Reply-To: <20260108154817.48665-1-sowmiya.s@intel.com>

Remove individual tests for each format for the test
writeback-fb-id and introduce dynamic subtest generation
based on the formats supported. Framebuffer creation was
now part of the subtest level based on format.

v4: squashed the FB creation function with this commit (Suraj)
v5: -Update dynamic subtest documentation (Suraj)
    -Rename input_fb to in_fb
    -Set plane to in_fb and remove unused input_fb as an arg to
    writeback-fb-id function.

Signed-off-by: Sowmiya S <sowmiya.s@intel.com>
---
 tests/kms_writeback.c | 87 +++++++++++++++++++++++++------------------
 1 file changed, 51 insertions(+), 36 deletions(-)

diff --git a/tests/kms_writeback.c b/tests/kms_writeback.c
index be123adcc..5fff27c2b 100644
--- a/tests/kms_writeback.c
+++ b/tests/kms_writeback.c
@@ -51,11 +51,14 @@
  * SUBTEST: writeback-check-output
  * Description: Check writeback output with CRC validation
  *
- * SUBTEST: writeback-fb-id-XRGB2101010
- * Description: Validate WRITEBACK_FB_ID with valid and invalid options
+ * SUBTEST: writeback-fb-id-%s
+ * Description:  Validate  WRITEBACK_FB_ID with valid and invalid options
+ *               for %arg[1] format
  *
- * SUBTEST: writeback-fb-id
- * Description: Validate WRITEBACK_FB_ID with valid and invalid options
+ * arg[1]:
+ *
+ * @XBGR8888:       XBGR8888
+ * @XBGR2101010:    XBGR2101010
  *
  * SUBTEST: writeback-invalid-parameters
  * Description: Writeback has a couple of parameters linked together(output
@@ -287,7 +290,7 @@ static void test_invalid_parameters(igt_output_t *output, igt_fb_t *valid_fb, ig
 	}
 }
 
-static void writeback_fb_id(igt_output_t *output, igt_fb_t *valid_fb, igt_fb_t *invalid_fb)
+static void writeback_fb_id(igt_output_t *output, igt_fb_t *valid_fb)
 {
 
 	int ret;
@@ -508,6 +511,25 @@ static void commit_and_dump_fb(igt_display_t *display, igt_output_t *output, igt
 	igt_remove_fb(display->drm_fd, &output_fb);
 }
 
+static void create_fbs(igt_display_t *display, igt_fb_t *in_fb, igt_fb_t *output_fb,
+		       uint32_t format, drmModeModeInfo *mode)
+{
+	int fb_id;
+
+	fb_id = igt_create_fb(display->drm_fd, mode->hdisplay,
+			      mode->vdisplay,
+			      format,
+			      DRM_FORMAT_MOD_LINEAR,
+			      in_fb);
+	igt_assert(fb_id >= 0);
+
+	fb_id = igt_create_fb(display->drm_fd, mode->hdisplay, mode->vdisplay,
+			      format,
+			      DRM_FORMAT_MOD_LINEAR,
+			      output_fb);
+	igt_assert(fb_id >= 0);
+}
+
 static igt_output_t *list_writeback_modes(igt_display_t *display)
 {
 	for (int i = 0; i < display->n_outputs; i++) {
@@ -686,37 +708,30 @@ int igt_main_args("b:c:f:dl", long_options, help_str, opt_handler, NULL)
 	}
 
 	igt_describe("Validate WRITEBACK_FB_ID with valid and invalid options");
-	igt_subtest("writeback-fb-id") {
-		igt_fb_t output_fb;
-
-		igt_skip_on(data.dump_check || data.list_modes);
-		igt_skip_on_f(!(data.supported_colors & XRGB8888),"DRM_FORMAT_XRGB8888 is unsupported\n");
-		fb_id = igt_create_fb(display.drm_fd, mode.hdisplay, mode.vdisplay,
-				      DRM_FORMAT_XRGB8888,
-				      DRM_FORMAT_MOD_LINEAR,
-				      &output_fb);
-		igt_require(fb_id > 0);
-
-		writeback_fb_id(output, &input_fb, &output_fb);
-
-		igt_remove_fb(display.drm_fd, &output_fb);
-	}
-
-	igt_describe("Validate XRGB2101010 WRITEBACK_FB_ID with valid and invalid options");
-	igt_subtest("writeback-fb-id-XRGB2101010") {
-		igt_fb_t output_fb;
-
-		igt_skip_on(data.dump_check || data.list_modes);
-		igt_skip_on_f(!(data.supported_colors & XRGB2101010), "DRM_FORMAT_XRGB2101010 is unsupported\n");
-		fb_id = igt_create_fb(display.drm_fd, mode.hdisplay, mode.vdisplay,
-				      DRM_FORMAT_XRGB2101010,
-				      DRM_FORMAT_MOD_LINEAR,
-				      &output_fb);
-		igt_require(fb_id > 0);
-
-		writeback_fb_id(output, &input_fb_10bit, &output_fb);
-
-		igt_remove_fb(display.drm_fd, &output_fb);
+	igt_subtest_with_dynamic_f("writeback-fb-id") {
+		for (int i = 0; i < ARRAY_SIZE(fourcc); i++) {
+			uint32_t test_format = fourcc[i];
+
+			if (is_intel_device(display.drm_fd))
+				if (!strstr(igt_format_str(test_format), "BGR"))
+					continue;
+			igt_dynamic_f("writeback-fb-id-%s", igt_format_str(test_format)) {
+				igt_fb_t in_fb, output_fb;
+
+				igt_skip_on(data.dump_check || data.list_modes);
+				igt_skip_on_f(!(data.supported_colors & (1 << i)),
+					      "DRM_FORMAT_%s is not supported\n",
+					      igt_format_str(test_format));
+				create_fbs(&display, &in_fb, &output_fb, test_format, &mode);
+				igt_plane_set_fb(plane, &in_fb);
+				writeback_fb_id(output, &output_fb);
+				/* cleanup */
+				igt_plane_set_fb(plane, NULL);
+				igt_display_commit2(output->display, COMMIT_ATOMIC);
+				igt_remove_fb(display.drm_fd, &in_fb);
+				igt_remove_fb(display.drm_fd, &output_fb);
+			}
+		}
 	}
 
 	igt_describe("Check writeback output with CRC validation");
-- 
2.43.0


  parent reply	other threads:[~2026-01-08 15:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-08 15:48 [PATCH i-g-t v5 0/6] Add writeback changes for intel-supported formats Sowmiya S
2026-01-08 15:48 ` [PATCH i-g-t v5 1/6] tests/kms_writeback: Add support for intel-specific formats Sowmiya S
2026-01-08 15:48 ` [PATCH i-g-t v5 2/6] lib/igt_fb: Validate supported formats for crc calculation Sowmiya S
2026-01-08 15:48 ` [PATCH i-g-t v5 3/6] tests/kms_writeback: Add intel check for vendor-specific restriction Sowmiya S
2026-01-09  3:32   ` Kandpal, Suraj
2026-01-08 15:48 ` [PATCH i-g-t v5 4/6] tests/kms_writeback: Refactor format handling in commit_and_dump_fb Sowmiya S
2026-01-09  3:35   ` Kandpal, Suraj
2026-01-08 15:48 ` Sowmiya S [this message]
2026-01-08 15:48 ` [PATCH i-g-t v5 6/6] tests/kms_writeback: Refactor writeback-check-output subtest Sowmiya S

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=20260108154817.48665-6-sowmiya.s@intel.com \
    --to=sowmiya.s@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=suraj.kandpal@intel.com \
    --cc=swati2.sharma@intel.com \
    /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