summaryrefslogtreecommitdiff
path: root/tests/kms_flip.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 /tests/kms_flip.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 'tests/kms_flip.c')
-rwxr-xr-xtests/kms_flip.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index d7c1f9cf..2a158d97 100755
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -71,6 +71,7 @@
#define TEST_SUSPEND (1 << 26)
#define TEST_BO_TOOBIG (1 << 28)
+#define TEST_NO_VBLANK (1 << 29)
#define TEST_BASIC (1 << 30)
#define EVENT_FLIP (1 << 0)
@@ -126,6 +127,18 @@ struct event_state {
int seq_step;
};
+static bool vblank_dependence(int flags)
+{
+ int vblank_flags = TEST_VBLANK | TEST_VBLANK_BLOCK |
+ TEST_VBLANK_ABSOLUTE | TEST_VBLANK_EXPIRED_SEQ |
+ TEST_CHECK_TS | TEST_VBLANK_RACE | TEST_EBUSY;
+
+ if (flags & vblank_flags)
+ return true;
+
+ return false;
+}
+
static float timeval_float(const struct timeval *tv)
{
return tv->tv_sec + tv->tv_usec / 1000000.0f;
@@ -494,7 +507,7 @@ static void check_state(const struct test_output *o, const struct event_state *e
/* check only valid if no modeset happens in between, that increments by
* (1 << 23) on each step. This bounding matches the one in
* DRM_IOCTL_WAIT_VBLANK. */
- if (!(o->flags & (TEST_DPMS | TEST_MODESET)))
+ if (!(o->flags & (TEST_DPMS | TEST_MODESET | TEST_NO_VBLANK)))
igt_assert_f(es->current_seq - (es->last_seq + o->seq_step) <= 1UL << 23,
"unexpected %s seq %u, should be >= %u\n",
es->name, es->current_seq, es->last_seq + o->seq_step);
@@ -1176,6 +1189,7 @@ static void run_test_on_crtc_set(struct test_output *o, int *crtc_idxs,
unsigned bo_size = 0;
uint64_t tiling;
int i;
+ bool vblank = true;
switch (crtc_count) {
case RUN_TEST:
@@ -1259,6 +1273,14 @@ static void run_test_on_crtc_set(struct test_output *o, int *crtc_idxs,
}
igt_assert(fb_is_bound(o, o->fb_ids[0]));
+ vblank = kms_has_vblank(drm_fd);
+ if (!vblank) {
+ if (vblank_dependence(o->flags))
+ igt_require_f(vblank, "There is no VBlank\n");
+ else
+ o->flags |= TEST_NO_VBLANK;
+ }
+
/* quiescent the hw a bit so ensure we don't miss a single frame */
if (o->flags & TEST_CHECK_TS)
calibrate_ts(o, crtc_idxs[0]);