[igt-dev] [PATCH i-g-t 3/3] benchmarks: Remove libdrm dependency

Dominik Grzegorzek dominik.grzegorzek at intel.com
Tue Sep 29 10:48:18 UTC 2020


Thanks to intel_bb / intel_buf we could get rid of libdrm.
With intel_buf caching mechanism we are able to keep results similar.

Signed-off-by: Dominik Grzegorzek <dominik.grzegorzek at intel.com>
Cc: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
Cc: Chris Wilson <chris at chris-wilson.co.uk>
---
 benchmarks/intel_upload_blit_large.c     | 79 +++++++++++-----------
 benchmarks/intel_upload_blit_large_gtt.c | 84 ++++++++++++------------
 benchmarks/intel_upload_blit_large_map.c | 84 ++++++++++++------------
 benchmarks/intel_upload_blit_small.c     | 78 +++++++++++-----------
 4 files changed, 164 insertions(+), 161 deletions(-)

diff --git a/benchmarks/intel_upload_blit_large.c b/benchmarks/intel_upload_blit_large.c
index 12bbae3d..ec34dd11 100644
--- a/benchmarks/intel_upload_blit_large.c
+++ b/benchmarks/intel_upload_blit_large.c
@@ -72,74 +72,74 @@ get_time_in_secs(void)
 }
 
 static void
-do_render(drm_intel_bufmgr *bufmgr, struct intel_batchbuffer *batch,
-	  drm_intel_bo *dst_bo, int width, int height)
+do_render(struct buf_ops *bops, struct intel_bb *ibb,
+	  struct intel_buf *dst_buf, int width, int height)
 {
 	uint32_t data[width * height];
-	drm_intel_bo *src_bo;
-	int i;
+	struct intel_buf *src_buf;
+	int i, fd;
 	static uint32_t seed = 1;
 
+	fd = buf_ops_get_fd(bops);
 	/* Generate some junk.  Real workloads would be doing a lot more
 	 * work to generate the junk.
 	 */
-	for (i = 0; i < width * height; i++) {
+	for (i = 0; i < width * height; i++)
 		data[i] = seed++;
-	}
 
 	/* Upload the junk. */
-	src_bo = drm_intel_bo_alloc(bufmgr, "src", sizeof(data), 4096);
-	drm_intel_bo_subdata(src_bo, 0, sizeof(data), data);
+	src_buf = intel_buf_create(bops, width, height, 32, 0, I915_TILING_NONE,
+				   I915_COMPRESSION_NONE);
+	gem_write(fd, src_buf->handle, 0, data, sizeof(data));
 
+	intel_bb_add_intel_buf(ibb, dst_buf, true);
 	/* Render the junk to the dst. */
-	BLIT_COPY_BATCH_START(0);
-	OUT_BATCH((3 << 24) | /* 32 bits */
+	intel_bb_blit_start(ibb, 0);
+	intel_bb_out(ibb, (3 << 24) | /* 32 bits */
 		  (0xcc << 16) | /* copy ROP */
 		  (width * 4) /* dst pitch */);
-	OUT_BATCH(0); /* dst x1,y1 */
-	OUT_BATCH((height << 16) | width); /* dst x2,y2 */
-	OUT_RELOC(dst_bo, I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER, 0);
-	OUT_BATCH(0); /* src x1,y1 */
-	OUT_BATCH(width * 4); /* src pitch */
-	OUT_RELOC(src_bo, I915_GEM_DOMAIN_RENDER, 0, 0);
-	ADVANCE_BATCH();
-
-	intel_batchbuffer_flush(batch);
-
-	drm_intel_bo_unreference(src_bo);
+	intel_bb_out(ibb, 0); /* dst x1,y1 */
+	intel_bb_out(ibb, (height << 16) | width); /* dst x2,y2 */
+	intel_bb_emit_reloc(ibb, dst_buf->handle, I915_GEM_DOMAIN_RENDER,
+			    I915_GEM_DOMAIN_RENDER, 0, dst_buf->addr.offset);
+	intel_bb_out(ibb, 0); /* src x1,y1 */
+	intel_bb_out(ibb, width * 4); /* src pitch */
+	intel_bb_emit_reloc(ibb, src_buf->handle, I915_GEM_DOMAIN_RENDER, 0, 0,
+			    src_buf->addr.offset);
+
+	intel_bb_flush_blit(ibb);
+	intel_buf_destroy(src_buf);
 }
 
 int main(int argc, char **argv)
 {
 	int fd;
-	int object_size = OBJECT_WIDTH * OBJECT_HEIGHT * 4;
 	double start_time, end_time;
-	drm_intel_bo *dst_bo;
-	drm_intel_bufmgr *bufmgr;
-	struct intel_batchbuffer *batch;
+	struct intel_buf *dst_buf;
+	struct buf_ops *bops;
+	struct intel_bb *ibb;
 	int i;
 
 	fd = drm_open_driver(DRIVER_INTEL);
 
-	bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
-	drm_intel_bufmgr_gem_enable_reuse(bufmgr);
+	intel_buf_use_caching(true);
+	bops = buf_ops_create(fd);
 
-	batch = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd));
+	ibb = intel_bb_create(fd, 4096);
 
