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

Dominik Grzegorzek dominik.grzegorzek at intel.com
Wed Jul 8 08:58:56 UTC 2020


Replace an intel_batchbuffer with an intel_bb in gem_bad_address.

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_bad_address.c | 34 ++++++++++++++--------------------
 1 file changed, 14 insertions(+), 20 deletions(-)

diff --git a/tests/i915/gem_bad_address.c b/tests/i915/gem_bad_address.c
index a970dfa4..60ef7ffa 100644
--- a/tests/i915/gem_bad_address.c
+++ b/tests/i915/gem_bad_address.c
@@ -36,24 +36,25 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "intel_bufmgr.h"
-
-static drm_intel_bufmgr *bufmgr;
-struct intel_batchbuffer *batch;
 
 #define BAD_GTT_DEST ((512*1024*1024)) /* past end of aperture */
 
 static void
-bad_store(void)
+bad_store(int fd)
 {
-	BEGIN_BATCH(4, 0);
-	OUT_BATCH(MI_STORE_DWORD_IMM | MI_MEM_VIRTUAL | 1 << 21);
-	OUT_BATCH(0);
-	OUT_BATCH(BAD_GTT_DEST);
-	OUT_BATCH(0xdeadbeef);
-	ADVANCE_BATCH();
+	struct intel_bb *ibb = intel_bb_create(fd, 4096);
+
+	intel_bb_out(ibb, MI_STORE_DWORD_IMM | MI_MEM_VIRTUAL | 1 << 21);
+	intel_bb_out(ibb, 0);
+	intel_bb_out(ibb, BAD_GTT_DEST);
+	intel_bb_out(ibb, 0xdeadbeef);
+
+	/* Mark the end of the buffer. */
+	intel_bb_out(ibb, MI_BATCH_BUFFER_END);
+	intel_bb_ptr_align(ibb, 8);
 
-	intel_batchbuffer_flush(batch);
+	intel_bb_flush_blit(ibb);
+	intel_bb_destroy(ibb);
 }
 
 igt_simple_main
@@ -62,14 +63,7 @@ igt_simple_main
 
 	fd = drm_open_driver(DRIVER_INTEL);
 
-	bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
-	drm_intel_bufmgr_gem_enable_reuse(bufmgr);
-	batch = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd));
-
-	bad_store();
-
-	intel_batchbuffer_free(batch);
-	drm_intel_bufmgr_destroy(bufmgr);
+	bad_store(fd);
 
 	close(fd);
 }
-- 
2.20.1



More information about the igt-dev mailing list