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

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


Replace an intel_batchbuffer with an intel_bb in gem_bad_blit.

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_blit.c | 57 ++++++++++++++++++++-------------------
 1 file changed, 29 insertions(+), 28 deletions(-)

diff --git a/tests/i915/gem_bad_blit.c b/tests/i915/gem_bad_blit.c
index 848e1975..c5311698 100644
--- a/tests/i915/gem_bad_blit.c
+++ b/tests/i915/gem_bad_blit.c
@@ -53,18 +53,15 @@
 #include "drm.h"
 #include "i915/gem.h"
 #include "igt.h"
-#include "intel_bufmgr.h"
-
-static drm_intel_bufmgr *bufmgr;
-struct intel_batchbuffer *batch;
 
 #define BAD_GTT_DEST (256*1024*1024ULL) /* past end of aperture */
 
 static void
-bad_blit(drm_intel_bo *src_bo, uint32_t devid)
+bad_blit(int fd, struct intel_buf *src, uint32_t devid)
 {
 	uint32_t src_pitch = 512, dst_pitch = 512;
 	uint32_t cmd_bits = 0;
+	struct intel_bb *ibb = intel_bb_create(fd, 4096);
 
 	if (IS_965(devid)) {
 		src_pitch /= 4;
@@ -76,42 +73,46 @@ bad_blit(drm_intel_bo *src_bo, uint32_t devid)
 		cmd_bits |= XY_SRC_COPY_BLT_DST_TILED;
 	}
 
-	BLIT_COPY_BATCH_START(cmd_bits);
-	OUT_BATCH((3 << 24) | /* 32 bits */
+	intel_bb_blit_start(ibb, 0);
+	intel_bb_out(ibb, (3 << 24) | /* 32 bits */
 		  (0xcc << 16) | /* copy ROP */
 		  dst_pitch);
-	OUT_BATCH(0); /* dst x1,y1 */
-	OUT_BATCH((64 << 16) | 64); /* 64x64 blit */
-	OUT_BATCH(BAD_GTT_DEST);
-	if (batch->gen >= 8)
-		OUT_BATCH(BAD_GTT_DEST >> 32); /* Upper 16 bits */
-	OUT_BATCH(0); /* src x1,y1 */
-	OUT_BATCH(src_pitch);
-	OUT_RELOC_FENCED(src_bo, I915_GEM_DOMAIN_RENDER, 0, 0);
-	ADVANCE_BATCH();
-
-	intel_batchbuffer_flush(batch);
+	intel_bb_out(ibb, 0); /* dst x1,y1 */
+	intel_bb_out(ibb, (64 << 16) | 64); /* 64x64 blit */
+	intel_bb_out(ibb, BAD_GTT_DEST);
+	if (ibb->gen >= 8)
+		intel_bb_out(ibb, BAD_GTT_DEST >> 32); /* Upper 16 bits */
+	intel_bb_out(ibb, 0); /* src x1,y1 */
+	intel_bb_out(ibb, src_pitch);
+	intel_bb_emit_reloc(ibb, src->handle, I915_GEM_DOMAIN_RENDER, 0, 0, 0x0);
+
+	/* Mark the end of the buffer. */
+	intel_bb_out(ibb, MI_BATCH_BUFFER_END);
+	intel_bb_ptr_align(ibb, 8);
+
+	intel_bb_flush_blit(ibb);
+	intel_bb_destroy(ibb);
 }
 
 igt_simple_main
 {
-	drm_intel_bo *src;
+	struct intel_buf *src;
+	struct buf_ops *bops;
+	uint32_t devid;
 	int fd;
 
 	fd = drm_open_driver(DRIVER_INTEL);
+	devid = intel_get_drm_devid(fd);
 	igt_require_gem(fd);
 	gem_require_blitter(fd);
 
-	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));
-
-	src = drm_intel_bo_alloc(bufmgr, "src", 128 * 128, 4096);
-
-	bad_blit(src, batch->devid);
+	bops = buf_ops_create(fd);
+	src = intel_buf_create(bops, 128, 128, 32,
+			       0, I915_TILING_NONE, 0);
 
-	intel_batchbuffer_free(batch);
-	drm_intel_bufmgr_destroy(bufmgr);
+	bad_blit(fd, src, devid);
 
+	intel_buf_destroy(src);
+	buf_ops_destroy(bops);
 	close(fd);
 }
-- 
2.20.1



More information about the igt-dev mailing list