-	dst_bo = drm_intel_bo_alloc(bufmgr, "dst", object_size, 4096);
+	dst_buf = intel_buf_create(bops, OBJECT_WIDTH, OBJECT_HEIGHT, 32, 0,
+				   I915_TILING_NONE, I915_COMPRESSION_NONE);
 
 	/* Prep loop to get us warmed up. */
-	for (i = 0; i < 60; i++) {
-		do_render(bufmgr, batch, dst_bo, OBJECT_WIDTH, OBJECT_HEIGHT);
-	}
-	drm_intel_bo_wait_rendering(dst_bo);
+	for (i = 0; i < 60; i++)
+		do_render(bops, ibb, dst_buf, OBJECT_WIDTH, OBJECT_HEIGHT);
+	intel_bb_sync(ibb);
 
 	/* Do the actual timing. */
 	start_time = get_time_in_secs();
-	for (i = 0; i < 200; i++) {
-		do_render(bufmgr, batch, dst_bo, OBJECT_WIDTH, OBJECT_HEIGHT);
-	}
-	drm_intel_bo_wait_rendering(dst_bo);
+	for (i = 0; i < 200; i++)
+		do_render(bops, ibb, dst_buf, OBJECT_WIDTH, OBJECT_HEIGHT);
+	intel_bb_sync(ibb);
 	end_time = get_time_in_secs();
 
 	printf("%d iterations in %.03f secs: %.01f MB/sec\n", i,
@@ -147,8 +147,9 @@ int main(int argc, char **argv)
 	       (double)i * OBJECT_WIDTH * OBJECT_HEIGHT * 4 / 1024.0 / 1024.0 /
 	       (end_time - start_time));
 
-	intel_batchbuffer_free(batch);
-	drm_intel_bufmgr_destroy(bufmgr);
+	intel_buf_destroy(dst_buf);
+	intel_bb_destroy(ibb);
+	buf_ops_destroy(bops);
 
 	close(fd);
 
diff --git a/benchmarks/intel_upload_blit_large_gtt.c b/benchmarks/intel_upload_blit_large_gtt.c
index 0b704b57..f48260b0 100644
--- a/benchmarks/intel_upload_blit_large_gtt.c
+++ b/benchmarks/intel_upload_blit_large_gtt.c
@@ -69,74 +69,73 @@ get_time_in_secs(void)
 }
 
 static void
