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 12/17] tests/intel/kms_pipe_b_c_ivb: Use igt_crtc_t instead of enum pipe
Date: Wed, 11 Feb 2026 18:33:59 +0200	[thread overview]
Message-ID: <20260211163404.2018-13-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20260211163404.2018-1-ville.syrjala@linux.intel.com>

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

Convert the use of enum pipe to igt_crtc_t in
tests/intel/kms_pipe_b_c_ivb.

This test wants to specifically use pipes B and C,
thus we are left with a few igt_crtc_for_pipe()
calls even after the conversion.

 #include "scripts/iterators.cocci"

@func1@
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
|
- kmsetst_crtc_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(&data->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
|
- kmsetst_crtc_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(&data->display, PIPE)
	,...)

@@
identifier FUNC;
expression DISPLAY;
@@
FUNC(...)
{
+ igt_crtc_t *crtc_b = igt_crtc_for_pipe(DISPLAY, PIPE_B);
+ igt_crtc_t *crtc_c = igt_crtc_for_pipe(DISPLAY, PIPE_C);
<+...
(
- igt_crtc_for_pipe(DISPLAY, PIPE_B)
+ crtc_b
|
- igt_crtc_for_pipe(DISPLAY, PIPE_C)
+ crtc_c
)
...+>
}

@@
identifier CRTC;
expression PIPE;
@@
 igt_crtc_t *CRTC = igt_crtc_for_pipe(..., PIPE);
<+...
(
- kmstest_pipe_name(PIPE)
+ igt_crtc_name(CRTC)
|
- PIPE
+ CRTC->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/intel/kms_pipe_b_c_ivb.c | 102 ++++++++++++++++++++++-----------
 1 file changed, 68 insertions(+), 34 deletions(-)

diff --git a/tests/intel/kms_pipe_b_c_ivb.c b/tests/intel/kms_pipe_b_c_ivb.c
index 184d3b38fee7..d5c1ab3ff758 100644
--- a/tests/intel/kms_pipe_b_c_ivb.c
+++ b/tests/intel/kms_pipe_b_c_ivb.c
@@ -98,10 +98,8 @@ drmModeModeInfo mode_2_lanes = {
 };
 
 static int
-disable_pipe(data_t *data, enum pipe pipe, igt_output_t *output)
+disable_pipe(data_t *data, igt_crtc_t *crtc, igt_output_t *output)
 {
-	igt_display_t *display = &data->display;
-	igt_crtc_t *crtc = igt_crtc_for_pipe(display, pipe);
 	igt_plane_t *primary;
 
 	igt_output_set_crtc(output, crtc);
@@ -111,10 +109,8 @@ disable_pipe(data_t *data, enum pipe pipe, igt_output_t *output)
 }
 
 static int
-set_mode_on_pipe(data_t *data, enum pipe pipe, igt_output_t *output)
+set_mode_on_pipe(data_t *data, igt_crtc_t *crtc, igt_output_t *output)
 {
-	igt_display_t *display = &data->display;
-	igt_crtc_t *crtc = igt_crtc_for_pipe(display, pipe);
 	igt_plane_t *primary;
 	drmModeModeInfo *mode;
 	struct igt_fb fb;
@@ -137,17 +133,19 @@ set_mode_on_pipe(data_t *data, enum pipe pipe, igt_output_t *output)
 }
 
 static int
-set_big_mode_on_pipe(data_t *data, enum pipe pipe, igt_output_t *output)
+set_big_mode_on_pipe(data_t *data, igt_crtc_t *crtc, igt_output_t *output)
 {
 	igt_output_override_mode(output, &mode_3_lanes);
-	return set_mode_on_pipe(data, pipe, output);
+	return set_mode_on_pipe(data, crtc,
+				output);
 }
 
 static int
-set_normal_mode_on_pipe(data_t *data, enum pipe pipe, igt_output_t *output)
+set_normal_mode_on_pipe(data_t *data, igt_crtc_t *crtc, igt_output_t *output)
 {
 	igt_output_override_mode(output, &mode_2_lanes);
-	return set_mode_on_pipe(data, pipe, output);
+	return set_mode_on_pipe(data, crtc,
+				output);
 }
 
 static void
@@ -175,6 +173,8 @@ find_outputs(data_t *data, igt_output_t **output1, igt_output_t **output2)
 static void
 test_dpms(data_t *data)
 {
+	igt_crtc_t *crtc_b = igt_crtc_for_pipe(&data->display, PIPE_B);
+	igt_crtc_t *crtc_c = igt_crtc_for_pipe(&data->display, PIPE_C);
 	igt_output_t *output1, *output2;
 	int ret;
 
@@ -182,22 +182,28 @@ test_dpms(data_t *data)
 	find_outputs(data, &output1, &output2);
 
 	igt_info("Pipe %s will use connector %s\n",
-		 kmstest_pipe_name(PIPE_B), igt_output_name(output1));
+		 igt_crtc_name(crtc_b), igt_output_name(output1));
 	igt_info("Pipe %s will use connector %s\n",
-		 kmstest_pipe_name(PIPE_C), igt_output_name(output2));
+		 igt_crtc_name(crtc_c), igt_output_name(output2));
 
