Skip to contentSkip to conversation

tests/kms_flip: Skip VBlank tests in modules without VBlank

PATCH RESEND Superseded Rodrigo Siqueira 3 participants 5 messages Apr 18, 2019 Library code

v6 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

PATCH RESEND v6 1/1 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).

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

---
Updates:
1. Rebase the code with the last updates from the master.
2. Patch tested on VC4, Bochs, VKMS, and i915.

 lib/igt_kms.c    | 20 ++++++++++++++++++++
 lib/igt_kms.h    |  2 ++
 tests/kms_flip.c | 22 ++++++++++++++++++++++
 3 files changed, 44 insertions(+)
lib/igt_kms.c +20 -0
index df9aafd2..0bdd1e40 100644
@@ -1656,6 +1656,26 @@ 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;
+
+	drmWaitVBlank(fd, &dummy_vbl);
+	return (errno != EOPNOTSUPP);
+}
+
 /*
  * A small modeset API
  */
lib/igt_kms.h +2 -0
index 38bdc08f..b0ff79ab 100644
@@ -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, int plane_index, bool visibility);
 
+bool kms_has_vblank(int fd);
+
 /*
  * A small modeset API
  */
tests/kms_flip.c +22 -0
index 6287ce14..4e0471a9 100755
@@ -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;
+
+	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;
@@ -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]);
Signature · 5 lines
2.21.0
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#1 lore raw

[igt-dev] ✓ Fi.CI.BAT: success for tests/kms_flip: Skip VBlank tests in modules without VBlank (rev4)

== Series Details ==

== Series Details ==

Series: tests/kms_flip: Skip VBlank tests in modules without VBlank (rev4)
URL : https://patchwork.freedesktop.org/series/58091/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5953 -> IGTPW_2894
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://patchwork.freedesktop.org/api/1.0/series/58091/revisions/4/mbox/

Known issues
------------

