Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t] tests/kms_plane_cursor: limit simulation to first and last CRTC
@ 2026-11-24  6:27 Jeevan B
  0 siblings, 0 replies; 5+ messages in thread
From: Jeevan B @ 2026-11-24  6:27 UTC (permalink / raw)
  To: igt-dev; +Cc: karthik.b.s, jani.nikula, Jeevan B

Running on every CRTC makes the test hit the timeout on simulation.
Restrict it to the first and last usable CRTC when running in
simulation, which keeps coverage while avoiding the timeout.

Move the per-pipe validity check and the per-pipe subtest body into
pipe_output_valid() and run_pipe() so both the regular and the
simulation paths can share them.

v2:
 - Test the first and last usable CRTC instead of the first 2 pipes,
   and drop SIM_MAX_PIPES.
v3:
 - Skip non-first/non-last CRTCs inside the existing loop.
v4:
 - Split the validity check and per-pipe run into helpers, and pick
   the first/last valid CRTC while iterating, then run only those
   after the loop in simulation.

Signed-off-by: Jeevan B <jeevan.b@intel.com>
---
 tests/kms_plane_cursor.c | 92 +++++++++++++++++++++++++++-------------
 1 file changed, 62 insertions(+), 30 deletions(-)

diff --git a/tests/kms_plane_cursor.c b/tests/kms_plane_cursor.c
index 4b69f1a17..f932cc775 100644
--- a/tests/kms_plane_cursor.c
+++ b/tests/kms_plane_cursor.c
@@ -284,14 +284,51 @@ static void test_cursor(data_t *data, int size, unsigned int flags)
 	test_cursor_spots(data, size, flags);
 }
 
