From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [PATCH i-g-t v2 14/23] tests/kms_vblank: Use igt_crtc_t instead of enum pipe
Date: Sat, 21 Feb 2026 05:19:53 +0200 [thread overview]
Message-ID: <20260221032003.30936-15-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 kms_vblank from 'enum pipe' to 'igt_crtc_t'.
The data.pipe member gets directly replaced with data.crtc.
Also note that the local 'enum pipe p' in crtc_id_subtest()
needs a bit of extra cleanup.
#include "scripts/iterators.cocci"
@find_data@
typedef igt_crtc_t;
identifier DISPLAY, PIPE;
type T;
@@
T {
...
igt_display_t DISPLAY;
...
- enum pipe PIPE;
+ igt_crtc_t *crtc;
...
};
@depends on find_data@
find_data.T S;
find_data.T *P;
expression E;
@@
(
- S.pipe = E
+ S.crtc = igt_crtc_for_pipe(&S.display, E)
|
- P->pipe = E
+ P->crtc = igt_crtc_for_pipe(&P->display, E)
|
- igt_crtc_for_pipe(..., S.pipe)
+ S.crtc
|
- igt_crtc_for_pipe(..., P->pipe)
+ P->crtc
|
- kmstest_pipe_name(S.pipe)
+ igt_crtc_name(S.crtc)
|
- kmstest_pipe_name(P->pipe)
+ igt_crtc_name(P->crtc)
)
@depends on find_data@
find_data.T S;
find_data.T *P;
@@
(
- S.pipe
+ S.crtc->pipe
|
- P->pipe
+ P->crtc->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
@depends on find_data@
find_data.T S;
find_data.T *P;
@@
(
- igt_crtc_for_pipe(..., S.crtc->pipe)
+ S.crtc
|
- igt_crtc_for_pipe(..., P->crtc->pipe)
+ P->crtc
)
@@
typedef igt_display_t;
identifier DISPLAY;
@@
- igt_display_t *DISPLAY = ...;
... when != DISPLAY
@clean_pipe@
identifier PIPE;
expression CRTC;
@@
- enum pipe PIPE = CRTC->pipe;
<+...
(
- igt_crtc_for_pipe(..., PIPE)
+ CRTC
|
- PIPE
+ CRTC->pipe
)
...+>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
tests/kms_vblank.c | 55 +++++++++++++++++++++++-----------------------
1 file changed, 27 insertions(+), 28 deletions(-)
diff --git a/tests/kms_vblank.c b/tests/kms_vblank.c
index add8b7ec3cbf..970eb4d9a6a7 100644
--- a/tests/kms_vblank.c
+++ b/tests/kms_vblank.c
@@ -97,7 +97,7 @@ typedef struct {
igt_display_t display;
struct igt_fb primary_fb;
igt_output_t *output;
- enum pipe pipe;
+ igt_crtc_t *crtc;
unsigned int flags;
#define IDLE 0x1
#define BUSY 0x2
@@ -130,7 +130,7 @@ static void prepare_crtc(data_t *data, int fd, igt_output_t *output)
/* select the pipe we want to use */
igt_output_set_crtc(output,
- igt_crtc_for_pipe(display, data->pipe));
+ data->crtc);
/* create and set the primary plane fb */
mode = igt_output_get_mode(output);
@@ -144,7 +144,7 @@ static void prepare_crtc(data_t *data, int fd, igt_output_t *output)
igt_display_commit(display);
- igt_wait_for_vblank(igt_crtc_for_pipe(display, data->pipe));
+ igt_wait_for_vblank(data->crtc);
}
static void cleanup_crtc(data_t *data, int fd, igt_output_t *output)
@@ -192,7 +192,7 @@ static void run_test(data_t *data, void (*testfunc)(data_t *, int, int))
memset(&vbl, 0, sizeof(vbl));
vbl.request.type =
DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT;
- vbl.request.type |= kmstest_get_vbl_flag(data->pipe);
+ vbl.request.type |= kmstest_get_vbl_flag(data->crtc->pipe);
vbl.request.sequence = 120 + 12;
igt_assert_eq(wait_vblank(fd, &vbl), 0);
}
@@ -225,14 +225,14 @@ static void run_test(data_t *data, void (*testfunc)(data_t *, int, int))
}
static bool
-pipe_output_combo_valid(igt_display_t *display,
- enum pipe pipe, igt_output_t *output)
+pipe_output_combo_valid(igt_display_t *display, igt_crtc_t *crtc,
+ igt_output_t *output)
{
bool ret = true;
igt_display_reset(display);
- igt_output_set_crtc(output, igt_crtc_for_pipe(display, pipe));
+ igt_output_set_crtc(output, crtc);
if (!intel_pipe_output_combo_valid(display))
ret = false;
igt_output_set_crtc(output, NULL);
@@ -243,15 +243,14 @@ pipe_output_combo_valid(igt_display_t *display,
static void crtc_id_subtest(data_t *data, int fd)
{
igt_display_t *display = &data->display;
- enum pipe p = data->pipe;
igt_output_t *output = data->output;
struct drm_event_vblank buf;
- const uint32_t pipe_id_flag = kmstest_get_vbl_flag(p);
+ const uint32_t pipe_id_flag = kmstest_get_vbl_flag(data->crtc->pipe);
unsigned crtc_id, expected_crtc_id;
uint64_t val;
union drm_wait_vblank vbl;
- crtc_id = igt_crtc_for_pipe(display, p)->crtc_id;
+ crtc_id = data->crtc->crtc_id;
if (drmGetCap(display->drm_fd, DRM_CAP_CRTC_IN_VBLANK_EVENT, &val) == 0)
expected_crtc_id = crtc_id;
else
@@ -291,7 +290,7 @@ static void crtc_id_subtest(data_t *data, int fd)
static void accuracy(data_t *data, int fd, int nchildren)
{
- const uint32_t pipe_id_flag = kmstest_get_vbl_flag(data->pipe);
+ const uint32_t pipe_id_flag = kmstest_get_vbl_flag(data->crtc->pipe);
union drm_wait_vblank vbl;
unsigned long target;
int total = 120 / nchildren;
@@ -330,7 +329,7 @@ static void accuracy(data_t *data, int fd, int nchildren)
static void vblank_query(data_t *data, int fd, int nchildren)
{
- const uint32_t pipe_id_flag = kmstest_get_vbl_flag(data->pipe);
+ const uint32_t pipe_id_flag = kmstest_get_vbl_flag(data->crtc->pipe);
union drm_wait_vblank vbl;
struct timespec start, end;
unsigned long sq, count = 0;
@@ -359,7 +358,7 @@ static void vblank_query(data_t *data, int fd, int nchildren)
static void vblank_wait(data_t *data, int fd, int nchildren)
{
- const uint32_t pipe_id_flag = kmstest_get_vbl_flag(data->pipe);
+ const uint32_t pipe_id_flag = kmstest_get_vbl_flag(data->crtc->pipe);
union drm_wait_vblank vbl;
struct timespec start, end;
unsigned long sq, count = 0;
@@ -388,12 +387,12 @@ static void vblank_wait(data_t *data, int fd, int nchildren)
elapsed(&start, &end, count));
}
-static int get_vblank(int fd, enum pipe pipe, unsigned flags)
+static int get_vblank(int fd, igt_crtc_t *crtc, unsigned flags)
{
union drm_wait_vblank vbl;
memset(&vbl, 0, sizeof(vbl));
- vbl.request.type = DRM_VBLANK_RELATIVE | kmstest_get_vbl_flag(pipe) | flags;
+ vbl.request.type = DRM_VBLANK_RELATIVE | kmstest_get_vbl_flag(crtc->pipe) | flags;
do_or_die(igt_ioctl(fd, DRM_IOCTL_WAIT_VBLANK, &vbl));
return vbl.reply.sequence;
@@ -412,7 +411,7 @@ static void vblank_ts_cont(data_t *data, int fd, int nchildren)
int vrefresh = igt_output_get_mode(output)->vrefresh;
double time_elapsed;
- seq1 = get_vblank(fd, data->pipe, 0);
+ seq1 = get_vblank(fd, data->crtc, 0);
clock_gettime(CLOCK_MONOTONIC, &start);
if (data->flags & DPMS) {
@@ -436,7 +435,7 @@ static void vblank_ts_cont(data_t *data, int fd, int nchildren)
/* Attempting to do a vblank while disabled should return -EINVAL */
memset(&vbl, 0, sizeof(vbl));
vbl.request.type = _DRM_VBLANK_RELATIVE;
- vbl.request.type |= kmstest_get_vbl_flag(data->pipe);
+ vbl.request.type |= kmstest_get_vbl_flag(data->crtc->pipe);
igt_assert_eq(wait_vblank(fd, &vbl), -EINVAL);
}
@@ -447,11 +446,11 @@ static void vblank_ts_cont(data_t *data, int fd, int nchildren)
if (data->flags & MODESET) {
igt_output_set_crtc(output,
- igt_crtc_for_pipe(display, data->pipe));
+ data->crtc);
igt_display_commit2(display, display->is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
}
- seq2 = get_vblank(fd, data->pipe, 0);
+ seq2 = get_vblank(fd, data->crtc, 0);
clock_gettime(CLOCK_MONOTONIC, &end);
time_elapsed = igt_time_elapsed(&start, &end);
@@ -519,8 +518,8 @@ static void run_subtests(data_t *data)
for_each_crtc_with_valid_output(&data->display,
crtc,
data->output) {
- data->pipe = crtc->pipe;
- if (!pipe_output_combo_valid(&data->display, crtc->pipe, data->output))
+ data->crtc = crtc;
+ if (!pipe_output_combo_valid(&data->display, crtc, data->output))
continue;
if (!all_pipes && crtc->pipe != active_pipes[0] &&
@@ -551,8 +550,8 @@ static void run_subtests(data_t *data)
for_each_crtc_with_valid_output(&data->display,
crtc,
data->output) {
- data->pipe = crtc->pipe;
- if (!pipe_output_combo_valid(&data->display, crtc->pipe, data->output))
+ data->crtc = crtc;
+ if (!pipe_output_combo_valid(&data->display, crtc, data->output))
continue;
if (!all_pipes && crtc->pipe != active_pipes[0] &&
@@ -650,7 +649,7 @@ int igt_main_args("e", NULL, help_str, opt_handler, NULL)
/* Get active pipes. */
for_each_crtc(&data.display, crtc) {
- data.pipe = crtc->pipe;
+ data.crtc = crtc;
active_pipes[last_pipe++] = crtc->pipe;
}
last_pipe--;
@@ -660,8 +659,8 @@ int igt_main_args("e", NULL, help_str, opt_handler, NULL)
igt_subtest_with_dynamic("invalid") {
for_each_crtc_with_valid_output(&data.display, crtc,
data.output) {
- data.pipe = crtc->pipe;
- if (!pipe_output_combo_valid(&data.display, crtc->pipe, data.output))
+ data.crtc = crtc;
+ if (!pipe_output_combo_valid(&data.display, crtc, data.output))
continue;
igt_dynamic_f("pipe-%s-%s", igt_crtc_name(crtc),
@@ -676,8 +675,8 @@ int igt_main_args("e", NULL, help_str, opt_handler, NULL)
igt_subtest_with_dynamic("crtc-id") {
for_each_crtc_with_valid_output(&data.display, crtc,
data.output) {
- data.pipe = crtc->pipe;
- if (!pipe_output_combo_valid(&data.display, crtc->pipe, data.output))
+ data.crtc = crtc;
+ if (!pipe_output_combo_valid(&data.display, crtc, data.output))
continue;
if (!all_pipes && crtc->pipe != active_pipes[0] &&
--
2.52.0
next prev parent reply other threads:[~2026-02-21 3:21 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 ` [PATCH i-g-t v2 12/23] tests/drm_read: " Ville Syrjala
2026-02-24 8:58 ` 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 ` Ville Syrjala [this message]
2026-02-24 13:43 ` [PATCH i-g-t v2 14/23] tests/kms_vblank: Use igt_crtc_t instead of enum pipe 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-15-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