diff options
-rw-r--r-- | tests/gem_mmap_gtt.c | 13 | ||||
-rw-r--r-- | tests/prime_vgem.c | 15 |
2 files changed, 28 insertions, 0 deletions
diff --git a/tests/gem_mmap_gtt.c b/tests/gem_mmap_gtt.c index c8a0bede..f6353555 100644 --- a/tests/gem_mmap_gtt.c +++ b/tests/gem_mmap_gtt.c @@ -309,6 +309,18 @@ test_write_gtt(int fd) munmap(src, OBJECT_SIZE); } +static bool is_coherent(int i915) +{ + int val = 1; /* by default, we assume GTT is coherent, hence the test */ + struct drm_i915_getparam gp = { + gp.param = 52, /* GTT_COHERENT */ + gp.value = &val, + }; + + ioctl(i915, DRM_IOCTL_I915_GETPARAM, &gp); + return val; +} + static void test_coherency(int fd) { @@ -316,6 +328,7 @@ test_coherency(int fd) uint32_t *gtt, *cpu; int i; + igt_require(is_coherent(fd)); igt_require(igt_setup_clflush()); handle = gem_create(fd, OBJECT_SIZE); diff --git a/tests/prime_vgem.c b/tests/prime_vgem.c index 763c62e6..d886044a 100644 --- a/tests/prime_vgem.c +++ b/tests/prime_vgem.c @@ -24,6 +24,7 @@ #include "igt.h" #include "igt_vgem.h" +#include <sys/ioctl.h> #include <sys/poll.h> #include <signal.h> #include <time.h> @@ -236,6 +237,18 @@ static void test_gtt(int vgem, int i915) gem_close(vgem, scratch.handle); } +static bool is_coherent(int i915) +{ + int val = 1; /* by default, we assume GTT is coherent, hence the test */ + struct drm_i915_getparam gp = { + gp.param = 52, /* GTT_COHERENT */ + gp.value = &val, + }; + + ioctl(i915, DRM_IOCTL_I915_GETPARAM, &gp); + return val; +} + static void test_gtt_interleaved(int vgem, int i915) { struct vgem_bo scratch; @@ -243,6 +256,8 @@ static void test_gtt_interleaved(int vgem, int i915) uint32_t *ptr, *gtt; int dmabuf, i; + igt_require(is_coherent(i915)); + scratch.width = 1024; scratch.height = 1024; scratch.bpp = 32; |