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>
Subject: [PATCH i-g-t 2/2] tests/intel/kms_big_joiner: add new test to validate force bigjoiner
Date: Thu, 18 Jan 2024 21:48:47 +0530	[thread overview]
Message-ID: <20240118161847.1001234-3-kunal1.joshi@intel.com> (raw)
In-Reply-To: <20240118161847.1001234-1-kunal1.joshi@intel.com>

Earlier bigjoiner was enabled only for below cases
a) for mode having hdisplay > 5k
b) if clock requirement were higher than 1 pipe could handle

https://patchwork.freedesktop.org/series/124730/
With above series we can force bigjoiner without such constraints.

Cc: Swati Sharma <swati2.sharma@intel.com>
Cc: Karthik B S <karthik.b.s@intel.com>
Cc: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
Signed-off-by: Kunal Joshi <kunal1.joshi@intel.com>
---
 tests/intel/kms_big_joiner.c | 92 +++++++++++++++++++++++++++++++++---
 1 file changed, 86 insertions(+), 6 deletions(-)

diff --git a/tests/intel/kms_big_joiner.c b/tests/intel/kms_big_joiner.c
index aba2adfbe..bc1c49023 100644
--- a/tests/intel/kms_big_joiner.c
+++ b/tests/intel/kms_big_joiner.c
@@ -46,8 +46,10 @@
  *
  * SUBTEST: 2x-modeset
  * Description: Verify simultaneous modeset on 2 big joiner outputs
+ *
+ * SUBTEST: force-bigjoiner
+ * Description: Verify bigjoiner on non bigjoiner outputs by force
  */
-
 IGT_TEST_DESCRIPTION("Test big joiner");
 
 struct bigjoiner_output {
@@ -67,6 +69,23 @@ typedef struct {
 
 static int max_dotclock;
 
+static void force_big_joiner_on_all_outputs(data_t *data, bool enable)
+{
+	igt_output_t *output;
+
+	for_each_connected_output(&data->display, output) {
+		/*
+		 * Force big joiner on output
+		 */
+		igt_assert_f(igt_force_bigjoiner_enable(data->drm_fd, output->name, enable) >= 0,
+			     "Failed to %s big joiner for connector %s\n",
+			     enable ? "enable" : "disable", output->name);
+		igt_assert_f(igt_check_force_bigjoiner_status(data->drm_fd, output->name) == enable ? 1 : 0,
+			     "Failed to force big joiner on output %s\n", output->name);
+	}
+	igt_display_commit2(&data->display, COMMIT_ATOMIC);
+}
+
 static void test_invalid_modeset(data_t *data)
 {
 	igt_output_t *output;
@@ -107,6 +126,53 @@ static void test_invalid_modeset(data_t *data)
 	igt_assert_lt(ret, 0);
 }
 
+static void cleanup(data_t *data, igt_output_t *output, struct igt_fb *primary_fb, igt_plane_t **primary) {
+    for_each_connected_output(&data->display, output) {
+        igt_output_set_pipe(output, PIPE_NONE);
+    }
+    force_big_joiner_on_all_outputs(data, false);
+    free(primary_fb);
+    free(primary);
+}
+
+static void force_bigjoiner(data_t *data, int simultaneous_bigjoner)
+{
+	int no_of_outputs;
+	drmModeModeInfo *mode;
+	igt_output_t *output;
+	igt_display_t *display = &data->display;
+	enum pipe pipe;
+	struct igt_fb *primary_fb = malloc(data->n_pipes * sizeof(struct igt_fb));
+	igt_plane_t **primary = malloc(data->n_pipes * sizeof(igt_plane_t *));
+
+	igt_display_reset(display);
+	pipe = 0;
+	no_of_outputs = 0;
+
+	force_big_joiner_on_all_outputs(data, true);
+	for_each_connected_output(display, output) {
+		mode = igt_output_get_mode(output);
+		igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
+				    DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_LINEAR, 1.0, 0.0, 0.0, &primary_fb[no_of_outputs]);
+		igt_output_set_pipe(output, pipe);
+		primary[no_of_outputs] = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
+		igt_plane_set_fb(primary[no_of_outputs], &primary_fb[no_of_outputs]);
+		igt_info("Using (pipe %s + %s) to run the subtest with mode %dx%d@%d.\n",
+				kmstest_pipe_name(pipe), igt_output_name(output),
+				output->override_mode.hdisplay, output->override_mode.vdisplay, output->override_mode.vrefresh);
+		no_of_outputs++;
+		pipe = pipe + 2;
+		if (pipe >= data->n_pipes || no_of_outputs >= simultaneous_bigjoner)
+			break;
+	}
+	if (no_of_outputs != simultaneous_bigjoner) {
+		cleanup(data, output, primary_fb, primary);
+		igt_skip("Can't test all outputs\n");
+	}
+	igt_display_commit2(display, COMMIT_ATOMIC);
+	cleanup(data, output, primary_fb, primary);
+}
+
 static void test_basic_modeset(data_t *data)
 {
 	drmModeModeInfo *mode;
@@ -257,24 +323,27 @@ igt_main
 			j++;
 		}
 
-		igt_require_f(count > 0, "No output with 5k+ mode (or) clock > max-dot-clock found\n");
-
-		igt_create_pattern_fb(data.drm_fd, width, height, DRM_FORMAT_XRGB8888,
-				      DRM_FORMAT_MOD_LINEAR, &data.fb);
 	}
 
 	igt_describe("Verify the basic modeset on big joiner mode on all pipes");
 	igt_subtest_with_dynamic("basic") {
+		igt_require_f(count > 0, "No output with 5k+ mode (or) clock > max-dot-clock found\n");
+		igt_create_pattern_fb(data.drm_fd, width, height, DRM_FORMAT_XRGB8888,
+				      DRM_FORMAT_MOD_LINEAR, &data.fb);
 		for (i = 0; i < data.n_pipes - 1; i++) {
 			data.pipe1 = pipe_seq[i];
 			igt_dynamic_f("pipe-%s", kmstest_pipe_name(pipe_seq[i]))
 				test_basic_modeset(&data);
 		}
+		igt_remove_fb(data.drm_fd, &data.fb);
 	}
 
 	igt_describe("Verify if the modeset on the adjoining pipe is rejected "
 		     "when the pipe is active with a big joiner modeset");
 	igt_subtest_with_dynamic("invalid-modeset") {
+		igt_require_f(count > 0, "No output with 5k+ mode (or) clock > max-dot-clock found\n");
+		igt_create_pattern_fb(data.drm_fd, width, height, DRM_FORMAT_XRGB8888,
+				      DRM_FORMAT_MOD_LINEAR, &data.fb);
 		data.pipe1 = pipe_seq[j - 1];
 
 		igt_display_reset(&data.display);
@@ -323,11 +392,15 @@ igt_main
 					test_invalid_modeset(&data);
 			}
 		}
