All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeevan B <jeevan.b@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t] tests/kms_display_modes: Add test for clone mode
Date: Tue, 21 Jun 2022 23:27:06 +0530	[thread overview]
Message-ID: <20220621175706.23060-1-jeevan.b@intel.com> (raw)

Add test for validation of clone mode.

Signed-off-by: Jeevan B <jeevan.b@intel.com>
---
 tests/kms_display_modes.c | 83 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 83 insertions(+)

diff --git a/tests/kms_display_modes.c b/tests/kms_display_modes.c
index eff30cbb..af299dc0 100644
--- a/tests/kms_display_modes.c
+++ b/tests/kms_display_modes.c
@@ -129,6 +129,80 @@ static void run_extendedmode_basic(data_t *data, int pipe1, int pipe2)
 	igt_assert_crc_equal(&crc[1], &ref_crc[1]);
 }
 
+static void run_clonemode_basic(data_t *data, int pipe1, int pipe2)
+{
+	struct igt_fb fbs[2];
+	drmModeModeInfo *mode[2];
+	igt_output_t *output, *clone_output[2];
+	igt_display_t *display = &data->display;
+	igt_plane_t *plane[2];
+	igt_pipe_crc_t *pipe_crc[2] = { 0 };
+	igt_crc_t ref_crc[2], crc[2];
+	int count = 0;
+
+	for_each_connected_output(display, output) {
+		clone_output[count] = output;
+		count++;
+
+		if (count > 1)
+			break;
+	}
+
+	igt_output_set_pipe(clone_output[0], pipe1);
+	igt_output_set_pipe(clone_output[1], pipe2);
+
+	mode[0] = igt_output_get_mode(clone_output[0]);
+	mode[1] = igt_output_get_mode(clone_output[1]);
+
+	pipe_crc[0] = igt_pipe_crc_new(data->drm_fd, pipe1, INTEL_PIPE_CRC_SOURCE_AUTO);
+	pipe_crc[1] = igt_pipe_crc_new(data->drm_fd, pipe2, INTEL_PIPE_CRC_SOURCE_AUTO);
+
+	igt_create_color_fb(data->drm_fd, mode[0]->hdisplay, mode[0]->vdisplay,
+			    DRM_FORMAT_XRGB8888, 0, 1, 0, 0, &fbs[0]);
+
+	igt_create_color_fb(data->drm_fd, mode[0]->hdisplay, mode[1]->vdisplay,
+			    DRM_FORMAT_XRGB8888, 0, 1, 0, 0, &fbs[1]);
+
+	plane[0] = igt_pipe_get_plane_type(&display->pipes[pipe1], DRM_PLANE_TYPE_PRIMARY);
+	plane[1] = igt_pipe_get_plane_type(&display->pipes[pipe2], DRM_PLANE_TYPE_PRIMARY);
+
+	igt_plane_set_fb(plane[0], &fbs[0]);
+	igt_plane_set_fb(plane[1], &fbs[1]);
+
+	igt_display_commit2(display, COMMIT_ATOMIC);
+
+	igt_pipe_crc_collect_crc(pipe_crc[0], &ref_crc[0]);
+	igt_pipe_crc_collect_crc(pipe_crc[1], &ref_crc[1]);
+
+	igt_plane_set_fb(plane[0], &fbs[0]);
+	igt_plane_set_fb(plane[1], &fbs[1]);
+
+	igt_display_commit2(display, COMMIT_ATOMIC);
+
+	igt_pipe_crc_collect_crc(pipe_crc[0], &crc[0]);
+	igt_pipe_crc_collect_crc(pipe_crc[1], &crc[1]);
+
+	/*Clean up*/
+	igt_remove_fb(data->drm_fd, &fbs[0]);
+	igt_remove_fb(data->drm_fd, &fbs[1]);
+
+	igt_pipe_crc_free(pipe_crc[0]);
+	igt_pipe_crc_free(pipe_crc[1]);
+
+	igt_output_set_pipe(clone_output[0], PIPE_NONE);
+	igt_output_set_pipe(clone_output[1], PIPE_NONE);
+
+	igt_plane_set_fb(igt_pipe_get_plane_type(&display->pipes[pipe1],
+			 DRM_PLANE_TYPE_PRIMARY), NULL);
+	igt_plane_set_fb(igt_pipe_get_plane_type(&display->pipes[pipe2],
+			 DRM_PLANE_TYPE_PRIMARY), NULL);
+	igt_display_commit2(display, COMMIT_ATOMIC);
+
+	/*Compare CRC*/
+	igt_assert_crc_equal(&crc[0], &ref_crc[0]);
+	igt_assert_crc_equal(&crc[1], &ref_crc[1]);
+}
+
 igt_main
 {
 	data_t data;
@@ -167,6 +241,15 @@ igt_main
 		}
 	}
 
+	igt_describe("Test for validating display clone mode with a pair of connected displays");
+	igt_subtest_with_dynamic("clone-mode-basic") {
+		for (i = 0; i < data.n_pipes - 1; i++) {
+			igt_dynamic_f("pipe-%s%s", kmstest_pipe_name(pipe[i]),
+					kmstest_pipe_name(pipe[i+1]));
+			run_clonemode_basic(&data, pipe[i], pipe[i+1]);
+		}
+	}
+
 	igt_fixture {
 		igt_display_fini(&data.display);
 	}
-- 
2.36.0

             reply	other threads:[~2022-06-21 18:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-21 17:57 Jeevan B [this message]
2022-06-21 18:38 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_display_modes: Add test for clone mode Patchwork
2022-06-22  7:14 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2022-06-22 10:06 ` [igt-dev] [PATCH i-g-t] " Modem, Bhanuprakash
2022-06-22 10:46   ` B, Jeevan

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=20220621175706.23060-1-jeevan.b@intel.com \
    --to=jeevan.b@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.