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 01/17] tests/kms_plane_alpha_blend: Use igt_crtc_t instead of enum pipe
Date: Wed, 11 Feb 2026 18:33:48 +0200	[thread overview]
Message-ID: <20260211163404.2018-2-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_plane_alpha_blend.

The use of function pointers makes this a bit more
complicated than your average test.

 #include "scripts/iterators.cocci"

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

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

@@
identifier FUNC, CRTC;
@@
FUNC(..., igt_crtc_t *CRTC, ...)
{
...
(
- igt_crtc_t *CRTC = CRTC;
|
- igt_crtc_t *CRTC = igt_crtc_for_pipe(...);
|
- igt_crtc_t *CRTC;
...
- CRTC = igt_crtc_for_pipe(...);
)
...
}

@func_ptr@
parameter list[N] P;
identifier F, PIPE;
type T;
@@
struct {
       ...
       T (*F)(P
-      	 ,enum pipe
+      	 ,igt_crtc_t *crtc
	 ,...);
       ...
}

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

@func_ptr2@
parameter list[N] P;
identifier FUNC, F, PIPE;
type T;
@@
FUNC(...,
  T (*F)(P
-	,enum pipe
+	,igt_crtc_t *crtc
	,...), ...)
{ ... }

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

@@
identifier DISPLAY;
expression E;
@@
- igt_display_t *DISPLAY = E;
... when != DISPLAY

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 tests/kms_plane_alpha_blend.c | 61 +++++++++++++++++------------------
 1 file changed, 30 insertions(+), 31 deletions(-)

diff --git a/tests/kms_plane_alpha_blend.c b/tests/kms_plane_alpha_blend.c
index 1f093a49c9b6..2ee74d30f558 100644
--- a/tests/kms_plane_alpha_blend.c
+++ b/tests/kms_plane_alpha_blend.c
@@ -168,11 +168,11 @@ static void draw_squares_coverage(struct igt_fb *fb, int w, int h, uint8_t as)
 	igt_put_cairo_ctx(cr);
 }
 
-static void reset_alpha(igt_display_t *display, enum pipe pipe)
+static void reset_alpha(igt_display_t *display, igt_crtc_t *crtc)
 {
 	igt_plane_t *plane;
 
-	for_each_plane_on_pipe(display, pipe, plane) {
+	for_each_plane_on_pipe(display, crtc->pipe, plane) {
 		if (igt_plane_has_prop(plane, IGT_PLANE_ALPHA))
 			igt_plane_set_prop_value(plane, IGT_PLANE_ALPHA, 0xffff);
 
@@ -209,11 +209,9 @@ static void remove_fbs(data_t *data)
 	igt_remove_fb(data->gfx_fd, &data->gray_fb);
 }
 
-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)
 {
 	drmModeModeInfo *mode;
-	igt_display_t *display = &data->display;
-	igt_crtc_t *crtc = igt_crtc_for_pipe(display, pipe);
 	int w, h;
 	igt_plane_t *primary = igt_crtc_get_plane_type(crtc,
 						       DRM_PLANE_TYPE_PRIMARY);
@@ -289,7 +287,7 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe)
 	igt_plane_set_fb(primary, &data->black_fb);
 }
 
-static void basic_alpha(data_t *data, enum pipe pipe, igt_plane_t *plane)
+static void basic_alpha(data_t *data, igt_crtc_t *crtc, igt_plane_t *plane)
 {
 	igt_display_t *display = &data->display;
 	igt_crc_t ref_crc, crc;
@@ -327,7 +325,7 @@ static void basic_alpha(data_t *data, enum pipe pipe, igt_plane_t *plane)
 	igt_assert_crc_equal(&ref_crc, &crc);
 }
 
-static void argb_opaque(data_t *data, enum pipe pipe, igt_plane_t *plane)
+static void argb_opaque(data_t *data, igt_crtc_t *crtc, igt_plane_t *plane)
 {
 	igt_display_t *display = &data->display;
 	igt_crc_t ref_crc, crc;
@@ -344,7 +342,8 @@ static void argb_opaque(data_t *data, enum pipe pipe, igt_plane_t *plane)
 	igt_assert_crc_equal(&ref_crc, &crc);
 }
 
