From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [PATCH i-g-t 16/17] lib/kms: Introduce igt_crtc_get_vbl_flag()
Date: Fri, 27 Feb 2026 10:06:52 +0200 [thread overview]
Message-ID: <20260227080653.30389-17-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20260227080653.30389-1-ville.syrjala@linux.intel.com>
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
Provide a crtc based wrapper (igt_crtc_get_vbl_flag())
for kmstest_get_vbl_flag(), and make use of it where
appropriate.
#include "scripts/iterators.cocci"
@@
igt_crtc_t *CRTC;
@@
- kmstest_get_vbl_flag(CRTC->crtc_index)
+ igt_crtc_get_vbl_flag(CRTC)
@@
typedef uint32_t;
@@
kmstest_get_vbl_flag(...) { ... }
+/**
+ * igt_crtc_get_vbl_flag:
+ * @crtc: CRTC
+ *
+ * Convert a CRTC into flag representation
+ * expected by DRM_IOCTL_WAIT_VBLANK.
+ *
+ * See #igt_wait_for_vblank_count for details.
+ */
+uint32_t igt_crtc_get_vbl_flag(igt_crtc_t *crtc)
+{
+ return kmstest_get_vbl_flag(crtc->crtc_index);
+}
@@
type T;
@@
T igt_first_crtc_with_single_output(...);
+
+ uint32_t igt_crtc_get_vbl_flag(igt_crtc_t *crtc);
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
lib/igt_kms.c | 14 ++++++++++++++
lib/igt_kms.h | 2 ++
tests/intel/perf_pmu.c | 2 +-
tests/kms_async_flips.c | 8 ++++----
tests/kms_vblank.c | 14 +++++++-------
5 files changed, 28 insertions(+), 12 deletions(-)
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index b3c44d9748d2..c3fe6198d302 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -6095,6 +6095,20 @@ uint32_t kmstest_get_vbl_flag(int crtc_index)
return flag;
}
+/**
+ * igt_crtc_get_vbl_flag:
+ * @crtc: CRTC
+ *
+ * Convert a CRTC into flag representation
+ * expected by DRM_IOCTL_WAIT_VBLANK.
+ *
+ * See #igt_wait_for_vblank_count for details.
+ */
+uint32_t igt_crtc_get_vbl_flag(igt_crtc_t *crtc)
+{
+ return kmstest_get_vbl_flag(crtc->crtc_index);
+}
+
static inline const uint32_t *
formats_ptr(const struct drm_format_modifier_blob *blob)
{
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index b38f62f354fc..3e88d49fdaba 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -586,6 +586,8 @@ igt_crtc_t *igt_crtc_for_crtc_id(igt_display_t *display, uint32_t crtc_id);
igt_crtc_t *igt_first_crtc(igt_display_t *display);
igt_crtc_t *igt_first_crtc_with_single_output(igt_display_t *display, igt_output_t **ret_output);
+uint32_t igt_crtc_get_vbl_flag(igt_crtc_t *crtc);
+
typedef struct _igt_pipe_crc igt_pipe_crc_t;
igt_pipe_crc_t *igt_crtc_crc_new(igt_crtc_t *crtc, const char *source);
igt_pipe_crc_t *igt_crtc_crc_new_nonblock(igt_crtc_t *crtc, const char *source);
diff --git a/tests/intel/perf_pmu.c b/tests/intel/perf_pmu.c
index 744d619f7f4c..661ead32dc29 100644
--- a/tests/intel/perf_pmu.c
+++ b/tests/intel/perf_pmu.c
@@ -1202,7 +1202,7 @@ event_wait(int gem_fd, const intel_ctx_t *ctx,
igt_fork_helper(&waiter) {
const uint32_t pipe_id_flag =
- kmstest_get_vbl_flag(data.crtc->crtc_index);
+ igt_crtc_get_vbl_flag(data.crtc);
for (;;) {
union drm_wait_vblank vbl = { };
diff --git a/tests/kms_async_flips.c b/tests/kms_async_flips.c
index 53990917c9e4..03d1931fb2bb 100644
--- a/tests/kms_async_flips.c
+++ b/tests/kms_async_flips.c
@@ -553,7 +553,7 @@ static void test_async_flip(data_t *data)
static void wait_for_vblank(data_t *data, unsigned long *vbl_time, unsigned int *seq)
{
drmVBlank wait_vbl = {
- .request.type = DRM_VBLANK_RELATIVE | kmstest_get_vbl_flag(data->crtc->crtc_index),
+ .request.type = DRM_VBLANK_RELATIVE | igt_crtc_get_vbl_flag(data->crtc),
.request.sequence = 1,
};
@@ -726,9 +726,9 @@ static void queue_vblank(data_t *data)
{
drmVBlank wait_vbl = {
.request.type = DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT |
- kmstest_get_vbl_flag(data->crtc->crtc_index),
- .request.sequence = 1,
- .request.signal = (long)data,
+ igt_crtc_get_vbl_flag(data->crtc),
+ .request.sequence = 1,
+ .request.signal = (long)data,
};
do_ioctl(data->drm_fd, DRM_IOCTL_WAIT_VBLANK, &wait_vbl);
diff --git a/tests/kms_vblank.c b/tests/kms_vblank.c
index fd1da2738ac1..e79b2535c599 100644
--- a/tests/kms_vblank.c
+++ b/tests/kms_vblank.c
@@ -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->crtc->crtc_index);
+ vbl.request.type |= igt_crtc_get_vbl_flag(data->crtc);
vbl.request.sequence = 120 + 12;
igt_assert_eq(wait_vblank(fd, &vbl), 0);
}
@@ -245,7 +245,7 @@ static void crtc_id_subtest(data_t *data, int fd)
igt_display_t *display = &data->display;
igt_output_t *output = data->output;
struct drm_event_vblank buf;
- const uint32_t pipe_id_flag = kmstest_get_vbl_flag(data->crtc->crtc_index);
+ const uint32_t pipe_id_flag = igt_crtc_get_vbl_flag(data->crtc);
unsigned crtc_id, expected_crtc_id;
uint64_t val;
union drm_wait_vblank vbl;
@@ -290,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->crtc->crtc_index);
+ const uint32_t pipe_id_flag = igt_crtc_get_vbl_flag(data->crtc);
union drm_wait_vblank vbl;
unsigned long target;
int total = 120 / nchildren;
@@ -329,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->crtc->crtc_index);
+ const uint32_t pipe_id_flag = igt_crtc_get_vbl_flag(data->crtc);
union drm_wait_vblank vbl;
struct timespec start, end;
unsigned long sq, count = 0;
@@ -358,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->crtc->crtc_index);
+ const uint32_t pipe_id_flag = igt_crtc_get_vbl_flag(data->crtc);
union drm_wait_vblank vbl;
struct timespec start, end;
unsigned long sq, count = 0;
@@ -392,7 +392,7 @@ 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(crtc->crtc_index) | flags;
+ vbl.request.type = DRM_VBLANK_RELATIVE | igt_crtc_get_vbl_flag(crtc) | flags;
do_or_die(igt_ioctl(fd, DRM_IOCTL_WAIT_VBLANK, &vbl));
return vbl.reply.sequence;
@@ -435,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->crtc->crtc_index);
+ vbl.request.type |= igt_crtc_get_vbl_flag(data->crtc);
igt_assert_eq(wait_vblank(fd, &vbl), -EINVAL);
}
--
2.52.0
next prev parent reply other threads:[~2026-02-27 8:08 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-27 8:06 [PATCH i-g-t 00/17] lib/kms: Finish the igt_crtc_t API refactoring Ville Syrjala
2026-02-27 8:06 ` [PATCH i-g-t 01/17] lib/kms: Replace igt_pipe_has_valid_output() with igt_crtc_has_valid_output() Ville Syrjala
2026-02-27 10:42 ` Jani Nikula
2026-02-27 8:06 ` [PATCH i-g-t 02/17] lib/kms: Replace igt_display_require_output_on_pipe() with igt_display_require_output_on_crtc() Ville Syrjala
2026-02-27 10:50 ` Jani Nikula
2026-02-27 8:06 ` [PATCH i-g-t 03/17] lib/kms: Replace igt_get_single_output_for_pipe() with igt_get_single_output_for_crtc() Ville Syrjala
2026-02-27 10:22 ` Jani Nikula
2026-02-27 8:06 ` [PATCH i-g-t 04/17] lib/kms: Make the igt_*_bpc_*() interfaces more abstract Ville Syrjala
2026-02-27 8:06 ` [PATCH i-g-t 05/17] tests/kms: Use igt_crtc_name() Ville Syrjala
2026-02-27 8:06 ` [PATCH i-g-t 06/17] tests/kms: Clean up crtc->pipe comparions Ville Syrjala
2026-02-27 10:51 ` Jani Nikula
2026-02-27 8:06 ` [PATCH i-g-t 07/17] tests/vmwgfx/vmw_prime: Replace igt_pipe_crc_new() with igt_crtc_crc_new() Ville Syrjala
2026-02-27 8:06 ` [PATCH i-g-t 08/17] lib/kms: Prefer "crtc" over "pipe" in function names Ville Syrjala
2026-02-27 8:06 ` [PATCH i-g-t 09/17] tests/kms_color*: " Ville Syrjala
2026-02-27 8:06 ` [PATCH i-g-t 10/17] tests/kms: " Ville Syrjala
2026-02-27 8:06 ` [PATCH i-g-t 11/17] tests/kms_tiled_display: Remove mention of PIPE_NONE Ville Syrjala
2026-02-27 8:06 ` [PATCH i-g-t 12/17] tests/kms: Remove hand rolled get_vblank() stuff Ville Syrjala
2026-02-27 8:06 ` [PATCH i-g-t 13/17] lib/kms: Fix kmstest_get_vblank() docs Ville Syrjala
2026-02-27 8:06 ` [PATCH i-g-t 14/17] tests/kms: Pass crtc_index to kmstest_get_vbl_flag() Ville Syrjala
2026-02-27 8:06 ` [PATCH i-g-t 15/17] tests/kms: Pass crtc_index to kmstest_get_vblank() Ville Syrjala
2026-02-27 8:06 ` Ville Syrjala [this message]
2026-02-27 8:06 ` [PATCH i-g-t 17/17] lib/kms: Introduce igt_crtc_get_vblank() Ville Syrjala
2026-02-27 10:55 ` [PATCH i-g-t 00/17] lib/kms: Finish the igt_crtc_t API refactoring Jani Nikula
2026-02-27 14:14 ` ✗ i915.CI.BAT: failure for " Patchwork
2026-02-27 14:24 ` ✓ Xe.CI.BAT: success " Patchwork
2026-02-27 23:28 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-03-04 5:58 ` ✓ Xe.CI.BAT: success for lib/kms: Finish the igt_crtc_t API refactoring (rev2) Patchwork
2026-03-04 6:19 ` ✓ i915.CI.BAT: " Patchwork
2026-03-05 5:01 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-03-05 8:15 ` ✗ i915.CI.Full: " 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=20260227080653.30389-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