summaryrefslogtreecommitdiff
path: root/lib/igt_kms.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/igt_kms.c')
-rw-r--r--lib/igt_kms.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index d7d711a7..8a465f67 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1673,6 +1673,27 @@ void igt_assert_plane_visible(int fd, enum pipe pipe, int plane_index, bool visi
igt_assert_eq(visible, visibility);
}
+/**
+ * kms_has_vblank:
+ * @fd: DRM fd
+ *
+ * Get the VBlank errno after an attempt to call drmWaitVBlank(). This
+ * function is useful for checking if a driver has support or not for VBlank.
+ *
+ * Returns: true if target driver has VBlank support, otherwise return false.
+ */
+bool kms_has_vblank(int fd)
+{
+ drmVBlank dummy_vbl;
+
+ memset(&dummy_vbl, 0, sizeof(drmVBlank));
+ dummy_vbl.request.type = DRM_VBLANK_RELATIVE;
+
+ errno = 0;
+ drmWaitVBlank(fd, &dummy_vbl);
+ return (errno != EOPNOTSUPP);
+}
+
/*
* A small modeset API
*/