-int igt_main()
+static bool pipe_output_valid(data_t *data, igt_crtc_t *crtc,
+			      igt_output_t *output, unsigned int flags)
+{
+	if ((flags & TEST_OVERLAY) &&
+	    !igt_crtc_get_plane_type(crtc, DRM_PLANE_TYPE_OVERLAY))
+		return false;
+
+	igt_display_reset(&data->display);
+	igt_output_set_crtc(output, crtc);
+
+	return intel_pipe_output_combo_valid(&data->display);
+}
+
+static void run_pipe(data_t *data, igt_crtc_t *crtc, igt_output_t *output,
+		     unsigned int flags)
 {
 	static const int cursor_sizes[] = { 64, 128, 256 };
+	int j;
+
+	igt_display_reset(&data->display);
+	igt_output_set_crtc(output, crtc);
+
+	test_init(data, crtc, output, flags);
+
+	for (j = 0; j < ARRAY_SIZE(cursor_sizes); j++) {
+		int size = cursor_sizes[j];
+
+		igt_dynamic_f("pipe-%s-%s-size-%d", igt_crtc_name(crtc),
+			      igt_output_name(output), size)
+			test_cursor(data, size, flags);
+
+		test_cleanup(data);
+		if (igt_run_in_simulation())
+			break;
+	}
+
+	test_fini(data);
+}
+
+int igt_main()
+{
 	data_t data = { .max_curw = 64, .max_curh = 64 };
 	igt_crtc_t *crtc;
 	igt_output_t *output;
-	igt_display_t *display;
-	int i, j;
+	int i;
 	struct {
 		const char *name;
 		unsigned int flags;
@@ -314,7 +351,6 @@ int igt_main()
 		igt_display_require(&data.display, data.drm_fd);
 		igt_require(data.display.is_atomic);
 		igt_display_require_output(&data.display);
-		display = &data.display;
 
 		ret = drmGetCap(data.drm_fd, DRM_CAP_CURSOR_WIDTH, &data.max_curw);
 		igt_assert(ret == 0 || errno == EINVAL);
@@ -327,40 +363,36 @@ int igt_main()
 	for (i = 0; i < ARRAY_SIZE(tests); i++) {
 		igt_describe_f("%s", tests[i].desc);
 		igt_subtest_with_dynamic_f("%s", tests[i].name) {
+			igt_crtc_t *first_crtc = NULL, *last_crtc = NULL;
+			igt_output_t *first_output = NULL, *last_output = NULL;
+
 			for_each_crtc_with_single_output(&data.display, crtc,
 							 output) {
-				if ((tests[i].flags & TEST_OVERLAY) &&
-				    !igt_crtc_get_plane_type(crtc,
-							     DRM_PLANE_TYPE_OVERLAY))
+				if (!pipe_output_valid(&data, crtc, output,
+						       tests[i].flags))
 					continue;
 
-				igt_display_reset(display);
-
-				igt_output_set_crtc(output,
-						    crtc);
-				if (!intel_pipe_output_combo_valid(display))
+				if (!igt_run_in_simulation()) {
+					run_pipe(&data, crtc, output,
+						 tests[i].flags);
 					continue;
+				}
 
-				test_init(&data,
-					  crtc,
-					  output,
-					  tests[i].flags);
-
-				for (j = 0; j < ARRAY_SIZE(cursor_sizes); j++) {
-					int size = cursor_sizes[j];
-
-					igt_dynamic_f("pipe-%s-%s-size-%d",
-						      igt_crtc_name(crtc),
-						      igt_output_name(output),
-						      size)
-						test_cursor(&data, size, tests[i].flags);
-
-					test_cleanup(&data);
-					if (igt_run_in_simulation())
-						break;
+				if (!first_crtc) {
+					first_crtc = crtc;
+					first_output = output;
 				}
+				last_crtc = crtc;
+				last_output = output;
+			}
 
-				test_fini(&data);
+			if (first_crtc) {
+				run_pipe(&data, first_crtc, first_output,
+					 tests[i].flags);
+				if (last_crtc->crtc_index -
+				    first_crtc->crtc_index > 1)
+					run_pipe(&data, last_crtc, last_output,
+						 tests[i].flags);
 			}
 		}
 	}
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread
* [PATCH i-g-t] tests/kms_plane_cursor: limit simulation to first and last CRTC
@ 2026-11-23  5:56 Jeevan B
  2026-11-23  9:32 ` Jani Nikula
  0 siblings, 1 reply; 5+ messages in thread
From: Jeevan B @ 2026-11-23  5:56 UTC (permalink / raw)
  To: igt-dev; +Cc: karthik.b.s, jani.nikula, Jeevan B

Running on every CRTC makes the test hit the timeout on simulation.
Restrict it to the first and last usable CRTC when running in
simulation, which keeps coverage while avoiding the timeout.

v2:
 - Test the first and last usable CRTC instead of the first 2 pipes,
   and drop SIM_MAX_PIPES.
v3:
 - Skip non-first/non-last CRTCs inside the existing loop.

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

diff --git a/tests/kms_plane_cursor.c b/tests/kms_plane_cursor.c
index 4b69f1a17..dfe1f2418 100644
--- a/tests/kms_plane_cursor.c
+++ b/tests/kms_plane_cursor.c
@@ -288,7 +288,7 @@ int igt_main()
 {
 	static const int cursor_sizes[] = { 64, 128, 256 };
 	data_t data = { .max_curw = 64, .max_curh = 64 };
-	igt_crtc_t *crtc;
+	igt_crtc_t *crtc, *last_crtc;
 	igt_output_t *output;
 	igt_display_t *display;
 	int i, j;
@@ -315,6 +315,8 @@ int igt_main()
 		igt_require(data.display.is_atomic);
 		igt_display_require_output(&data.display);
 		display = &data.display;
+		last_crtc = igt_crtc_for_pipe(display,
+					      igt_display_n_crtcs(display) - 1);
 
 		ret = drmGetCap(data.drm_fd, DRM_CAP_CURSOR_WIDTH, &data.max_curw);
 		igt_assert(ret == 0 || errno == EINVAL);
@@ -327,6 +329,8 @@ int igt_main()
 	for (i = 0; i < ARRAY_SIZE(tests); i++) {
 		igt_describe_f("%s", tests[i].desc);
 		igt_subtest_with_dynamic_f("%s", tests[i].name) {
+			bool tested_first = false;
+
 			for_each_crtc_with_single_output(&data.display, crtc,
 							 output) {
 				if ((tests[i].flags & TEST_OVERLAY) &&
@@ -334,6 +338,15 @@ int igt_main()
 							     DRM_PLANE_TYPE_OVERLAY))
 					continue;
 
+				/*
+				 * In simulation, only test the first usable
+				 * CRTC and the last one to avoid timeouts
+				 * while keeping coverage.
+				 */
+				if (igt_run_in_simulation() && tested_first &&
+				    crtc != last_crtc)
+					continue;
+
 				igt_display_reset(display);
 
 				igt_output_set_crtc(output,
@@ -341,6 +354,8 @@ int igt_main()
 				if (!intel_pipe_output_combo_valid(display))
 					continue;
 
+				tested_first = true;
+
 				test_init(&data,
 					  crtc,
 					  output,
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread
* [PATCH i-g-t] tests/kms_plane_cursor: limit simulation to first and last CRTC
@ 2026-11-16  4:01 Jeevan B
  2026-11-16  9:35 ` Jani Nikula
  0 siblings, 1 reply; 5+ messages in thread
From: Jeevan B @ 2026-11-16  4:01 UTC (permalink / raw)
  To: igt-dev; +Cc: karthik.b.s, Jeevan B

Running on every CRTC makes the test hit the timeout on simulation.
Restrict it to the first and last usable CRTC when running in
simulation, which keeps coverage while avoiding the timeout.

v2:
 - Test the first and last usable CRTC instead of the first 2 pipes, and
   drop SIM_MAX_PIPES.

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

diff --git a/tests/kms_plane_cursor.c b/tests/kms_plane_cursor.c
index 4b69f1a17..982505575 100644
--- a/tests/kms_plane_cursor.c
+++ b/tests/kms_plane_cursor.c
@@ -327,8 +327,37 @@ int igt_main()
 	for (i = 0; i < ARRAY_SIZE(tests); i++) {
 		igt_describe_f("%s", tests[i].desc);
 		igt_subtest_with_dynamic_f("%s", tests[i].name) {
+			igt_crtc_t *first_crtc = NULL, *last_crtc = NULL;
+
+			/*
+			 * In simulation, only test the first and last usable
+			 * CRTC to avoid timeouts while keeping coverage.
+			 */
+			if (igt_run_in_simulation()) {
+				for_each_crtc_with_single_output(&data.display,
+								 crtc, output) {
+					if ((tests[i].flags & TEST_OVERLAY) &&
+					    !igt_crtc_get_plane_type(crtc,
+								     DRM_PLANE_TYPE_OVERLAY))
+						continue;
+
+					igt_display_reset(display);
+					igt_output_set_crtc(output, crtc);
+					if (!intel_pipe_output_combo_valid(display))
+						continue;
+
+					if (!first_crtc)
+						first_crtc = crtc;
+					last_crtc = crtc;
+				}
+			}
+
 			for_each_crtc_with_single_output(&data.display, crtc,
 							 output) {
+				if (igt_run_in_simulation() &&
+				    crtc != first_crtc && crtc != last_crtc)
+					continue;
+
 				if ((tests[i].flags & TEST_OVERLAY) &&
 				    !igt_crtc_get_plane_type(crtc,
 							     DRM_PLANE_TYPE_OVERLAY))
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-11-24  6:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-24  6:27 [PATCH i-g-t] tests/kms_plane_cursor: limit simulation to first and last CRTC Jeevan B
  -- strict thread matches above, loose matches on Subject: below --
2026-11-23  5:56 Jeevan B
2026-11-23  9:32 ` Jani Nikula
2026-11-16  4:01 Jeevan B
2026-11-16  9:35 ` Jani Nikula

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox