public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [PATCH i-g-t v2 15/23] tests/kms_plane_multiple: Use igt_crtc_t instead of enum pipe
Date: Sat, 21 Feb 2026 05:19:54 +0200	[thread overview]
Message-ID: <20260221032003.30936-16-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20260221032003.30936-1-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Convert kms_plane_multiple from 'enum pipe' to 'igt_crtc_t'.

The use of multiple crtcs in some places causes some extra
complications here.

 #include "scripts/iterators.cocci"

@multi_func@
typedef igt_crtc_t;
identifier FUNC, PIPE1, PIPE2;
parameter list[N] P;
parameter list[N2] P2;
@@
FUNC(P
-	,enum pipe PIPE1
+	,igt_crtc_t *crtc1
	,P2
-	,enum pipe PIPE2
+	,igt_crtc_t *crtc2
	,...)
{
<+...
(
- igt_crtc_for_pipe(..., PIPE1)
+ crtc1
|
- kmsetst_crtc_name(PIPE1)
+ igt_crtc_name(crtc1)
|
- PIPE1
+ crtc1->pipe
|
- igt_crtc_for_pipe(..., PIPE2)
+ crtc2
|
- kmsetst_crtc_name(PIPE2)
+ igt_crtc_name(crtc2)
|
- PIPE2
+ crtc2->pipe
)
...+>
}

@depends on multi_func@
identifier multi_func.FUNC;
expression PIPE1, PIPE2;
expression list[multi_func.N] EP;
expression list[multi_func.N2] EP2;
@@
 FUNC(EP
-	,PIPE1
+	,igt_crtc_for_pipe(display, PIPE1)
	,EP2
-	,PIPE2
+	,igt_crtc_for_pipe(display, PIPE2)
	,...)

@func1@
typedef igt_output_t;
typedef igt_crtc_t;
identifier FUNC, PIPE, CRTC;
parameter list[N] P;
@@
FUNC(P
-	,enum pipe PIPE
+	,igt_crtc_t *CRTC
	,...)
{
...
(
- igt_crtc_t *CRTC = igt_crtc_for_pipe(..., PIPE);
|
- igt_crtc_t *CRTC;
... when != PIPE = ...
- CRTC = igt_crtc_for_pipe(..., PIPE);
)
<... when != PIPE = ...
(
- igt_crtc_for_pipe(..., PIPE)
+ CRTC
|
- kmstest_pipe_name(PIPE)
+ igt_crtc_name(CRTC)
|
- PIPE
+ CRTC->pipe
)
...>
}

@depends on func1@
identifier func1.FUNC;
expression list[func1.N] EP;
expression PIPE;
@@
FUNC(EP
-	,PIPE
+	,igt_crtc_for_pipe(display, PIPE)
	,...)

@func2@
typedef igt_crtc_t;
identifier FUNC, PIPE;
parameter list[N] P;
@@
FUNC(P
-	,enum pipe PIPE
+	,igt_crtc_t *crtc
	,...)
{
<+... when != PIPE = ...
(
- igt_crtc_for_pipe(..., PIPE)
+ crtc
|
- kmstest_pipe_name(PIPE)
+ igt_crtc_name(crtc)
|
- PIPE
+ crtc->pipe
)
...+>
}

@depends on func2@
identifier func2.FUNC;
expression list[func2.N] EP;
expression PIPE;
@@
FUNC(EP
-	,PIPE
+	,igt_crtc_for_pipe(display, PIPE)
	,...)

@@
igt_crtc_t *CRTC;
@@
- igt_crtc_for_pipe(..., CRTC->pipe)
+ CRTC

@@
typedef igt_display_t;
identifier DISPLAY;
@@
- igt_display_t *DISPLAY = ...;
... when != DISPLAY

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 tests/kms_plane_multiple.c | 88 ++++++++++++++++++++++----------------
 1 file changed, 52 insertions(+), 36 deletions(-)

diff --git a/tests/kms_plane_multiple.c b/tests/kms_plane_multiple.c
index 105ea50d464e..1a7b319cdcb5 100644
--- a/tests/kms_plane_multiple.c
+++ b/tests/kms_plane_multiple.c
@@ -105,10 +105,9 @@ struct {
 /*
  * Common code across all tests, acting on data_t
  */
-static void test_init(data_t *data, enum pipe pipe, int n_planes)
+static void test_init(data_t *data, igt_crtc_t *crtc, int n_planes)
 {
-	igt_display_t *display = &data->display;
-	data->pipe_crc1 = igt_crtc_crc_new(igt_crtc_for_pipe(display, pipe),
+	data->pipe_crc1 = igt_crtc_crc_new(crtc,
 					   IGT_PIPE_CRC_SOURCE_AUTO);
 
 	data->plane1 = calloc(n_planes, sizeof(*data->plane1));
@@ -136,16 +135,17 @@ static void test_fini(data_t *data, igt_output_t *output, int n_planes)
 }
 
 static void
-get_reference_crc(data_t *data, igt_output_t *output, enum pipe pipe, igt_pipe_crc_t *pipe_crc,
-	      color_t *color, igt_plane_t **plane, uint64_t modifier, igt_crc_t *ref_crc)
+get_reference_crc(data_t *data, igt_output_t *output, igt_crtc_t *crtc,
+		  igt_pipe_crc_t *pipe_crc,
+		  color_t *color, igt_plane_t **plane, uint64_t modifier,
+		  igt_crc_t *ref_crc)
 {
-	igt_display_t *display = &data->display;
 	drmModeModeInfo *mode;
 	igt_plane_t *primary;
 	int ret;
 
 	igt_display_reset(&data->display);
-	igt_output_set_crtc(output, igt_crtc_for_pipe(display, pipe));
+	igt_output_set_crtc(output, crtc);
 
 	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 	plane[primary->index] = primary;
@@ -202,11 +202,10 @@ create_fb_for_mode_position(data_t *data, igt_output_t *output, drmModeModeInfo
 
 
 static void
-prepare_planes(data_t *data, enum pipe pipe_id, color_t *color, igt_plane_t **plane,
+prepare_planes(data_t *data, igt_crtc_t *crtc, color_t *color,
+	       igt_plane_t **plane,
 	       uint64_t modifier, int max_planes, igt_output_t *output, igt_fb_t *fb)
 {
-	igt_display_t *display = &data->display;
-	igt_crtc_t *crtc = igt_crtc_for_pipe(display, pipe_id);
 	drmModeModeInfo *mode;
 	igt_plane_t *primary;
 	int *x;
@@ -325,7 +324,7 @@ prepare_planes(data_t *data, enum pipe pipe_id, color_t *color, igt_plane_t **pl
  */
 
 static void
-test_plane_position_with_output(data_t *data, enum pipe pipe,
+test_plane_position_with_output(data_t *data, igt_crtc_t *crtc,
 				igt_output_t *output, int n_planes,
 				uint64_t modifier)
 {
@@ -339,7 +338,7 @@ test_plane_position_with_output(data_t *data, enum pipe pipe,
 	char info[256];
 
 	igt_info("Using (pipe %s + %s) to run the subtest.\n",
-		 kmstest_pipe_name(pipe), igt_output_name(output));
+		 igt_crtc_name(crtc), igt_output_name(output));
 
 	if (opt.iterations == LOOP_FOREVER) {
 		loop_forever = true;
@@ -350,18 +349,21 @@ test_plane_position_with_output(data_t *data, enum pipe pipe,
 			iterations, iterations > 1 ? "iterations" : "iteration");
 	}
 
-	test_init(data, pipe, n_planes);
+	test_init(data, crtc, n_planes);
 
-	get_reference_crc(data, output, pipe, data->pipe_crc1, &blue,
+	get_reference_crc(data, output,
+			  crtc,
+			  data->pipe_crc1, &blue,
 			  data->plane1, modifier, &data->ref_crc1);
 
 	/* Find out how many planes are allowed simultaneously */
 	do {
 		c++;
-		prepare_planes(data, pipe, &blue, data->plane1, modifier, c, output, data->fb1);
+		prepare_planes(data, crtc, &blue,
+			       data->plane1, modifier, c, output, data->fb1);
 		err = igt_display_try_commit2(&data->display, COMMIT_ATOMIC);
 
-		for_each_plane_on_pipe(&data->display, pipe, plane)
+		for_each_plane_on_pipe(&data->display, crtc->pipe, plane)
 			igt_plane_set_fb(plane, NULL);
 
 		igt_output_set_crtc(output, NULL);
@@ -375,14 +377,15 @@ test_plane_position_with_output(data_t *data, enum pipe pipe,
 		c--;
 
 	igt_info("Testing connector %s using pipe %s with %d planes %s with seed %d\n",
-		 igt_output_name(output), kmstest_pipe_name(pipe), c,
+		 igt_output_name(output), igt_crtc_name(crtc), c,
 		 info, opt.seed);
 
 	i = 0;
 	while (i < iterations || loop_forever) {
 
 		/* randomize planes and set up the holes */
-		prepare_planes(data, pipe, &blue, data->plane1, modifier, c, output, data->fb1);
+		prepare_planes(data, crtc, &blue,
+			       data->plane1, modifier, c, output, data->fb1);
 
 		igt_display_commit2(&data->display, COMMIT_ATOMIC);
 		igt_pipe_crc_start(data->pipe_crc1);
@@ -391,7 +394,7 @@ test_plane_position_with_output(data_t *data, enum pipe pipe,
 		igt_assert_crc_equal(&data->ref_crc1, &crc);
 		igt_pipe_crc_stop(data->pipe_crc1);
 
-		for_each_plane_on_pipe(&data->display, pipe, plane)
+		for_each_plane_on_pipe(&data->display, crtc->pipe, plane)
 			igt_plane_set_fb(plane, NULL);
 
 		igt_output_set_crtc(output, NULL);
@@ -407,27 +410,29 @@ test_plane_position_with_output(data_t *data, enum pipe pipe,
 }
 
 static void
-test_plane_position(data_t *data, enum pipe pipe, igt_output_t *output, uint64_t modifier)
+test_plane_position(data_t *data, igt_crtc_t *crtc, igt_output_t *output,
+		    uint64_t modifier)
 {
-	igt_display_t *display = &data->display;
 	int n_planes = opt.all_planes ?
-			igt_crtc_for_pipe(display, pipe)->n_planes : DEFAULT_N_PLANES;
+			crtc->n_planes : DEFAULT_N_PLANES;
 
 	if (!opt.user_seed)
 		opt.seed = time(NULL);
 
 	srand(opt.seed);
 
-	test_plane_position_with_output(data, pipe, output,
+	test_plane_position_with_output(data,
+					crtc,
+					output,
 					n_planes, modifier);
 }
 
-static void test_init_2_display(data_t *data, enum pipe pipe1, enum pipe pipe2, int n_planes)
+static void test_init_2_display(data_t *data, igt_crtc_t *crtc1,
+				igt_crtc_t *crtc2, int n_planes)
 {
-	igt_display_t *display = &data->display;
-	data->pipe_crc1 = igt_crtc_crc_new(igt_crtc_for_pipe(display, pipe1),
+	data->pipe_crc1 = igt_crtc_crc_new(crtc1,
 					   IGT_PIPE_CRC_SOURCE_AUTO);
-	data->pipe_crc2 = igt_crtc_crc_new(igt_crtc_for_pipe(display, pipe2),
+	data->pipe_crc2 = igt_crtc_crc_new(crtc2,
 					   IGT_PIPE_CRC_SOURCE_AUTO);
 
 	data->plane1 = calloc(n_planes, sizeof(*data->plane1));
@@ -466,7 +471,8 @@ static void test_fini_2_display(data_t *data)
 	igt_display_reset(&data->display);
 }
 
-static void test_plane_position_2_display(data_t *data, enum pipe pipe1, enum pipe pipe2,
+static void test_plane_position_2_display(data_t *data, igt_crtc_t *crtc1,
+					  igt_crtc_t *crtc2,
 					  igt_output_t *output1, igt_output_t *output2,
 					  uint64_t modifier)
 {
@@ -483,15 +489,22 @@ static void test_plane_position_2_display(data_t *data, enum pipe pipe1, enum pi
 	 * default value. This might need to be tweaked if we see any bw related failures.
 	 */
 
-	test_init_2_display(data, pipe1, pipe2, n_planes);
-	get_reference_crc(data, output1, pipe1, data->pipe_crc1, &blue,
+	test_init_2_display(data, crtc1,
+			    crtc2, n_planes);
+	get_reference_crc(data, output1,
+			  crtc1,
+			  data->pipe_crc1, &blue,
 			  data->plane1, DRM_FORMAT_MOD_LINEAR, &data->ref_crc1);
-	get_reference_crc(data, output2, pipe2, data->pipe_crc2, &blue,
+	get_reference_crc(data, output2,
+			  crtc2,
+			  data->pipe_crc2, &blue,
 			  data->plane2, DRM_FORMAT_MOD_LINEAR, &data->ref_crc2);
 
-	prepare_planes(data, pipe1, &blue, data->plane1,
+	prepare_planes(data, crtc1, &blue,
+		       data->plane1,
 		       modifier, 2, output1, data->fb1);
-	prepare_planes(data, pipe2, &blue, data->plane2,
+	prepare_planes(data, crtc2, &blue,
+		       data->plane2,
 		       modifier, 2, output2, data->fb2);
 
 	igt_display_commit2(&data->display, COMMIT_ATOMIC);
@@ -554,8 +567,9 @@ static void run_2_display_test(data_t *data, uint64_t modifier, const char *name
 						       igt_crtc_name(crtc2),
 						       output2->name)
 						test_plane_position_2_display(data,
-									      crtc->pipe,
-									      crtc2->pipe,
+									      crtc
+									      ,
+									      crtc2,
 									      output1, output2,
 									      modifier);
 
@@ -584,7 +598,9 @@ static void run_test(data_t *data, uint64_t modifier, const char *name)
 			continue;
 
 		igt_dynamic_f("pipe-%s-%s", igt_crtc_name(crtc), output->name)
-			test_plane_position(data, crtc->pipe, output,
+			test_plane_position(data,
+					    crtc,
+					    output,
 					    modifier);
 	}
 }
-- 
2.52.0


  parent reply	other threads:[~2026-02-21  3:21 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-21  3:19 [PATCH i-g-t v2 00/23] tests/kms: More igt_crtc_t conversions Ville Syrjala
2026-02-21  3:19 ` [PATCH i-g-t v2 01/23] tests/intel/kms_psr: Don't pass uninitialized 'pipe' to intel_fbc_supported_on_chipset() Ville Syrjala
2026-02-23 11:22   ` Jani Nikula
2026-02-24  7:28     ` Ville Syrjälä
2026-02-23 11:23   ` Jani Nikula
2026-02-23 12:01     ` Jani Nikula
2026-02-24  8:49   ` [PATCH i-g-t v3 " Ville Syrjala
2026-02-24  8:53     ` Jani Nikula
2026-02-21  3:19 ` [PATCH i-g-t v2 02/23] tests/intel/kms_psr2_sf: Don't pass zero initialized 'data.pipe' " Ville Syrjala
2026-02-24  8:51   ` [PATCH i-g-t v3 " Ville Syrjala
2026-02-24  8:56     ` Jani Nikula
2026-02-21  3:19 ` [PATCH i-g-t v2 03/23] tests/intel/kms_flip_scaled_crc: Remove unused 'enum pipe pipe' Ville Syrjala
2026-02-23 11:34   ` Jani Nikula
2026-02-21  3:19 ` [PATCH i-g-t v2 04/23] tests/kms_concurrent: Actually run the test over all connected crtcs Ville Syrjala
2026-02-23  3:09   ` Karthik B S
2026-02-21  3:19 ` [PATCH i-g-t v2 05/23] tests/amdgpu/amd_abm: Don't use uninitialized 'pipe' Ville Syrjala
2026-02-24 14:08   ` Jani Nikula
2026-02-25  9:18     ` Ville Syrjälä
2026-02-21  3:19 ` [PATCH i-g-t v2 06/23] tests/kms: Use 'enum pipe' over int' Ville Syrjala
2026-02-23 11:44   ` Jani Nikula
2026-02-21  3:19 ` [PATCH i-g-t v2 07/23] lib/kms: Add igt_crtc_for_crtc_id() Ville Syrjala
2026-02-23 11:46   ` Jani Nikula
2026-02-21  3:19 ` [PATCH i-g-t v2 08/23] tests/kms_lease: Use igt_crtc_t instead of enum pipe Ville Syrjala
2026-02-23 11:48   ` Jani Nikula
2026-02-21  3:19 ` [PATCH i-g-t v2 09/23] tests/kms_lease: Pass lease_t to prepare_crtc() Ville Syrjala
2026-02-23 11:49   ` Jani Nikula
2026-02-21  3:19 ` [PATCH i-g-t v2 10/23] tests/intel/kms_frontbuffer_tracking: Use igt_crtc_t instead of enum pipe Ville Syrjala
2026-02-23 11:52   ` Jani Nikula
2026-02-21  3:19 ` [PATCH i-g-t v2 11/23] tests/kms_plane_scaling: " Ville Syrjala
2026-02-23 14:06   ` Jani Nikula
2026-02-21  3:19 ` [PATCH i-g-t v2 12/23] tests/drm_read: " Ville Syrjala
2026-02-24  8:58   ` Jani Nikula
2026-02-21  3:19 ` [PATCH i-g-t v2 13/23] tests/intel/kms_psr2_sf: Convert pipes[] to crtcs[] Ville Syrjala
2026-02-24  9:09   ` Jani Nikula
2026-02-21  3:19 ` [PATCH i-g-t v2 14/23] tests/kms_vblank: Use igt_crtc_t instead of enum pipe Ville Syrjala
2026-02-24 13:43   ` Jani Nikula
2026-02-21  3:19 ` Ville Syrjala [this message]
2026-02-24 13:48   ` [PATCH i-g-t v2 15/23] tests/kms_plane_multiple: " Jani Nikula
2026-02-25  7:44     ` Ville Syrjälä
2026-02-21  3:19 ` [PATCH i-g-t v2 16/23] tests/kms_tiled_display: " Ville Syrjala
2026-02-24 13:48   ` Jani Nikula
2026-02-21  3:19 ` [PATCH i-g-t v2 17/23] tests/intel/kms_psr: " Ville Syrjala
2026-02-24 13:49   ` Jani Nikula
2026-02-21  3:19 ` [PATCH i-g-t v2 18/23] tests/kms_prime: " Ville Syrjala
2026-02-24 13:50   ` Jani Nikula
2026-02-21  3:19 ` [PATCH i-g-t v2 19/23] tests/chamelium: " Ville Syrjala
2026-02-24 13:51   ` Jani Nikula
2026-02-21  3:19 ` [PATCH i-g-t v2 20/23] tests/kms: Use igt_crtc_t instead of enum pipe, part 1 Ville Syrjala
2026-02-24 13:56   ` Jani Nikula
2026-02-21  3:20 ` [PATCH i-g-t v2 21/23] tests/kms: Use igt_crtc_t instead of enum pipe, part 2 Ville Syrjala
2026-02-24 13:58   ` Jani Nikula
2026-02-21  3:20 ` [PATCH i-g-t v2 22/23] tests/kms: Use igt_crtc_t instead of enum pipe, part 3 Ville Syrjala
2026-02-24  8:51   ` [PATCH i-g-t v3 " Ville Syrjala
2026-02-24 14:04     ` Jani Nikula
2026-02-21  3:20 ` [PATCH i-g-t v2 23/23] tests/kms: Use igt_crtc_t instead of enum pipe, part 4 Ville Syrjala
2026-02-24 14:06   ` Jani Nikula
2026-02-21  3:59 ` ✓ Xe.CI.BAT: success for tests/kms: More igt_crtc_t conversions (rev2) Patchwork
2026-02-21  4:13 ` ✓ i915.CI.BAT: " Patchwork
2026-02-21 16:12 ` ✗ i915.CI.Full: failure " Patchwork
2026-02-23 13:25 ` ✗ Xe.CI.FULL: " Patchwork
2026-02-24 12:43 ` ✓ Xe.CI.BAT: success for tests/kms: More igt_crtc_t conversions (rev5) Patchwork
2026-02-24 12:58 ` ✓ i915.CI.BAT: " Patchwork
2026-02-24 18:52 ` ✗ i915.CI.Full: failure " Patchwork
2026-02-24 22:57 ` ✓ Xe.CI.FULL: success " 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=20260221032003.30936-16-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox