igt-gpu-tools: build kms_vblank test am: d711f57018

Change-Id: I21fd37a56c573261e57cdce7ead4472b13a1f707
diff --git a/Android.bp b/Android.bp
index 8247b84..477efe2 100644
--- a/Android.bp
+++ b/Android.bp
@@ -26,10 +26,12 @@
         "lib/igt_core.c",
         "lib/igt_debugfs.c",
         "lib/igt_device.c",
+        "lib/igt_dummy.c",
         "lib/igt_dummyload.c",
         "lib/igt_fb.c",
         "lib/igt_kmod.c",
         "lib/igt_kms.c",
+        "lib/igt_pm.c",
         "lib/igt_stats.c",
         "lib/igt_sysfs.c",
         "lib/ion.c",
@@ -75,3 +77,9 @@
     defaults: ["igt-gpu-tools-test-defaults"],
     srcs: ["tests/ion_fb.c"],
 }
+
+cc_test {
+    name: "kms_vblank",
+    defaults: ["igt-gpu-tools-test-defaults"],
+    srcs: ["tests/kms_vblank.c"],
+}
diff --git a/lib/igt_dummy.c b/lib/igt_dummy.c
new file mode 100644
index 0000000..8f4df67
--- /dev/null
+++ b/lib/igt_dummy.c
@@ -0,0 +1,49 @@
+/*
+ * Copyright © 2020 Google LLC.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+/**
+ * SECTION:igt_dummy
+ * @short_description: GT support library for non-GT devices
+ * @title: GT
+ * @include: igt.h
+ *
+ * This library provides various auxiliary helper functions to stub out general
+ * interactions like forcewake handling, injecting hangs or stopping engines
+ * that some tests rely on, but which a non-GT device does not support.
+ */
+
+#include "igt_gt.h"
+
+igt_hang_t igt_hang_ring(int fd, int ring) {
+    return (igt_hang_t) { NULL, 0, 0, 0 };
+}
+
+void igt_post_hang_ring(int fd, igt_hang_t arg) {
+}
+
+igt_hang_t igt_allow_hang(int fd, unsigned ctx, unsigned flags) {
+    return (igt_hang_t) { NULL, 0, 0, 0 };
+}
+
+void igt_disallow_hang(int fd, igt_hang_t arg) {
+}
diff --git a/tests/kms_vblank.c b/tests/kms_vblank.c
index 79ff97b..babef39 100644
--- a/tests/kms_vblank.c
+++ b/tests/kms_vblank.c
@@ -231,24 +231,24 @@
 	int n;
 
 	memset(&vbl, 0, sizeof(vbl));
-	vbl.request.type = DRM_VBLANK_RELATIVE;
+	vbl.request.type = _DRM_VBLANK_RELATIVE;
 	vbl.request.type |= pipe_id_flag;
 	vbl.request.sequence = 1;
 	igt_assert_eq(wait_vblank(fd, &vbl), 0);
 
 	target = vbl.reply.sequence + total;
 	for (n = 0; n < total; n++) {
-		vbl.request.type = DRM_VBLANK_RELATIVE;
+		vbl.request.type = _DRM_VBLANK_RELATIVE;
 		vbl.request.type |= pipe_id_flag;
 		vbl.request.sequence = 1;
 		igt_assert_eq(wait_vblank(fd, &vbl), 0);
 
-		vbl.request.type = DRM_VBLANK_ABSOLUTE | DRM_VBLANK_EVENT;
+		vbl.request.type = _DRM_VBLANK_ABSOLUTE | _DRM_VBLANK_EVENT;
 		vbl.request.type |= pipe_id_flag;
 		vbl.request.sequence = target;
 		igt_assert_eq(wait_vblank(fd, &vbl), 0);
 	}
-	vbl.request.type = DRM_VBLANK_RELATIVE;
+	vbl.request.type = _DRM_VBLANK_RELATIVE;
 	vbl.request.type |= pipe_id_flag;
 	vbl.request.sequence = 0;
 	igt_assert_eq(wait_vblank(fd, &vbl), 0);
@@ -269,7 +269,7 @@
 	unsigned long sq, count = 0;
 
 	memset(&vbl, 0, sizeof(vbl));
-	vbl.request.type = DRM_VBLANK_RELATIVE;
+	vbl.request.type = _DRM_VBLANK_RELATIVE;
 	vbl.request.type |= pipe_id_flag;
 	vbl.request.sequence = 0;
 	igt_assert_eq(wait_vblank(fd, &vbl), 0);
@@ -278,7 +278,7 @@
 
 	clock_gettime(CLOCK_MONOTONIC, &start);
 	do {
-		vbl.request.type = DRM_VBLANK_RELATIVE;
+		vbl.request.type = _DRM_VBLANK_RELATIVE;
 		vbl.request.type |= pipe_id_flag;
 		vbl.request.sequence = 0;
 		igt_assert_eq(wait_vblank(fd, &vbl), 0);
@@ -298,7 +298,7 @@
 	unsigned long sq, count = 0;
 
 	memset(&vbl, 0, sizeof(vbl));
-	vbl.request.type = DRM_VBLANK_RELATIVE;
+	vbl.request.type = _DRM_VBLANK_RELATIVE;
 	vbl.request.type |= pipe_id_flag;
 	vbl.request.sequence = 0;
 	igt_assert_eq(wait_vblank(fd, &vbl), 0);
@@ -307,7 +307,7 @@
 
 	clock_gettime(CLOCK_MONOTONIC, &start);
 	do {
-		vbl.request.type = DRM_VBLANK_RELATIVE;
+		vbl.request.type = _DRM_VBLANK_RELATIVE;
 		vbl.request.type |= pipe_id_flag;
 		vbl.request.sequence = 1;
 		igt_assert_eq(wait_vblank(fd, &vbl), 0);
@@ -368,7 +368,7 @@
 	if (data->flags & (MODESET | DPMS)) {
 		/* Attempting to do a vblank while disabled should return -EINVAL */
 		memset(&vbl, 0, sizeof(vbl));
-		vbl.request.type = DRM_VBLANK_RELATIVE;
+		vbl.request.type = _DRM_VBLANK_RELATIVE;
 		vbl.request.type |= kmstest_get_vbl_flag(data->pipe);
 		igt_assert_eq(wait_vblank(fd, &vbl), -EINVAL);
 	}
@@ -477,7 +477,7 @@
 
 	/* First check all is well with a simple query */
 	memset(&vbl, 0, sizeof(vbl));
-	vbl.request.type = DRM_VBLANK_RELATIVE;
+	vbl.request.type = _DRM_VBLANK_RELATIVE;
 	igt_assert_eq(wait_vblank(fd, &vbl), 0);
 
 	valid_flags = (_DRM_VBLANK_TYPES_MASK |