-do_render(drm_intel_bufmgr *bufmgr, struct intel_batchbuffer *batch,
-	  drm_intel_bo *dst_bo, int width, int height)
+do_render(struct buf_ops *bops, struct intel_bb *ibb,
+	  struct intel_buf *dst_buf, int width, int height)
 {
 	uint32_t *data;
-	drm_intel_bo *src_bo;
-	int i;
+	struct intel_buf *src_buf;
+	int i, fd;
 	static uint32_t seed = 1;
 
-	src_bo = drm_intel_bo_alloc(bufmgr, "src", width * height * 4, 4096);
-
-	drm_intel_gem_bo_map_gtt(src_bo);
+	fd = buf_ops_get_fd(bops);
+	src_buf = intel_buf_create(bops, width, height, 32, 0, I915_TILING_NONE,
+				   I915_COMPRESSION_NONE);
+	data = gem_mmap__gtt(fd, src_buf->handle,
+			     src_buf->surface[0].size, PROT_WRITE);
 
-	data = src_bo->virtual;
-	for (i = 0; i < width * height; i++) {
+	for (i = 0; i < width * height; i++)
 		data[i] = seed++;
-	}
 
-	drm_intel_gem_bo_unmap_gtt(src_bo);
+	gem_munmap(data, src_buf->surface[0].size);
 
+	intel_bb_add_intel_buf(ibb, dst_buf, true);
 	/* Render the junk to the dst. */
-	BLIT_COPY_BATCH_START(0);
-	OUT_BATCH((3 << 24) | /* 32 bits */
+	intel_bb_blit_start(ibb, 0);
+	intel_bb_out(ibb, (3 << 24) | /* 32 bits */
 		  (0xcc << 16) | /* copy ROP */
 		  (width * 4) /* dst pitch */);
-	OUT_BATCH(0); /* dst x1,y1 */
-	OUT_BATCH((height << 16) | width); /* dst x2,y2 */
-	OUT_RELOC(dst_bo, I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER, 0);
-	OUT_BATCH(0); /* src x1,y1 */
-	OUT_BATCH(width * 4); /* src pitch */
-	OUT_RELOC(src_bo, I915_GEM_DOMAIN_RENDER, 0, 0);
-	ADVANCE_BATCH();
-
-	intel_batchbuffer_flush(batch);
-
-	drm_intel_bo_unreference(src_bo);
+	intel_bb_out(ibb, 0); /* dst x1,y1 */
+	intel_bb_out(ibb, (height << 16) | width); /* dst x2,y2 */
+	intel_bb_emit_reloc(ibb, dst_buf->handle, I915_GEM_DOMAIN_RENDER,
+			    I915_GEM_DOMAIN_RENDER, 0, dst_buf->addr.offset);
+	intel_bb_out(ibb, 0); /* src x1,y1 */
+	intel_bb_out(ibb, width * 4); /* src pitch */
+	intel_bb_emit_reloc(ibb, src_buf->handle, I915_GEM_DOMAIN_RENDER, 0, 0,
+			    src_buf->addr.offset);
+
+	intel_bb_flush_blit(ibb);
+	intel_buf_destroy(src_buf);
 }
 
 int main(int argc, char **argv)
 {
 	int fd;
-	int object_size = OBJECT_WIDTH * OBJECT_HEIGHT * 4;
 	double start_time, end_time;
-	drm_intel_bo *dst_bo;
-	drm_intel_bufmgr *bufmgr;
-	struct intel_batchbuffer *batch;
+	struct intel_buf *dst_buf;
+	struct buf_ops *bops;
+	struct intel_bb *ibb;
 	int i;
 
 	fd = drm_open_driver(DRIVER_INTEL);
 
-	bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
-	drm_intel_bufmgr_gem_enable_reuse(bufmgr);
+	intel_buf_use_caching(true);
+	bops = buf_ops_create(fd);
 
-	batch = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd));
+	ibb = intel_bb_create(fd, 4096);
 
-	dst_bo = drm_intel_bo_alloc(bufmgr, "dst", object_size, 4096);
+	dst_buf = intel_buf_create(bops, OBJECT_WIDTH, OBJECT_HEIGHT, 32, 0,
+				   I915_TILING_NONE, I915_COMPRESSION_NONE);
 
 	/* Prep loop to get us warmed up. */
-	for (i = 0; i < 60; i++) {
-		do_render(bufmgr, batch, dst_bo, OBJECT_WIDTH, OBJECT_HEIGHT);
-	}
-	drm_intel_bo_wait_rendering(dst_bo);
+	for (i = 0; i < 60; i++)
+		do_render(bops, ibb, dst_buf, OBJECT_WIDTH, OBJECT_HEIGHT);
+	intel_bb_sync(ibb);
 
 	/* Do the actual timing. */
 	start_time = get_time_in_secs();
-	for (i = 0; i < 200; i++) {
-		do_render(bufmgr, batch, dst_bo, OBJECT_WIDTH, OBJECT_HEIGHT);
-	}
-	drm_intel_bo_wait_rendering(dst_bo);
+	for (i = 0; i < 200; i++)
+		do_render(bops, ibb, dst_buf, OBJECT_WIDTH, OBJECT_HEIGHT);
+	intel_bb_sync(ibb);
 	end_time = get_time_in_secs();
 
 	printf("%d iterations in %.03f secs: %.01f MB/sec\n", i,
@@ -144,8 +143,9 @@ int main(int argc, char **argv)
 	       (double)i * OBJECT_WIDTH * OBJECT_HEIGHT * 4 / 1024.0 / 1024.0 /
 	       (end_time - start_time));
 