-	ret = set_big_mode_on_pipe(data, PIPE_B, output1);
+	ret = set_big_mode_on_pipe(data,
+				   crtc_b,
+				   output1);
 	igt_assert_eq(ret, 0);
 
 	kmstest_set_connector_dpms(data->drm_fd, output1->config.connector, DRM_MODE_DPMS_OFF);
 
-	ret = set_big_mode_on_pipe(data, PIPE_C, output2);
+	ret = set_big_mode_on_pipe(data,
+				   crtc_c,
+				   output2);
 	igt_assert_neq(ret, 0);
 }
 
 static void
 test_lane_reduction(data_t *data)
 {
+	igt_crtc_t *crtc_b = igt_crtc_for_pipe(&data->display, PIPE_B);
+	igt_crtc_t *crtc_c = igt_crtc_for_pipe(&data->display, PIPE_C);
 	igt_output_t *output1, *output2;
 	int ret;
 
@@ -206,23 +212,31 @@ test_lane_reduction(data_t *data)
 	find_outputs(data, &output1, &output2);
 
 	igt_info("Pipe %s will use connector %s\n",
-		 kmstest_pipe_name(PIPE_B), igt_output_name(output1));
+		 igt_crtc_name(crtc_b), igt_output_name(output1));
 	igt_info("Pipe %s will use connector %s\n",
-		 kmstest_pipe_name(PIPE_C), igt_output_name(output2));
+		 igt_crtc_name(crtc_c), igt_output_name(output2));
 
-	ret = set_big_mode_on_pipe(data, PIPE_B, output1);
+	ret = set_big_mode_on_pipe(data,
+				   crtc_b,
+				   output1);
 	igt_assert_eq(ret, 0);
 
-	ret = set_normal_mode_on_pipe(data, PIPE_B, output1);
+	ret = set_normal_mode_on_pipe(data,
+				      crtc_b,
+				      output1);
 	igt_assert_eq(ret, 0);
 
-	ret = set_normal_mode_on_pipe(data, PIPE_C, output2);
+	ret = set_normal_mode_on_pipe(data,
+				      crtc_c,
+				      output2);
 	igt_assert_eq(ret, 0);
 }
 
 static void
 test_disable_pipe_B(data_t *data)
 {
+	igt_crtc_t *crtc_b = igt_crtc_for_pipe(&data->display, PIPE_B);
+	igt_crtc_t *crtc_c = igt_crtc_for_pipe(&data->display, PIPE_C);
 	igt_output_t *output1, *output2;
 	int ret;
 
@@ -230,26 +244,35 @@ test_disable_pipe_B(data_t *data)
 	find_outputs(data, &output1, &output2);
 
 	igt_info("Pipe %s will use connector %s\n",
-		 kmstest_pipe_name(PIPE_B), igt_output_name(output1));
+		 igt_crtc_name(crtc_b), igt_output_name(output1));
 	igt_info("Pipe %s will use connector %s\n",
-		 kmstest_pipe_name(PIPE_C), igt_output_name(output2));
+		 igt_crtc_name(crtc_c), igt_output_name(output2));
 
-	ret = set_big_mode_on_pipe(data, PIPE_B, output1);
+	ret = set_big_mode_on_pipe(data,
+				   crtc_b,
+				   output1);
 	igt_assert_eq(ret, 0);
 
-	ret = disable_pipe(data, PIPE_B, output1);
+	ret = disable_pipe(data, crtc_b,
+			   output1);
 	igt_assert_eq(ret, 0);
 
-	ret = set_normal_mode_on_pipe(data, PIPE_C, output2);
+	ret = set_normal_mode_on_pipe(data,
+				      crtc_c,
+				      output2);
 	igt_assert_eq(ret, 0);
 
-	ret = set_normal_mode_on_pipe(data, PIPE_B, output1);
+	ret = set_normal_mode_on_pipe(data,
+				      crtc_b,
+				      output1);
 	igt_assert_eq(ret, 0);
 }
 
 static void
 test_from_C_to_B_with_3_lanes(data_t *data)
 {
+	igt_crtc_t *crtc_b = igt_crtc_for_pipe(&data->display, PIPE_B);
+	igt_crtc_t *crtc_c = igt_crtc_for_pipe(&data->display, PIPE_C);
 	igt_output_t *output1, *output2;
 	int ret;
 
@@ -257,23 +280,30 @@ test_from_C_to_B_with_3_lanes(data_t *data)
 	find_outputs(data, &output1, &output2);
 
 	igt_info("Pipe %s will use connector %s\n",
-		 kmstest_pipe_name(PIPE_B), igt_output_name(output1));
+		 igt_crtc_name(crtc_b), igt_output_name(output1));
 	igt_info("Pipe %s will use connector %s\n",
-		 kmstest_pipe_name(PIPE_C), igt_output_name(output2));
+		 igt_crtc_name(crtc_c), igt_output_name(output2));
 
