All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dominik Grzegorzek <dominik.grzegorzek@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Subject: [igt-dev] [PATCH i-g-t v5 03/14] i915/gem_pwrite_snooped: Remove libdrm dependency
Date: Tue, 27 Oct 2020 10:23:06 +0100	[thread overview]
Message-ID: <20201027092317.18716-4-dominik.grzegorzek@intel.com> (raw)
In-Reply-To: <20201027092317.18716-1-dominik.grzegorzek@intel.com>

Use intel_bb / intel_buf to remove libdrm dependency.

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

diff --git a/tests/i915/gem_pwrite_snooped.c b/tests/i915/gem_pwrite_snooped.c
index 4a339524..52ebaec2 100644
--- a/tests/i915/gem_pwrite_snooped.c
+++ b/tests/i915/gem_pwrite_snooped.c
@@ -42,40 +42,38 @@ IGT_TEST_DESCRIPTION(
    "pwrite to a snooped bo then make it uncached and check that the GPU sees the data.");
 
 static int fd;
-static uint32_t devid;
-static drm_intel_bufmgr *bufmgr;
+static struct buf_ops *bops;
 
-static void blit(drm_intel_bo *dst, drm_intel_bo *src,
+static void blit(struct intel_buf *dst, struct intel_buf *src,
 		 unsigned int width, unsigned int height,
 		 unsigned int dst_pitch, unsigned int src_pitch)
 {
-	struct intel_batchbuffer *batch;
+	struct intel_bb *ibb;
 
-	batch = intel_batchbuffer_alloc(bufmgr, devid);
-	igt_assert(batch);
-
-	BLIT_COPY_BATCH_START(0);
-	OUT_BATCH((3 << 24) | /* 32 bits */
+	ibb = intel_bb_create(fd, 4096);
+	intel_bb_add_intel_buf(ibb, dst, true);
+	intel_bb_add_intel_buf(ibb, src, false);
+	intel_bb_blit_start(ibb, 0);
+	intel_bb_out(ibb, (3 << 24) | /* 32 bits */
 		  (0xcc << 16) | /* copy ROP */
 		  dst_pitch);
-	OUT_BATCH(0 << 16 | 0);
-	OUT_BATCH(height << 16 | width);
-	OUT_RELOC_FENCED(dst, I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER, 0);
-	OUT_BATCH(0 << 16 | 0);
-	OUT_BATCH(src_pitch);
-	OUT_RELOC_FENCED(src, I915_GEM_DOMAIN_RENDER, 0, 0);
-	ADVANCE_BATCH();
-
-	if (batch->gen >= 6) {
-		BEGIN_BATCH(3, 0);
-		OUT_BATCH(XY_SETUP_CLIP_BLT_CMD);
-		OUT_BATCH(0);
-		OUT_BATCH(0);
-		ADVANCE_BATCH();
+	intel_bb_out(ibb, 0 << 16 | 0);
+	intel_bb_out(ibb, height << 16 | width);
+	intel_bb_emit_reloc_fenced(ibb, dst->handle, I915_GEM_DOMAIN_RENDER,
+				   I915_GEM_DOMAIN_RENDER, 0, dst->addr.offset);
+	intel_bb_out(ibb, 0 << 16 | 0);
+	intel_bb_out(ibb, src_pitch);
+	intel_bb_emit_reloc_fenced(ibb, src->handle, I915_GEM_DOMAIN_RENDER,
+				   0, 0, src->addr.offset);
+
+	if (ibb->gen >= 6) {
+		intel_bb_out(ibb, XY_SETUP_CLIP_BLT_CMD);
+		intel_bb_out(ibb, 0);
+		intel_bb_out(ibb, 0);
 	}
 
-	intel_batchbuffer_flush(batch);
-	intel_batchbuffer_free(batch);
+	intel_bb_flush_blit(ibb);
+	intel_bb_destroy(ibb);
 }
 
 static void *memchr_inv(const void *s, int c, size_t n)
@@ -98,13 +96,13 @@ static void *memchr_inv(const void *s, int c, size_t n)
 static void test(int w, int h)
 {
 	int object_size = w * h * 4;
-	drm_intel_bo *src, *dst;
+	struct intel_buf *src, *dst;
 	void *buf;
 
-	src = drm_intel_bo_alloc(bufmgr, "src", object_size, 4096);
-	igt_assert(src);
-	dst = drm_intel_bo_alloc(bufmgr, "dst", object_size, 4096);
-	igt_assert(dst);
+	src = intel_buf_create(bops, w, h, 32, 0, I915_TILING_NONE,
+			       I915_COMPRESSION_NONE);
+	dst = intel_buf_create(bops, w, h, 32, 0, I915_TILING_NONE,
+			       I915_COMPRESSION_NONE);
 
 	buf = malloc(object_size);
 	igt_assert(buf);
@@ -125,6 +123,9 @@ static void test(int w, int h)
 	gem_read(fd, dst->handle, 0, buf, object_size);
 
 	igt_assert(memchr_inv(buf, 0xff, object_size) == NULL);
+
+	intel_buf_destroy(src);
+	intel_buf_destroy(dst);
 }
 
 igt_simple_main
@@ -133,11 +134,10 @@ igt_simple_main
 	igt_require_gem(fd);
 	gem_require_blitter(fd);
 
-	devid = intel_get_drm_devid(fd);
-	bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
+	bops = buf_ops_create(fd);
 
 	test(256, 256);
 
-	drm_intel_bufmgr_destroy(bufmgr);
+	buf_ops_destroy(bops);
 	close(fd);
 }
-- 
2.20.1

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

  parent reply	other threads:[~2020-10-27  9:23 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-27  9:23 [igt-dev] [PATCH i-g-t v5 00/14] tests: Remove libdrm dependency Dominik Grzegorzek
2020-10-27  9:23 ` [igt-dev] [PATCH i-g-t v5 01/14] lib/intel_batchbuffer: add intel_bb_blit_copy wrapper Dominik Grzegorzek
2020-10-27  9:23 ` [igt-dev] [PATCH i-g-t v5 02/14] Remove unused intel_bufmgr.h headers Dominik Grzegorzek
2020-10-27  9:23 ` Dominik Grzegorzek [this message]
2020-10-27  9:23 ` [igt-dev] [PATCH i-g-t v5 04/14] i915/gem_pread_after_blit.c: Remove libdrm dependency Dominik Grzegorzek
2020-10-27  9:23 ` [igt-dev] [PATCH i-g-t v5 05/14] i915/gem_threaded_access_tiled.c: " Dominik Grzegorzek
2020-10-27  9:23 ` [igt-dev] [PATCH i-g-t v5 06/14] i915/gem_unfence_active_buffers.c: Remove librdm dependency Dominik Grzegorzek
2020-10-27  9:23 ` [igt-dev] [PATCH i-g-t v5 07/14] i915/gem_unref_active_buffers.c: Remove libdrm dependency Dominik Grzegorzek
2020-11-19 19:16   ` Chris Wilson
2020-10-27  9:23 ` [igt-dev] [PATCH i-g-t v5 08/14] i915/gem_tiled_partial_pwrite_pread: " Dominik Grzegorzek
2020-10-27  9:23 ` [igt-dev] [PATCH i-g-t v5 09/14] i915/gem_set_tiling_vs_blit.c: " Dominik Grzegorzek
2020-10-28  7:01   ` Zbigniew Kempczyński
2020-10-27  9:23 ` [igt-dev] [PATCH i-g-t v5 10/14] tests/kms_fence_pin_leak.c: " Dominik Grzegorzek
2020-10-27  9:23 ` [igt-dev] [PATCH i-g-t v5 11/14] tests/kms_flip.c: " Dominik Grzegorzek
2020-10-27  9:23 ` [igt-dev] [PATCH i-g-t v5 12/14] tests/kms_psr2_su.c: Get rid of unused bufmgr Dominik Grzegorzek
2020-10-27  9:23 ` [igt-dev] [PATCH i-g-t v5 13/14] tests/i915/gem_ppgtt: make copying more readable Dominik Grzegorzek
2020-10-27  9:23 ` [igt-dev] [PATCH i-g-t v5 14/14] i915/gem_pipe_control_store_loop.c: Remove libdrm dependency Dominik Grzegorzek
2020-10-27 18:19 ` [igt-dev] ✗ Fi.CI.BAT: failure for tests: Remove libdrm dependency (rev6) Patchwork
2020-10-28  8:47 ` [igt-dev] ✓ Fi.CI.BAT: success for tests: Remove libdrm dependency (rev7) Patchwork
2020-10-28 12:02 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2020-11-10  9:32   ` Grzegorzek, Dominik

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=20201027092317.18716-4-dominik.grzegorzek@intel.com \
    --to=dominik.grzegorzek@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.