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: Nidhi Gupta <nidhi1.gupta@intel.com>
Subject: [igt-dev] [PATCH 2/2] tests/kms_writeback: Test cleanup
Date: Fri, 30 Sep 2022 11:02:29 +0530	[thread overview]
Message-ID: <20220930053229.9755-3-jeevan.b@intel.com> (raw)
In-Reply-To: <20220930053229.9755-1-jeevan.b@intel.com>

From: Nidhi Gupta <nidhi1.gupta@intel.com>

v1: move igt_skip_on(data.dump_check || data.list_modes)
    to igt_fixture as it is common for all subtests.
    (Bhanu)
v2: replaced hard coded mode with default mode.
    (Bhanu)

Signed-off-by: Nidhi Gupta <nidhi1.gupta@intel.com>
---
 tests/kms_writeback.c | 52 +++++++++++++------------------------------
 1 file changed, 15 insertions(+), 37 deletions(-)

diff --git a/tests/kms_writeback.c b/tests/kms_writeback.c
index 9d134585..8846d6d8 100644
--- a/tests/kms_writeback.c
+++ b/tests/kms_writeback.c
@@ -107,46 +107,27 @@ static bool check_writeback_config(igt_display_t *display, igt_output_t *output,
 
 static igt_output_t *kms_writeback_get_output(igt_display_t *display)
 {
-	int i;
 	enum pipe pipe;
+	igt_output_t *output;
 
-	drmModeModeInfo override_mode = {
-		.clock = 25175,
-		.hdisplay = 640,
-		.hsync_start = 656,
-		.hsync_end = 752,
-		.htotal = 800,
-		.hskew = 0,
-		.vdisplay = 480,
-		.vsync_start = 490,
-		.vsync_end = 492,
-		.vtotal = 525,
-		.vscan = 0,
-		.vrefresh = 60,
-		.flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
-		.name = {"640x480-60"},
-	};
-
-	for (i = 0; i < display->n_outputs; i++) {
-		igt_output_t *output = &display->outputs[i];
+	drmModeModeInfo override_mode;
 
+	for_each_pipe_with_valid_output(display, pipe, output) {
+		igt_output_set_pipe(output, pipe);
 		if (output->config.connector->connector_type != DRM_MODE_CONNECTOR_WRITEBACK)
 			continue;
 
-		for_each_pipe(display, pipe) {
-			igt_output_set_pipe(output, pipe);
+		override_mode = *igt_output_get_mode(output);
 
-			if (data.custom_mode)
-				override_mode = data.user_mode;
-			if (data.builtin_mode)
-				override_mode = output->config.connector->modes[data.mode_index];
-
-			if (check_writeback_config(display, output, override_mode)) {
-				igt_debug("Using connector %u:%s on pipe %d\n",
-					  output->config.connector->connector_id,
-					  output->name, pipe);
+		if (data.custom_mode)
+			override_mode = data.user_mode;
+		if (data.builtin_mode)
+			override_mode = output->config.connector->modes[data.mode_index];
+		if (check_writeback_config(display, output, override_mode)) {
+			igt_debug("Using connector %u:%s on pipe %d\n",
+				   output->config.connector->connector_id,
+				   output->name, pipe);
 				return output;
-			}
 		}
 
 		igt_debug("We found %u:%s, but this test will not be able to use it.\n",
@@ -155,7 +136,6 @@ static igt_output_t *kms_writeback_get_output(igt_display_t *display)
 		/* Restore any connectors we don't use, so we don't trip on them later */
 		kmstest_force_connector(display->drm_fd, output->config.connector, FORCE_CONNECTOR_UNSPECIFIED);
 	}
-
 	return NULL;
 }
 
@@ -498,6 +478,8 @@ igt_main_args("b:c:dl", long_options, help_str, opt_handler, NULL)
 
 		igt_require(display.is_atomic);
 
+		igt_skip_on(data.dump_check || data.list_modes);
+
 		output = kms_writeback_get_output(&display);
 		igt_require(output);
 
@@ -533,7 +515,6 @@ igt_main_args("b:c:dl", long_options, help_str, opt_handler, NULL)
 		drmModePropertyBlobRes *formats_blob;
 		const char *valid_chars;
 
-		igt_skip_on(data.dump_check || data.list_modes);
 		formats_blob = get_writeback_formats_blob(output);
 		valid_chars = "01234568 ABCGNRUVXY";
 
@@ -556,7 +537,6 @@ igt_main_args("b:c:dl", long_options, help_str, opt_handler, NULL)
 	igt_subtest("writeback-invalid-parameters") {
 		igt_fb_t invalid_output_fb;
 
-		igt_skip_on(data.dump_check || data.list_modes);
 		fb_id = igt_create_fb(display.drm_fd, mode.hdisplay / 2,
 				      mode.vdisplay / 2,
 				      DRM_FORMAT_XRGB8888,
@@ -573,7 +553,6 @@ igt_main_args("b:c:dl", long_options, help_str, opt_handler, NULL)
 	igt_subtest("writeback-fb-id") {
 		igt_fb_t output_fb;
 
-		igt_skip_on(data.dump_check || data.list_modes);
 		fb_id = igt_create_fb(display.drm_fd, mode.hdisplay, mode.vdisplay,
 				      DRM_FORMAT_XRGB8888,
 				      DRM_FORMAT_MOD_LINEAR,
@@ -589,7 +568,6 @@ igt_main_args("b:c:dl", long_options, help_str, opt_handler, NULL)
 	igt_subtest("writeback-check-output") {
 		igt_fb_t output_fb;
 
-		igt_skip_on(data.dump_check || data.list_modes);
 		fb_id = igt_create_fb(display.drm_fd, mode.hdisplay, mode.vdisplay,
 				      DRM_FORMAT_XRGB8888,
 				      igt_fb_mod_to_tiling(0),
-- 
2.36.0

  parent reply	other threads:[~2022-09-30  5:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-30  5:32 [igt-dev] [PATCH 0/2] tests/kms_writeback: Test cleanup Jeevan B
2022-09-30  5:32 ` [igt-dev] [PATCH 1/2] lib/intel_memory_region: Remove function which returns batch size in regions Jeevan B
2022-09-30  5:32 ` Jeevan B [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-09-30  5:41 [igt-dev] [PATCH 0/2] tests/kms_writeback: Test cleanup Nidhi Gupta
2022-09-30  5:41 ` [igt-dev] [PATCH 2/2] " Nidhi Gupta
2022-09-22  0:58 [igt-dev] [PATCH 0/2] " Nidhi Gupta
2022-09-22  0:58 ` [igt-dev] [PATCH 2/2] " Nidhi Gupta
2022-09-22 10:02   ` Modem, Bhanuprakash
2022-09-08  8:48 [igt-dev] [PATCH 0/2] " Nidhi Gupta
2022-09-08  8:48 ` [igt-dev] [PATCH 2/2] " Nidhi Gupta
2022-09-08 18:03   ` Jessica Zhang
2022-08-25 21:06 [igt-dev] [PATCH 0/2] tests/kms_writeback: Test Cleanup Nidhi Gupta
2022-08-25 21:06 ` [igt-dev] [PATCH 2/2] " Nidhi Gupta
2022-08-26 18:49   ` Jessica Zhang

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=20220930053229.9755-3-jeevan.b@intel.com \
    --to=jeevan.b@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=nidhi1.gupta@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