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>,
	Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>,
	Ankit Nautiyal <ankit.k.nautiyal@intel.com>,
	Karthik B S <karthik.b.s@intel.com>,
	Bhanuprakash Modem <bhanuprakash.modem@intel.com>
Subject: [PATCH i-g-t 4/4] tests/intel/kms_big_joiner: add tests for force joiner
Date: Sun, 10 Mar 2024 19:57:21 +0530	[thread overview]
Message-ID: <20240310142721.874315-5-kunal1.joshi@intel.com> (raw)
In-Reply-To: <20240310142721.874315-1-kunal1.joshi@intel.com>

add tests for force joiner

Cc: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
Cc: Ankit Nautiyal <ankit.k.nautiyal@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 | 101 +++++++++++++++++++++++++++++------
 1 file changed, 85 insertions(+), 16 deletions(-)

diff --git a/tests/intel/kms_big_joiner.c b/tests/intel/kms_big_joiner.c
index d4b0d1100..6017b30cd 100644
--- a/tests/intel/kms_big_joiner.c
+++ b/tests/intel/kms_big_joiner.c
@@ -44,13 +44,20 @@
  * SUBTEST: basic-bigjoiner
  * Description: Verify the basic modeset on big joiner mode on all pipes
  *
+ * SUBTEST: invalid-modeset-force-joiner
+ * Description: Verify if the modeset on the adjoining pipe is rejected when
+ *              the pipe is active with a force joiner modeset
+ *
+ * SUBTEST: basic-force-joiner
+ * Description: Verify the basic modeset on force joiner mode on all pipes
  */
 
-IGT_TEST_DESCRIPTION("Test big joiner");
+IGT_TEST_DESCRIPTION("Test big joiner / force joiner");
 
 #define INVALID_TEST_OUTPUT 2
 
 typedef struct {
+	bool force_joiner_supported;
 	int drm_fd;
 	int big_joiner_output_count;
 	int non_big_joiner_output_count;
@@ -90,6 +97,17 @@ static igt_output_t *get_output_by_id_or_assert(data_t *data, uint64_t id)
 	return NULL;
 }
 
+static void toggle_force_joiner_on_all_non_big_joiner_outputs(data_t *data, bool toggle)
+{
+	int i;
+	igt_output_t *output;
+
+	for (i = 0; i < data->non_big_joiner_output_count; i++) {
+		output = get_output_by_id_or_assert(data, data->non_big_joiner_output[i]);
+		igt_force_bigjoiner_enable(data->drm_fd, output->name, toggle);
+	}
+}
+
 static enum pipe get_next_master_pipe(data_t *data, unsigned int available_pipe_mask)
 {
 	if ((data->master_pipes & available_pipe_mask) == 0)
@@ -98,7 +116,7 @@ static enum pipe get_next_master_pipe(data_t *data, unsigned int available_pipe_
 	return ffs(data->master_pipes & available_pipe_mask) - 1;
 }
 
-static void test_single_joiner(data_t *data, int output_count)
+static void test_single_joiner(data_t *data, int output_count, bool force_joiner)
 {
 	int i, ret;
 	enum pipe pipe, master_pipe;
@@ -110,7 +128,7 @@ static void test_single_joiner(data_t *data, int output_count)
 	igt_fb_t fb;
 	drmModeModeInfo *mode;
 
-	outputs = data->big_joiner_output;
+	outputs = force_joiner ? data->non_big_joiner_output : data->big_joiner_output;
 
 	for (i = 0; i < output_count; i++) {
 		output = get_output_by_id_or_assert(data, outputs[i]);
@@ -121,7 +139,8 @@ static void test_single_joiner(data_t *data, int output_count)
 			master_pipe = get_next_master_pipe(data, available_pipe_mask & attempt_mask);
 			if (master_pipe == PIPE_NONE)
 				continue;
-			igt_info("Using pipe %s as master and %s slave for %s\n", kmstest_pipe_name(pipe), kmstest_pipe_name(pipe + 1), output->name);
+			igt_info("Using pipe %s as master and %s slave for %s\n", kmstest_pipe_name(pipe),
+					 kmstest_pipe_name(pipe + 1), output->name);
 			igt_output_set_pipe(output, pipe);
 			mode = igt_output_get_mode(output);
 			primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
@@ -134,7 +153,7 @@ static void test_single_joiner(data_t *data, int output_count)
 	}
 }
 
-static void test_multi_joiner(data_t *data, int output_count)
+static void test_multi_joiner(data_t *data, int output_count, bool force_joiner)
 {
 	int i, ret;
 	unsigned int available_pipe_mask;
@@ -158,7 +177,8 @@ static void test_multi_joiner(data_t *data, int output_count)
 			if (master_pipe == PIPE_NONE)
 				continue;
 
-			igt_info("Using pipe %s as master %s slave for %s\n", kmstest_pipe_name(pipe), kmstest_pipe_name(pipe + 1), output->name);
+			igt_info("Using pipe %s as master %s slave for %s\n", kmstest_pipe_name(pipe),
+					 kmstest_pipe_name(pipe + 1), output->name);
 			igt_output_set_pipe(output, pipe);
 			mode = igt_output_get_mode(output);
 			primary[i] = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
@@ -176,7 +196,7 @@ static void test_multi_joiner(data_t *data, int output_count)
 }
 
 static void test_invalid_modeset_two_joiner(data_t *data,
-					    bool combined)
+					    bool combined,  bool force_joiner)
 {
 	int i, j, ret;
 	uint64_t *outputs;
@@ -209,7 +229,7 @@ static void test_invalid_modeset_two_joiner(data_t *data,
 	}
 }
 
-static void tets_big_joiner_on_last_pipe(data_t *data)
+static void test_joiner_on_last_pipe(data_t *data, bool force_joiner)
 {
 	int i, len, ret;
 	uint64_t *outputs;
@@ -218,8 +238,8 @@ static void tets_big_joiner_on_last_pipe(data_t *data)
 	igt_fb_t fb;
 	drmModeModeInfo *mode;
 
-	len = data->big_joiner_output_count;
-	outputs = data->big_joiner_output;
+	len = force_joiner ? data->non_big_joiner_output_count : data->big_joiner_output_count;
+	outputs = force_joiner ? data->non_big_joiner_output : data->big_joiner_output;
 
 	for (i = 0; i < len; i++) {
 		igt_display_reset(&data->display);
@@ -247,6 +267,7 @@ igt_main
 	data_t data;
 
 	igt_fixture {
+		data.force_joiner_supported = false;
 		data.big_joiner_output_count = 0;
 		data.non_big_joiner_output_count = 0;
 		data.combined_output_count = 0;
@@ -274,7 +295,10 @@ igt_main
 				data.big_joiner_output[data.big_joiner_output_count++] = output->config.connector->connector_id;
 				igt_output_override_mode(output, &connector->modes[0]);
 			} else {
-				data.non_big_joiner_output[data.non_big_joiner_output_count++] = output->config.connector->connector_id;
+				if (has_force_joiner_debugfs(data.drm_fd, output)) {
+					data.force_joiner_supported = true;
+					data.non_big_joiner_output[data.non_big_joiner_output_count++] = output->config.connector->connector_id;
+				}
 			}
 			data.output_count++;
 		}
@@ -297,10 +321,10 @@ igt_main
 			igt_require_f(data.n_pipes > 1,
 				      "Minimum 2 pipes required\n");
 			igt_dynamic_f("single-joiner")
-				test_single_joiner(&data, data.big_joiner_output_count);
+				test_single_joiner(&data, data.big_joiner_output_count, false);
 			if (data.big_joiner_output_count > 1)
 				igt_dynamic_f("multi-joiner")
-					test_multi_joiner(&data, data.big_joiner_output_count);
+					test_multi_joiner(&data, data.big_joiner_output_count, false);
 
 	}
 
@@ -309,13 +333,58 @@ igt_main
 		igt_require_f(data.n_pipes > 1, "Minimum of 2 pipes are required\n");
 		if (data.big_joiner_output_count >= 1)
 			igt_dynamic_f("big_joiner_on_last_pipe")
-				tets_big_joiner_on_last_pipe(&data);
+				test_joiner_on_last_pipe(&data, false);
 		if (data.big_joiner_output_count > 1)
 			igt_dynamic_f("invalid_combinations")
-				test_invalid_modeset_two_joiner(&data, false);
+				test_invalid_modeset_two_joiner(&data, false, false);
 		if (data.combined_output_count)
 			igt_dynamic_f("combined_output")
