summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2016-01-25 10:36:12 -0800
committerEric Anholt <eric@anholt.net>2016-02-04 13:41:09 -0800
commit9aabd10bd0765d9809bdd0412534c66008c3dd77 (patch)
tree1ab10ca1d9b5b87252ac98ce156eee6a6ecc7724
parent1114317f4edcd0e4e7cbec1b776bf72e56293ca0 (diff)
igt/vc4_wait_bo: Add tests with rendering performed.vc4
These caught an unexpected bug with clear colors (we'd get the last executed clear's color in our new BO), while failing to catch the bug I'd been hoping to find all along. Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Daniel Stone <daniels@collabora.com>
-rw-r--r--tests/vc4_wait_bo.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/vc4_wait_bo.c b/tests/vc4_wait_bo.c
index 1b924642..65a085a3 100644
--- a/tests/vc4_wait_bo.c
+++ b/tests/vc4_wait_bo.c
@@ -34,6 +34,38 @@
#include <sys/ioctl.h>
#include "vc4_drm.h"
+static void
+test_used_bo(int fd, uint64_t timeout)
+{
+ size_t size = 4096;
+ uint32_t clearval = 0xaabbccdd + timeout;
+ int handle = igt_vc4_get_cleared_bo(fd, size, clearval);
+ struct drm_vc4_wait_bo wait = {
+ .timeout_ns = timeout,
+ .handle = handle,
+ };
+ int ret, i;
+
+ ret = ioctl(fd, DRM_IOCTL_VC4_WAIT_BO, &wait);
+ if (timeout == ~0ull) {
+ igt_assert_eq_u32(ret, 0);
+ } else {
+ if (ret == -1 && errno == ETIME)
+ igt_debug("Timeout triggered\n");
+ igt_assert(ret == 0 || (ret == -1 && errno == ETIME));
+ }
+
+ if (ret == 0) {
+ uint32_t *map = igt_vc4_mmap_bo(fd, handle, size, PROT_READ);
+ for (i = 0; i < size / 4; i++) {
+ igt_assert_eq_u32(map[i], clearval);
+ }
+ munmap((void *)map, size);
+ }
+
+ gem_close(fd, handle);
+}
+
igt_main
{
int fd;
@@ -77,6 +109,15 @@ igt_main
do_ioctl(fd, DRM_IOCTL_VC4_WAIT_BO, &arg);
}
+ igt_subtest("used-bo-0ns")
+ test_used_bo(fd, 0);
+
+ igt_subtest("used-bo-1ns")
+ test_used_bo(fd, 1);
+
+ igt_subtest("used-bo")
+ test_used_bo(fd, ~0ull);
+
igt_fixture
close(fd);
}