[igt-dev] [PATCH i-g-t 1/2] lib/igt_kms: Decouple ioctl call logic for vblank wait
Sumera Priyadarsini
sylphrenadin at gmail.com
Thu Feb 4 12:44:36 UTC 2021
Extract the ioctl call logic in igt_wait_for_vblank_count() into
a helper function, __igt_vblank_wait(). Adjust igt_assert() test
in igt_wait_for_vblank_count() and igt_wait_for_vblank() accordingly.
Signed-off-by: Sumera Priyadarsini <sylphrenadin at gmail.com>
---
lib/igt_kms.c | 28 ++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 0dc2fda4..08d429a8 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -4190,6 +4190,20 @@ void igt_output_set_writeback_fb(igt_output_t *output, struct igt_fb *fb)
(ptrdiff_t)&output->writeback_out_fence_fd);
}
+static int __igt_vblank_wait(int drm_fd, int crtc_offset, int count)
+{
+ drmVBlank wait_vbl;
+ uint32_t pipe_id_flag;
+
+ memset(&wait_vbl, 0, sizeof(wait_vbl));
+ pipe_id_flag = kmstest_get_vbl_flag(crtc_offset);
+
+ wait_vbl.request.type = DRM_VBLANK_RELATIVE | pipe_id_flag;
+ wait_vbl.request.sequence = count;
+
+ return drmWaitVBlank(drm_fd, &wait_vbl);
+}
+
/**
* igt_wait_for_vblank_count:
* @drm_fd: A drm file descriptor
@@ -4209,17 +4223,7 @@ void igt_output_set_writeback_fb(igt_output_t *output, struct igt_fb *fb)
*/
void igt_wait_for_vblank_count(int drm_fd, int crtc_offset, int count)
{
- drmVBlank wait_vbl;
- uint32_t pipe_id_flag;
-
- memset(&wait_vbl, 0, sizeof(wait_vbl));
- pipe_id_flag = kmstest_get_vbl_flag(crtc_offset);
-
- wait_vbl.request.type = DRM_VBLANK_RELATIVE;
- wait_vbl.request.type |= pipe_id_flag;
- wait_vbl.request.sequence = count;
-
- igt_assert(drmWaitVBlank(drm_fd, &wait_vbl) == 0);
+ igt_assert(__igt_vblank_wait(drm_fd, crtc_offset, count) == 0);
}
/**
@@ -4233,7 +4237,7 @@ void igt_wait_for_vblank_count(int drm_fd, int crtc_offset, int count)
*/
void igt_wait_for_vblank(int drm_fd, int crtc_offset)
{
- igt_wait_for_vblank_count(drm_fd, crtc_offset, 1);
+ igt_assert(__igt_vblank_wait(drm_fd, crtc_offset, 1) == 0);
}
/**
--
2.25.1
More information about the igt-dev
mailing list