+		igt_remove_fb(data.drm_fd, &data.fb);
 	}
 
 	igt_describe("Verify simultaneous modeset on 2 big joiner outputs");
 	igt_subtest_with_dynamic("2x-modeset") {
 		igt_require_f(count > 1, "2 outputs with big joiner modes are required\n");
+		igt_create_pattern_fb(data.drm_fd, width, height, DRM_FORMAT_XRGB8888,
+				      DRM_FORMAT_MOD_LINEAR, &data.fb);
+
 		igt_require_f(data.n_pipes > 3, "Minumum of 4 pipes are required\n");
 		for (i = 0; (i + 2) < data.n_pipes - 1; i++) {
 			data.pipe1 = pipe_seq[i];
@@ -335,10 +408,17 @@ igt_main
 			igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(pipe_seq[i]), kmstest_pipe_name(pipe_seq[i + 2]))
 				test_dual_display(&data);
 		}
+		igt_remove_fb(data.drm_fd, &data.fb);
+	}
+
+	igt_describe("Verify bigjoiner on non bigjoiner outputs by force");
+	igt_subtest_with_dynamic("force-bigjoiner") {
+		for (i = 1; i  < valid_output+1; i++)
+			igt_dynamic_f("%dx", i)
+				force_bigjoiner(&data, i);
 	}
 
 	igt_fixture {
-		igt_remove_fb(data.drm_fd, &data.fb);
 		igt_display_fini(&data.display);
 		drm_close_driver(data.drm_fd);
 	}
-- 
2.25.1


  parent reply	other threads:[~2024-01-18 16:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-18 16:18 [PATCH i-g-t 0/2] add force bigjoiner test Kunal Joshi
2024-01-18 16:18 ` [PATCH i-g-t 1/2] lib/igt_kms: add support to force big joiner Kunal Joshi
2024-01-24  7:44   ` Modem, Bhanuprakash
2024-01-18 16:18 ` Kunal Joshi [this message]
2024-01-24  7:54   ` [PATCH i-g-t 2/2] tests/intel/kms_big_joiner: add new test to validate force bigjoiner Modem, Bhanuprakash
2024-01-24  8:25     ` Joshi, Kunal1
2024-01-24  9:18       ` Modem, Bhanuprakash
2024-01-18 17:47 ` ✓ Fi.CI.BAT: success for add force bigjoiner test (rev2) Patchwork
2024-01-18 18:15 ` ✓ CI.xeBAT: " Patchwork
2024-01-18 20:24 ` ✗ Fi.CI.IGT: failure " Patchwork

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=20240118161847.1001234-3-kunal1.joshi@intel.com \
    --to=kunal1.joshi@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