All of 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-16  4:01 Jeevan B
  2026-11-16  9:35 ` Jani Nikula
  0 siblings, 1 reply; 9+ 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] 9+ messages in thread

* Re: [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, 0 replies; 9+ messages in thread
From: Jani Nikula @ 2026-11-16  9:35 UTC (permalink / raw)
  To: Jeevan B, igt-dev; +Cc: karthik.b.s, Jeevan B

On Mon, 16 Nov 2026, Jeevan B <jeevan.b@intel.com> wrote:
> 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;
> +				}
> +			}

Why are you duplicating the for_each_crtc_with_single_output() loop?
Aren't you also *adding* more modesets for simulation here?!

BR,
Jani.


> +
>  			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))

-- 
Jani Nikula, Intel

^ permalink raw reply	[flat|nested] 9+ 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; 9+ 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] 9+ messages in thread

* Re: [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, 0 replies; 9+ messages in thread
From: Jani Nikula @ 2026-11-23  9:32 UTC (permalink / raw)
  To: Jeevan B, igt-dev; +Cc: karthik.b.s, Jeevan B

On Mon, 23 Nov 2026, Jeevan B <jeevan.b@intel.com> wrote:
> 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);

That's just plain wrong in many different ways.

Basically there's no guarantee "igt_display_n_crtcs(display) - 1" is a
pipe that exists. Pipes aren't guaranteed to be consecutive, and they
may not have anything to do with the number of CRTCs or CRTC indexes or
anything.

Even if "igt_display_n_crtcs(display) - 1" exists, it may be any pipe,
first, last, or something in between. You just can't make any
assumptions about pipe numbering or how they correspond to CRTCs.

And, in general, do not use igt_crtc_for_pipe() at all if it can be
avoided. Everything should be CRTC based if possible.

---

Now, we've seen patches here that do stuff on first/last pipe only, or
first/last CRTC only, or whatever.

I've said it a few times in various contexts, but this sprinkling of
random checks within loops is really not the way to go.

What you want is a CRTC index mask that you initialize in the beginning,
and the test loop only uses CRTCs that are in the mask. The test loop
shouldn't need to do any of this "igt_run_in_simulation()" or whatever.


BR,
Jani.


>  
>  		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,

-- 
Jani Nikula, Intel

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

* [PATCH i-g-t] tests/kms_plane_cursor: limit simulation to first and last CRTC
@ 2026-11-24  6:27 Jeevan B
  2026-11-24 11:02 ` Jani Nikula
  0 siblings, 1 reply; 9+ 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] 9+ messages in thread

* Re: [PATCH i-g-t] tests/kms_plane_cursor: limit simulation to first and last CRTC
  2026-11-24  6:27 [PATCH i-g-t] tests/kms_plane_cursor: limit simulation to first and last CRTC Jeevan B
@ 2026-11-24 11:02 ` Jani Nikula
  2026-11-24 22:43   ` Michał Grzelak
  2026-11-25  9:38   ` B, Jeevan
  0 siblings, 2 replies; 9+ messages in thread
From: Jani Nikula @ 2026-11-24 11:02 UTC (permalink / raw)
  To: Jeevan B, igt-dev; +Cc: karthik.b.s, Jeevan B, Michał Grzelak

On Tue, 24 Nov 2026, Jeevan B <jeevan.b@intel.com> wrote:
> 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.

I think you're overcomplicating things for something that should be
simplified.

I don't know what to say. I don't think my review comments are being
understood.

Below is what I meant, maybe C is the lingua franca. Use the first and
last pipes on simulation, all otherwise. And keep the simulation
conditional stuff mostly out of the main test loops, because it
complicates everything.

Also Cc: Michał, this is what I meant in my comments to you too. There's
no need for those complicated arrays with bools.


BR,
Jani.


PS. It's untested.


diff --git a/tests/kms_plane_cursor.c b/tests/kms_plane_cursor.c
index 4b69f1a17e24..a1111245fb0d 100644
--- a/tests/kms_plane_cursor.c
+++ b/tests/kms_plane_cursor.c
@@ -284,6 +284,27 @@ static void test_cursor(data_t *data, int size, unsigned int flags)
        test_cursor_spots(data, size, flags);
 }
 
+static uint32_t get_crtc_index_mask(igt_display_t *display)
+{
+       igt_crtc_t *crtc, *first_pipe_crtc = NULL, *last_pipe_crtc = NULL;
+       __maybe_unused igt_output_t *output;
+       uint32_t crtc_index_mask = 0;
+
+       for_each_crtc_with_single_output(display, crtc, output) {
+               if (!first_pipe_crtc || crtc->hardware_pipe < first_pipe_crtc->hardware_pipe)
+                       first_pipe_crtc = crtc;
+               if (!last_pipe_crtc || crtc->hardware_pipe > last_pipe_crtc->hardware_pipe)
+                       last_pipe_crtc = crtc;
+               crtc_index_mask |= 1 << crtc->crtc_index;
+       }
+
+       if (igt_run_in_simulation() && first_pipe_crtc && last_pipe_crtc)
+               crtc_index_mask = 1 << first_pipe_crtc->crtc_index |
+                       1 << last_pipe_crtc->crtc_index;
+
+       return crtc_index_mask;
+}
+
 int igt_main()
 {
        static const int cursor_sizes[] = { 64, 128, 256 };
@@ -291,6 +312,7 @@ int igt_main()
        igt_crtc_t *crtc;
        igt_output_t *output;
        igt_display_t *display;
+       uint32_t crtc_index_mask = 0;
        int i, j;
        struct {
                const char *name;
@@ -322,6 +344,8 @@ int igt_main()
                igt_assert(ret == 0 || errno == EINVAL);
 
                kmstest_set_vt_graphics_mode();
+
+               crtc_index_mask = get_crtc_index_mask(&data.display);
        }
 
        for (i = 0; i < ARRAY_SIZE(tests); i++) {
@@ -329,6 +353,9 @@ int igt_main()
                igt_subtest_with_dynamic_f("%s", tests[i].name) {
                        for_each_crtc_with_single_output(&data.display, crtc,
                                                         output) {
+                               if (!(crtc_index_mask & (1 << crtc->crtc_index)))
+                                       continue;
+
                                if ((tests[i].flags & TEST_OVERLAY) &&
                                    !igt_crtc_get_plane_type(crtc,
                                                             DRM_PLANE_TYPE_OVERLAY))


-- 
Jani Nikula, Intel

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

* Re: [PATCH i-g-t] tests/kms_plane_cursor: limit simulation to first and last CRTC
  2026-11-24 11:02 ` Jani Nikula
@ 2026-11-24 22:43   ` Michał Grzelak
  2026-11-25  9:38   ` B, Jeevan
  1 sibling, 0 replies; 9+ messages in thread
From: Michał Grzelak @ 2026-11-24 22:43 UTC (permalink / raw)
  To: Jani Nikula; +Cc: Jeevan B, igt-dev, karthik.b.s

On Tue, Nov 24, 2026 at 01:02:33PM GMT, Jani Nikula wrote:
> On Tue, 24 Nov 2026, Jeevan B <jeevan.b@intel.com> wrote:
> > 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.
> 
> I think you're overcomplicating things for something that should be
> simplified.
> 
> I don't know what to say. I don't think my review comments are being
> understood.
> 
> Below is what I meant, maybe C is the lingua franca. Use the first and
> last pipes on simulation, all otherwise. And keep the simulation
> conditional stuff mostly out of the main test loops, because it
> complicates everything.
> 
> Also Cc: Michał, this is what I meant in my comments to you too. There's
> no need for those complicated arrays with bools.

