igt-dev.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
To: Petri Latvala <petri.latvala@intel.com>,
	Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Cc: igt-dev@lists.freedesktop.org,
	Gustavo Padovan <gustavo@padovan.org>,
	intel-gfx@lists.freedesktop.org
Subject: [igt-dev] [PATCH V2 i-g-t] Skip VBlank tests in modules without VBlank
Date: Thu, 23 Aug 2018 14:18:48 -0300	[thread overview]
Message-ID: <20180823171848.tchxz5iuhrjlbkh4@smtp.gmail.com> (raw)

The kms_flip test does not support drivers without VBlank which exclude
some virtual drivers. This patch adds a function that checks if a module
has a VBlank or not; if a module has VBlank than kms_flip will execute
all the VBlank tests, otherwise, VBlank tests will be skipped.

Changes since 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()

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
---
 lib/igt_kms.c    | 10 ++++++++++
 lib/igt_kms.h    |  2 ++
 tests/kms_flip.c | 26 ++++++++++++++++++++++++--
 3 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index c9e00c3b..21636093 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1684,6 +1684,16 @@ void igt_assert_plane_visible(int fd, enum pipe pipe, bool visibility)
 	igt_assert_eq(visible, visibility);
 }
 
+bool kms_has_vblank(int fd)
+{
+	drmVBlank dummy_vbl;
+
+	memset(&dummy_vbl, 0, sizeof(drmVBlank));
+	dummy_vbl.request.type = DRM_VBLANK_ABSOLUTE;
+
+	return drmWaitVBlank(fd, &dummy_vbl) == 0;
+}
+
 /*
  * A small modeset API
  */
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 4222a341..9543debd 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -226,6 +226,8 @@ void kmstest_wait_for_pageflip(int fd);
 unsigned int kmstest_get_vblank(int fd, int pipe, unsigned int flags);
 void igt_assert_plane_visible(int fd, enum pipe pipe, bool visibility);
 
+bool kms_has_vblank(int fd);
+
 /*
  * A small modeset API
  */
diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index 393d690a..13b408a6 100644
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -73,6 +73,7 @@
 #define TEST_TS_CONT		(1 << 27)
 #define TEST_BO_TOOBIG		(1 << 28)
 
+#define TEST_NO_VBLANK		(1 << 29)
 #define TEST_BASIC		(1 << 30)
 
 #define EVENT_FLIP		(1 << 0)
@@ -125,6 +126,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_TS_CONT | TEST_CHECK_TS | TEST_VBLANK_RACE;
+
+	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;
@@ -493,11 +506,11 @@ 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);
-
+	}
 	/* Check that the vblank frame didn't wrap unexpectedly. */
 	if (o->flags & TEST_TS_CONT) {
 		/* Ignore seq_step here since vblank waits time out immediately
@@ -1204,6 +1217,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 1:
@@ -1297,6 +1311,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]);
-- 
2.18.0


-- 
Rodrigo Siqueira
http://siqueira.tech
Graduate Student
Department of Computer Science
University of São Paulo
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

             reply	other threads:[~2018-08-23 17:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-23 17:18 Rodrigo Siqueira [this message]
2018-08-23 17:47 ` [igt-dev] ✓ Fi.CI.BAT: success for Skip VBlank tests in modules without VBlank (rev2) Patchwork
2018-08-27 11:33   ` Arkadiusz Hiler
2019-01-13 20:31     ` Rodrigo Siqueira
2019-01-14 10:19       ` Daniel Vetter
2019-01-14 10:38         ` Rodrigo Siqueira
2018-08-23 19:22 ` [igt-dev] ✓ Fi.CI.IGT: " 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=20180823171848.tchxz5iuhrjlbkh4@smtp.gmail.com \
    --to=rodrigosiqueiramelo@gmail.com \
    --cc=arkadiusz.hiler@intel.com \
    --cc=gustavo@padovan.org \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=petri.latvala@intel.com \
    /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;
as well as URLs for NNTP newsgroup(s).