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 12/23] tests/drm_read: Use igt_crtc_t instead of enum pipe
Date: Sat, 21 Feb 2026 05:19:51 +0200	[thread overview]
Message-ID: <20260221032003.30936-13-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 drm_read from 'enum pipe' to 'igt_crtc_t'.

The pipe usage in igt_main() creates a slight complication
is this one.

 #include "scripts/iterators.cocci"

@clean_igt_main@
identifier PIPE;
identifier CRTC;
@@
- enum pipe PIPE;
+ igt_crtc_t *CRTC;
...
igt_fixture() {
...
- igt_crtc_t *CRTC;
<...
(
- PIPE = CRTC->pipe;
|
- PIPE
+ CRTC->pipe
)
...>
}
<...
- PIPE
+ CRTC->pipe
...>

@func1@
typedef igt_output_t;
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
|
- kmstest_pipe_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(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
|
- kmstest_pipe_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(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/drm_read.c | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/tests/drm_read.c b/tests/drm_read.c
index e745e98534bd..23b9ebe0faa3 100644
--- a/tests/drm_read.c
+++ b/tests/drm_read.c
@@ -77,9 +77,9 @@ static void assert_empty(int fd)
 	do_or_die(poll(&pfd, 1, 0));
 }
 
-static void generate_event(int fd, enum pipe pipe)
+static void generate_event(int fd, igt_crtc_t *crtc)
 {
-	igt_assert(kmstest_get_vblank(fd, pipe, DRM_VBLANK_EVENT));
+	igt_assert(kmstest_get_vblank(fd, crtc->pipe, DRM_VBLANK_EVENT));
 }
 
 static void wait_for_event(int fd)
@@ -132,7 +132,7 @@ static void test_invalid_buffer(int in)
 	teardown(fd);
 }
 
-static void test_fault_buffer(int in, enum pipe pipe)
+static void test_fault_buffer(int in, igt_crtc_t *crtc)
 {
 	int fd = setup(in, 0);
 	struct drm_mode_map_dumb arg;
@@ -146,7 +146,7 @@ static void test_fault_buffer(int in, enum pipe pipe)
 	buf = mmap(0, 4096, PROT_WRITE, MAP_SHARED, fd, arg.offset);
 	igt_assert(buf != MAP_FAILED);
 
-	generate_event(fd, pipe);
+	generate_event(fd, crtc);
 
 	alarm(1);
 
@@ -168,13 +168,13 @@ static void test_empty(int in, int nonblock, int expected)
 	teardown(fd);
 }
 
-static void test_short_buffer(int in, int nonblock, enum pipe pipe)
+static void test_short_buffer(int in, int nonblock, igt_crtc_t *crtc)
 {
 	char buffer[1024]; /* events are typically 32 bytes */
 	int fd = setup(in, nonblock);
 
-	generate_event(fd, pipe);
-	generate_event(fd, pipe);
+	generate_event(fd, crtc);
+	generate_event(fd, crtc);
 
 	wait_for_event(fd);
 
@@ -214,7 +214,7 @@ static void *thread_short_buffer_wakeup(void *arg)
 	return NULL;
 }
 
-static void test_short_buffer_wakeup(int in, enum pipe pipe)
+static void test_short_buffer_wakeup(int in, igt_crtc_t *crtc)
 {
 	const int nt = sysconf(_SC_NPROCESSORS_ONLN) + 1;
 	struct short_buffer_wakeup w = {
@@ -243,7 +243,7 @@ static void test_short_buffer_wakeup(int in, enum pipe pipe)
 		sched_yield();
 
 		/* One event should wake all threads as none consume */
-		generate_event(w.fd, pipe);
+		generate_event(w.fd, crtc);
 
 		clock_gettime(CLOCK_REALTIME, &tv);
 		tv.tv_sec += 5; /* Let's be very generous to the scheduler */
@@ -274,13 +274,12 @@ int igt_main()
 {
 	igt_display_t display;
 	struct igt_fb fb;
-	enum pipe pipe;
+	igt_crtc_t *crtc;
 	igt_fd_t(fd);
 
 	igt_fixture() {
 		struct sigaction alarm_action = {};
 		igt_output_t *output;
-		igt_crtc_t *crtc;
 
 		igt_assert_neq(sigaction(SIGALRM, NULL, &alarm_action), -1);
 		alarm_action.sa_flags &= ~SA_RESTART;
@@ -302,20 +301,18 @@ int igt_main()
 
 			igt_output_set_crtc(output, crtc);
 			igt_plane_set_fb(igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY), &fb);
-
-			pipe = crtc->pipe;
 			break;
 		}
 
 		igt_display_commit2(&display, display.is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
-		igt_require(kmstest_get_vblank(fd, pipe, 0));
+		igt_require(kmstest_get_vblank(fd, crtc->pipe, 0));
 	}
 
 	igt_subtest("invalid-buffer")
 		test_invalid_buffer(fd);
 
 	igt_subtest("fault-buffer")
-		test_fault_buffer(fd, pipe);
+		test_fault_buffer(fd, crtc);
 
 	igt_subtest("empty-block")
 		test_empty(fd, 0, EINTR);
@@ -324,11 +321,14 @@ int igt_main()
 		test_empty(fd, 1, EAGAIN);
 
 	igt_subtest("short-buffer-block")
-		test_short_buffer(fd, 0, pipe);
+		test_short_buffer(fd, 0,
+				  crtc);
 
 	igt_subtest("short-buffer-nonblock")
-		test_short_buffer(fd, 1, pipe);
+		test_short_buffer(fd, 1,
+				  crtc);
 
 	igt_subtest("short-buffer-wakeup")
-		test_short_buffer_wakeup(fd, pipe);
+		test_short_buffer_wakeup(fd,
+					 crtc);
 }
-- 
2.52.0


  parent reply	other threads:[~2026-02-21  3:20 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 ` Ville Syrjala [this message]
2026-02-24  8:58   ` [PATCH i-g-t v2 12/23] tests/drm_read: " 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 ` [PATCH i-g-t v2 19/23] tests/chamelium: " Ville Syrjala
2026-02-24 13:51   ` 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-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