diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2018-07-20 09:02:26 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2018-07-20 17:39:03 +0100 |
commit | 65cdccdc7bcbb791d791aeeeecb784a382110a3c (patch) | |
tree | 10d5906c122703f813ff36833949e2a120fd8f21 /tests | |
parent | bf70728a951cd3c08dd9bbc9310e16aaa252164f (diff) |
igt/gem_mmap_gtt: Check for known incoherency before testing
We test map_gtt coherency (whether or not a write via the mmap_gtt is
immediately visible in the backing storage to a read via mmap_cpu) but
we know that several platforms are inherently incorrect and require some
form of hammer to workaround internal delays. These platforms break our
ABI guarantees and so we report the change in ABI via a driver getparam.
If we know the platform doesn't meet the ABI guarantee, skip the test.
If it is meant to work, test!
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100587
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Diffstat (limited to 'tests')
-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; |