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 19/23] tests/chamelium: Use igt_crtc_t instead of enum pipe
Date: Sat, 21 Feb 2026 05:19:58 +0200	[thread overview]
Message-ID: <20260221032003.30936-20-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 the remaining chamelium tests to use igt_crtc_t
instead of enum pipe. Here we specifically deal with changing
the return type of chamelium_get_pipe_for_output().

The mess inside test_hotplug() proved difficult for cocci,
so there is some special sauce for that in the semantic
patch.

 #include "scripts/iterators.cocci"

@ret_pipe@
typedef igt_output_t;
typedef igt_crtc_t;
identifier FUNC;
igt_crtc_t *CRTC;
parameter list[N] P;
@@
- enum pipe
+ igt_crtc_t *
FUNC(P)
{
<...
- return CRTC->pipe;
+ return CRTC;
...>
}

@depends on ret_pipe@
identifier ret_pipe.FUNC;
@@
- enum pipe
+ igt_crtc_t *
FUNC(...);

@depends on ret_pipe@
identifier ret_pipe.FUNC;
@@
FUNC(...)
+ ->pipe

@depends on ret_pipe@
identifier ret_pipe.FUNC, PIPE;
expression list[ret_pipe.N] EP;
@@
{ ...
  enum pipe PIPE;
+ igt_crtc_t *crtc;
<+... when != PIPE = ...
- PIPE = FUNC(EP)->pipe;
+ crtc = FUNC(EP);
+ PIPE = crtc->pipe;
...+>
}

@depends on ret_pipe@
identifier ret_pipe.FUNC;
expression list[ret_pipe.N] EP;
@@
- igt_crtc_for_pipe(..., FUNC(EP)->pipe)
+ FUNC(EP)

@@
identifier PIPE;
igt_crtc_t *CRTC;
@@
{...
if (...) {
...
- PIPE = CRTC->pipe;
...
}
<+... when != PIPE = ...
- PIPE
+ CRTC->pipe
...+>
}

@@
identifier PIPE;
igt_crtc_t *CRTC;
@@
{...
- PIPE = CRTC->pipe;
<+... when != PIPE = ...
- PIPE
+ CRTC->pipe
...+>
}

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

@@
identifier PIPE;
@@
{...
- enum pipe PIPE;
... when != PIPE
}

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

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 tests/chamelium/kms_chamelium_edid.c   | 13 +++++++------
 tests/chamelium/kms_chamelium_helper.c | 10 +++++-----
 tests/chamelium/kms_chamelium_helper.h |  2 +-
 tests/chamelium/kms_chamelium_hpd.c    |  8 ++++----
 4 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/tests/chamelium/kms_chamelium_edid.c b/tests/chamelium/kms_chamelium_edid.c
