From 65cdccdc7bcbb791d791aeeeecb784a382110a3c Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 20 Jul 2018 09:02:26 +0100 Subject: 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 Cc: Joonas Lahtinen Reviewed-by: Tvrtko Ursulin --- tests/prime_vgem.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tests/prime_vgem.c') 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 #include #include #include @@ -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; -- cgit v1.2.3