[igt-dev] [PATCH i-g-t v15 22/33] tests/gem_ppgtt: Adopt test to use intel_bb with allocator

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Thu Jan 14 19:57:25 UTC 2021


Tests work in multiprocess environment so we must turn on/off
thread in parent process which is responsible for allocations.

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/gem_ppgtt.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/tests/i915/gem_ppgtt.c b/tests/i915/gem_ppgtt.c
index 73d13fe77..674bba43a 100644
--- a/tests/i915/gem_ppgtt.c
+++ b/tests/i915/gem_ppgtt.c
@@ -136,6 +136,7 @@ static void fork_rcs_copy(int timeout, uint32_t final,
 			    dst[child], 0, 0);
 
 		intel_buf_destroy(src);
+		dst[child]->addr.offset = INTEL_BUF_INVALID_ADDRESS;
 
 		intel_bb_destroy(ibb);
 	}
@@ -171,6 +172,7 @@ static void fork_bcs_copy(int timeout, uint32_t final,
 
 			intel_buf_destroy(src[1]);
 			intel_buf_destroy(src[0]);
+			intel_bb_reset(ibb, true);
 		}
 
 		src[0] = create_bo(dst[child]->bops, ~0);
@@ -182,6 +184,7 @@ static void fork_bcs_copy(int timeout, uint32_t final,
 
 		intel_buf_destroy(src[1]);
 		intel_buf_destroy(src[0]);
+		dst[child]->addr.offset = INTEL_BUF_INVALID_ADDRESS;
 
 		intel_bb_destroy(ibb);
 	}
@@ -280,6 +283,8 @@ igt_main
 	igt_subtest("blt-vs-render-ctx0") {
 		struct intel_buf *bcs[1], *rcs[N_CHILD];
 
+		intel_allocator_multiprocess_start();
+
 		fork_bcs_copy(30, 0x4000, bcs, 1);
 		fork_rcs_copy(30, 0x8000 / N_CHILD, rcs, N_CHILD, 0);
 
@@ -290,6 +295,8 @@ igt_main
 
 		cleanup_bufs(bcs, 1);
 		cleanup_bufs(rcs, N_CHILD);
+
+		intel_allocator_multiprocess_stop();
 	}
 
 	igt_subtest("blt-vs-render-ctxN") {
@@ -297,6 +304,8 @@ igt_main
 
 		igt_require(has_contexts());
 
+		intel_allocator_multiprocess_start();
+
 		fork_rcs_copy(30, 0x8000 / N_CHILD, rcs, N_CHILD, CREATE_CONTEXT);
 		fork_bcs_copy(30, 0x4000, bcs, 1);
 
@@ -307,6 +316,8 @@ igt_main
 
 		cleanup_bufs(bcs, 1);
 		cleanup_bufs(rcs, N_CHILD);
+
+		intel_allocator_multiprocess_stop();
 	}
 
 	igt_subtest("flink-and-close-vma-leak")
-- 
2.26.0



More information about the igt-dev mailing list