public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Subject: [igt-dev] [PATCH i-g-t v28 25/30] tests/gem_render_linear_blits: remove libdrm dependency
Date: Thu, 13 Aug 2020 10:56:52 +0200	[thread overview]
Message-ID: <20200813085657.20658-26-zbigniew.kempczynski@intel.com> (raw)
In-Reply-To: <20200813085657.20658-1-zbigniew.kempczynski@intel.com>

Use intel_bb / intel_buf to remove libdrm dependency.

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

diff --git a/tests/i915/gem_render_linear_blits.c b/tests/i915/gem_render_linear_blits.c
index 55a9e6be..8d044e9e 100644
--- a/tests/i915/gem_render_linear_blits.c
+++ b/tests/i915/gem_render_linear_blits.c
@@ -49,7 +49,6 @@
 
 #include "i915/gem.h"
 #include "igt.h"
-#include "intel_bufmgr.h"
 
 #define WIDTH 512
 #define STRIDE (WIDTH*4)
@@ -60,7 +59,7 @@ static uint32_t linear[WIDTH*HEIGHT];
 static igt_render_copyfunc_t render_copy;
 
 static void
-check_bo(int fd, uint32_t handle, uint32_t val)
+check_buf(int fd, uint32_t handle, uint32_t val)
 {
 	int i;
 
@@ -76,114 +75,89 @@ check_bo(int fd, uint32_t handle, uint32_t val)
 
 static void run_test (int fd, int count)
 {
-	drm_intel_bufmgr *bufmgr;
-	struct intel_batchbuffer *batch;
+	struct buf_ops *bops;
+	struct intel_bb *ibb;
 	uint32_t *start_val;
-	drm_intel_bo **bo;
+	struct intel_buf *bufs;
 	uint32_t start = 0;
 	int i, j;
 
 	render_copy = igt_get_render_copyfunc(intel_get_drm_devid(fd));
 	igt_require(render_copy);
 
-	bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
-	batch = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd));
+	bops = buf_ops_create(fd);
+	ibb = intel_bb_create(fd, 4096);
 
-	bo = malloc(sizeof(*bo)*count);
+	bufs = malloc(sizeof(*bufs)*count);
 	start_val = malloc(sizeof(*start_val)*count);
 
 	for (i = 0; i < count; i++) {
-		bo[i] = drm_intel_bo_alloc(bufmgr, "", SIZE, 4096);
+		intel_buf_init(bops, &bufs[i], WIDTH, HEIGHT, 32, 0,
+			       I915_TILING_NONE, I915_COMPRESSION_NONE);
 		start_val[i] = start;
 		for (j = 0; j < WIDTH*HEIGHT; j++)
 			linear[j] = start++;
-		gem_write(fd, bo[i]->handle, 0, linear, sizeof(linear));
+		gem_write(fd, bufs[i].handle, 0, linear, sizeof(linear));
 	}
 
 	igt_info("Verifying initialisation - %d buffers of %d bytes\n", count, SIZE);
 	for (i = 0; i < count; i++)
-		check_bo(fd, bo[i]->handle, start_val[i]);
+		check_buf(fd, bufs[i].handle, start_val[i]);
 
 	igt_info("Cyclic blits, forward...\n");
 	for (i = 0; i < count * 4; i++) {
-		struct igt_buf src = {}, dst = {};
+		struct intel_buf *src, *dst;
 
-		src.bo = bo[i % count];
-		src.surface[0].stride = STRIDE;
-		src.tiling = I915_TILING_NONE;
-		src.surface[0].size = SIZE;
-		src.bpp = 32;
+		src = &bufs[i % count];
+		dst = &bufs[(i + 1) % count];
 
-		dst.bo = bo[(i + 1) % count];
-		dst.surface[0].stride = STRIDE;
-		dst.tiling = I915_TILING_NONE;
-		dst.surface[0].size = SIZE;
-		dst.bpp = 32;
-
-		render_copy(batch, NULL, &src, 0, 0, WIDTH, HEIGHT, &dst, 0, 0);
+		render_copy(ibb, 0, src, 0, 0, WIDTH, HEIGHT, dst, 0, 0);
 		start_val[(i + 1) % count] = start_val[i % count];
 	}
+
 	for (i = 0; i < count; i++)