-	intel_batchbuffer_free(batch);
-	drm_intel_bufmgr_destroy(bufmgr);
+	intel_buf_destroy(dst_buf);
+	intel_bb_destroy(ibb);
+	buf_ops_destroy(bops);
 
 	close(fd);
 
diff --git a/benchmarks/intel_upload_blit_large_map.c b/benchmarks/intel_upload_blit_large_map.c
index ae05434f..3b2f8b41 100644
--- a/benchmarks/intel_upload_blit_large_map.c
+++ b/benchmarks/intel_upload_blit_large_map.c
@@ -72,74 +72,73 @@ get_time_in_secs(void)
 }
 
 static void
-do_render(drm_intel_bufmgr *bufmgr, struct intel_batchbuffer *batch,
-	  drm_intel_bo *dst_bo, int width, int height)
+do_render(struct buf_ops *bops, struct intel_bb *ibb,
+	  struct intel_buf *dst_buf, int width, int height)
 {
 	uint32_t *data;
-	drm_intel_bo *src_bo;
-	int i;
+	struct intel_buf *src_buf;
+	int i, fd;
 	static uint32_t seed = 1;
 
-	src_bo = drm_intel_bo_alloc(bufmgr, "src", width * height * 4, 4096);
-
-	drm_intel_bo_map(src_bo, 1);
+	fd = buf_ops_get_fd(bops);
+	src_buf = intel_buf_create(bops, width, height, 32, 0, I915_TILING_NONE,
+				   I915_COMPRESSION_NONE);
+	data = gem_mmap__cpu_coherent(fd, src_buf->handle, 0,
+				      src_buf->surface[0].size, PROT_WRITE);
 
-	data = src_bo->virtual;
-	for (i = 0; i < width * height; i++) {
+	for (i = 0; i < width * height; i++)
 		data[i] = seed++;
-	}
 
-	drm_intel_bo_unmap(src_bo);
+	gem_munmap(data, src_buf->surface[0].size);
 
+	intel_bb_add_intel_buf(ibb, dst_buf, true);
 	/* Render the junk to the dst. */
-	BLIT_COPY_BATCH_START(0);
-	OUT_BATCH((3 << 24) | /* 32 bits */
+	intel_bb_blit_start(ibb, 0);
+	intel_bb_out(ibb, (3 << 24) | /* 32 bits */
 		  (0xcc << 16) | /* copy ROP */
 		  (width * 4) /* dst pitch */);
-	OUT_BATCH(0); /* dst x1,y1 */
-	OUT_BATCH((height << 16) | width); /* dst x2,y2 */
-	OUT_RELOC(dst_bo, I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER, 0);
-	OUT_BATCH(0); /* src x1,y1 */
-	OUT_BATCH(width * 4); /* src pitch */
-	OUT_RELOC(src_bo, I915_GEM_DOMAIN_RENDER, 0, 0);
-	ADVANCE_BATCH();
-
-	intel_batchbuffer_flush(batch);
-
-	drm_intel_bo_unreference(src_bo);
+	intel_bb_out(ibb, 0); /* dst x1,y1 */
+	intel_bb_out(ibb, (height << 16) | width); /* dst x2,y2 */
+	intel_bb_emit_reloc(ibb, dst_buf->handle, I915_GEM_DOMAIN_RENDER,
+			    I915_GEM_DOMAIN_RENDER, 0, dst_buf->addr.offset);
+	intel_bb_out(ibb, 0); /* src x1,y1 */
+	intel_bb_out(ibb, width * 4); /* src pitch */
+	intel_bb_emit_reloc(ibb, src_buf->handle, I915_GEM_DOMAIN_RENDER, 0, 0,
+			    src_buf->addr.offset);
+
+	intel_bb_flush_blit(ibb);
+	intel_buf_destroy(src_buf);
 }
 
 int main(int argc, char **argv)
 {
 	int fd;
-	int object_size = OBJECT_WIDTH * OBJECT_HEIGHT * 4;
 	double start_time, end_time;
-	drm_intel_bo *dst_bo;
-	drm_intel_bufmgr *bufmgr;
-	struct intel_batchbuffer *batch;
+	struct intel_buf *dst_buf;
+	struct buf_ops *bops;
+	struct intel_bb *ibb;
 	int i;
 
 	fd = drm_open_driver(DRIVER_INTEL);
 
-	bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
-	drm_intel_bufmgr_gem_enable_reuse(bufmgr);
+	intel_buf_use_caching(true);
+	bops = buf_ops_create(fd);
 
-	batch = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd));
+	ibb = intel_bb_create(fd, 4096);
 
