[igt-dev] [PATCH i-g-t] i915/gem_pread/pwrite: Skip gtt test on self for missing mappable gtt

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Thu Nov 14 17:08:30 UTC 2019


Some tests are designed to use GGTT API which should be skipped
when HW doesn't support mappable aperture.

Gem pread / pwrite "self" test is one of them.

Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
Cc: Chris Wilson <chris at chris-wilson.co.uk>
---
 tests/i915/gem_pread.c  | 3 ++-
 tests/i915/gem_pwrite.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/tests/i915/gem_pread.c b/tests/i915/gem_pread.c
index 0d3e10b8..5b926ab0 100644
--- a/tests/i915/gem_pread.c
+++ b/tests/i915/gem_pread.c
@@ -52,13 +52,14 @@ static void *wrap_gem_mmap__gtt(int i915, uint32_t handle,
 
 static void pread_self(int i915)
 {
+	int start = gem_has_mappable_ggtt(i915) ? 0 : 1;
 	static const mmap_fn_t mmap_fn[] = {
 		wrap_gem_mmap__gtt,
 		gem_mmap__cpu,
 		gem_mmap__wc,
 		NULL
 	};
-	for (const mmap_fn_t *fn = mmap_fn; *fn; fn++) {
+	for (const mmap_fn_t *fn = mmap_fn + start; *fn; fn++) {
 		uint32_t handle = gem_create(i915, MiB(4));
 		void *ptr = (*fn)(i915, handle, 0, MiB(4), PROT_WRITE);
 
diff --git a/tests/i915/gem_pwrite.c b/tests/i915/gem_pwrite.c
index 37e97879..69f823d5 100644
--- a/tests/i915/gem_pwrite.c
+++ b/tests/i915/gem_pwrite.c
@@ -52,13 +52,14 @@ static void *wrap_gem_mmap__gtt(int i915, uint32_t handle,
 
 static void pwrite_self(int i915)
 {
+	int start = gem_has_mappable_ggtt(i915) ? 0 : 1;
 	static const mmap_fn_t mmap_fn[] = {
 		wrap_gem_mmap__gtt,
 		gem_mmap__cpu,
 		gem_mmap__wc,
 		NULL
 	};
-	for (const mmap_fn_t *fn = mmap_fn; *fn; fn++) {
+	for (const mmap_fn_t *fn = mmap_fn + start; *fn; fn++) {
 		uint32_t handle = gem_create(i915, MiB(4));
 		void *ptr = (*fn)(i915, handle, 0, MiB(4), PROT_READ);
 
-- 
2.23.0



More information about the igt-dev mailing list