-		check_bo(fd, bo[i]->handle, start_val[i]);
+		check_buf(fd, bufs[i].handle, start_val[i]);
 
 	if (igt_run_in_simulation())
 		return;
 
 	igt_info("Cyclic blits, backward...\n");
 	for (i = 0; i < count * 4; i++) {
-		struct igt_buf src = {}, dst = {};
+		struct intel_buf *src, *dst;
 
-		src.bo = bo[(i + 1) % count];
-		src.surface[0].stride = STRIDE;
-		src.tiling = I915_TILING_NONE;
-		src.surface[0].size = SIZE;
-		src.bpp = 32;
+		src = &bufs[(i + 1) % count];
+		dst = &bufs[i % count];
 
-		dst.bo = bo[i % count];
-		dst.surface[0].stride = STRIDE;
-		dst.tiling = I915_TILING_NONE;
-		dst.surface[0].size = SIZE;
-		dst.bpp = 32;
-
-		render_copy(batch, NULL, &src, 0, 0, WIDTH, HEIGHT, &dst, 0, 0);
+		render_copy(ibb, 0, src, 0, 0, WIDTH, HEIGHT, dst, 0, 0);
 		start_val[i % count] = start_val[(i + 1) % count];
 	}
 	for (i = 0; i < count; i++)
-		check_bo(fd, bo[i]->handle, start_val[i]);
+		check_buf(fd, bufs[i].handle, start_val[i]);
 
 	igt_info("Random blits...\n");
 	for (i = 0; i < count * 4; i++) {
-		struct igt_buf src = {}, dst = {};
+		struct intel_buf *src, *dst;
 		int s = random() % count;
 		int d = random() % count;
 
 		if (s == d)
 			continue;
 
-		src.bo = bo[s];
-		src.surface[0].stride = STRIDE;
-		src.tiling = I915_TILING_NONE;
-		src.surface[0].size = SIZE;
-		src.bpp = 32;
-
-		dst.bo = bo[d];
-		dst.surface[0].stride = STRIDE;
-		dst.tiling = I915_TILING_NONE;
-		dst.surface[0].size = SIZE;
-		dst.bpp = 32;
+		src = &bufs[s];
+		dst = &bufs[d];
 
-		render_copy(batch, NULL, &src, 0, 0, WIDTH, HEIGHT, &dst, 0, 0);
+		render_copy(ibb, 0, src, 0, 0, WIDTH, HEIGHT, dst, 0, 0);
 		start_val[d] = start_val[s];
 	}
 	for (i = 0; i < count; i++)
-		check_bo(fd, bo[i]->handle, start_val[i]);
+		check_buf(fd, bufs[i].handle, start_val[i]);
 
 	/* release resources */
-	for (i = 0; i < count; i++) {
-		drm_intel_bo_unreference(bo[i]);
-	}
-	intel_batchbuffer_free(batch);
-	drm_intel_bufmgr_destroy(bufmgr);
+	for (i = 0; i < count; i++)
+		intel_buf_close(bops, &bufs[i]);
+	free(bufs);
+	intel_bb_destroy(ibb);
+	buf_ops_destroy(bops);
 }
 
 igt_main