-	dst_bo = drm_intel_bo_alloc(bufmgr, "dst", object_size, 4096);
+	dst_buf = intel_buf_create(bops, OBJECT_WIDTH, OBJECT_HEIGHT, 32, 0,
+				   I915_TILING_NONE, I915_COMPRESSION_NONE);
 
 	/* Prep loop to get us warmed up. */
-	for (i = 0; i < 60; i++) {
-		do_render(bufmgr, batch, dst_bo, OBJECT_WIDTH, OBJECT_HEIGHT);
-	}
-	drm_intel_bo_wait_rendering(dst_bo);
+	for (i = 0; i < 60; i++)
+		do_render(bops, ibb, dst_buf, OBJECT_WIDTH, OBJECT_HEIGHT);
+	intel_bb_sync(ibb);
 
 	/* Do the actual timing. */
 	start_time = get_time_in_secs();
-	for (i = 0; i < 200; i++) {
-		do_render(bufmgr, batch, dst_bo, OBJECT_WIDTH, OBJECT_HEIGHT);
-	}
-	drm_intel_bo_wait_rendering(dst_bo);
+	for (i = 0; i < 200; i++)
+		do_render(bops, ibb, dst_buf, OBJECT_WIDTH, OBJECT_HEIGHT);
+	intel_bb_sync(ibb);
 	end_time = get_time_in_secs();
 
 	printf("%d iterations in %.03f secs: %.01f MB/sec\n", i,
@@ -147,8 +146,9 @@ int main(int argc, char **argv)
 	       (double)i * OBJECT_WIDTH * OBJECT_HEIGHT * 4 / 1024.0 / 1024.0 /
 	       (end_time - start_time));
 
-	intel_batchbuffer_free(batch);
-	drm_intel_bufmgr_destroy(bufmgr);
+	intel_buf_destroy(dst_buf);
+	intel_bb_destroy(ibb);
+	buf_ops_destroy(bops);
 
 	close(fd);
 
diff --git a/benchmarks/intel_upload_blit_small.c b/benchmarks/intel_upload_blit_small.c
index 7e3346eb..7d976075 100644
--- a/benchmarks/intel_upload_blit_small.c
+++ b/benchmarks/intel_upload_blit_small.c
@@ -66,19 +66,20 @@ get_time_in_secs(void)
 }
 
 static void