index f5647dde0d9d..e014ba3aa873 100644
--- a/tests/chamelium/kms_chamelium_edid.c
+++ b/tests/chamelium/kms_chamelium_edid.c
@@ -287,7 +287,7 @@ static void edid_stress_resolution(chamelium_data_t *data,
 		drmModeModeInfo mode;
 		struct igt_fb fb = { 0 };
 		igt_output_t *output;
-		enum pipe pipe;
+		igt_crtc_t *crtc;
 		bool is_video_stable;
 		int screen_res_w, screen_res_h;
 
@@ -311,9 +311,9 @@ static void edid_stress_resolution(chamelium_data_t *data,
 		mode = chamelium_get_mode_for_port(chamelium, port);
 		chamelium_create_fb_for_mode(data, &fb, &mode);
 		output = chamelium_get_output_for_port(data, port);
-		pipe = chamelium_get_pipe_for_output(&data->display, output);
+		crtc = chamelium_get_pipe_for_output(&data->display, output);
 		igt_output_set_crtc(output,
-				    igt_crtc_for_pipe(output->display, pipe));
+				    crtc);
 		chamelium_enable_output(data, port, output, &mode, &fb);
 
 		/* Capture the screen resolution and verify. */
@@ -350,7 +350,7 @@ static void edid_resolution_list(chamelium_data_t *data,
 	int count_modes;
 	int i;
 	igt_output_t *output;
-	enum pipe pipe;
+	igt_crtc_t *crtc;
 
 	chamelium_unplug(chamelium, port);
 	chamelium_set_edid(data, port, IGT_CUSTOM_EDID_FULL);
@@ -366,8 +366,9 @@ static void edid_resolution_list(chamelium_data_t *data,
 	count_modes = connector->count_modes;
 
 	output = chamelium_get_output_for_port(data, port);
-	pipe = chamelium_get_pipe_for_output(&data->display, output);
-	igt_output_set_crtc(output, igt_crtc_for_pipe(output->display, pipe));
+	crtc = chamelium_get_pipe_for_output(&data->display, output);
+	igt_output_set_crtc(output,
+			    crtc);
 
 	for (i = 0; i < count_modes; ++i)
 		igt_debug("#%d %s %uHz\n", i, modes[i].name, modes[i].vrefresh);
diff --git a/tests/chamelium/kms_chamelium_helper.c b/tests/chamelium/kms_chamelium_helper.c
index c15a3096c5fe..ea30ff42d9a9 100644
--- a/tests/chamelium/kms_chamelium_helper.c
+++ b/tests/chamelium/kms_chamelium_helper.c
@@ -133,7 +133,7 @@ igt_output_t *chamelium_prepare_output(chamelium_data_t *data,
 {
 	igt_display_t *display = &data->display;
 	igt_output_t *output;
-	enum pipe pipe;
+	igt_crtc_t *crtc;
 
 	/* The chamelium's default EDID has a lot of resolutions, way more then
 	 * we need to test. Additionally the default EDID doesn't support HDMI
@@ -152,8 +152,8 @@ igt_output_t *chamelium_prepare_output(chamelium_data_t *data,
 	/* Refresh pipe to update connected status */
 	igt_output_set_crtc(output, NULL);
 
-	pipe = chamelium_get_pipe_for_output(display, output);
-	igt_output_set_crtc(output, igt_crtc_for_pipe(display, pipe));
+	crtc = chamelium_get_pipe_for_output(display, output);
+	igt_output_set_crtc(output, crtc);
 
 	return output;
 }
@@ -201,7 +201,7 @@ void chamelium_enable_output(chamelium_data_t *data,
 }
 
 /* Return pipe attached to @outpu.t */
-enum pipe chamelium_get_pipe_for_output(igt_display_t *display,
+igt_crtc_t * chamelium_get_pipe_for_output(igt_display_t *display,
 					igt_output_t *output)
 {
 	igt_crtc_t *crtc;
@@ -216,7 +216,7 @@ enum pipe chamelium_get_pipe_for_output(igt_display_t *display,
 		}
 
 		igt_output_set_crtc(output, NULL);
-		return crtc->pipe;
+		return crtc;
 	}
 
 	igt_assert_f(false, "No pipe found for output %s\n",
diff --git a/tests/chamelium/kms_chamelium_helper.h b/tests/chamelium/kms_chamelium_helper.h
index 7941ca9d3139..6060796661c4 100644
--- a/tests/chamelium/kms_chamelium_helper.h
+++ b/tests/chamelium/kms_chamelium_helper.h
@@ -97,7 +97,7 @@ igt_output_t *chamelium_prepare_output(chamelium_data_t *data,
 void chamelium_enable_output(chamelium_data_t *data,
 			     struct chamelium_port *port, igt_output_t *output,
 			     drmModeModeInfo *mode, struct igt_fb *fb);
-enum pipe chamelium_get_pipe_for_output(igt_display_t *display,
+igt_crtc_t * chamelium_get_pipe_for_output(igt_display_t *display,
 					igt_output_t *output);
 
 int chamelium_get_pattern_fb(chamelium_data_t *data, size_t width,
diff --git a/tests/chamelium/kms_chamelium_hpd.c b/tests/chamelium/kms_chamelium_hpd.c
index 29028ce6f7da..bd8731c0216b 100644
--- a/tests/chamelium/kms_chamelium_hpd.c
+++ b/tests/chamelium/kms_chamelium_hpd.c
@@ -230,7 +230,7 @@ static void test_hotplug(chamelium_data_t *data, struct chamelium_port *port,
 			 int toggle_count, enum test_modeset_mode modeset_mode)
 {
 	int i;
-	enum pipe pipe;
+	igt_crtc_t *crtc;
 	struct igt_fb fb = { 0 };
 	drmModeModeInfo mode;
 	struct udev_monitor *mon = igt_watch_uevents();
@@ -259,15 +259,15 @@ static void test_hotplug(chamelium_data_t *data, struct chamelium_port *port,
 				 * connected */
 				output = chamelium_get_output_for_port(data,
 								       port);
-				pipe = chamelium_get_pipe_for_output(
-					&data->display, output);
+				crtc = chamelium_get_pipe_for_output(&data->display,
+								     output);
 				mode = chamelium_get_mode_for_port(
 					data->chamelium, port);
 				chamelium_create_fb_for_mode(data, &fb, &mode);
 			}
 
 			igt_output_set_crtc(output,
-					    igt_crtc_for_pipe(output->display, pipe));
+					    crtc);
 			chamelium_enable_output(data, port, output, &mode, &fb);
 		}
 
-- 
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 ` [PATCH i-g-t v2 15/23] tests/kms_plane_multiple: " Ville Syrjala
2026-02-24 13:48   ` 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 ` Ville Syrjala [this message]
2026-02-24 13:51   ` [PATCH i-g-t v2 19/23] tests/chamelium: " 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-20-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