diff mbox series

[RFC,i-g-t,v3,4/4] tests/gem_ctx_shared: Calculate object attributs from actual page size

Message ID 20191028155318.23416-5-janusz.krzysztofik@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series Calculate softpin offsets from actual page size | expand

Commit Message

Janusz Krzysztofik Oct. 28, 2019, 3:53 p.m. UTC
exec-shared-gtt-* subtests use hardcoded values for object size and
softpin offset, based on 4kB page size assumption.  That may result in
those subtests failing when run on future backing stores with possibly
larger minimum page sizes.

Replace hardcoded constants with values derived from minimum page size
of actual backing store the test is running on.

Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/i915/gem_ctx_shared.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/tests/i915/gem_ctx_shared.c b/tests/i915/gem_ctx_shared.c
index f7852482..d386de65 100644
--- a/tests/i915/gem_ctx_shared.c
+++ b/tests/i915/gem_ctx_shared.c
@@ -195,6 +195,7 @@  static void exec_shared_gtt(int i915, unsigned int ring)
 	uint32_t scratch, *s;
 	uint32_t batch, cs[16];
 	uint64_t offset;
+	uint64_t page_size;
 	int i;
 
 	gem_require_ring(i915, ring);
@@ -203,7 +204,8 @@  static void exec_shared_gtt(int i915, unsigned int ring)
 	clone = gem_context_clone(i915, 0, I915_CONTEXT_CLONE_VM, 0);
 
 	/* Find a hole big enough for both objects later */
-	scratch = gem_create(i915, 16384);
+	page_size = 1ull << gem_min_page_size_order(i915);
+	scratch = gem_create(i915, 4 * page_size);
 	gem_write(i915, scratch, 0, &bbe, sizeof(bbe));
 	obj.handle = scratch;
 	gem_execbuf(i915, &execbuf);
@@ -246,7 +248,7 @@  static void exec_shared_gtt(int i915, unsigned int ring)
 	gem_write(i915, batch, 0, cs, sizeof(cs));
 
 	obj.handle = batch;
-	obj.offset += 8192; /* make sure we don't cause an eviction! */
+	obj.offset += 2 * page_size; /* make sure we don't cause an eviction! */
 	execbuf.rsvd1 = clone;
 	if (gen > 3 && gen < 6)
 		execbuf.flags |= I915_EXEC_SECURE;