[igt-dev] [PATCH i-g-t 5/5] tests/i915/gem_non_secure_batch: Removal libdrm dependency

Dominik Grzegorzek dominik.grzegorzek at intel.com
Wed Jul 8 08:59:00 UTC 2020


Replace an intel_batchbuffer with an intel_bb in gem_non_secure_batch.

Signed-off-by: Dominik Grzegorzek <dominik.grzegorzek at intel.com>
Cc: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
---
 tests/i915/gem_non_secure_batch.c | 41 +++++++++++++------------------
 1 file changed, 17 insertions(+), 24 deletions(-)

diff --git a/tests/i915/gem_non_secure_batch.c b/tests/i915/gem_non_secure_batch.c
index 0bc2c3b5..ecdc1fc4 100644
--- a/tests/i915/gem_non_secure_batch.c
+++ b/tests/i915/gem_non_secure_batch.c
@@ -38,13 +38,9 @@
 #include "i830_reg.h"
 #include "i915/gem.h"
 #include "igt.h"
-#include "intel_bufmgr.h"
 
 IGT_TEST_DESCRIPTION("Basic check of non-secure batches.");
 
-static drm_intel_bufmgr *bufmgr;
-struct intel_batchbuffer *batch;
-
 /*
  * Testcase: Basic check of non-secure batches
  *
@@ -55,24 +51,32 @@ struct intel_batchbuffer *batch;
 static int num_rings = 1;
 
 static void
-mi_lri_loop(void)
+mi_lri_loop(int fd)
 {
 	int i;
+	struct intel_bb *ibb = intel_bb_create(fd, 4096);
 
 	srandom(0xdeadbeef);
 
 	for (i = 0; i < 0x100; i++) {
 		int ring = random() % num_rings + 1;
 
-		BEGIN_BATCH(4, 0);
-		OUT_BATCH(MI_LOAD_REGISTER_IMM);
-		OUT_BATCH(0x203c); /* RENDER RING CTL */
-		OUT_BATCH(0); /* try to stop the ring */
-		OUT_BATCH(MI_NOOP);
-		ADVANCE_BATCH();
+		intel_bb_out(ibb, MI_LOAD_REGISTER_IMM);
+		intel_bb_out(ibb, 0x203c); /* RENDER RING CTL */
+		intel_bb_out(ibb, 0); /* try to stop the ring */
+		intel_bb_out(ibb, MI_NOOP);
+
+		/* Mark the end of the buffer. */
+		intel_bb_out(ibb, MI_BATCH_BUFFER_END);
+		intel_bb_ptr_align(ibb, 8);
 
-		intel_batchbuffer_flush_on_ring(batch, ring);
+		intel_bb_exec_with_context(ibb, intel_bb_offset(ibb), ibb->ctx,
+					   ring | I915_EXEC_NO_RELOC, false);
+		intel_bb_reset(ibb, false);
 	}
+
+	intel_bb_sync(ibb);
+	intel_bb_destroy(ibb);
 }
 
 igt_simple_main
@@ -89,21 +93,10 @@ igt_simple_main
 	if (HAS_BLT_RING(devid))
 		num_rings++;
 
-
 	igt_info("num rings detected: %i\n", num_rings);
 
-	bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
-	igt_assert(bufmgr);
-	drm_intel_bufmgr_gem_enable_reuse(bufmgr);
-
-	batch = intel_batchbuffer_alloc(bufmgr, devid);
-	igt_assert(batch);
-
-	mi_lri_loop();
+	mi_lri_loop(fd);
 	gem_quiescent_gpu(fd);
 
-	intel_batchbuffer_free(batch);
-	drm_intel_bufmgr_destroy(bufmgr);
-
 	close(fd);
 }
-- 
2.20.1



More information about the igt-dev mailing list