From d711f5701806f6e5e08c9da01912b79b7f80eed5 Mon Sep 17 00:00:00 2001 From: Kevin DuBois Date: Wed, 12 Feb 2020 15:32:07 -0800 Subject: igt-gpu-tools: build kms_vblank test Add kms_vblank test build target. kms_vblank tests the vsync event signals for correctness and timing accurracy. Test: builds and runs (with some failures) on a Pixel 4. Fixes: 149217819 Change-Id: I0152d332a980347ce4e40173dc3b3c48f207df3b --- Android.bp | 8 ++++++++ lib/igt_dummy.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ tests/kms_vblank.c | 20 ++++++++++---------- 3 files changed, 67 insertions(+), 10 deletions(-) create mode 100644 lib/igt_dummy.c diff --git a/Android.bp b/Android.bp index 8247b849..477efe2e 100644 --- a/Android.bp +++ b/Android.bp @@ -26,10 +26,12 @@ cc_library_static { "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 @@ cc_test { 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 00000000..8f4df67f --- /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 79ff97b2..babef39d 100644 --- a/tests/kms_vblank.c +++ b/tests/kms_vblank.c @@ -231,24 +231,24 @@ static void accuracy(data_t *data, int fd, int nchildren) 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 @@ static void vblank_query(data_t *data, int fd, int nchildren) 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 @@ static void vblank_query(data_t *data, int fd, int nchildren) 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 @@ static void vblank_wait(data_t *data, int fd, int nchildren) 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 @@ static void vblank_wait(data_t *data, int fd, int nchildren) 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 @@ static void vblank_ts_cont(data_t *data, int fd, int nchildren) 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 @@ static void invalid_subtest(data_t *data, int fd) /* 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 | -- cgit v1.2.3