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 12/17] tests/kms: Remove hand rolled get_vblank() stuff
Date: Fri, 27 Feb 2026 10:06:48 +0200	[thread overview]
Message-ID: <20260227080653.30389-13-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>

Replace the hand rolled get_vblank() stuff with the
identical kmstest_get_vblank().

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 tests/intel/kms_pipe_stress.c | 24 +-----------------------
 tests/prime_vgem.c            | 28 +++-------------------------
 2 files changed, 4 insertions(+), 48 deletions(-)

diff --git a/tests/intel/kms_pipe_stress.c b/tests/intel/kms_pipe_stress.c
index b35f19f75b9b..85ab2ec50621 100644
--- a/tests/intel/kms_pipe_stress.c
+++ b/tests/intel/kms_pipe_stress.c
@@ -315,28 +315,6 @@ static void *gpu_load(void *ptr)
 	return NULL;
 }
 
-static inline uint32_t pipe_select(igt_crtc_t *crtc)
-{
-	if (crtc->pipe > 1)
-		return crtc->pipe << DRM_VBLANK_HIGH_CRTC_SHIFT;
-	else if (crtc->pipe > 0)
-		return DRM_VBLANK_SECONDARY;
-	else
-		return 0;
-}
-
-static unsigned 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 | pipe_select(crtc) | flags;
-	if (drmIoctl(fd, DRM_IOCTL_WAIT_VBLANK, &vbl))
-		return 0;
-
-	return vbl.reply.sequence;
-}
-
 static int commit_mode(struct data *data, igt_output_t *output,
 		       igt_crtc_t *crtc, drmModeModeInfo *mode)
 {
@@ -613,7 +591,7 @@ static void stress_pipes(struct data *data, struct timespec *start,
 
 		igt_pipe_crc_start(data->pipe_crc[pipe]);
 		igt_pipe_crc_get_current(data->display.drm_fd, data->pipe_crc[pipe], &crc);
-		get_vblank(data->display.drm_fd, crtc, DRM_VBLANK_NEXTONMISS);
+		kmstest_get_vblank(data->display.drm_fd, crtc->pipe, DRM_VBLANK_NEXTONMISS);
 		igt_pipe_crc_get_current(data->display.drm_fd, data->pipe_crc[pipe], &crc2);
 		igt_pipe_crc_stop(data->pipe_crc[pipe]);
 		igt_assert_crc_equal(&crc, &crc2);
diff --git a/tests/prime_vgem.c b/tests/prime_vgem.c
index bbf5ab97f459..6abd2ac53093 100644
--- a/tests/prime_vgem.c
+++ b/tests/prime_vgem.c
@@ -970,28 +970,6 @@ static uint32_t set_fb_on_crtc(int fd, int pipe, struct vgem_bo *bo, uint32_t fb
 	return 0;
 }
 
-static inline uint32_t pipe_select(int pipe)
-{
-	if (pipe > 1)
-		return pipe << DRM_VBLANK_HIGH_CRTC_SHIFT;
-	else if (pipe > 0)
-		return DRM_VBLANK_SECONDARY;
-	else
-		return 0;
-}
-
-static unsigned get_vblank(int fd, int pipe, unsigned flags)
-{
-	union drm_wait_vblank vbl;
-
-	memset(&vbl, 0, sizeof(vbl));
-	vbl.request.type = DRM_VBLANK_RELATIVE | pipe_select(pipe) | flags;
-	if (drmIoctl(fd, DRM_IOCTL_WAIT_VBLANK, &vbl))
-		return 0;
-
-	return vbl.reply.sequence;
-}
-
 static void flip_to_vgem(int i915, int vgem,
 			 struct vgem_bo *bo,
 			 uint32_t fb_id,
@@ -1013,7 +991,7 @@ static void flip_to_vgem(int i915, int vgem,
 			igt_assert_f(poll(&pfd, 1, 0) == 0,
 				     "flip to %s completed whilst busy\n",
 				     name);
-			get_vblank(i915, 0, DRM_VBLANK_NEXTONMISS);
+			kmstest_get_vblank(i915, 0, DRM_VBLANK_NEXTONMISS);
 		}
 	}
 	igt_waitchildren_timeout(2, "flip blocked by waiting for busy vgem fence");
@@ -1023,12 +1001,12 @@ static void flip_to_vgem(int i915, int vgem,
 		unsigned long miss;
 
 		/* Signal fence at the start of the next vblank */
-		get_vblank(i915, 0, DRM_VBLANK_NEXTONMISS);
+		kmstest_get_vblank(i915, 0, DRM_VBLANK_NEXTONMISS);
 		vgem_fence_signal(vgem, fence);
 
 		miss = 0;
 		igt_until_timeout(5) {
-			get_vblank(i915, 0, DRM_VBLANK_NEXTONMISS);
+			kmstest_get_vblank(i915, 0, DRM_VBLANK_NEXTONMISS);
 			if (poll(&pfd, 1, 0))
 				break;
 			miss++;
-- 
2.52.0


  parent reply	other threads:[~2026-02-27  8:07 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 ` Ville Syrjala [this message]
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 ` [PATCH i-g-t 16/17] lib/kms: Introduce igt_crtc_get_vbl_flag() Ville Syrjala
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-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