-	ret = set_normal_mode_on_pipe(data, PIPE_C, output2);
+	ret = set_normal_mode_on_pipe(data,
+				      crtc_c,
+				      output2);
 	igt_assert_eq(ret, 0);
 
-	ret = disable_pipe(data, PIPE_C, output2);
+	ret = disable_pipe(data, crtc_c,
+			   output2);
 	igt_assert_eq(ret, 0);
 
-	ret = set_big_mode_on_pipe(data, PIPE_B, output1);
+	ret = set_big_mode_on_pipe(data,
+				   crtc_b,
+				   output1);
 	igt_assert_eq(ret, 0);
 }
 
 static void
 test_fail_enable_pipe_C_while_B_has_3_lanes(data_t *data)
 {
+	igt_crtc_t *crtc_b = igt_crtc_for_pipe(&data->display, PIPE_B);
+	igt_crtc_t *crtc_c = igt_crtc_for_pipe(&data->display, PIPE_C);
 	igt_output_t *output1, *output2;
 	int ret;
 
@@ -281,14 +311,18 @@ test_fail_enable_pipe_C_while_B_has_3_lanes(data_t *data)
 	find_outputs(data, &output1, &output2);
 
 	igt_info("Pipe %s will use connector %s\n",
-		 kmstest_pipe_name(PIPE_B), igt_output_name(output1));
+		 igt_crtc_name(crtc_b), igt_output_name(output1));
 	igt_info("Pipe %s will use connector %s\n",
-		 kmstest_pipe_name(PIPE_C), igt_output_name(output2));
+		 igt_crtc_name(crtc_c), igt_output_name(output2));
 
-	ret = set_big_mode_on_pipe(data, PIPE_B, output1);
+	ret = set_big_mode_on_pipe(data,
+				   crtc_b,
+				   output1);
 	igt_assert_eq(ret, 0);
 
-	ret = set_normal_mode_on_pipe(data, PIPE_C, output2);
+	ret = set_normal_mode_on_pipe(data,
+				      crtc_c,
+				      output2);
 	igt_assert_neq(ret, 0);
 }
 
-- 
2.52.0


  parent reply	other threads:[~2026-02-11 16:35 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-11 16:33 [PATCH i-g-t 00/17] tests/kms: Use igt_crtc_t instead of enum pipe Ville Syrjala
2026-02-11 16:33 ` [PATCH i-g-t 01/17] tests/kms_plane_alpha_blend: " Ville Syrjala
2026-02-11 16:33 ` [PATCH i-g-t 02/17] tests/kms: Remove unused 'pipe' function parameters Ville Syrjala
2026-02-11 16:33 ` [PATCH i-g-t 03/17] tests/kms: Remove const qualifier from " Ville Syrjala
2026-02-11 16:33 ` [PATCH i-g-t 04/17] tests/intel/kms_busy: Use 'enum pipe' instead of 'int' Ville Syrjala
2026-02-11 16:33 ` [PATCH i-g-t 05/17] tests/kms_atomic_interruptible: s/crtc/drm_crtc/ Ville Syrjala
2026-02-11 16:33 ` [PATCH i-g-t 06/17] tests/intel/kms_psr2_su: Use igt_crtc_t instead of enum pipe Ville Syrjala
2026-02-11 16:33 ` [PATCH i-g-t 07/17] tests/intel/kms_dsc*: " Ville Syrjala
2026-02-11 16:33 ` [PATCH i-g-t 08/17] tests/kms_cursor_legacy: " Ville Syrjala
2026-02-11 16:33 ` [PATCH i-g-t 09/17] tests/kms_color*: " Ville Syrjala
2026-02-11 16:33 ` [PATCH i-g-t 10/17] tests/kms_atomic_transition: " Ville Syrjala
2026-02-11 16:33 ` [PATCH i-g-t 11/17] tests/kms_plane: " Ville Syrjala
2026-02-11 16:33 ` Ville Syrjala [this message]
2026-02-11 16:34 ` [PATCH i-g-t 13/17] tests/kms_vrr: " Ville Syrjala
2026-02-11 16:34 ` [PATCH i-g-t 14/17] tests/kms_display_modes: " Ville Syrjala
2026-02-11 16:34 ` [PATCH i-g-t 15/17] tests/kms_rotation_crc: " Ville Syrjala
2026-02-11 16:34 ` [PATCH i-g-t 16/17] tests/kms_properties: " Ville Syrjala
2026-02-11 16:34 ` [PATCH i-g-t 17/17] tests/kms: " Ville Syrjala
2026-02-11 17:35 ` ✗ Xe.CI.BAT: failure for " Patchwork
2026-02-11 17:47 ` ✓ i915.CI.BAT: success " Patchwork
2026-02-12  6:18 ` ✗ i915.CI.Full: failure " Patchwork
2026-02-12  9:42 ` [PATCH i-g-t 00/17] " Jani Nikula
2026-02-13  2:09 ` ✗ Xe.CI.FULL: failure for " 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=20260211163404.2018-13-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