[igt-dev] [PATCH i-g-t v13 26/31] tests/api_intel_*: Adopt to use relocations as default up to gen12

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Mon Jan 11 10:25:07 UTC 2021


Some minor changes are required to properly handle the tests
when we change intel-bb to use relocations as default up to gen12.

+ migrate purge-bb test from api_intel_allocator -> api_intel_bb
  because it is not allocator test but intel-bb

Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
Cc: Dominik Grzegorzek <dominik.grzegorzek at intel.com>
Cc: Chris Wilson <chris at chris-wilson.co.uk>
---
 tests/i915/api_intel_allocator.c | 32 ----------------------------
 tests/i915/api_intel_bb.c        | 36 ++++++++++++++++++++++++++++++--
 2 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/tests/i915/api_intel_allocator.c b/tests/i915/api_intel_allocator.c
index 84366e70d..16f83c43a 100644
--- a/tests/i915/api_intel_allocator.c
+++ b/tests/i915/api_intel_allocator.c
@@ -97,35 +97,6 @@ static void reserve_simple(int fd)
 	intel_allocator_close(ialh);
 }
 
-static void purge_bb(int fd)
-{
-	struct buf_ops *bops;
-	struct intel_buf *buf;
-	struct intel_bb *ibb;
-	uint64_t offset0, offset1;
-
-	bops = buf_ops_create(fd);
-	buf = intel_buf_create(bops, 512, 512, 32, 0, I915_TILING_NONE,
-			       I915_COMPRESSION_NONE);
-	ibb = intel_bb_create(fd, 4096);
-	intel_bb_set_debug(ibb, true);
-
-	intel_bb_add_intel_buf(ibb, buf, false);
-	offset0 = buf->addr.offset;
-
-	intel_bb_reset(ibb, true);
-	buf->addr.offset = INTEL_BUF_INVALID_ADDRESS;
-
-	intel_bb_add_intel_buf(ibb, buf, false);
-	offset1 = buf->addr.offset;
-
-	igt_assert(offset0 == offset1);
-
-	intel_buf_destroy(buf);
-	intel_bb_destroy(ibb);
-	buf_ops_destroy(bops);
-}
-
 static void reserve(int fd, uint8_t type)
 {
 	struct intel_allocator *ial;
@@ -527,9 +498,6 @@ igt_main
 	igt_subtest_f("reserve-simple")
 		reserve_simple(fd);
 
-	igt_subtest_f("purge-bb")
-		purge_bb(fd);
-
 	igt_subtest_f("print")
 		basic_alloc(fd, 1UL << 2, INTEL_ALLOCATOR_RANDOM);
 
diff --git a/tests/i915/api_intel_bb.c b/tests/i915/api_intel_bb.c
index 3ded9cf55..65844fb92 100644
--- a/tests/i915/api_intel_bb.c
+++ b/tests/i915/api_intel_bb.c
@@ -142,6 +142,33 @@ static void reset_bb(struct buf_ops *bops)
 	intel_bb_destroy(ibb);
 }
 
+static void purge_bb(struct buf_ops *bops)
+{
+	int i915 = buf_ops_get_fd(bops);
+	struct intel_buf *buf;
+	struct intel_bb *ibb;
+	uint64_t offset0, offset1;
+
+	buf = intel_buf_create(bops, 512, 512, 32, 0, I915_TILING_NONE,
+			       I915_COMPRESSION_NONE);
+	ibb = intel_bb_create(i915, 4096);
+	intel_bb_set_debug(ibb, true);
+
+	intel_bb_add_intel_buf(ibb, buf, false);
+	offset0 = buf->addr.offset;
+
+	intel_bb_reset(ibb, true);
+	buf->addr.offset = INTEL_BUF_INVALID_ADDRESS;
+
+	intel_bb_add_intel_buf(ibb, buf, false);
+	offset1 = buf->addr.offset;
+
+	igt_assert(offset0 == offset1);
+
+	intel_buf_destroy(buf);
+	intel_bb_destroy(ibb);
+}
+
 static void simple_bb(struct buf_ops *bops, bool use_context)
 {
 	int i915 = buf_ops_get_fd(bops);
@@ -239,13 +266,15 @@ static void check_canonical(struct buf_ops *bops)
 	/* Twice same addresses to verify will be unreserved in remove path */
 	uint64_t addresses[] = { 0x800000000000, 0x800000000000, 0x400000000000 };
 	uint64_t address, start, end;
-	bool supports_48bit;
+	bool supports_48bit, relocs;
 
 	ibb = intel_bb_create(i915, PAGE_SIZE);
 	supports_48bit = ibb->supports_48b_address;
-	if (!supports_48bit)
+	relocs = ibb->enforce_relocs;
+	if (!supports_48bit || relocs)
 		intel_bb_destroy(ibb);
 	igt_require_f(supports_48bit, "We need 48bit ppgtt for testing\n");
+	igt_require_f(!relocs, "We need to use allocator instead of relocations\n");
 
 	if (debug_bb)
 		intel_bb_set_debug(ibb, true);
@@ -1466,6 +1495,9 @@ igt_main_args("dpib", NULL, help_str, opt_handler, NULL)
 	igt_subtest("reset-bb")
 		reset_bb(bops);
 
+	igt_subtest_f("purge-bb")
+		purge_bb(bops);
+
 	igt_subtest("simple-bb")
 		simple_bb(bops, false);
 
-- 
2.26.0



More information about the igt-dev mailing list