-static void argb_transparent(data_t *data, enum pipe pipe, igt_plane_t *plane)
+static void argb_transparent(data_t *data, igt_crtc_t *crtc,
+			     igt_plane_t *plane)
 {
 	igt_display_t *display = &data->display;
 	igt_crc_t ref_crc, crc;
@@ -361,7 +360,8 @@ static void argb_transparent(data_t *data, enum pipe pipe, igt_plane_t *plane)
 	igt_assert_crc_equal(&ref_crc, &crc);
 }
 
-static void constant_alpha_min(data_t *data, enum pipe pipe, igt_plane_t *plane)
+static void constant_alpha_min(data_t *data, igt_crtc_t *crtc,
+			       igt_plane_t *plane)
 {
 	igt_display_t *display = &data->display;
 	igt_crc_t ref_crc, crc;
@@ -383,10 +383,10 @@ static void constant_alpha_min(data_t *data, enum pipe pipe, igt_plane_t *plane)
 	igt_assert_crc_equal(&ref_crc, &crc);
 }
 
-static void constant_alpha_mid(data_t *data, enum pipe pipe, igt_plane_t *plane)
+static void constant_alpha_mid(data_t *data, igt_crtc_t *crtc,
+			       igt_plane_t *plane)
 {
 	igt_display_t *display = &data->display;
-	igt_crtc_t *crtc = igt_crtc_for_pipe(display, pipe);
 	igt_crc_t ref_crc, crc;
 
 	if (plane->type != DRM_PLANE_TYPE_PRIMARY)
@@ -410,10 +410,10 @@ static void constant_alpha_mid(data_t *data, enum pipe pipe, igt_plane_t *plane)
 	igt_assert_crc_equal(&ref_crc, &crc);
 }
 
-static void constant_alpha_max(data_t *data, enum pipe pipe, igt_plane_t *plane)
+static void constant_alpha_max(data_t *data, igt_crtc_t *crtc,
+			       igt_plane_t *plane)
 {
 	igt_display_t *display = &data->display;
-	igt_crtc_t *crtc = igt_crtc_for_pipe(display, pipe);
 	igt_crc_t ref_crc, crc;
 
 	if (plane->type != DRM_PLANE_TYPE_PRIMARY)
@@ -442,10 +442,9 @@ static void constant_alpha_max(data_t *data, enum pipe pipe, igt_plane_t *plane)
 	igt_plane_set_fb(plane, NULL);
 }
 
-static void alpha_7efc(data_t *data, enum pipe pipe, igt_plane_t *plane)
+static void alpha_7efc(data_t *data, igt_crtc_t *crtc, igt_plane_t *plane)
 {
 	igt_display_t *display = &data->display;
-	igt_crtc_t *crtc = igt_crtc_for_pipe(display, pipe);
 	igt_crc_t ref_crc = {}, crc = {};
 
 	if (plane->type != DRM_PLANE_TYPE_PRIMARY)
@@ -471,7 +470,7 @@ static void alpha_7efc(data_t *data, enum pipe pipe, igt_plane_t *plane)
 	igt_pipe_crc_stop(data->pipe_crc);
 }
 
-static void coverage_7efc(data_t *data, enum pipe pipe, igt_plane_t *plane)
+static void coverage_7efc(data_t *data, igt_crtc_t *crtc, igt_plane_t *plane)
 {
 	igt_display_t *display = &data->display;
 	igt_crc_t ref_crc = {}, crc = {};
@@ -497,10 +496,10 @@ static void coverage_7efc(data_t *data, enum pipe pipe, igt_plane_t *plane)
 	igt_pipe_crc_stop(data->pipe_crc);
 }
 
