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 15/17] tests/kms_rotation_crc: Use igt_crtc_t instead of enum pipe
Date: Wed, 11 Feb 2026 18:34:02 +0200	[thread overview]
Message-ID: <20260211163404.2018-16-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/kms_rotation_crc.

The oddball thing here is the explicit use of PIPE_A
for some of the tests. Thus we are left with a few
igt_crtc_for_pipe() calls even after the tests. Someone
should probably review what this test actually doing and
try do something a bit more sensible.

 #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 PIPE;
expression list[func1.N] EP;
@@
 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 PIPE;
expression list[func2.N] EP;
@@
FUNC(EP
-	,PIPE
+	,igt_crtc_for_pipe(&data.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_rotation_crc.c | 42 ++++++++++++++++++++++++----------------
 1 file changed, 25 insertions(+), 17 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 8721a8311b8c..cd0873b3bf8d 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -292,11 +292,10 @@ static void cleanup_crtc(data_t *data)
 	igt_display_reset(display);
 }
 
-static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
+static void prepare_crtc(data_t *data, igt_output_t *output, igt_crtc_t *crtc,
 			 igt_plane_t *plane, bool start_crc)
 {
 	igt_display_t *display = &data->display;
-	igt_crtc_t *crtc = igt_crtc_for_pipe(display, pipe);
 
 	cleanup_crtc(data);
 
@@ -462,13 +461,12 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
 		igt_plane_set_position(plane, data->pos_x, data->pos_y);
 }
 
-static void test_single_case(data_t *data, enum pipe pipe,
+static void test_single_case(data_t *data, igt_crtc_t *crtc,
 			     igt_output_t *output, igt_plane_t *plane,
 			     enum rectangle_type rect,
 			     uint32_t format, bool test_bad_format)
 {
 	igt_display_t *display = &data->display;
-	igt_crtc_t *crtc = igt_crtc_for_pipe(display, pipe);
 	igt_crc_t crc_output;
 	int ret;
 
@@ -655,7 +653,9 @@ static void test_plane_rotation(data_t *data, int plane_type, bool test_bad_form
 		plane = igt_output_get_plane_type(output, plane_type);
 		igt_require(plane_rotation_requirements(data, plane));
 
-		prepare_crtc(data, output, crtc->pipe, plane, true);
+		prepare_crtc(data, output,
+			     crtc,
+			     plane, true);
 
 		for (i = 0; i < num_rectangle_types; i++) {
 			/* Unsupported on intel */
@@ -687,13 +687,17 @@ static void test_plane_rotation(data_t *data, int plane_type, bool test_bad_form
 					if (!test_format(data, &tested_formats, format))
 						continue;
 
-					test_single_case(data, crtc->pipe, output, plane, i,
+					test_single_case(data,
+							 crtc,
+							 output, plane, i,
 							 format, test_bad_format);
 				}
 
 				igt_vec_fini(&tested_formats);
 			} else {
-				test_single_case(data, crtc->pipe, output, plane, i,
+				test_single_case(data,
+						 crtc,
+						 output, plane, i,
 						 data->override_fmt, test_bad_format);
 			}
 		}
@@ -904,10 +908,9 @@ static bool reusecrcfromlastround(planeinfos p[2], int lastroundp1format,
  * It is left here if this test ever was wanted to be run on
  * different pipes.
  */
-static void test_multi_plane_rotation(data_t *data, enum pipe pipe)
+static void test_multi_plane_rotation(data_t *data, igt_crtc_t *crtc)
 {
 	igt_display_t *display = &data->display;
-	igt_crtc_t *crtc = igt_crtc_for_pipe(display, pipe);
 	igt_output_t *output;
 	igt_crc_t retcrc_sw, retcrc_hw;
 	planeinfos p[2];
@@ -1102,13 +1105,11 @@ static void test_multi_plane_rotation(data_t *data, enum pipe pipe)
 	igt_require_f(found, "No valid pipe/output combo found.\n");
 }
 
-static void test_plane_rotation_exhaust_fences(data_t *data,
-					       enum pipe pipe,
+static void test_plane_rotation_exhaust_fences(data_t *data, igt_crtc_t *crtc,
 					       igt_output_t *output,
 					       igt_plane_t *plane)
 {
 	igt_display_t *display = &data->display;
-	igt_crtc_t *crtc = igt_crtc_for_pipe(display, pipe);
 	uint64_t modifier = I915_FORMAT_MOD_Y_TILED;
 	uint32_t format = DRM_FORMAT_XRGB8888;
 	int fd = data->gfx_fd;
@@ -1123,7 +1124,9 @@ static void test_plane_rotation_exhaust_fences(data_t *data,
 	igt_require(igt_plane_has_rotation(plane, IGT_ROTATION_0 | IGT_ROTATION_90));
 	igt_require(gem_available_fences(display->drm_fd) > 0);
 
-	prepare_crtc(data, output, crtc->pipe, plane, false);
+	prepare_crtc(data, output,
+		     crtc, plane,
+		     false);
 
 	mode = igt_output_get_mode(output);
 	w = mode->hdisplay;
@@ -1319,7 +1322,8 @@ int igt_main_args("", long_opts, help_str, opt_handler, &data)
 		data.planepos[1].origo = p_top | p_right;
 		data.planepos[1].x = -.4f;
 		data.planepos[1].y = .1f;
-		test_multi_plane_rotation(&data, PIPE_A);
+		test_multi_plane_rotation(&data,
+					  igt_crtc_for_pipe(&data.display, PIPE_A));
 	}
 
 	igt_describe("Rotation test on both planes by cropping left/top corner of primary plane and"
@@ -1333,7 +1337,8 @@ int igt_main_args("", long_opts, help_str, opt_handler, &data)
 		data.planepos[1].origo = p_top | p_right;
 		data.planepos[1].x = -.15f;
 		data.planepos[1].y = -.15f;
-		test_multi_plane_rotation(&data, PIPE_A);
+		test_multi_plane_rotation(&data,
+					  igt_crtc_for_pipe(&data.display, PIPE_A));
 	}
 
 	igt_describe("Rotation test on both planes by cropping left/bottom corner of primary plane"
@@ -1347,7 +1352,8 @@ int igt_main_args("", long_opts, help_str, opt_handler, &data)
 		data.planepos[1].origo = p_bottom | p_right;
 		data.planepos[1].x = -.15f;
 		data.planepos[1].y = -.20f;
-		test_multi_plane_rotation(&data, PIPE_A);
+		test_multi_plane_rotation(&data,
+					  igt_crtc_for_pipe(&data.display, PIPE_A));
 	}
 
 	/*
@@ -1365,7 +1371,9 @@ int igt_main_args("", long_opts, help_str, opt_handler, &data)
 		for_each_crtc_with_valid_output(&data.display, crtc, output) {
 			igt_plane_t *primary = &crtc->planes[0];
 
-			test_plane_rotation_exhaust_fences(&data, crtc->pipe, output, primary);
+			test_plane_rotation_exhaust_fences(&data,
+							   crtc,
+							   output, primary);
 			break;
 		}
 	}
-- 
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 ` [PATCH i-g-t 12/17] tests/intel/kms_pipe_b_c_ivb: " Ville Syrjala
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 ` Ville Syrjala [this message]
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-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