From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Thu, 14 Feb 2019 19:40:31 -0200 Message-ID: <20190214214031.tstbbmbaxf2fynvq@smtp.gmail.com> MIME-Version: 1.0 Subject: [igt-dev] [PATCH V4 i-g-t] Skip VBlank tests in modules without VBlank List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Rodrigo Siqueira via igt-dev Reply-To: Rodrigo Siqueira Content-Type: multipart/mixed; boundary="===============1056813473==" Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" To: Petri Latvala , Arkadiusz Hiler Cc: igt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, Daniel Vetter List-ID: --===============1056813473== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="vyhhov26wopcnicv" Content-Disposition: inline --vyhhov26wopcnicv Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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). Changes since V3: Daniel Vetter: - Add documentation for kms_vblank_status() Changes since V2: - Add new branch coverage to check if VBlank is enabled or not - Update commit message - Change function name from kms_has_vblank to kms_vblank_status 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 --- lib/igt_kms.c | 20 ++++++++++++++++++++ lib/igt_kms.h | 2 ++ tests/kms_flip.c | 27 +++++++++++++++++++++++++-- 3 files changed, 47 insertions(+), 2 deletions(-) diff --git a/lib/igt_kms.c b/lib/igt_kms.c index 85a911e1..81fbafe0 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -1654,6 +1654,26 @@ void igt_assert_plane_visible(int fd, enum pipe pipe= , bool visibility) igt_assert_eq(visible, visibility); } =20 +/** + * kms_vblank_status: + * @fd: DRM fd + * + * Get the VBlank status after an attempt to call drmWaitVBlank(). This + * function is useful for checking if a driver has support or not for VBla= nk. + * + * Returns: The errno code generated by drmWaitVBlank() + */ +int kms_vblank_status(int fd) +{ + drmVBlank dummy_vbl; + + memset(&dummy_vbl, 0, sizeof(drmVBlank)); + dummy_vbl.request.type =3D DRM_VBLANK_ABSOLUTE; + + drmWaitVBlank(fd, &dummy_vbl); + return errno; +} + /* * A small modeset API */ diff --git a/lib/igt_kms.h b/lib/igt_kms.h index 679d4e84..259eaa75 100644 --- a/lib/igt_kms.h +++ b/lib/igt_kms.h @@ -230,6 +230,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); =20 +int kms_vblank_status(int fd); + /* * A small modeset API */ diff --git a/tests/kms_flip.c b/tests/kms_flip.c index 798fc4e8..efc59328 100755 --- 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) =20 +#define TEST_NO_VBLANK (1 << 29) #define TEST_BASIC (1 << 30) =20 #define EVENT_FLIP (1 << 0) @@ -125,6 +126,18 @@ struct event_state { int seq_step; }; =20 +static bool vblank_dependence(int flags) +{ + int vblank_flags =3D 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) <=3D 1UL << = 23, "unexpected %s seq %u, should be >=3D %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 @@ -1184,6 +1197,7 @@ static void run_test_on_crtc_set(struct test_output *= o, int *crtc_idxs, unsigned bo_size =3D 0; uint64_t tiling; int i; + int vblank_status =3D 0; =20 switch (crtc_count) { case 1: @@ -1267,6 +1281,15 @@ static void run_test_on_crtc_set(struct test_output = *o, int *crtc_idxs, } igt_assert(fb_is_bound(o, o->fb_ids[0])); =20 + vblank_status =3D kms_vblank_status(drm_fd); + if (vblank_status =3D=3D EOPNOTSUPP) { + if (vblank_dependence(o->flags)) + igt_require_f(!(vblank_status =3D=3D EOPNOTSUPP), + "Vblank: %s\n", strerror(vblank_status)); + else + o->flags |=3D 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]); --=20 2.20.1 --vyhhov26wopcnicv Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE4tZ+ii1mjMCMQbfkWJzP/comvP8FAlxl4E8ACgkQWJzP/com vP/VcA/+NqqXftFpbTDVVds3rRSQiHHDOaoxLuVBQ9+rd2nz75vz+HvRgdoURJy8 GDOCRNvqbNN1DQPUVqykhqIf5ems29Qj5sfPnbPzGRKejrQHP2A1GicHemeDadIO gdVgQK4ghbvjDj6BKC8wHHjvit/J/6wtwJAaQ+KEFiuMM9Is0VjbLWSgVXFR47ZG woBu9yHMKB+TV6LCdQLKCkRZE8mttPp0iPvHPwLhPCZkr9FCmLrlYBe7CnjGLVPC 1BUtGc/YmoTMoLIpFtbFObSphS7qCMmhgQ7LVjwLmJdhE/aMjlOhvE3O5esfFtmZ ljh2/0tLmrcpFUeQFuGGeUDRrZ46gtusv/P8JUG1PhPlsK6w86+vpXFjVSa0VAuH bHoSkZfkjJIJaHqLcn2DwTpenPuTW1YbFGRmJfmO0aGR3SA+KEkKqZjJXChr8OBR gvxW+ykJb/8pgg159CgPltYobonAwQzOnd1wespAmitMM1i2kg2sfZtN1cPk5x1H stIAQJ9WqLiAVWaYj7ltjMP1gTC6T9Z4qlMUu/oGreszTP0tThfB3TalpZ1JNOko 2QrBmvTDRu5llvVDpROm5yQx/qe56TZ9iTvjIgE0e+LzP8Q/SJkmB0HzQ4MslkPA H9h5pz4D/h8Z0bcZM3AjA6iKpSVwRdUIjqgvebS/KV2dot5Gx1I= =VOCk -----END PGP SIGNATURE----- --vyhhov26wopcnicv-- --===============1056813473== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KaWd0LWRldiBt YWlsaW5nIGxpc3QKaWd0LWRldkBsaXN0cy5mcmVlZGVza3RvcC5vcmcKaHR0cHM6Ly9saXN0cy5m cmVlZGVza3RvcC5vcmcvbWFpbG1hbi9saXN0aW5mby9pZ3QtZGV2 --===============1056813473==--