Looks like I fell for quick & dirty solution with those arrays of bools.
Sorry about that chief.

BR,
Michał

> 
> 
> BR,
> Jani.
> 
> 
> PS. It's untested.
> 
> 
> diff --git a/tests/kms_plane_cursor.c b/tests/kms_plane_cursor.c
> index 4b69f1a17e24..a1111245fb0d 100644
> --- a/tests/kms_plane_cursor.c
> +++ b/tests/kms_plane_cursor.c
> @@ -284,6 +284,27 @@ static void test_cursor(data_t *data, int size, unsigned int flags)
>         test_cursor_spots(data, size, flags);
>  }
>  
> +static uint32_t get_crtc_index_mask(igt_display_t *display)
> +{
> +       igt_crtc_t *crtc, *first_pipe_crtc = NULL, *last_pipe_crtc = NULL;
> +       __maybe_unused igt_output_t *output;
> +       uint32_t crtc_index_mask = 0;
> +
> +       for_each_crtc_with_single_output(display, crtc, output) {
> +               if (!first_pipe_crtc || crtc->hardware_pipe < first_pipe_crtc->hardware_pipe)
> +                       first_pipe_crtc = crtc;
> +               if (!last_pipe_crtc || crtc->hardware_pipe > last_pipe_crtc->hardware_pipe)
> +                       last_pipe_crtc = crtc;
> +               crtc_index_mask |= 1 << crtc->crtc_index;
> +       }
> +
> +       if (igt_run_in_simulation() && first_pipe_crtc && last_pipe_crtc)
> +               crtc_index_mask = 1 << first_pipe_crtc->crtc_index |
> +                       1 << last_pipe_crtc->crtc_index;
> +
> +       return crtc_index_mask;
> +}
> +
>  int igt_main()
>  {
>         static const int cursor_sizes[] = { 64, 128, 256 };
> @@ -291,6 +312,7 @@ int igt_main()
>         igt_crtc_t *crtc;
>         igt_output_t *output;
>         igt_display_t *display;
> +       uint32_t crtc_index_mask = 0;
>         int i, j;
>         struct {
>                 const char *name;
> @@ -322,6 +344,8 @@ int igt_main()
>                 igt_assert(ret == 0 || errno == EINVAL);
>  
>                 kmstest_set_vt_graphics_mode();
> +
> +               crtc_index_mask = get_crtc_index_mask(&data.display);
>         }
>  
>         for (i = 0; i < ARRAY_SIZE(tests); i++) {
> @@ -329,6 +353,9 @@ int igt_main()
>                 igt_subtest_with_dynamic_f("%s", tests[i].name) {
>                         for_each_crtc_with_single_output(&data.display, crtc,
>                                                          output) {
> +                               if (!(crtc_index_mask & (1 << crtc->crtc_index)))
> +                                       continue;
> +
>                                 if ((tests[i].flags & TEST_OVERLAY) &&
>                                     !igt_crtc_get_plane_type(crtc,
>                                                              DRM_PLANE_TYPE_OVERLAY))
> 
> 
> -- 
> Jani Nikula, Intel

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

* RE: [PATCH i-g-t] tests/kms_plane_cursor: limit simulation to first and last CRTC
  2026-11-24 11:02 ` Jani Nikula
  2026-11-24 22:43   ` Michał Grzelak
@ 2026-11-25  9:38   ` B, Jeevan
  1 sibling, 0 replies; 9+ messages in thread
From: B, Jeevan @ 2026-11-25  9:38 UTC (permalink / raw)
  To: Nikula, Jani, igt-dev@lists.freedesktop.org; +Cc: B S, Karthik, Grzelak, Michal

> -----Original Message-----
> From: Nikula, Jani <jani.nikula@intel.com>
> Sent: Tuesday, November 24, 2026 4:33 PM
> To: B, Jeevan <jeevan.b@intel.com>; igt-dev@lists.freedesktop.org
> Cc: B S, Karthik <karthik.b.s@intel.com>; B, Jeevan <jeevan.b@intel.com>;
> Grzelak, Michal <michal.grzelak@intel.com>
> Subject: Re: [PATCH i-g-t] tests/kms_plane_cursor: limit simulation to first and
> last CRTC
> 
> On Tue, 24 Nov 2026, Jeevan B <jeevan.b@intel.com> wrote:
> > 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.
> 
> I think you're overcomplicating things for something that should be simplified.
> 
> I don't know what to say. I don't think my review comments are being
> understood.
> 
> Below is what I meant, maybe C is the lingua franca. Use the first and last
> pipes on simulation, all otherwise. And keep the simulation conditional stuff
> mostly out of the main test loops, because it complicates everything.
> 
> Also Cc: Michał, this is what I meant in my comments to you too. There's no
> need for those complicated arrays with bools.
> 
> 
> BR,
> Jani.

Hi Jani,

  Sorry for misreading your earlier comments. I was trying some overly
  complicated stuff and got lost in my own thoughts. Thanks for the code,
  that made it clear. The pipe_output_valid()/run_pipe() split and the
  separate simulation path weren't needed here.

  v5 uses your approach: a CRTC index mask computed once in the fixture,
  and the existing loop skips CRTCs not in it.

  BR,
  Jeevan

> 
> 
> PS. It's untested.
> 
> 
> diff --git a/tests/kms_plane_cursor.c b/tests/kms_plane_cursor.c index
> 4b69f1a17e24..a1111245fb0d 100644
> --- a/tests/kms_plane_cursor.c
> +++ b/tests/kms_plane_cursor.c
> @@ -284,6 +284,27 @@ static void test_cursor(data_t *data, int size,
> unsigned int flags)
>         test_cursor_spots(data, size, flags);  }
> 
> +static uint32_t get_crtc_index_mask(igt_display_t *display) {
> +       igt_crtc_t *crtc, *first_pipe_crtc = NULL, *last_pipe_crtc = NULL;
> +       __maybe_unused igt_output_t *output;
> +       uint32_t crtc_index_mask = 0;
> +
> +       for_each_crtc_with_single_output(display, crtc, output) {
> +               if (!first_pipe_crtc || crtc->hardware_pipe < first_pipe_crtc-
> >hardware_pipe)
> +                       first_pipe_crtc = crtc;
> +               if (!last_pipe_crtc || crtc->hardware_pipe > last_pipe_crtc-
> >hardware_pipe)
> +                       last_pipe_crtc = crtc;
> +               crtc_index_mask |= 1 << crtc->crtc_index;
> +       }
> +
> +       if (igt_run_in_simulation() && first_pipe_crtc && last_pipe_crtc)
> +               crtc_index_mask = 1 << first_pipe_crtc->crtc_index |
> +                       1 << last_pipe_crtc->crtc_index;
> +
> +       return crtc_index_mask;
> +}
> +
>  int igt_main()
>  {
>         static const int cursor_sizes[] = { 64, 128, 256 }; @@ -291,6 +312,7 @@
> int igt_main()
>         igt_crtc_t *crtc;
>         igt_output_t *output;
>         igt_display_t *display;
> +       uint32_t crtc_index_mask = 0;
>         int i, j;
>         struct {
>                 const char *name;
> @@ -322,6 +344,8 @@ int igt_main()
>                 igt_assert(ret == 0 || errno == EINVAL);
> 
>                 kmstest_set_vt_graphics_mode();
> +
> +               crtc_index_mask = get_crtc_index_mask(&data.display);
>         }
> 
>         for (i = 0; i < ARRAY_SIZE(tests); i++) { @@ -329,6 +353,9 @@ int
> igt_main()
>                 igt_subtest_with_dynamic_f("%s", tests[i].name) {
>                         for_each_crtc_with_single_output(&data.display, crtc,
>                                                          output) {
> +                               if (!(crtc_index_mask & (1 << crtc->crtc_index)))
> +                                       continue;
> +
>                                 if ((tests[i].flags & TEST_OVERLAY) &&
>                                     !igt_crtc_get_plane_type(crtc,
>                                                              DRM_PLANE_TYPE_OVERLAY))
> 
> 
> --
> Jani Nikula, Intel

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

* [PATCH i-g-t] tests/kms_plane_cursor: limit simulation to first and last CRTC
@ 2026-11-25  9:41 Jeevan B
  0 siblings, 0 replies; 9+ messages in thread
From: Jeevan B @ 2026-11-25  9:41 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 pipe when running in simulation,
which keeps coverage while avoiding the timeout.

Compute a CRTC index mask once in the fixture, holding only the first
and last pipe in simulation and all CRTCs otherwise, and skip CRTCs not
in the mask in the existing loop. This keeps the simulation handling
out of the main test loops.

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.
v5:
 - Use a CRTC index mask computed up front.

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

diff --git a/tests/kms_plane_cursor.c b/tests/kms_plane_cursor.c
index 4b69f1a17..a1111245f 100644
--- a/tests/kms_plane_cursor.c
+++ b/tests/kms_plane_cursor.c
@@ -284,6 +284,27 @@ static void test_cursor(data_t *data, int size, unsigned int flags)
 	test_cursor_spots(data, size, flags);
 }
 
+static uint32_t get_crtc_index_mask(igt_display_t *display)
+{
+	igt_crtc_t *crtc, *first_pipe_crtc = NULL, *last_pipe_crtc = NULL;
+	__maybe_unused igt_output_t *output;
+	uint32_t crtc_index_mask = 0;
+
+	for_each_crtc_with_single_output(display, crtc, output) {
+		if (!first_pipe_crtc || crtc->hardware_pipe < first_pipe_crtc->hardware_pipe)
+			first_pipe_crtc = crtc;
+		if (!last_pipe_crtc || crtc->hardware_pipe > last_pipe_crtc->hardware_pipe)
+			last_pipe_crtc = crtc;
+		crtc_index_mask |= 1 << crtc->crtc_index;
+	}
+
+	if (igt_run_in_simulation() && first_pipe_crtc && last_pipe_crtc)
+		crtc_index_mask = 1 << first_pipe_crtc->crtc_index |
+			1 << last_pipe_crtc->crtc_index;
+
+	return crtc_index_mask;
+}
+
 int igt_main()
 {
 	static const int cursor_sizes[] = { 64, 128, 256 };
@@ -291,6 +312,7 @@ int igt_main()
 	igt_crtc_t *crtc;
 	igt_output_t *output;
 	igt_display_t *display;
+	uint32_t crtc_index_mask = 0;
 	int i, j;
 	struct {
 		const char *name;
@@ -322,6 +344,8 @@ int igt_main()
 		igt_assert(ret == 0 || errno == EINVAL);
 
 		kmstest_set_vt_graphics_mode();
+
+		crtc_index_mask = get_crtc_index_mask(&data.display);
 	}
 
 	for (i = 0; i < ARRAY_SIZE(tests); i++) {
@@ -329,6 +353,9 @@ int igt_main()
 		igt_subtest_with_dynamic_f("%s", tests[i].name) {
 			for_each_crtc_with_single_output(&data.display, crtc,
 							 output) {
+				if (!(crtc_index_mask & (1 << crtc->crtc_index)))
+					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] 9+ messages in thread

end of thread, other threads:[~2026-11-25 10:19 UTC | newest]

Thread overview: 9+ 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
2026-11-24 11:02 ` Jani Nikula
2026-11-24 22:43   ` Michał Grzelak
2026-11-25  9:38   ` B, Jeevan
  -- strict thread matches above, loose matches on Subject: below --
2026-11-25  9:41 Jeevan B
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 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.