Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Kunal Joshi <kunal1.joshi@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Kunal Joshi <kunal1.joshi@intel.com>,
	Aurabindo Pillai <aurabindo.pillai@amd.com>
Subject: [PATCH i-g-t 2/3] tests/kms_bw: allow physically connected only
Date: Thu, 23 May 2024 15:32:47 +0530	[thread overview]
Message-ID: <20240523100248.230989-3-kunal1.joshi@intel.com> (raw)
In-Reply-To: <20240523100248.230989-1-kunal1.joshi@intel.com>

modify kms_bw test to only run on physically connected displays,
avoiding issues with forcing a 4K EDID on disconnected connectors.

For instance, consider a system with 2 DP and 2 HDMI connectors
(DP-1, DP-2, HDMI-1, HDMI-2). Forcing EDID on DP is currently problematic,
and we only support forcing for HDMI. However, if there's only one
TMDS encoder, we can only drive one HDMI display, not two.

For now, the test will only run on physically connected displays.
Future improvements may consider the encoder count to handle such
scenarios more gracefully.

Cc: Aurabindo Pillai <aurabindo.pillai@amd.com>
Signed-off-by: Kunal Joshi <kunal1.joshi@intel.com>
---
 tests/kms_bw.c | 43 ++++++++++++++++++-------------------------
 1 file changed, 18 insertions(+), 25 deletions(-)

diff --git a/tests/kms_bw.c b/tests/kms_bw.c
index b50f324af..4aabb02b7 100644
--- a/tests/kms_bw.c
+++ b/tests/kms_bw.c
@@ -61,6 +61,7 @@ typedef struct data {
         int h[IGT_MAX_PIPES];
         int fd;
 	int num_pipes;
+	int num_outputs;
 } data_t;
 
 static drmModeModeInfo test_mode[] = {
@@ -105,8 +106,9 @@ static drmModeModeInfo test_mode[] = {
 static void test_init(data_t *data)
 {
 	igt_display_t *display = &data->display;
-	int i, max_pipes = display->n_pipes;
+	int i;
 	igt_output_t *output;
+	data->num_outputs = 0;
 
 	for_each_pipe(display, i) {
 		data->pipe_id[i] = i;
@@ -118,23 +120,22 @@ static void test_init(data_t *data)
 					 IGT_PIPE_CRC_SOURCE_AUTO);
 	}
 
-	for (i = 0; i < display->n_outputs && i < max_pipes; i++) {
-		if (!data->pipe[i])
-			continue;
-
-		output = &display->outputs[i];
-
-		data->output[i] = output;
+	i = 0;
 
+	for_each_output(display, output) {
 		/* Only allow physically connected displays for the tests. */
 		if (!igt_output_is_connected(output))
 			continue;
 
+		data->output[i] = output;
+		data->num_outputs++;
+
 		igt_assert(kmstest_get_connector_default_mode(
 			data->fd, output->config.connector, &data->mode[i]));
 
 		data->w[i] = data->mode[i].hdisplay;
 		data->h[i] = data->mode[i].vdisplay;
+		i++;
 	}
 
 
@@ -156,27 +157,12 @@ static void test_fini(data_t *data)
 	igt_display_commit_atomic(display, DRM_MODE_ATOMIC_ALLOW_MODESET, 0);
 }
 
-/* Forces a mode for a connector. */
-static void force_output_mode(data_t *d, igt_output_t *output,
-			      const drmModeModeInfo *mode)
-{
-	/* This allows us to create a virtual sink. */
-	if (!igt_output_is_connected(output)) {
-		kmstest_force_edid(d->fd, output->config.connector,
-				   igt_kms_get_4k_edid());
-
-		kmstest_force_connector(d->fd, output->config.connector,
-					FORCE_CONNECTOR_DIGITAL);
-	}
-
-	igt_output_override_mode(output, mode);
-}
-
 static void run_test_linear_tiling(data_t *data, int pipe, const drmModeModeInfo *mode) {
 	igt_display_t *display = &data->display;
 	igt_output_t *output;
 	struct igt_fb buffer[IGT_MAX_PIPES];
 	igt_crc_t zero, captured[IGT_MAX_PIPES];
+	int i = 0;
 	int ret;
 
 	igt_skip_on_f(pipe >= data->num_pipes,
@@ -184,6 +170,10 @@ static void run_test_linear_tiling(data_t *data, int pipe, const drmModeModeInfo
 
 	test_init(data);
 
+	igt_skip_on_f(pipe >= data->num_outputs,
+				  "%d connected outputs required but found %d\n",
+				  pipe+1, data->num_outputs+1);
+
 	/* create buffers */
 	for (i = 0; i <= pipe; i++) {
 		output = data->output[i];
@@ -191,7 +181,7 @@ static void run_test_linear_tiling(data_t *data, int pipe, const drmModeModeInfo
 			continue;
 		}
 
-		force_output_mode(data, output, mode);
+		igt_output_override_mode(output, mode);
 
 		igt_create_color_fb(display->drm_fd, mode->hdisplay,
 				    mode->vdisplay, DRM_FORMAT_XRGB8888,
@@ -199,6 +189,9 @@ static void run_test_linear_tiling(data_t *data, int pipe, const drmModeModeInfo
 				    &buffer[i]);
 
 		igt_output_set_pipe(output, i);
+		igt_info("Assigned output %s to pipe %s with mode %dx%d@%d\n",
+				 igt_output_name(output), kmstest_pipe_name(i),
+				 mode->hdisplay, mode->vdisplay, mode->vrefresh);
 
 		igt_plane_set_fb(data->primary[i], &buffer[i]);
 	}
-- 
2.25.1


  parent reply	other threads:[~2024-05-23  9:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-23 10:02 [PATCH i-g-t 0/3] fix kms_bw test Kunal Joshi
2024-05-23 10:02 ` [PATCH i-g-t 1/3] tests/kms_bw: convert to dynamic subtest Kunal Joshi
2024-05-23 10:02 ` Kunal Joshi [this message]
2024-05-23 12:56   ` [PATCH i-g-t 2/3] tests/kms_bw: allow physically connected only Aurabindo Pillai
2024-06-13 13:05     ` Joshi, Kunal1
2024-05-23 10:02 ` [PATCH i-g-t 3/3] HAX patch do not merge Kunal Joshi
2024-05-23 10:35 ` ✗ Fi.CI.BAT: failure for fix kms_bw test Patchwork
2024-05-23 10:50 ` ✓ CI.xeBAT: success " Patchwork
2024-05-23 11:53 ` ✗ CI.xeFULL: failure " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2024-05-12 16:01 [PATCH i-g-t 0/3] fix kms_be test Kunal Joshi
2024-05-12 16:01 ` [PATCH i-g-t 2/3] tests/kms_bw: allow physically connected only Kunal Joshi
2024-05-13 12:10   ` Kamil Konieczny

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=20240523100248.230989-3-kunal1.joshi@intel.com \
    --to=kunal1.joshi@intel.com \
    --cc=aurabindo.pillai@amd.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