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

The explicit use of pipe==PIPE_NONE (now converted to
crtc==NULL) complicates this one a bit.

 #include "scripts/iterators.cocci"

@func@
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 func@
identifier func.FUNC;
expression PIPE;
expression list[func.N] EP;
@@
FUNC(EP
-	,PIPE
+	,igt_crtc_for_pipe(display, PIPE)
	,...)

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

@@
@@
- igt_crtc_for_pipe(..., PIPE_NONE)
+ NULL

@@
igt_crtc_t *CRTC;
binary operator OP = { ==, != };
@@
- CRTC->pipe OP PIPE_NONE
+ CRTC OP NULL

@@
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_properties.c | 91 ++++++++++++++++++++++++++++--------------
 1 file changed, 60 insertions(+), 31 deletions(-)

diff --git a/tests/kms_properties.c b/tests/kms_properties.c
index 34bb6ac42618..2fbcce6ad864 100644
--- a/tests/kms_properties.c
+++ b/tests/kms_properties.c
@@ -73,25 +73,27 @@ struct additional_test {
 			  uint32_t prop_id, uint64_t prop_value, bool atomic);
 };
 
-static void prepare_pipe(igt_display_t *display, enum pipe pipe, igt_output_t *output, struct igt_fb *fb)
+static void prepare_pipe(igt_display_t *display, igt_crtc_t *crtc,
+			 igt_output_t *output, struct igt_fb *fb)
 {
 	drmModeModeInfo *mode = igt_output_get_mode(output);
 
 	igt_create_pattern_fb(display->drm_fd, mode->hdisplay, mode->vdisplay,
 			      DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_LINEAR, fb);
 
-	igt_output_set_crtc(output, igt_crtc_for_pipe(display, pipe));
+	igt_output_set_crtc(output, crtc);
 
 	igt_plane_set_fb(igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY), fb);
 
 	igt_display_commit2(display, display->is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
 }
 
-static void cleanup_pipe(igt_display_t *display, enum pipe pipe, igt_output_t *output, struct igt_fb *fb)
+static void cleanup_pipe(igt_display_t *display, igt_crtc_t *crtc,
+			 igt_output_t *output, struct igt_fb *fb)
 {
 	igt_plane_t *plane;
 
-	for_each_plane_on_pipe(display, pipe, plane)
+	for_each_plane_on_pipe(display, crtc->pipe, plane)
 		igt_plane_set_fb(plane, NULL);
 
 	igt_output_set_crtc(output, NULL);
@@ -231,7 +233,9 @@ static void test_properties(int fd, uint32_t type, uint32_t id, bool atomic, boo
 	}
 }
 
