summaryrefslogtreecommitdiff
path: root/lib/igt_kms.c
diff options
context:
space:
mode:
authorRodrigo Siqueira <rodrigosiqueiramelo@gmail.com>2019-06-04 23:30:53 -0300
committerRodrigo Siqueira <rodrigosiqueiramelo@gmail.com>2019-06-06 19:43:00 -0300
commit2d244aed69165753f3adbbd6468db073dc1acf9a (patch)
tree224fe5ff5a3e05df8850265e6d0d6deef5fce47b /lib/igt_kms.c
parentde204870261c0ccda668ef8abc8b756b6e679b4a (diff)
tests/kms_flip: Skip VBlank tests in modules without VBlank
The kms_flip test relies on VBlank support, and this situation may exclude some virtual drivers to take advantage of this set of tests. This commit adds a mechanism that checks if a module has VBlank. If the target module has VBlank support, kms_flip will run all the VBlank tests; otherwise, the VBlank tests will be skipped. Additionally, this commit improves the test coverage by checks if the function drmWaitVBlank() returns EOPNOTSUPP (i.e., no VBlank support). V7: Skip seq number checking and busy flip if the device doesn't support vblank V6: Set errno to zero before call drmWaitVBlank() (Chris Wilson) V5: Drop the DRM_VBLANK_NEXTONMISS (Chris Wilson) V4: Replace DRM_VBLANK_ABSOLUTE by DRM_VBLANK_RELATIVE and DRM_VBLANK_NEXTONMISS V3: Add documentation (Daniel Vetter) V2: Add new branch coverage to check if VBlank is enabled or not and update commit message V1: Chris Wilson - Change function name from igt_there_is_vblank to kms_has_vblank - Move vblank function check from igt_aux to igt_kms - Utilizes memset in dummy_vbl variable - Directly return the result of drmWaitVBlank() Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
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
*/