-static void coverage_premult_constant(data_t *data, enum pipe pipe, igt_plane_t *plane)
+static void coverage_premult_constant(data_t *data, igt_crtc_t *crtc,
+				      igt_plane_t *plane)
 {
 	igt_display_t *display = &data->display;
-	igt_crtc_t *crtc = igt_crtc_for_pipe(display, pipe);
 	igt_crc_t ref_crc = {}, crc = {};
 
 	/* Set a background color on the primary fb for testing */
@@ -530,12 +529,12 @@ static void coverage_premult_constant(data_t *data, enum pipe pipe, igt_plane_t
 	igt_pipe_crc_stop(data->pipe_crc);
 }
 
-static void run_test_on_pipe_planes(data_t *data, enum pipe pipe, igt_output_t *output,
+static void run_test_on_pipe_planes(data_t *data, igt_crtc_t *crtc,
+				    igt_output_t *output,
 				    bool blend, bool must_multiply,
-				    void(*test)(data_t *, enum pipe, igt_plane_t *))
+				    void(*test)(data_t *, igt_crtc_t *crtc, igt_plane_t *))
 {
 	igt_display_t *display = &data->display;
-	igt_crtc_t *crtc = igt_crtc_for_pipe(display, pipe);
 	igt_plane_t *plane;
 	int first_plane = -1;
 	int last_plane = -1;
@@ -548,7 +547,7 @@ static void run_test_on_pipe_planes(data_t *data, enum pipe pipe, igt_output_t *
 			continue;
 
 		/* reset plane alpha properties between each plane */
-		reset_alpha(display, crtc->pipe);
+		reset_alpha(display, crtc);
 
 		if (must_multiply && !has_multiplied_alpha(data, plane))
 			continue;
@@ -568,7 +567,7 @@ static void run_test_on_pipe_planes(data_t *data, enum pipe pipe, igt_output_t *
 			continue;
 
 		/* Reset plane alpha properties between each plane. */
-		reset_alpha(display, crtc->pipe);
+		reset_alpha(display, crtc);
 
 		if (must_multiply && !has_multiplied_alpha(data, plane))
 			continue;
@@ -577,7 +576,7 @@ static void run_test_on_pipe_planes(data_t *data, enum pipe pipe, igt_output_t *
 			continue;
 
 		igt_info("Testing plane %u\n", plane->index);
-		test(data, crtc->pipe, plane);
+		test(data, crtc, plane);
 		igt_plane_set_fb(plane, NULL);
 
 		if (in_simulation)
@@ -590,7 +589,7 @@ static void run_test_on_pipe_planes(data_t *data, enum pipe pipe, igt_output_t *
 
 static const struct {
 	const char *name;
-	void (*test)(data_t *, enum pipe, igt_plane_t *);
+	void (*test)(data_t *, igt_crtc_t *crtc, igt_plane_t *);
 	bool blend;
 	bool must_multiply;
 	const char *desc;
@@ -653,11 +652,10 @@ static const struct {
 	},
 };
 
-static bool pipe_check(data_t *data, enum pipe pipe,
+static bool pipe_check(data_t *data, igt_crtc_t *crtc,
 		       bool blend, bool must_multiply)
 {
 	igt_display_t *display = &data->display;
-	igt_crtc_t *crtc = igt_crtc_for_pipe(display, pipe);
 	igt_plane_t *plane;
 	bool plane_alpha = false, plane_blend = false, multiply = false;
 
@@ -672,7 +670,7 @@ static bool pipe_check(data_t *data, enum pipe pipe,
 		plane_blend = true;
 
 		/* reset plane alpha properties between each plane */
-		reset_alpha(display, crtc->pipe);
+		reset_alpha(display, crtc);
 
 		if (must_multiply && !has_multiplied_alpha(data, plane))
 			continue;
@@ -718,15 +716,16 @@ static void run_subtests(data_t *data)
 				if (!intel_pipe_output_combo_valid(&data->display))
 					continue;
 
-				prepare_crtc(data, output, crtc->pipe);
-				if (!pipe_check(data, crtc->pipe, subtests[i].blend, subtests[i].must_multiply))
+				prepare_crtc(data, output,
+					     crtc);
+				if (!pipe_check(data, crtc, subtests[i].blend, subtests[i].must_multiply))
 					continue;
 
 				igt_dynamic_f("pipe-%s-%s",
 					      igt_crtc_name(crtc),
 					      output->name)
 					run_test_on_pipe_planes(data,
-								crtc->pipe,
+								crtc,
 								output,
 								subtests[i].blend,
 								subtests[i].must_multiply, subtests[i].test);
-- 
2.52.0


  reply	other threads:[~2026-02-11 16:34 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 ` Ville Syrjala [this message]
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 ` [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-2-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