-static void run_colorop_property_tests(igt_display_t *display, enum pipe pipe, igt_output_t *output, bool atomic)
+static void run_colorop_property_tests(igt_display_t *display,
+				       igt_crtc_t *crtc, igt_output_t *output,
+				       bool atomic)
 {
 	struct igt_fb fb;
 	igt_plane_t *plane;
@@ -239,11 +243,13 @@ static void run_colorop_property_tests(igt_display_t *display, enum pipe pipe, i
 	int i;
 	int colorop_id = 0;
 
-	prepare_pipe(display, pipe, output, &fb);
+	prepare_pipe(display, crtc, output,
+		     &fb);
 
-	for_each_plane_on_pipe(display, pipe, plane) {
+	for_each_plane_on_pipe(display, crtc->pipe, plane) {
 		igt_info("Testing colorop properties on plane %s.#%d-%s (output: %s)\n",
-			 kmstest_pipe_name(pipe), plane->index, kmstest_plane_type_name(plane->type), output->name);
+			 igt_crtc_name(crtc), plane->index,
+			 kmstest_plane_type_name(plane->type), output->name);
 
 		/* iterate over all color pipelines on plane */
 		for (i = 0; i < plane->num_color_pipelines; ++i) {
@@ -251,7 +257,8 @@ static void run_colorop_property_tests(igt_display_t *display, enum pipe pipe, i
 			colorop = plane->color_pipelines[i];
 			while (colorop) {
 				igt_info("Testing colorop properties on %s.#%d.#%d-%s (output: %s)\n",
-					  kmstest_pipe_name(pipe), plane->index, colorop->id,
+					  igt_crtc_name(crtc), plane->index,
+					  colorop->id,
 					  kmstest_plane_type_name(plane->type), output->name);
 				test_properties(display->drm_fd, DRM_MODE_OBJECT_COLOROP, colorop->id,
 						atomic, display->has_plane_color_pipeline);
@@ -263,54 +270,69 @@ static void run_colorop_property_tests(igt_display_t *display, enum pipe pipe, i
 		}
 	}
 
-	cleanup_pipe(display, pipe, output, &fb);
+	cleanup_pipe(display, crtc, output,
+		     &fb);
 }
 
-static void run_plane_property_tests(igt_display_t *display, enum pipe pipe, igt_output_t *output, bool atomic)
+static void run_plane_property_tests(igt_display_t *display, igt_crtc_t *crtc,
+				     igt_output_t *output, bool atomic)
 {
 	struct igt_fb fb;
 	igt_plane_t *plane;
 
-	prepare_pipe(display, pipe, output, &fb);
+	prepare_pipe(display, crtc, output,
+		     &fb);
 
-	for_each_plane_on_pipe(display, pipe, plane) {
+	for_each_plane_on_pipe(display, crtc->pipe, plane) {
 		igt_info("Testing plane properties on %s.#%d-%s (output: %s)\n",
-			 kmstest_pipe_name(pipe), plane->index, kmstest_plane_type_name(plane->type), output->name);
+			 igt_crtc_name(crtc), plane->index,
+			 kmstest_plane_type_name(plane->type), output->name);
 
 		test_properties(display->drm_fd, DRM_MODE_OBJECT_PLANE, plane->drm_plane->plane_id, atomic, display->has_plane_color_pipeline);
 	}
 
-	cleanup_pipe(display, pipe, output, &fb);
+	cleanup_pipe(display, crtc, output,
+		     &fb);
 }
 
-static void run_crtc_property_tests(igt_display_t *display, enum pipe pipe, igt_output_t *output, bool atomic)
+static void run_crtc_property_tests(igt_display_t *display, igt_crtc_t *crtc,
+				    igt_output_t *output, bool atomic)
 {
 	struct igt_fb fb;
 
-	prepare_pipe(display, pipe, output, &fb);
+	prepare_pipe(display, crtc, output,
+		     &fb);
 
-	igt_info("Testing crtc properties on %s (output: %s)\n", kmstest_pipe_name(pipe), output->name);
+	igt_info("Testing crtc properties on %s (output: %s)\n",
+		 igt_crtc_name(crtc), output->name);
 
 	test_properties(display->drm_fd, DRM_MODE_OBJECT_CRTC,
-			igt_crtc_for_pipe(display, pipe)->crtc_id, atomic,
+			crtc->crtc_id,
+			atomic,
 			false);
 
-	cleanup_pipe(display, pipe, output, &fb);
+	cleanup_pipe(display, crtc, output,
+		     &fb);
 }
 
-static void run_connector_property_tests(igt_display_t *display, enum pipe pipe, igt_output_t *output, bool atomic)
+static void run_connector_property_tests(igt_display_t *display,
+					 igt_crtc_t *crtc,
+					 igt_output_t *output, bool atomic)
 {
 	struct igt_fb fb;
 
-	if (pipe != PIPE_NONE)
-		prepare_pipe(display, pipe, output, &fb);
+	if (crtc != NULL)
+		prepare_pipe(display, crtc,
+			     output, &fb);
 
-	igt_info("Testing connector properties on output %s (pipe: %s)\n", output->name, kmstest_pipe_name(pipe));
+	igt_info("Testing connector properties on output %s (pipe: %s)\n", output->name,
+		 igt_crtc_name(crtc));
 
 	test_properties(display->drm_fd, DRM_MODE_OBJECT_CONNECTOR, output->id, atomic, false);
 
-	if (pipe != PIPE_NONE)
-		cleanup_pipe(display, pipe, output, &fb);
+	if (crtc != NULL)
+		cleanup_pipe(display, crtc,
+			     output, &fb);
 }
 
 static void colorop_properties(igt_display_t *display, bool atomic)
@@ -338,7 +360,8 @@ static void colorop_properties(igt_display_t *display, bool atomic)
 			igt_dynamic_f("pipe-%s-%s", igt_crtc_name(crtc),
 				      igt_output_name(output)) {
 				run_colorop_property_tests(display,
-							   crtc->pipe, output,
+							   crtc,
+							   output,
 							   atomic);
 			}
 		}
@@ -362,7 +385,9 @@ static void plane_properties(igt_display_t *display, bool atomic)
 
 		igt_dynamic_f("pipe-%s-%s", igt_crtc_name(crtc),
 			      igt_output_name(output)) {
-			run_plane_property_tests(display, crtc->pipe, output,
+			run_plane_property_tests(display,
+						 crtc,
+						 output,
 						 atomic);
 		}
 	}
@@ -383,7 +408,9 @@ static void crtc_properties(igt_display_t *display, bool atomic)
 
 		igt_dynamic_f("pipe-%s-%s", igt_crtc_name(crtc),
 			      igt_output_name(output)) {
-			run_crtc_property_tests(display, crtc->pipe, output,
+			run_crtc_property_tests(display,
+						crtc,
+						output,
 						atomic);
 		}
 	}
@@ -410,7 +437,7 @@ static void connector_properties(igt_display_t *display, bool atomic)
 			igt_dynamic_f("pipe-%s-%s", igt_crtc_name(crtc),
 				      igt_output_name(output)) {
 				run_connector_property_tests(display,
-							     crtc->pipe,
+							     crtc,
 							     output, atomic);
 			}
 
@@ -422,7 +449,9 @@ static void connector_properties(igt_display_t *display, bool atomic)
 		igt_display_reset(display);
 
 		igt_dynamic_f("pipe-None-%s", igt_output_name(output))
-			run_connector_property_tests(display, PIPE_NONE, output, atomic);
+			run_connector_property_tests(display,
+						     NULL,
+						     output, atomic);
 
 	}
 }
-- 
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 ` [PATCH i-g-t 15/17] tests/kms_rotation_crc: " Ville Syrjala
2026-02-11 16:34 ` Ville Syrjala [this message]
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-17-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