-do_render(drm_intel_bufmgr *bufmgr, struct intel_batchbuffer *batch,
-	  drm_intel_bo *dst_bo, int width, int height)
+do_render(struct buf_ops *bops, struct intel_bb *ibb,
+	  struct intel_buf *dst_buf, int width, int height)
 {
 	uint32_t data[64];
-	drm_intel_bo *src_bo;
-	int i;
+	struct intel_buf *src_buf;
+	int i, fd;
 	static uint32_t seed = 1;
 
-	src_bo = drm_intel_bo_alloc(bufmgr, "src", width * height * 4, 4096);
-
+	fd = buf_ops_get_fd(bops);
 	/* Upload some junk.  Real workloads would be doing a lot more
 	 * work to generate the junk.
 	 */
+	src_buf = intel_buf_create(bops, width, height, 32, 0, I915_TILING_NONE,
+				   I915_COMPRESSION_NONE);
 	for (i = 0; i < width * height;) {
 		int size, j;
 
@@ -96,60 +97,60 @@ do_render(drm_intel_bufmgr *bufmgr, struct intel_batchbuffer *batch,
 			data[j] = seed++;
 
 		/* Upload the junk. */
-		drm_intel_bo_subdata(src_bo, i * 4, size * 4, data);
+		gem_write(fd, src_buf->handle, i * 4, data,
+			  size * 4);
 
 		i += size;
 	}
 
+	intel_bb_add_intel_buf(ibb, dst_buf, true);
 	/* Render the junk to the dst. */
-	BLIT_COPY_BATCH_START(0);
-	OUT_BATCH((3 << 24) | /* 32 bits */
+	intel_bb_blit_start(ibb, 0);
+	intel_bb_out(ibb, (3 << 24) | /* 32 bits */
 		  (0xcc << 16) | /* copy ROP */
 		  (width * 4) /* dst pitch */);
-	OUT_BATCH(0); /* dst x1,y1 */
-	OUT_BATCH((height << 16) | width); /* dst x2,y2 */
-	OUT_RELOC(dst_bo, I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER, 0);
-	OUT_BATCH(0); /* src x1,y1 */
-	OUT_BATCH(width * 4); /* src pitch */
-	OUT_RELOC(src_bo, I915_GEM_DOMAIN_RENDER, 0, 0);
-	ADVANCE_BATCH();
-
-	intel_batchbuffer_flush(batch);
-
-	drm_intel_bo_unreference(src_bo);
+	intel_bb_out(ibb, 0); /* dst x1,y1 */
+	intel_bb_out(ibb, (height << 16) | width); /* dst x2,y2 */
+	intel_bb_emit_reloc(ibb, dst_buf->handle, I915_GEM_DOMAIN_RENDER,
+			    I915_GEM_DOMAIN_RENDER, 0, dst_buf->addr.offset);
+	intel_bb_out(ibb, 0); /* src x1,y1 */
+	intel_bb_out(ibb, width * 4); /* src pitch */
+	intel_bb_emit_reloc(ibb, src_buf->handle, I915_GEM_DOMAIN_RENDER, 0, 0,
+			    src_buf->addr.offset);
+
+	intel_bb_flush_blit(ibb);
+	intel_buf_use_caching(true);
 }
 
 int main(int argc, char **argv)
 {
 	int fd;
-	int object_size = OBJECT_WIDTH * OBJECT_HEIGHT * 4;
 	double start_time, end_time;
-	drm_intel_bo *dst_bo;
-	drm_intel_bufmgr *bufmgr;
-	struct intel_batchbuffer *batch;
+	struct intel_buf *dst_buf;
+	struct buf_ops *bops;
+	struct intel_bb *ibb;
 	int i;
 
 	fd = drm_open_driver(DRIVER_INTEL);
 
-	bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
-	drm_intel_bufmgr_gem_enable_reuse(bufmgr);
+	intel_buf_use_caching(true);
+	bops = buf_ops_create(fd);
 
-	batch = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd));
+	ibb = intel_bb_create(fd, 4096);
 
-	dst_bo = drm_intel_bo_alloc(bufmgr, "dst", object_size, 4096);
+	dst_buf = intel_buf_create(bops, OBJECT_WIDTH, OBJECT_HEIGHT, 32, 0,
+				   I915_TILING_NONE, I915_COMPRESSION_NONE);
 
 	/* Prep loop to get us warmed up. */
-	for (i = 0; i < 20; i++) {
-		do_render(bufmgr, batch, dst_bo, OBJECT_WIDTH, OBJECT_HEIGHT);
-	}
-	drm_intel_bo_wait_rendering(dst_bo);
+	for (i = 0; i < 20; i++)
+		do_render(bops, ibb, dst_buf, OBJECT_WIDTH, OBJECT_HEIGHT);
+	intel_bb_sync(ibb);
 
 	/* Do the actual timing. */
 	start_time = get_time_in_secs();
-	for (i = 0; i < 1000; i++) {
-		do_render(bufmgr, batch, dst_bo, OBJECT_WIDTH, OBJECT_HEIGHT);
-	}
-	drm_intel_bo_wait_rendering(dst_bo);
+	for (i = 0; i < 1000; i++)
+		do_render(bops, ibb, dst_buf, OBJECT_WIDTH, OBJECT_HEIGHT);
+	intel_bb_sync(ibb);
 	end_time = get_time_in_secs();
 
 	printf("%d iterations in %.03f secs: %.01f MB/sec\n", i,
@@ -157,8 +158,9 @@ int main(int argc, char **argv)
 	       (double)i * OBJECT_WIDTH * OBJECT_HEIGHT * 4 / 1024.0 / 1024.0 /
 	       (end_time - start_time));
 
-	intel_batchbuffer_free(batch);
-	drm_intel_bufmgr_destroy(bufmgr);
+	intel_buf_destroy(dst_buf);
+	intel_bb_destroy(ibb);
+	buf_ops_destroy(bops);
 
 	close(fd);
 
-- 
2.20.1



More information about the igt-dev mailing list