-				test_invalid_modeset_two_joiner(&data, true);
+				test_invalid_modeset_two_joiner(&data, true, false);
+	}
+
+	igt_describe("Verify the basic modeset on big joiner mode on all pipes");
+	igt_subtest_with_dynamic("basic-force-joiner") {
+			igt_require_f(data.force_joiner_supported,
+						 "force joiner not supported on this platform or none of the connected output supports it\n");
+			igt_require_f(data.non_big_joiner_output_count > 0,
+				      "No non big joiner output found\n");
+			igt_require_f(data.n_pipes > 1,
+				      "Minimum 2 pipes required\n");
+			igt_dynamic_f("single") {
+				toggle_force_joiner_on_all_non_big_joiner_outputs(&data, true);
+				test_single_joiner(&data, data.non_big_joiner_output_count, true);
+				toggle_force_joiner_on_all_non_big_joiner_outputs(&data, false);
+
+			}
+			if (data.non_big_joiner_output_count > 1) {
+				igt_dynamic_f("multi") {
+					toggle_force_joiner_on_all_non_big_joiner_outputs(&data, true);
+					test_multi_joiner(&data, data.non_big_joiner_output_count, true);
+					toggle_force_joiner_on_all_non_big_joiner_outputs(&data, false);
+				}
+			}
+	}
+
+	igt_subtest_with_dynamic("invalid-modeset-force-joiner") {
+			igt_require_f(data.force_joiner_supported,
+						 "force joiner not supported on this platform or none of the connected output supports it\n");
+		igt_require_f(data.non_big_joiner_output_count > 0, "Non big joiner output not found\n");
+		igt_require_f(data.n_pipes > 1, "Minimum of 2 pipes are required\n");
+
+		if (data.non_big_joiner_output_count >= 1) {
+			igt_dynamic_f("big_joiner_on_last_pipe") {
+				toggle_force_joiner_on_all_non_big_joiner_outputs(&data, true);
+				test_joiner_on_last_pipe(&data, true);
+				toggle_force_joiner_on_all_non_big_joiner_outputs(&data, false);
+			}
+		}
+		if (data.non_big_joiner_output_count > 1) {
+			igt_dynamic_f("invalid_combinations") {
+				toggle_force_joiner_on_all_non_big_joiner_outputs(&data, true);
+				test_invalid_modeset_two_joiner(&data, true, false);
+				toggle_force_joiner_on_all_non_big_joiner_outputs(&data, false);
+			}
+		}
 	}
 
 	igt_fixture {
-- 
2.34.1


  parent reply	other threads:[~2024-03-10 14:17 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-10 14:27 [PATCH i-g-t 0/4] revamp big joiner test Kunal Joshi
2024-03-10 14:27 ` [PATCH i-g-t 1/4] lib/igt_kms: move bigjoiner_mode_found to lib Kunal Joshi
2024-03-15  4:10   ` Nautiyal, Ankit K
2024-03-18  5:38     ` Joshi, Kunal1
2024-03-20 12:29       ` Nautiyal, Ankit K
2024-03-10 14:27 ` [PATCH i-g-t 2/4] tests/intel/kms_big_joiner: revamp bigjoiner Kunal Joshi
2024-03-14  8:43   ` Nautiyal, Ankit K
2024-03-18  5:26     ` Joshi, Kunal1
2024-03-10 14:27 ` [PATCH i-g-t 3/4] lib/igt_kms: add helper to enable/disable force joiner Kunal Joshi
2024-03-20 12:53   ` Nautiyal, Ankit K
2024-03-20 13:21     ` Nautiyal, Ankit K
2024-03-10 14:27 ` Kunal Joshi [this message]
2024-03-20 13:17   ` [PATCH i-g-t 4/4] tests/intel/kms_big_joiner: add tests for " Nautiyal, Ankit K
2024-03-10 14:48 ` ✓ CI.xeBAT: success for revamp big joiner test (rev7) Patchwork
2024-03-10 14:56 ` ✓ Fi.CI.BAT: " Patchwork
2024-03-10 16:26 ` ✗ Fi.CI.IGT: failure " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2024-03-21 18:28 [PATCH i-g-t 0/4] revamp big joiner test Kunal Joshi
2024-03-21 18:28 ` [PATCH i-g-t 4/4] tests/intel/kms_big_joiner: add tests for force joiner Kunal Joshi
2024-03-25 16:51 [PATCH i-g-t 0/4] revamp big joiner test Kunal Joshi
2024-03-25 16:51 ` [PATCH i-g-t 4/4] tests/intel/kms_big_joiner: add tests for force joiner Kunal Joshi
2024-03-28  7:06   ` Nautiyal, Ankit K
2024-03-28  8:39 [PATCH i-g-t 0/4] revamp big joiner test Kunal Joshi
2024-03-28  8:39 ` [PATCH i-g-t 4/4] tests/intel/kms_big_joiner: add tests for force 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=20240310142721.874315-5-kunal1.joshi@intel.com \
    --to=kunal1.joshi@intel.com \
    --cc=ankit.k.nautiyal@intel.com \
    --cc=bhanuprakash.modem@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=karthik.b.s@intel.com \
    --cc=stanislav.lisovskiy@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