-- 
2.26.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  parent reply	other threads:[~2020-08-13  8:58 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-13  8:56 [igt-dev] [PATCH i-g-t v28 00/30] Remove libdrm in rendercopy Zbigniew Kempczyński
2020-08-13  8:56 ` [igt-dev] [PATCH i-g-t v28 01/30] lib/intel_bufops: add mapping on cpu / device Zbigniew Kempczyński
2020-08-13  8:56 ` [igt-dev] [PATCH i-g-t v28 02/30] lib/intel_bufops: change in hw/sw tiling detection Zbigniew Kempczyński
2020-08-13  8:56 ` [igt-dev] [PATCH i-g-t v28 03/30] lib/intel_bufops: change stride requirements for Grantsdale Zbigniew Kempczyński
2020-08-13  8:56 ` [igt-dev] [PATCH i-g-t v28 04/30] lib/intel_bufops: add support for 64bit bpp Zbigniew Kempczyński
2020-08-13  8:56 ` [igt-dev] [PATCH i-g-t v28 05/30] lib/intel_bufops: extract getting the stride Zbigniew Kempczyński
2020-08-13  8:56 ` [igt-dev] [PATCH i-g-t v28 06/30] lib/intel_batchbuffer: add new functions to support rendercopy Zbigniew Kempczyński
2020-08-13  8:56 ` [igt-dev] [PATCH i-g-t v28 07/30] lib/intel_batchbuffer: dump bb to base64 Zbigniew Kempczyński
2020-08-13  8:56 ` [igt-dev] [PATCH i-g-t v28 08/30] lib/intel_batchbuffer: use canonical addresses for 48bit ppgtt Zbigniew Kempczyński
2020-08-13  8:56 ` [igt-dev] [PATCH i-g-t v28 09/30] tests/api_intel_bb: test flags are cleared on bb reset Zbigniew Kempczyński
2020-08-13  8:56 ` [igt-dev] [PATCH i-g-t v28 10/30] tests/gem_caching|partial: adopt to batch flush function cleanup Zbigniew Kempczyński
2020-08-13  8:56 ` [igt-dev] [PATCH i-g-t v28 11/30] lib/rendercopy: remove libdrm dependency Zbigniew Kempczyński
2020-08-13  8:56 ` [igt-dev] [PATCH i-g-t v28 12/30] tests/api_intel_bb: add render tests Zbigniew Kempczyński
2020-08-13  8:56 ` [igt-dev] [PATCH i-g-t v28 13/30] lib/igt_draw: remove libdrm dependency Zbigniew Kempczyński
2020-08-13  8:56 ` [igt-dev] [PATCH i-g-t v28 14/30] lib/igt_fb: Removal of " Zbigniew Kempczyński
2020-08-13  8:56 ` [igt-dev] [PATCH i-g-t v28 15/30] tests/kms_psr: remove " Zbigniew Kempczyński
2020-08-13  8:56 ` [igt-dev] [PATCH i-g-t v28 16/30] tests/kms_fronbuffer_tracking: " Zbigniew Kempczyński
2020-08-13  8:56 ` [igt-dev] [PATCH i-g-t v28 17/30] tests/kms_draw_crc: " Zbigniew Kempczyński
2020-08-13  8:56 ` [igt-dev] [PATCH i-g-t v28 18/30] tests/gem_ppgtt: " Zbigniew Kempczyński
2020-08-13  8:56 ` [igt-dev] [PATCH i-g-t v28 19/30] tests/gem_concurrent_all: " Zbigniew Kempczyński
2020-08-13  8:56 ` [igt-dev] [PATCH i-g-t v28 20/30] tests/kms_cursor_crc: " Zbigniew Kempczyński
2020-08-13  8:56 ` [igt-dev] [PATCH i-g-t v28 21/30] tests/kms_big_fb: " Zbigniew Kempczyński
2020-08-13  8:56 ` [igt-dev] [PATCH i-g-t v28 22/30] tests/gem_stress: " Zbigniew Kempczyński
2020-08-13  8:56 ` [igt-dev] [PATCH i-g-t v28 23/30] tests/gem_render_copy: " Zbigniew Kempczyński
2020-08-13  8:56 ` [igt-dev] [PATCH i-g-t v28 24/30] tests/gem_render_copy_redux: " Zbigniew Kempczyński
2020-08-13  8:56 ` Zbigniew Kempczyński [this message]
2020-08-13  8:56 ` [igt-dev] [PATCH i-g-t v28 26/30] tests/gem_render_tiled_blits: " Zbigniew Kempczyński
2020-08-13  8:56 ` [igt-dev] [PATCH i-g-t v28 27/30] tests/gem_read_read_speed: " Zbigniew Kempczyński
2020-08-13  8:56 ` [igt-dev] [PATCH i-g-t v28 28/30] lib/rendercopy_bufmgr: remove rendercopy_bufmgr Zbigniew Kempczyński
2020-08-13  8:56 ` [igt-dev] [PATCH i-g-t v28 29/30] tools/intel_residency: adopt intel_residency to use bufops Zbigniew Kempczyński
2020-08-13  8:56 ` [igt-dev] [PATCH i-g-t v28 30/30] tests/perf: remove libdrm dependency for rendercopy Zbigniew Kempczyński
2020-08-13  9:25 ` [igt-dev] ✓ Fi.CI.BAT: success for Remove libdrm in rendercopy (rev27) Patchwork
2020-08-13 11:25 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200813085657.20658-26-zbigniew.kempczynski@intel.com \
    --to=zbigniew.kempczynski@intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=igt-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox