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 4/5] tests/gem_media_vme: Remove libdrm dependency
Date: Tue, 26 May 2020 10:14:50 +0200	[thread overview]
Message-ID: <20200526081451.2045-5-zbigniew.kempczynski@intel.com> (raw)
In-Reply-To: <20200526081451.2045-1-zbigniew.kempczynski@intel.com>

Continue migration of the tests to be libdrm-free.

Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/i915/gem_media_vme.c | 78 +++++++++-----------------------------
 1 file changed, 17 insertions(+), 61 deletions(-)

diff --git a/tests/i915/gem_media_vme.c b/tests/i915/gem_media_vme.c
index c3af1b12..391a76d9 100644
--- a/tests/i915/gem_media_vme.c
+++ b/tests/i915/gem_media_vme.c
@@ -35,7 +35,6 @@
 #include "drm.h"
 #include "i915/gem.h"
 #include "igt.h"
-#include "intel_bufmgr.h"
 
 IGT_TEST_DESCRIPTION("A very simple workload for the VME media block.");
 
@@ -46,43 +45,6 @@ IGT_TEST_DESCRIPTION("A very simple workload for the VME media block.");
 #define INPUT_SIZE	(WIDTH * HEIGHT * sizeof(char) * 1.5)
 #define OUTPUT_SIZE	(56*sizeof(int))
 
-static void
-scratch_buf_init(drm_intel_bufmgr *bufmgr,
-		 struct igt_buf *buf,
-		 unsigned int size)
-{
-	drm_intel_bo *bo;
-
-	bo = drm_intel_bo_alloc(bufmgr, "", size, 4096);
-	igt_assert(bo);
-
-	memset(buf, 0, sizeof(*buf));
-
-	buf->bo = bo;
-	buf->tiling = I915_TILING_NONE;
-	buf->surface[0].size = size;
-}
-
-static void scratch_buf_init_src(drm_intel_bufmgr *bufmgr, struct igt_buf *buf)
-{
-	scratch_buf_init(bufmgr, buf, INPUT_SIZE);
-
-	/*
-	 * Ideally we would read src surface from file "SourceFrameI.yu12".
-	 * But even without it, we can still triger the rcs0 resetting
-	 * with this vme kernel.
-	 */
-
-	buf->surface[0].stride = STRIDE;
-}
-
-static void scratch_buf_init_dst(drm_intel_bufmgr *bufmgr, struct igt_buf *buf)
-{
-	scratch_buf_init(bufmgr, buf, OUTPUT_SIZE);
-
-	buf->surface[0].stride = 1;
-}
-
 static uint64_t switch_off_n_bits(uint64_t mask, unsigned int n)
 {
 	unsigned int i;
@@ -131,12 +93,11 @@ static void shut_non_vme_subslices(int drm_fd, uint32_t ctx)
 
 igt_simple_main
 {
+	struct buf_ops *bops;
+	struct intel_buf src, dst;
 	int drm_fd;
-	uint32_t devid;
-	drm_intel_bufmgr *bufmgr;
+	uint32_t devid, ctx;
 	igt_vme_func_t media_vme;
-	struct intel_batchbuffer *batch;
-	struct igt_buf src, dst;
 
 	drm_fd = drm_open_driver(DRIVER_INTEL);
 	igt_require_gem(drm_fd);
@@ -146,34 +107,29 @@ igt_simple_main
 	media_vme = igt_get_media_vme_func(devid);
 	igt_require_f(media_vme, "no media-vme function\n");
 
-	bufmgr = drm_intel_bufmgr_gem_init(drm_fd, 4096);
-	igt_assert(bufmgr);
+	bops = buf_ops_create(drm_fd);
 
-	batch = intel_batchbuffer_alloc(bufmgr, devid);
-	igt_assert(batch);
+	/* Use WIDTH/HEIGHT/STRIDE according to INPUT_SIZE */
+	intel_buf_init(bops, &src, WIDTH, HEIGHT * 1.5, 8, STRIDE,
+		       I915_TILING_NONE, 0);
 
-	scratch_buf_init_src(bufmgr, &src);
-	scratch_buf_init_dst(bufmgr, &dst);
+	/* This comes from OUTPUT_SIZE requirements */
+	intel_buf_init(bops, &dst, 56, sizeof(int), 8, 56,
+		       I915_TILING_NONE, 0);
+	dst.stride = 1;
 
-	batch->ctx = drm_intel_gem_context_create(bufmgr);
-	igt_assert(batch->ctx);
+	ctx = gem_context_create(drm_fd);
+	igt_assert(ctx);
 
 	/* ICL hangs if non-VME enabled slices are enabled with a VME kernel. */
-	if (intel_gen(devid) == 11) {
-		uint32_t ctx_id;
-		int ret;
-
-		ret = drm_intel_gem_context_get_id(batch->ctx, &ctx_id);
-		igt_assert_eq(ret, 0);
-
-		shut_non_vme_subslices(drm_fd, ctx_id);
-	}
+	if (intel_gen(devid) == 11)
+		shut_non_vme_subslices(drm_fd, ctx);
 
 	igt_fork_hang_detector(drm_fd);
 
-	media_vme(batch, &src, WIDTH, HEIGHT, &dst);
+	media_vme(drm_fd, ctx, &src, WIDTH, HEIGHT, &dst);
 
-	gem_sync(drm_fd, dst.bo->handle);
+	gem_sync(drm_fd, dst.handle);
 
 	igt_stop_hang_detector();
 }
-- 
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-05-26  8:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-26  8:14 [igt-dev] [PATCH i-g-t 0/5] Make gem_media_vme libdrm-free Zbigniew Kempczyński
2020-05-26  8:14 ` [igt-dev] [PATCH i-g-t 1/5] lib/gpu_cmds: Change gpu commands to use intel_bb Zbigniew Kempczyński
2020-05-26  8:14 ` [igt-dev] [PATCH i-g-t 2/5] lib/media_fill: Migrate gen11 media pipeline creation to intel_bb Zbigniew Kempczyński
2020-05-26 14:09   ` Chris Wilson
2020-05-26  8:14 ` [igt-dev] [PATCH i-g-t 3/5] lib/intel_batchbuffer: Change media vme function prototype Zbigniew Kempczyński
2020-05-26  8:14 ` Zbigniew Kempczyński [this message]
2020-05-26  8:14 ` [igt-dev] [PATCH i-g-t 5/5] HAX: run media_vme in BAT only Zbigniew Kempczyński
2020-05-26  8:31 ` [igt-dev] ✓ Fi.CI.BAT: success for Make gem_media_vme libdrm-free Patchwork
2020-05-26  9:33 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2020-05-26 11:01 ` Patchwork
2020-05-26 11:08 ` [igt-dev] ✓ Fi.CI.BAT: success for Make gem_media_vme libdrm-free (rev2) Patchwork
2020-05-26 14:28 ` [igt-dev] ✗ Fi.CI.IGT: failure " 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=20200526081451.2045-5-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