Here are the changes found in IGTPW_2894 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@i915_selftest@live_execlists:
- fi-apl-guc: PASS -> INCOMPLETE [fdo#103927] / [fdo#109720]

* igt@i915_selftest@live_hangcheck:
- fi-icl-y: PASS -> INCOMPLETE [fdo#107713] / [fdo#108569]

* igt@kms_force_connector_basic@force-edid:
- fi-glk-dsi: NOTRUN -> SKIP [fdo#109271] +26

* igt@kms_frontbuffer_tracking@basic:
- fi-glk-dsi: NOTRUN -> FAIL [fdo#103167]

#### Possible fixes ####

* igt@kms_cursor_legacy@basic-flip-before-cursor-varying-size:
- fi-glk-dsi: INCOMPLETE [fdo#103359] / [k.org#198133] -> PASS

[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103359]: https://bugs.freedesktop.org/show_bug.cgi?id=103359
[fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#108569]: https://bugs.freedesktop.org/show_bug.cgi?id=108569
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109720]: https://bugs.freedesktop.org/show_bug.cgi?id=109720
[k.org#198133]: https://bugzilla.kernel.org/show_bug.cgi?id=198133

Participating hosts (50 -> 36)
------------------------------

Missing (14): fi-ilk-m540 fi-bxt-dsi fi-byt-j1900 fi-byt-squawks fi-icl-u2 fi-bsw-cyan fi-snb-2520m fi-ctg-p8600 fi-hsw-4770 fi-gdg-551 fi-bsw-kefka fi-skl-lmem fi-byt-clapper fi-bdw-samus

Build changes
-------------

* IGT: IGT_4957 -> IGTPW_2894

CI_DRM_5953: 7ab8969b77f4f10172e3836b6d5c1d917f7e4007 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_2894: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2894/
IGT_4957: a765aa108105804c19096554447ad0cb71f64fc3 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2894/
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#2 lore raw
In reply to Rodrigo Siqueira

Quoting Rodrigo Siqueira (2019-04-18 15:01:49)

lib/igt_kms.c void igt_assert_plane_visible(int fd, enum pipe pipe, int plane_index, bool visi · line 1676

Quoted 9 lines
lib/igt_kms.c +9 -0
+bool kms_has_vblank(int fd)
+{
+       drmVBlank dummy_vbl;
+
+       memset(&dummy_vbl, 0, sizeof(drmVBlank));
+       dummy_vbl.request.type = DRM_VBLANK_RELATIVE;
+
+       drmWaitVBlank(fd, &dummy_vbl);
+       return (errno != EOPNOTSUPP);

errno is only set on error. It is conceivably that drmWaitVBlank() suceeed but errno is still set to EOPNOTSUPP from an earlier syscall. -Chris
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#3 lore raw
Quoted 14 lines · Chris Wilson

Quoting Rodrigo Siqueira (2019-04-18 15:01:49)

lib/igt_kms.c void igt_assert_plane_visible(int fd, enum pipe pipe, int plane_index, bool visi · line 1676

Quoted 9 lines
lib/igt_kms.c +9 -0
+bool kms_has_vblank(int fd)
+{
+       drmVBlank dummy_vbl;
+
+       memset(&dummy_vbl, 0, sizeof(drmVBlank));
+       dummy_vbl.request.type = DRM_VBLANK_RELATIVE;
+
+       drmWaitVBlank(fd, &dummy_vbl);
+       return (errno != EOPNOTSUPP);

errno is only set on error. It is conceivably that drmWaitVBlank() suceeed but errno is still set to EOPNOTSUPP from an earlier syscall. -Chris

Nice catch!

Before I send a V7, how about this fix:

bool kms_has_vblank(int fd)
{
...
errno = 0;
drmWaitVBlank(fd, &dummy_vbl);
return (errno != EOPNOTSUPP);
}

--
Rodrigo Siqueira
https://siqueira.tech

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#4 lore raw

[igt-dev] ✓ Fi.CI.IGT: success for tests/kms_flip: Skip VBlank tests in modules without VBlank (rev4)

In reply to Rodrigo Siqueira
== Series Details ==

== Series Details ==

Series: tests/kms_flip: Skip VBlank tests in modules without VBlank (rev4)
URL : https://patchwork.freedesktop.org/series/58091/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5953_full -> IGTPW_2894_full
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://patchwork.freedesktop.org/api/1.0/series/58091/revisions/4/mbox/

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in IGTPW_2894_full:

### IGT changes ###

#### Suppressed ####

The following results come from untrusted machines, tests, or statuses. They do not affect the overall result.

* {igt@audio@hdmi-integrity}:
- shard-iclb: NOTRUN -> FAIL

Known issues
------------

Here are the changes found in IGTPW_2894_full that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_ctx_isolation@rcs0-s3:
- shard-apl: PASS -> DMESG-WARN [fdo#108566] +5

* igt@gem_exec_params@no-vebox:
- shard-iclb: NOTRUN -> SKIP [fdo#109283]

* igt@gem_exec_parse@basic-allowed:
- shard-iclb: NOTRUN -> SKIP [fdo#109289] +1

* igt@gem_exec_schedule@fifo-bsd1:
- shard-snb: NOTRUN -> SKIP [fdo#109271] +35

* igt@gem_exec_schedule@preempt-bsd1:
- shard-iclb: NOTRUN -> SKIP [fdo#109276] +20

* igt@gem_exec_store@basic-bsd2:
- shard-apl: NOTRUN -> SKIP [fdo#109271] +49

* igt@gem_pwrite@huge-gtt-forwards:
- shard-iclb: NOTRUN -> SKIP [fdo#109290] +1

* igt@gem_stolen@stolen-pwrite:
- shard-iclb: NOTRUN -> SKIP [fdo#109277]

* igt@gem_tiled_swapping@non-threaded:
- shard-iclb: PASS -> FAIL [fdo#108686]
- shard-hsw: PASS -> FAIL [fdo#108686]

* igt@gem_userptr_blits@readonly-pwrite-unsync:
- shard-iclb: NOTRUN -> SKIP [fdo#110426]

* igt@i915_pm_rpm@modeset-pc8-residency-stress:
- shard-iclb: NOTRUN -> SKIP [fdo#109293]

* igt@kms_atomic_transition@3x-modeset-transitions-nonblocking:
- shard-kbl: NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +6

* igt@kms_atomic_transition@6x-modeset-transitions:
- shard-iclb: NOTRUN -> SKIP [fdo#109278] +7

* igt@kms_busy@extended-modeset-hang-oldfb-render-e:
- shard-apl: NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +2

* igt@kms_chamelium@dp-hpd-storm:
- shard-iclb: NOTRUN -> SKIP [fdo#109284] +5

* igt@kms_cursor_crc@cursor-512x512-offscreen:
- shard-iclb: NOTRUN -> SKIP [fdo#109279] +1

* igt@kms_cursor_legacy@cursorb-vs-flipa-toggle:
- shard-iclb: NOTRUN -> SKIP [fdo#109274] +7

* igt@kms_dp_dsc@basic-dsc-enable-dp:
- shard-iclb: NOTRUN -> SKIP [fdo#109349]

* igt@kms_draw_crc@draw-method-rgb565-render-xtiled:
- shard-glk: PASS -> FAIL [fdo#103184]

* igt@kms_force_connector_basic@force-edid:
- shard-iclb: NOTRUN -> SKIP [fdo#109285]

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-indfb-plflip-blt:
- shard-iclb: NOTRUN -> FAIL [fdo#103167]

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-cpu:
- shard-apl: PASS -> FAIL [fdo#103167]
- shard-kbl: PASS -> FAIL [fdo#103167]

* igt@kms_frontbuffer_tracking@fbcpsr-1p-pri-indfb-multidraw:
- shard-iclb: PASS -> FAIL [fdo#103167] +3

* igt@kms_frontbuffer_tracking@psr-2p-primscrn-pri-shrfb-draw-blt:
- shard-iclb: NOTRUN -> SKIP [fdo#109280] +26

* igt@kms_frontbuffer_tracking@psr-rgb101010-draw-mmap-wc:
- shard-kbl: NOTRUN -> SKIP [fdo#109271] +71

* igt@kms_lease@setcrtc_implicit_plane:
- shard-snb: NOTRUN -> FAIL [fdo#110281]

* igt@kms_plane@pixel-format-pipe-a-planes-source-clamping:
- shard-glk: PASS -> SKIP [fdo#109271]

* igt@kms_plane_alpha_blend@pipe-a-alpha-7efc:
- shard-apl: NOTRUN -> FAIL [fdo#108145]

* igt@kms_plane_alpha_blend@pipe-c-alpha-basic:
- shard-kbl: NOTRUN -> FAIL [fdo#108145] +1

* igt@kms_psr2_su@page_flip:
- shard-iclb: PASS -> SKIP [fdo#109642]

* igt@kms_psr@no_drrs:
- shard-iclb: PASS -> FAIL [fdo#108341]

* igt@kms_psr@psr2_basic:
- shard-iclb: PASS -> SKIP [fdo#109441] +2

* igt@kms_psr@psr2_sprite_plane_move:
- shard-iclb: NOTRUN -> SKIP [fdo#109441] +1

* igt@kms_setmode@basic:

    - shard-apl:          PASS -> FAIL [fdo#99912]
    - shard-iclb:         NOTRUN -> FAIL [fdo#99912]
    - shard-kbl:          PASS -> FAIL [fdo#99912]

* igt@kms_vblank@pipe-a-ts-continuation-suspend:
- shard-kbl: PASS -> DMESG-WARN [fdo#108566] +2

* igt@kms_vblank@pipe-c-query-forked-hang:
- shard-snb: NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +4

* igt@perf_pmu@rc6-runtime-pm-long:

    - shard-apl:          PASS -> FAIL [fdo#105010]
    - shard-glk:          PASS -> FAIL [fdo#105010]
    - shard-kbl:          PASS -> FAIL [fdo#105010]

* igt@prime_nv_pcopy@test2:
- shard-iclb: NOTRUN -> SKIP [fdo#109291] +2

* igt@v3d_get_param@get-bad-flags:
- shard-iclb: NOTRUN -> SKIP [fdo#109315]

#### Possible fixes ####

* igt@gem_eio@unwedge-stress:
- shard-snb: FAIL [fdo#109661] -> PASS

* igt@gem_workarounds@suspend-resume:
- shard-kbl: DMESG-WARN [fdo#108566] -> PASS +1

* igt@i915_pm_rpm@system-suspend:
- shard-kbl: INCOMPLETE [fdo#103665] / [fdo#107807] -> PASS

* igt@i915_suspend@fence-restore-untiled:
- shard-apl: DMESG-WARN [fdo#108566] -> PASS +6

* igt@kms_busy@extended-modeset-hang-oldfb-render-c:
- shard-iclb: INCOMPLETE [fdo#107713] -> PASS
- shard-apl: INCOMPLETE [fdo#103927] -> PASS

* igt@kms_flip@2x-flip-vs-expired-vblank:
- shard-glk: FAIL [fdo#105363] -> PASS

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-pwrite:
- shard-snb: SKIP [fdo#109271] -> PASS +5

* igt@kms_frontbuffer_tracking@fbc-1p-rte:
- shard-iclb: FAIL [fdo#103167] / [fdo#110378] -> PASS

* igt@kms_frontbuffer_tracking@fbc-stridechange:
- shard-iclb: FAIL [fdo#103167] -> PASS +3

* igt@kms_plane@pixel-format-pipe-b-planes:
- shard-glk: SKIP [fdo#109271] -> PASS

* igt@kms_plane_scaling@pipe-a-scaler-with-pixel-format:
- shard-glk: SKIP [fdo#109271] / [fdo#109278] -> PASS +2

* igt@kms_psr@psr2_cursor_plane_onoff:
- shard-iclb: SKIP [fdo#109441] -> PASS +1

* igt@kms_vblank@pipe-b-ts-continuation-dpms-suspend:
- shard-kbl: INCOMPLETE [fdo#103665] -> PASS

* igt@perf_pmu@rc6:
- shard-kbl: SKIP [fdo#109271] -> PASS

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103184]: https://bugs.freedesktop.org/show_bug.cgi?id=103184
[fdo#103665]: https://bugs.freedesktop.org/show_bug.cgi?id=103665
[fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#105010]: https://bugs.freedesktop.org/show_bug.cgi?id=105010
[fdo#105363]: https://bugs.freedesktop.org/show_bug.cgi?id=105363
[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#107807]: https://bugs.freedesktop.org/show_bug.cgi?id=107807
[fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
[fdo#108341]: https://bugs.freedesktop.org/show_bug.cgi?id=108341
[fdo#108566]: https://bugs.freedesktop.org/show_bug.cgi?id=108566
[fdo#108686]: https://bugs.freedesktop.org/show_bug.cgi?id=108686
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109274]: https://bugs.freedesktop.org/show_bug.cgi?id=109274
[fdo#109276]: https://bugs.freedesktop.org/show_bug.cgi?id=109276
[fdo#109277]: https://bugs.freedesktop.org/show_bug.cgi?id=109277
[fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
[fdo#109279]: https://bugs.freedesktop.org/show_bug.cgi?id=109279
[fdo#109280]: https://bugs.freedesktop.org/show_bug.cgi?id=109280
[fdo#109283]: https://bugs.freedesktop.org/show_bug.cgi?id=109283
[fdo#109284]: https://bugs.freedesktop.org/show_bug.cgi?id=109284
[fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
[fdo#109289]: https://bugs.freedesktop.org/show_bug.cgi?id=109289
[fdo#109290]: https://bugs.freedesktop.org/show_bug.cgi?id=109290
[fdo#109291]: https://bugs.freedesktop.org/show_bug.cgi?id=109291
[fdo#109293]: https://bugs.freedesktop.org/show_bug.cgi?id=109293
[fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
[fdo#109349]: https://bugs.freedesktop.org/show_bug.cgi?id=109349
[fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
[fdo#109642]: https://bugs.freedesktop.org/show_bug.cgi?id=109642
[fdo#109661]: https://bugs.freedesktop.org/show_bug.cgi?id=109661
[fdo#110281]: https://bugs.freedesktop.org/show_bug.cgi?id=110281
[fdo#110378]: https://bugs.freedesktop.org/show_bug.cgi?id=110378
[fdo#110426]: https://bugs.freedesktop.org/show_bug.cgi?id=110426
[fdo#99912]: https://bugs.freedesktop.org/show_bug.cgi?id=99912

Participating hosts (10 -> 6)
------------------------------

Missing (4): pig-skl-6260u shard-skl pig-hsw-4770r pig-glk-j5005

Build changes
-------------

* IGT: IGT_4957 -> IGTPW_2894
* Piglit: piglit_4509 -> None

CI_DRM_5953: 7ab8969b77f4f10172e3836b6d5c1d917f7e4007 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_2894: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2894/
IGT_4957: a765aa108105804c19096554447ad0cb71f64fc3 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2894/
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev