Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Santhosh Reddy Guddati <santhosh.reddy.guddati@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: karthik.b.s@intel.com, swati2.sharma@intel.com,
	Santhosh Reddy Guddati <santhosh.reddy.guddati@intel.com>
Subject: [PATCH i-g-t v6 1/1] tests/intel/kms_joiner: switch modeset between uj and bj
Date: Tue,  3 Dec 2024 09:12:17 +0530	[thread overview]
Message-ID: <20241203034218.53066-2-santhosh.reddy.guddati@intel.com> (raw)
In-Reply-To: <20241203034218.53066-1-santhosh.reddy.guddati@intel.com>

Add a subtest to validate switching from ultra joiner to big joiner
and vice-versa.

v2: Add new subtests for switching without force joiner (Karthik).
v3: Start with uj to bj switch, if not available switch to force mode.
v4: Check for uj, bj support before starting dynamic tests (karthik)
    call reset_connectors after forcing to uj.
v5: Add a separate function to switch modes and execute test for each
    connected supported output (karthik).
v6: Add force_joiner and dsc supported checks, remove redundant checks
    while setting modes (karthik).
    Remove display_reset during switch-modeset, intentionally force
    big joiner and then switch to ultra joiner.

Signed-off-by: Santhosh Reddy Guddati <santhosh.reddy.guddati@intel.com>
---
 tests/intel/kms_joiner.c | 115 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 115 insertions(+)

diff --git a/tests/intel/kms_joiner.c b/tests/intel/kms_joiner.c
index 9a353ee1b..97ffecf60 100644
--- a/tests/intel/kms_joiner.c
+++ b/tests/intel/kms_joiner.c
@@ -71,6 +71,9 @@
  * SUBTEST: invalid-modeset-force-ultra-joiner
  * Description: Verify if the modeset on the other pipes are rejected when
  *              the pipe A is active with force ultra joiner modeset.
+ *
+ * SUBTEST: switch-modeset-ultra-joiner-big-joiner
+ * Description: Verify switching between ultra joiner and big joiner modeset.
  */
 IGT_TEST_DESCRIPTION("Test joiner / force joiner");
 
@@ -161,6 +164,103 @@ static enum pipe setup_pipe(data_t *data, igt_output_t *output, enum pipe pipe,
 	return master_pipe;
 }
 
+static void set_joiner_mode(data_t *data, igt_output_t *output, drmModeModeInfo *mode)
+{
+	igt_plane_t *primary;
+	igt_fb_t fb;
+
+	igt_info("Committing joiner mode for output %s with mode %dx%d@%d\n",
+		  output->name, mode->hdisplay, mode->vdisplay, mode->vrefresh);
+
+	igt_output_set_pipe(output, PIPE_A);
+	igt_output_override_mode(output, mode);
+	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
+	igt_create_pattern_fb(data->drm_fd, mode->hdisplay, mode->vdisplay, DRM_FORMAT_XRGB8888,
+			      DRM_FORMAT_MOD_LINEAR, &fb);
+	igt_plane_set_fb(primary, &fb);
+	igt_display_commit2(&data->display, COMMIT_ATOMIC);
+
+	igt_display_reset(&data->display);
+	igt_reset_connectors();
+	igt_plane_set_fb(primary, NULL);
+	igt_remove_fb(data->drm_fd, &fb);
+}
+
+static void switch_modeset_ultra_joiner_big_joiner(data_t *data, igt_output_t *output)
+{
+	drmModeModeInfo bj_mode;
+	drmModeModeInfo uj_mode;
+	int status;
+	bool ultrajoiner_found;
+	enum pipe pipe;
+	bool force_joiner_supported;
+
+	drmModeConnector *connector = output->config.connector;
+
+	ultrajoiner_found = ultrajoiner_mode_found(data->drm_fd, connector, max_dotclock, &uj_mode);
+	force_joiner_supported = igt_has_force_joiner_debugfs(data->drm_fd, output->name) &&
+				 is_dsc_supported_by_sink(data->drm_fd, output);
+
+	if (ultrajoiner_found) {
+		igt_output_override_mode(output, &uj_mode);
+	} else if (force_joiner_supported) {
+		status = kmstest_force_connector_joiner(data->drm_fd, output->config.connector,
+							JOINED_PIPES_ULTRA_JOINER);
+		igt_assert_f(status, "Failed to toggle force joiner\n");
+		uj_mode = *igt_output_get_mode(output);
+	} else {
+		igt_info("No ultra joiner mode found on output %s\n", output->name);
+		return;
+	}
+
+	igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(pipe), output->name) {
+		set_joiner_mode(data, output, &uj_mode);
+		/* Switch to big joiner mode */
+		if (bigjoiner_mode_found(data->drm_fd, output->config.connector,
+					 max_dotclock, &bj_mode)) {
+			igt_output_override_mode(output, &bj_mode);
+		} else {
+			status = kmstest_force_connector_joiner(data->drm_fd,
+								output->config.connector,
+								JOINED_PIPES_BIG_JOINER);
+			igt_assert_f(status, "Failed to toggle force joiner\n");
+			bj_mode = *igt_output_get_mode(output);
+		}
+
+		set_joiner_mode(data, output, &bj_mode);
+
+		/* Switch back to ultra joiner*/
+		if (ultrajoiner_found) {
+			igt_output_override_mode(output, &uj_mode);
+		} else {
+			status = kmstest_force_connector_joiner(data->drm_fd,
+								output->config.connector,
+								JOINED_PIPES_ULTRA_JOINER);
+			igt_assert_f(status, "Failed to toggle force joiner\n");
+		}
+
+		set_joiner_mode(data, output, &uj_mode);
+
+		/* Intentionally force to big joiner and then switch */
+		status = kmstest_force_connector_joiner(data->drm_fd, output->config.connector,
+							JOINED_PIPES_BIG_JOINER);
+		igt_assert_f(status, "Failed to toggle force joiner\n");
+		bj_mode = *igt_output_get_mode(output);
+		set_joiner_mode(data, output, &bj_mode);
+
+		/* Switch back to ultra joiner */
+		if (ultrajoiner_found) {
+			igt_output_override_mode(output, &uj_mode);
+		} else {
+			status = kmstest_force_connector_joiner(data->drm_fd,
+								output->config.connector,
+								JOINED_PIPES_ULTRA_JOINER);
+			igt_assert_f(status, "Failed to toggle force joiner\n");
+		}
+		set_joiner_mode(data, output, &uj_mode);
+	}
+}
+
 static void test_single_joiner(data_t *data, int output_count, bool force_joiner)
 {
 	int i;
@@ -592,6 +692,21 @@ igt_main
 		}
 	}
 
+	igt_describe("Verify modeset switch between ultra joiner and big joiner");
+	igt_subtest_with_dynamic("switch-modeset-ultra-joiner-big-joiner") {
+		igt_require_f(ultra_joiner_supported,
+			      "Ultra joiner not supported on this platform\n");
+		igt_require_f(data.ultra_joiner_output_count > 0 ||
+			      data.non_ultra_joiner_output_count > 0,
+				  "No ultra joiner or force ultra joiner output found\n");
+		igt_require_f(data.n_pipes > 3,
+			      "Minimum 4 pipes required\n");
+
+		for_each_connected_output(&data.display, output) {
+			switch_modeset_ultra_joiner_big_joiner(&data, output);
+		}
+	}
+
 	igt_subtest_with_dynamic("invalid-modeset-force-ultra-joiner") {
 		igt_require_f(ultra_joiner_supported,
 			      "Ultra joiner not supported on this platform\n");
-- 
2.34.1


  reply	other threads:[~2024-12-03  3:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-03  3:42 [PATCH i-g-t v6 0/1] tests/intel/kms_joiner: switch modeset from uj to bj and vice-versa Santhosh Reddy Guddati
2024-12-03  3:42 ` Santhosh Reddy Guddati [this message]
2024-12-03  3:42 ` [PATCH i-g-t v6 1/1] tests/intel/kms_joiner: switch modeset between ultra and big joiner Santhosh Reddy Guddati
2024-12-12  6:12   ` Karthik B S
2024-12-03  4:25 ` ✓ Xe.CI.BAT: success for tests/intel/kms_joiner: switch modeset from uj to bj and vice-versa (rev6) Patchwork
2024-12-03  4:35 ` ✗ i915.CI.BAT: failure " Patchwork
2024-12-03  4:53 ` ✗ GitLab.Pipeline: warning " Patchwork
2024-12-03  5:15 ` ✗ Xe.CI.Full: 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=20241203034218.53066-2-santhosh.reddy.guddati@intel.com \
    --to=santhosh.reddy.guddati@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=karthik.b.s@intel.com \
    --cc=swati2.sharma@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