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: [igt-dev] [PATCH i-g-t 1/2] tests/intel/kms_big_joiner: added new subtest simultaneous-modeset
Date: Mon, 20 Nov 2023 15:31:50 +0530	[thread overview]
Message-ID: <20231120100151.1792953-2-kunal1.joshi@intel.com> (raw)
In-Reply-To: <20231120100151.1792953-1-kunal1.joshi@intel.com>

newly added test tries to have as many outputs as possible,
prefernce is given to big_joiner outputs, with this we can
stress on bw

v2: Sorting not needed when output count is 1
    Skip if output count is 0
v3: Rebase

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 | 118 ++++++++++++++++++++++++++++++++---
 1 file changed, 108 insertions(+), 10 deletions(-)

diff --git a/tests/intel/kms_big_joiner.c b/tests/intel/kms_big_joiner.c
index 2f81204f5..73d3b20ae 100644
--- a/tests/intel/kms_big_joiner.c
+++ b/tests/intel/kms_big_joiner.c
@@ -46,10 +46,101 @@ typedef struct {
 	enum pipe pipe1;
 	enum pipe pipe2;
 	struct bigjoiner_output output[2];
+	int no_of_big_joiner_outputs;
+	igt_output_t **sorted_outputs;
+	int no_sorted_outputs;
 } data_t;
 
 static int max_dotclock;
 
+/*
+ *  Sort outputs based on hdisplay
+ */
+static int compare_outputs(const void *a, const void *b)
+{
+	igt_output_t *outputA = *(igt_output_t **)a;
+	igt_output_t *outputB = *(igt_output_t **)b;
+
+	return outputB->config.connector->modes[0].hdisplay - outputA->config.connector->modes[0].hdisplay;
+}
+
+/*
+ * Function to add connected outputs to an array and sort them by hdisplay
+ */
+static void set_sorted_outputs(data_t *data)
+{
+	int i;
+	igt_output_t *output;
+
+	i = 0;
+	for_each_connected_output(&data->display, output)
+		data->no_sorted_outputs++;
+
+	igt_skip_on_f(data->no_sorted_outputs <= 0, "No output found\n");
+	/*
+	 * Create an array to store igt_output_t pointers
+	 */
+	data->sorted_outputs = (igt_output_t **)malloc(sizeof(igt_output_t *) * data->no_sorted_outputs);
+	/*
+	 * Add connected outputs to the array
+	 */
+	for_each_connected_output(&data->display, output)
+		data->sorted_outputs[i++] = output;
+
+	if (data->no_sorted_outputs > 1)
+		/*
+		 * Sort the array based on hdisplay
+		 */
+		qsort(data->sorted_outputs, data->no_sorted_outputs,
+		      sizeof(igt_output_t *), compare_outputs);
+}
+
+/**
+ * SUBTEST: simultaneous-modeset
+ * Description: Try to do modeset with as many output as possible
+ *		with big joiner given as priority
+ * Driver requirement: i915, xe
+ * Functionality: BW
+ * Mega feature: Bigjoiner, BW
+ * Test category: BW test
+ */
+static int run_simultaneous_modeset(data_t *data)
+{
+	int pipe, i, j;
+	int remanining_big_joiner_outputs;
+	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 *));
+	drmModeModeInfo *mode;
+	igt_output_t *output;
+
+	remanining_big_joiner_outputs = data->no_of_big_joiner_outputs;
+	pipe = i = j = 0;
+	set_sorted_outputs(data);
+
+	while (pipe < data->n_pipes) {
+		output = i < data->no_sorted_outputs ? data->sorted_outputs[i] : NULL;
+		if (output == NULL)
+			break;
+		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[i]);
+		igt_output_set_pipe(output, pipe);
+		igt_info("Using (pipe %s + %s) to run the subtest with mode %dx%d.\n",
+				kmstest_pipe_name(pipe), igt_output_name(output),
+				mode->hdisplay, mode->vdisplay);
+		primary[i] = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
+		igt_plane_set_fb(primary[i], &primary_fb[i]);
+		i++;
+		pipe = pipe + remanining_big_joiner_outputs > 0 ? 2 : 1;
+	       --remanining_big_joiner_outputs;
+	}
+	if (igt_display_try_commit2(&data->display, COMMIT_ATOMIC) == 0) {
+		igt_display_commit2(&data->display, COMMIT_ATOMIC);
+		return 0;
+	} else
+		return igt_display_try_commit2(&data->display, COMMIT_ATOMIC);
+}
+
 /**
  * SUBTEST: invalid-modeset
  * Description: Verify if the modeset on the adjoining pipe is rejected when
@@ -222,7 +313,7 @@ igt_main
 	data_t data;
 	igt_output_t *output;
 	drmModeModeInfo *mode;
-	int valid_output = 0, i, count = 0, j = 0;
+	int valid_output = 0, i, j = 0;
 	uint16_t width = 0, height = 0;
 	enum pipe pipe_seq[IGT_MAX_PIPES];
 
@@ -248,9 +339,8 @@ igt_main
 					true : false;
 
 			if (found) {
-				data.output[count].output_id = output->id;
-				memcpy(&data.output[count].mode, mode, sizeof(drmModeModeInfo));
-				count++;
+				data.output[data.no_of_big_joiner_outputs].output_id = output->id;
+				memcpy(&data.output[data.no_of_big_joiner_outputs++].mode, mode, sizeof(drmModeModeInfo));
 
 				width = max(width, mode->hdisplay);
 				height = max(height, mode->vdisplay);
@@ -264,15 +354,13 @@ igt_main
 			pipe_seq[j] = i;
 			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(data.no_of_big_joiner_outputs > 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]))
@@ -283,6 +371,10 @@ igt_main
 	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(data.no_of_big_joiner_outputs > 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);
@@ -335,7 +427,9 @@ igt_main
 
 	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_require_f(data.no_of_big_joiner_outputs > 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];
@@ -345,6 +439,10 @@ igt_main
 		}
 	}
 
+	igt_describe("Simultaneous moseset on all pipes possible");
+	igt_subtest("simultaneous-modeset")
+		igt_assert_f(run_simultaneous_modeset(&data) == 0, "Commit failure\n");
+
 	igt_fixture {
 		igt_remove_fb(data.drm_fd, &data.fb);
 		igt_display_fini(&data.display);
-- 
2.25.1

  reply	other threads:[~2023-11-20  9:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-20 10:01 [igt-dev] [PATCH i-g-t 0/2] added new subtest simultaneous-modeset Kunal Joshi
2023-11-20 10:01 ` Kunal Joshi [this message]
2023-11-23 10:25   ` [igt-dev] [PATCH i-g-t 1/2] tests/intel/kms_big_joiner: " Sharma, Swati2
2023-11-20 10:01 ` [igt-dev] [PATCH i-g-t 2/2] HAX patch do not merge Kunal Joshi
2023-11-20 16:06 ` [igt-dev] ✗ CI.xeBAT: failure for added new subtest simultaneous-modeset (rev3) Patchwork
2023-11-20 16:20 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2023-11-21 16:03 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2023-11-22 14:31 ` [igt-dev] ✓ Fi.CI.BAT: success for added new subtest simultaneous-modeset (rev4) Patchwork
2023-11-22 15:50 ` [igt-dev] ✓ CI.xeBAT: " Patchwork
2023-11-23  8:36 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2023-11-06  7:12 [igt-dev] [PATCH i-g-t 0/2] added new subtest simultaneous-modeset Kunal Joshi
2023-11-06  7:12 ` [igt-dev] [PATCH i-g-t 1/2] tests/intel/kms_big_joiner: " Kunal Joshi
2023-10-26 12:02 [igt-dev] [PATCH i-g-t 0/2] " Kunal Joshi
2023-10-26 12:02 ` [igt-dev] [PATCH i-g-t 1/2] tests/intel/kms_big_joiner: " Kunal Joshi

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=20231120100151.1792953-2-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