Skip to contentSkip to conversation

tests/kms_flip: Skip VBlank tests in modules without VBlank

PATCH Superseded Rodrigo Siqueira 4 participants 9 messages Mar 16, 2019 – Mar 18, 2019 Library code

v5 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

PATCH v5 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).

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

---
 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 e1eacc1e..1d2d7188 100644
@@ -1655,6 +1655,26 @@ void igt_assert_plane_visible(int fd, enum pipe pipe, bool visibility)
 	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 | DRM_VBLANK_NEXTONMISS;
+
+	drmWaitVBlank(fd, &dummy_vbl);
+	return (errno != EOPNOTSUPP);
+}
+
 /*
  * A small modeset API
  */
lib/igt_kms.h +2 -0
index 407f3d64..1cc15eea 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, bool visibility);
 
+bool kms_has_vblank(int fd);
+
 /*
  * A small modeset API
  */
tests/kms_flip.c +22 -0
index dfa5a69e..614efc5b 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;
@@ -1177,6 +1190,7 @@ static void run_test_on_crtc_set(struct test_output *o, int *crtc_idxs,
 	unsigned bo_size = 0;
 	uint64_t tiling;
 	int i;
+	int vblank = true;
 
 	switch (crtc_count) {
 	case RUN_TEST:
@@ -1260,6 +1274,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 (rev2)

== Series Details ==

== Series Details ==

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

== Summary ==

CI Bug Log - changes from IGT_4888 -> IGTPW_2647
====================================================

Summary
-------

**SUCCESS**

No regressions found.

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

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

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

### IGT changes ###

#### Issues hit ####

* igt@amdgpu/amd_cs_nop@sync-gfx0:
- fi-kbl-7567u: NOTRUN -> SKIP [fdo#109271] +17

* igt@gem_exec_suspend@basic-s4-devices:
- fi-blb-e6850: PASS -> INCOMPLETE [fdo#107718]

* igt@i915_module_load@reload:
- fi-kbl-7567u: PASS -> DMESG-WARN [fdo#105602] / [fdo#108529]

* igt@i915_pm_rpm@module-reload:
- fi-kbl-7567u: NOTRUN -> DMESG-WARN [fdo#108529]

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

* igt@kms_chamelium@common-hpd-after-suspend:
- fi-kbl-7567u: PASS -> DMESG-FAIL [fdo#105079]

* igt@kms_chamelium@dp-edid-read:
- fi-skl-iommu: NOTRUN -> SKIP [fdo#109271] +45

* igt@kms_pipe_crc_basic@nonblocking-crc-pipe-c:
- fi-kbl-7567u: PASS -> SKIP [fdo#109271] +33

* igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
- fi-whl-u: PASS -> FAIL [fdo#103375] +3

#### Possible fixes ####

* igt@kms_frontbuffer_tracking@basic:
- fi-icl-u3: FAIL [fdo#103167] -> PASS

* igt@kms_pipe_crc_basic@read-crc-pipe-b:
- fi-byt-clapper: FAIL [fdo#107362] -> PASS

* igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
- fi-byt-clapper: FAIL [fdo#103191] / [fdo#107362] -> PASS +2

* igt@prime_vgem@basic-fence-flip:
- fi-ilk-650: FAIL [fdo#104008] -> PASS

[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191
[fdo#103375]: https://bugs.freedesktop.org/show_bug.cgi?id=103375
[fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#104008]: https://bugs.freedesktop.org/show_bug.cgi?id=104008
[fdo#105079]: https://bugs.freedesktop.org/show_bug.cgi?id=105079
[fdo#105602]: https://bugs.freedesktop.org/show_bug.cgi?id=105602
[fdo#107362]: https://bugs.freedesktop.org/show_bug.cgi?id=107362
[fdo#107718]: https://bugs.freedesktop.org/show_bug.cgi?id=107718
[fdo#108529]: https://bugs.freedesktop.org/show_bug.cgi?id=108529
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109720]: https://bugs.freedesktop.org/show_bug.cgi?id=109720

Participating hosts (46 -> 40)
------------------------------

Additional (1): fi-skl-iommu
Missing (7): fi-kbl-soraka fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-icl-u2 fi-bsw-cyan fi-bdw-samus

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

* IGT: IGT_4888 -> IGTPW_2647
* Linux: CI_DRM_5756 -> CI_DRM_5763

CI_DRM_5756: 0a2a982693ac3f3ecabf8e6c12cb18aa993ae3b0 @ git://anongit.freedesktop.org/gfx-ci/linux
CI_DRM_5763: de2772b353b83e6347687973dfff6f7f5257e364 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_2647: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2647/
IGT_4888: 71ad19eb8fe4f0eecae3bf063e107293b90b9abc @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

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

#2 lore raw
In reply to Rodrigo Siqueira
Quoted 42 lines · Rodrigo Siqueira

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

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

---
 lib/igt_kms.c    | 20 ++++++++++++++++++++
 lib/igt_kms.h    |  2 ++
 tests/kms_flip.c | 22 ++++++++++++++++++++++
 3 files changed, 44 insertions(+)
lib/igt_kms.c +5 -0
index e1eacc1e..1d2d7188 100644
@@ -1655,6 +1655,26 @@ void igt_assert_plane_visible(int fd, enum pipe pipe, bool visibility)
 	igt_assert_eq(visible, visibility);
 }
 
+/**
+ * kms_has_vblank:
+ * @fd: DRM fd
+ *
+ * Get the VBlank errno after an attempt to call drmWaitVBlank(). This

lib/igt_kms.c void igt_assert_plane_visible(int fd, enum pipe pipe, bool visibility) · line 1672

Quoted 10 lines
lib/igt_kms.c +10 -0
+ * 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 | DRM_VBLANK_NEXTONMISS;

Why the NEXTONMISS?

Quoted 81 lines
lib/igt_kms.c +5 -0
+
+	drmWaitVBlank(fd, &dummy_vbl);
+	return (errno != EOPNOTSUPP);
+}
+
 /*
  * A small modeset API
  */
lib/igt_kms.h +2 -0
index 407f3d64..1cc15eea 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, bool visibility);
 
+bool kms_has_vblank(int fd);
+
 /*
  * A small modeset API
  */
tests/kms_flip.c +22 -0
index dfa5a69e..614efc5b 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;
@@ -1177,6 +1190,7 @@ static void run_test_on_crtc_set(struct test_output *o, int *crtc_idxs,
 	unsigned bo_size = 0;
 	uint64_t tiling;
 	int i;
+	int vblank = true;
 
 	switch (crtc_count) {
 	case RUN_TEST:
@@ -1260,6 +1274,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
Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#3 lore raw
Quoted 47 lines · Ville Syrjälä
Quoted 46 lines · Rodrigo Siqueira

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

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

---
 lib/igt_kms.c    | 20 ++++++++++++++++++++
 lib/igt_kms.h    |  2 ++
 tests/kms_flip.c | 22 ++++++++++++++++++++++
 3 files changed, 44 insertions(+)
lib/igt_kms.c +9 -0
index e1eacc1e..1d2d7188 100644
@@ -1655,6 +1655,26 @@ void igt_assert_plane_visible(int fd, enum pipe pipe, bool visibility)
 	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.
+ */
Quoted 8 lines

lib/igt_kms.c void igt_assert_plane_visible(int fd, enum pipe pipe, bool visibility) · line 1672

Quoted 6 lines
lib/igt_kms.c +6 -0
+bool kms_has_vblank(int fd)
+{
+	drmVBlank dummy_vbl;
+
+	memset(&dummy_vbl, 0, sizeof(drmVBlank));
+	dummy_vbl.request.type = DRM_VBLANK_RELATIVE | DRM_VBLANK_NEXTONMISS;

Why the NEXTONMISS?

I added this flag because I was suspecting that in case of any problem during the kms_has_vblank() execution the flag NEXTONMISS will wait for the next VBlank and avoid to generate problems in the subsequent tests. However, I was not 100% sure about this decision since this code will only test the first if condition inside drm_wait_vblank_ioctl(). Additionally, I could not find a good way to test the drmWaitVBlank() with and without this flag.

Please, correct if I'm wrong. I'm fighting to understand the vblank API.

Thanks for you review :)

Quoted 85 lines
Quoted 81 lines
lib/igt_kms.c +5 -0
+
+	drmWaitVBlank(fd, &dummy_vbl);
+	return (errno != EOPNOTSUPP);
+}
+
 /*
  * A small modeset API
  */
lib/igt_kms.h +2 -0
index 407f3d64..1cc15eea 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, bool visibility);
 
+bool kms_has_vblank(int fd);
+
 /*
  * A small modeset API
  */
tests/kms_flip.c +22 -0
index dfa5a69e..614efc5b 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;
@@ -1177,6 +1190,7 @@ static void run_test_on_crtc_set(struct test_output *o, int *crtc_idxs,
 	unsigned bo_size = 0;
 	uint64_t tiling;
 	int i;
+	int vblank = true;
 
 	switch (crtc_count) {
 	case RUN_TEST:
@@ -1260,6 +1274,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
Signature · 2 lines
Ville Syrjälä
Intel
Signature · 5 lines
Rodrigo Siqueira
https://siqueira.tech
Graduate Student
Department of Computer Science
University of São Paulo

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

#4 lore raw

Quoting Rodrigo Siqueira (2019-03-18 21:35:44)

Quoted 57 lines · Ville Syrjälä
Quoted 47 lines · Rodrigo Siqueira
Quoted 46 lines

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

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

---
 lib/igt_kms.c    | 20 ++++++++++++++++++++
 lib/igt_kms.h    |  2 ++
 tests/kms_flip.c | 22 ++++++++++++++++++++++
 3 files changed, 44 insertions(+)
lib/igt_kms.c +9 -0
index e1eacc1e..1d2d7188 100644
@@ -1655,6 +1655,26 @@ void igt_assert_plane_visible(int fd, enum pipe pipe, bool visibility)
    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.
+ */
Quoted 8 lines

lib/igt_kms.c void igt_assert_plane_visible(int fd, enum pipe pipe, bool visibility) · line 1672

Quoted 6 lines
lib/igt_kms.c +6 -0
+bool kms_has_vblank(int fd)
+{
+   drmVBlank dummy_vbl;
+
+   memset(&dummy_vbl, 0, sizeof(drmVBlank));
+   dummy_vbl.request.type = DRM_VBLANK_RELATIVE | DRM_VBLANK_NEXTONMISS;

Why the NEXTONMISS?

Quoted 3 lines

I added this flag because I was suspecting that in case of any problem during the kms_has_vblank() execution the flag NEXTONMISS will wait for the next VBlank and avoid to generate problems in the subsequent tests.

That is true, and a valid use for using NEXTONMISS if you want to align your code to the start of a vblank to avoid overrunning into the next vblank.

However, that is not the purpose of kms_has_vblank()! Whose only purpose is answer the question of whether the device has vblank support, and so should be as quick and simple as possible, so the trivial query of the current vblank counter.
-Chris
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#5 lore raw
Quoted 62 lines · Chris Wilson

Quoting Rodrigo Siqueira (2019-03-18 21:35:44)

Quoted 57 lines · Ville Syrjälä
Quoted 47 lines · Rodrigo Siqueira
Quoted 46 lines

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

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

---
 lib/igt_kms.c    | 20 ++++++++++++++++++++
 lib/igt_kms.h    |  2 ++
 tests/kms_flip.c | 22 ++++++++++++++++++++++
 3 files changed, 44 insertions(+)
lib/igt_kms.c +9 -0
index e1eacc1e..1d2d7188 100644
@@ -1655,6 +1655,26 @@ void igt_assert_plane_visible(int fd, enum pipe pipe, bool visibility)
    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.
+ */
Quoted 8 lines

lib/igt_kms.c void igt_assert_plane_visible(int fd, enum pipe pipe, bool visibility) · line 1672

Quoted 6 lines
lib/igt_kms.c +6 -0
+bool kms_has_vblank(int fd)
+{
+   drmVBlank dummy_vbl;
+
+   memset(&dummy_vbl, 0, sizeof(drmVBlank));
+   dummy_vbl.request.type = DRM_VBLANK_RELATIVE | DRM_VBLANK_NEXTONMISS;

Why the NEXTONMISS?

Quoted 3 lines

I added this flag because I was suspecting that in case of any problem during the kms_has_vblank() execution the flag NEXTONMISS will wait for the next VBlank and avoid to generate problems in the subsequent tests.

Quoted 8 lines

That is true, and a valid use for using NEXTONMISS if you want to align your code to the start of a vblank to avoid overrunning into the next vblank.

However, that is not the purpose of kms_has_vblank()! Whose only purpose is answer the question of whether the device has vblank support, and so should be as quick and simple as possible, so the trivial query of the current vblank counter.

Nice! Thanks for your answer.

So, I suppose that use DRM_VBLANK_RELATIVE is enough for this case, right?

Quoted 1 line

-Chris

Signature · 5 lines
Rodrigo Siqueira
https://siqueira.tech
Graduate Student
Department of Computer Science
University of São Paulo

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

#6 lore raw

Quoting Rodrigo Siqueira (2019-03-18 21:53:42)

Quoted 72 lines · Chris Wilson
Quoted 62 lines

Quoting Rodrigo Siqueira (2019-03-18 21:35:44)

Quoted 57 lines · Ville Syrjälä
Quoted 47 lines · Rodrigo Siqueira
Quoted 46 lines

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

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

---
 lib/igt_kms.c    | 20 ++++++++++++++++++++
 lib/igt_kms.h    |  2 ++
 tests/kms_flip.c | 22 ++++++++++++++++++++++
 3 files changed, 44 insertions(+)
lib/igt_kms.c +9 -0
index e1eacc1e..1d2d7188 100644
@@ -1655,6 +1655,26 @@ void igt_assert_plane_visible(int fd, enum pipe pipe, bool visibility)
    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.
+ */
Quoted 8 lines

lib/igt_kms.c void igt_assert_plane_visible(int fd, enum pipe pipe, bool visibility) · line 1672

Quoted 6 lines
lib/igt_kms.c +6 -0
+bool kms_has_vblank(int fd)
+{
+   drmVBlank dummy_vbl;
+
+   memset(&dummy_vbl, 0, sizeof(drmVBlank));
+   dummy_vbl.request.type = DRM_VBLANK_RELATIVE | DRM_VBLANK_NEXTONMISS;

Why the NEXTONMISS?

Quoted 3 lines

I added this flag because I was suspecting that in case of any problem during the kms_has_vblank() execution the flag NEXTONMISS will wait for the next VBlank and avoid to generate problems in the subsequent tests.

Quoted 8 lines

That is true, and a valid use for using NEXTONMISS if you want to align your code to the start of a vblank to avoid overrunning into the next vblank.

However, that is not the purpose of kms_has_vblank()! Whose only purpose is answer the question of whether the device has vblank support, and so should be as quick and simple as possible, so the trivial query of the current vblank counter.

Quoted 4 lines

Nice! Thanks for your answer.

So, I suppose that use DRM_VBLANK_RELATIVE is enough for this case, right?

Yes, that should return immediately both on success and on failure. -Chris
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#7 lore raw
Quoted 73 lines · Chris Wilson

Quoting Rodrigo Siqueira (2019-03-18 21:53:42)

Quoted 72 lines · Chris Wilson
Quoted 70 lines

Quoting Rodrigo Siqueira (2019-03-18 21:35:44)

Quoted 57 lines · Ville Syrjälä
Quoted 47 lines · Rodrigo Siqueira
Quoted 46 lines

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

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

---
 lib/igt_kms.c    | 20 ++++++++++++++++++++
 lib/igt_kms.h    |  2 ++
 tests/kms_flip.c | 22 ++++++++++++++++++++++
 3 files changed, 44 insertions(+)
lib/igt_kms.c +9 -0
index e1eacc1e..1d2d7188 100644
@@ -1655,6 +1655,26 @@ void igt_assert_plane_visible(int fd, enum pipe pipe, bool visibility)
    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.
+ */
Quoted 8 lines

lib/igt_kms.c void igt_assert_plane_visible(int fd, enum pipe pipe, bool visibility) · line 1672

Quoted 6 lines
lib/igt_kms.c +6 -0
+bool kms_has_vblank(int fd)
+{
+   drmVBlank dummy_vbl;
+
+   memset(&dummy_vbl, 0, sizeof(drmVBlank));
+   dummy_vbl.request.type = DRM_VBLANK_RELATIVE | DRM_VBLANK_NEXTONMISS;

Why the NEXTONMISS?

Quoted 3 lines

I added this flag because I was suspecting that in case of any problem during the kms_has_vblank() execution the flag NEXTONMISS will wait for the next VBlank and avoid to generate problems in the subsequent tests.

That is true, and a valid use for using NEXTONMISS if you want to align your code to the start of a vblank to avoid overrunning into the next vblank.

However, that is not the purpose of kms_has_vblank()! Whose only purpose is answer the question of whether the device has vblank support, and so should be as quick and simple as possible, so the trivial query of the current vblank counter.

Quoted 7 lines
Quoted 4 lines

Nice! Thanks for your answer.

So, I suppose that use DRM_VBLANK_RELATIVE is enough for this case, right?

Yes, that should return immediately both on success and on failure. -Chris

Thanks! I will prepare a v6 tomorrow

Signature · 5 lines
Rodrigo Siqueira
https://siqueira.tech
Graduate Student
Department of Computer Science
University of São Paulo

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

#8 lore raw

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

In reply to Rodrigo Siqueira
== Series Details ==

== Series Details ==

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

== Summary ==

CI Bug Log - changes from IGT_4888_full -> IGTPW_2647_full
====================================================

Summary
-------

**SUCCESS**

No regressions found.

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

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

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

### IGT changes ###

#### Issues hit ####

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

* igt@kms_atomic_transition@4x-modeset-transitions-nonblocking-fencing:
- shard-glk: NOTRUN -> SKIP [fdo#109271] / [fdo#109278]

* igt@kms_busy@extended-modeset-hang-newfb-render-c:
- shard-kbl: PASS -> DMESG-WARN [fdo#107956] +1

* igt@kms_busy@extended-modeset-hang-newfb-with-reset-render-b:
- shard-snb: NOTRUN -> DMESG-WARN [fdo#107956]
- shard-hsw: PASS -> DMESG-WARN [fdo#107956]

* igt@kms_ccs@pipe-a-crc-sprite-planes-basic:
- shard-glk: PASS -> FAIL [fdo#108145]

* igt@kms_cursor_crc@cursor-128x128-suspend:
- shard-apl: PASS -> FAIL [fdo#103191] / [fdo#103232]

* igt@kms_cursor_crc@cursor-256x256-random:
- shard-apl: PASS -> FAIL [fdo#103232] +1

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

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-render:
- shard-apl: PASS -> FAIL [fdo#103167] +2

* igt@kms_frontbuffer_tracking@fbc-2p-primscrn-spr-indfb-draw-mmap-cpu:
- shard-glk: PASS -> FAIL [fdo#103167] +4

* igt@kms_frontbuffer_tracking@fbc-suspend:
- shard-apl: PASS -> FAIL [fdo#103375]

* igt@kms_frontbuffer_tracking@fbcpsr-rgb565-draw-mmap-gtt:
- shard-kbl: NOTRUN -> SKIP [fdo#109271] +5

* igt@kms_frontbuffer_tracking@psr-1p-primscrn-cur-indfb-onoff:
- shard-snb: NOTRUN -> SKIP [fdo#109271] +106

* igt@kms_psr@sprite_plane_onoff:
- shard-glk: NOTRUN -> SKIP [fdo#109271] +10

* igt@kms_rotation_crc@multiplane-rotation-cropping-top:
- shard-kbl: PASS -> FAIL [fdo#109016]

* igt@kms_setmode@basic:
- shard-hsw: PASS -> FAIL [fdo#99912]

* igt@prime_nv_api@i915_nv_reimport_twice_check_flink_name:
- shard-apl: NOTRUN -> SKIP [fdo#109271] +6

* igt@sw_sync@sync_busy_fork_unixsocket:
- shard-snb: NOTRUN -> FAIL [fdo#110150 ]

#### Possible fixes ####

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

* igt@i915_pm_rc6_residency@rc6-accuracy:
- shard-snb: SKIP [fdo#109271] -> PASS

* igt@kms_busy@extended-modeset-hang-newfb-with-reset-render-a:

    - shard-snb:          DMESG-WARN [fdo#107956] -> PASS
    - shard-hsw:          DMESG-WARN [fdo#107956] -> PASS
    - shard-kbl:          DMESG-WARN [fdo#107956] -> PASS

* igt@kms_cursor_crc@cursor-128x128-onscreen:
- shard-apl: FAIL [fdo#103232] -> PASS +1

* igt@kms_cursor_crc@cursor-64x64-suspend:
- shard-apl: FAIL [fdo#103191] / [fdo#103232] -> PASS
- shard-kbl: FAIL [fdo#103191] / [fdo#103232] -> PASS

* igt@kms_cursor_legacy@2x-long-cursor-vs-flip-legacy:
- shard-hsw: FAIL [fdo#105767] -> PASS

* igt@kms_flip@modeset-vs-vblank-race-interruptible:
- shard-glk: FAIL [fdo#103060] -> PASS

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

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-fullscreen:
- shard-kbl: FAIL [fdo#103167] -> PASS +1

* igt@kms_frontbuffer_tracking@fbc-2p-primscrn-spr-indfb-draw-pwrite:
- shard-glk: FAIL [fdo#103167] -> PASS +2

* igt@kms_pipe_crc_basic@suspend-read-crc-pipe-c:
- shard-kbl: INCOMPLETE [fdo#103665] -> PASS

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

* {igt@kms_plane@pixel-format-pipe-a-planes-source-clamping}:
- shard-apl: FAIL [fdo#110033] -> PASS +1
- shard-kbl: FAIL [fdo#110127] -> PASS

* {igt@kms_plane_multiple@atomic-pipe-b-tiling-none}:
- shard-apl: FAIL [fdo#110037] -> PASS +3

* igt@kms_setmode@basic:
- shard-apl: FAIL [fdo#99912] -> PASS

* igt@kms_vblank@pipe-c-ts-continuation-modeset:
- shard-kbl: FAIL [fdo#104894] -> PASS
- shard-apl: FAIL [fdo#104894] -> PASS

#### Warnings ####

* igt@kms_plane_scaling@pipe-a-scaler-with-rotation:
- shard-glk: FAIL [fdo#110098] -> SKIP [fdo#109271] / [fdo#109278] +1

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

[fdo#103060]: https://bugs.freedesktop.org/show_bug.cgi?id=103060
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191
[fdo#103232]: https://bugs.freedesktop.org/show_bug.cgi?id=103232
[fdo#103375]: https://bugs.freedesktop.org/show_bug.cgi?id=103375
[fdo#103665]: https://bugs.freedesktop.org/show_bug.cgi?id=103665
[fdo#104894]: https://bugs.freedesktop.org/show_bug.cgi?id=104894
[fdo#105767]: https://bugs.freedesktop.org/show_bug.cgi?id=105767
[fdo#107956]: https://bugs.freedesktop.org/show_bug.cgi?id=107956
[fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
[fdo#109016]: https://bugs.freedesktop.org/show_bug.cgi?id=109016
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
[fdo#109661]: https://bugs.freedesktop.org/show_bug.cgi?id=109661
[fdo#110033]: https://bugs.freedesktop.org/show_bug.cgi?id=110033
[fdo#110037]: https://bugs.freedesktop.org/show_bug.cgi?id=110037
[fdo#110038]: https://bugs.freedesktop.org/show_bug.cgi?id=110038
[fdo#110098]: https://bugs.freedesktop.org/show_bug.cgi?id=110098
[fdo#110127]: https://bugs.freedesktop.org/show_bug.cgi?id=110127
[fdo#110150 ]: https://bugs.freedesktop.org/show_bug.cgi?id=110150
[fdo#99912]: https://bugs.freedesktop.org/show_bug.cgi?id=99912

Participating hosts (7 -> 5)
------------------------------

Missing (2): shard-skl shard-iclb

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

* IGT: IGT_4888 -> IGTPW_2647
* Linux: CI_DRM_5756 -> CI_DRM_5763

CI_DRM_5756: 0a2a982693ac3f3ecabf8e6c12cb18aa993ae3b0 @ git://anongit.freedesktop.org/gfx-ci/linux
CI_DRM_5763: de2772b353b83e6347687973dfff6f7f5257e364 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_2647: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2647/
IGT_4888: 71ad19eb8fe4f0eecae3bf063e107293b90b9abc @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

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