public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Ramalingam C <ramalingam.c@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t v2 5/5] test/prime_vgem: use the gem_engine_topology library
Date: Thu, 30 May 2019 21:12:22 +0530	[thread overview]
Message-ID: <20190530154222.16804-6-ramalingam.c@intel.com> (raw)
In-Reply-To: <20190530154222.16804-1-ramalingam.c@intel.com>

Replace the legacy for_each_engine* defines with the ones
implemented in the gem_engine_topology library.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 tests/prime_vgem.c | 70 +++++++++++++++++++++-------------------------
 1 file changed, 32 insertions(+), 38 deletions(-)

diff --git a/tests/prime_vgem.c b/tests/prime_vgem.c
index 69ae8c9b0710..7689f6b3d6c8 100644
--- a/tests/prime_vgem.c
+++ b/tests/prime_vgem.c
@@ -325,7 +325,7 @@ static bool prime_busy(int fd, bool excl)
 	return poll(&pfd, 1, 0) == 0;
 }
 
-static void work(int i915, int dmabuf, unsigned ring, uint32_t flags)
+static void work(int i915, int dmabuf, const struct intel_execution_engine2 *e)
 {
 	const int SCRATCH = 0;
 	const int BATCH = 1;
@@ -341,7 +341,7 @@ static void work(int i915, int dmabuf, unsigned ring, uint32_t flags)
 	memset(&execbuf, 0, sizeof(execbuf));
 	execbuf.buffers_ptr = (uintptr_t)obj;
 	execbuf.buffer_count = 2;
-	execbuf.flags = ring | flags;
+	execbuf.flags = e ? e->flags : I915_EXEC_DEFAULT;
 	if (gen < 6)
 		execbuf.flags |= I915_EXEC_SECURE;
 
@@ -420,7 +420,7 @@ static void work(int i915, int dmabuf, unsigned ring, uint32_t flags)
 	igt_assert(read_busy && write_busy);
 }
 
-static void test_busy(int i915, int vgem, unsigned ring, uint32_t flags)
+static void test_busy(int i915, int vgem, const struct intel_execution_engine2 *e)
 {
 	struct vgem_bo scratch;
 	struct timespec tv;
@@ -434,7 +434,7 @@ static void test_busy(int i915, int vgem, unsigned ring, uint32_t flags)
 	vgem_create(vgem, &scratch);
 	dmabuf = prime_handle_to_fd(vgem, scratch.handle);
 
-	work(i915, dmabuf, ring, flags);
+	work(i915, dmabuf, e);
 
 	/* Calling busy in a loop should be enough to flush the rendering */
 	memset(&tv, 0, sizeof(tv));
@@ -450,7 +450,8 @@ static void test_busy(int i915, int vgem, unsigned ring, uint32_t flags)
 	close(dmabuf);
 }
 
-static void test_wait(int i915, int vgem, unsigned ring, uint32_t flags)
+static void test_wait(int i915, int vgem,
+		      const struct intel_execution_engine2 *e)
 {
 	struct vgem_bo scratch;
 	struct pollfd pfd;
@@ -463,7 +464,7 @@ static void test_wait(int i915, int vgem, unsigned ring, uint32_t flags)
 	vgem_create(vgem, &scratch);
 	pfd.fd = prime_handle_to_fd(vgem, scratch.handle);
 
-	work(i915, pfd.fd, ring, flags);
+	work(i915, pfd.fd, e);
 
 	pfd.events = POLLIN;
 	igt_assert_eq(poll(&pfd, 1, 10000), 1);
@@ -477,7 +478,7 @@ static void test_wait(int i915, int vgem, unsigned ring, uint32_t flags)
 	close(pfd.fd);
 }
 
-static void test_sync(int i915, int vgem, unsigned ring, uint32_t flags)
+static void test_sync(int i915, int vgem, const struct intel_execution_engine2 *e)
 {
 	struct vgem_bo scratch;
 	uint32_t *ptr;
@@ -494,7 +495,7 @@ static void test_sync(int i915, int vgem, unsigned ring, uint32_t flags)
 	igt_assert(ptr != MAP_FAILED);
 	gem_close(vgem, scratch.handle);
 
-	work(i915, dmabuf, ring, flags);
+	work(i915, dmabuf, e);
 
 	prime_sync_start(dmabuf, false);
 	for (i = 0; i < 1024; i++)
@@ -506,7 +507,8 @@ static void test_sync(int i915, int vgem, unsigned ring, uint32_t flags)
 	munmap(ptr, scratch.size);
 }
 
-static void test_fence_wait(int i915, int vgem, unsigned ring, unsigned flags)
+static void test_fence_wait(int i915, int vgem,
+			    const struct intel_execution_engine2 *e)
 {
 	struct vgem_bo scratch;
 	uint32_t fence;
@@ -527,7 +529,7 @@ static void test_fence_wait(int i915, int vgem, unsigned ring, unsigned flags)
 	igt_assert(ptr != MAP_FAILED);
 
 	igt_fork(child, 1)
-		work(i915, dmabuf, ring, flags);
+		work(i915, dmabuf, e);
 
 	sleep(1);
 
@@ -568,7 +570,7 @@ static void test_fence_hang(int i915, int vgem, unsigned flags)
 	igt_assert(ptr != MAP_FAILED);
 	gem_close(vgem, scratch.handle);
 
-	work(i915, dmabuf, I915_EXEC_DEFAULT, 0);
+	work(i915, dmabuf, NULL);
 
 	/* The work should have been cancelled */
 
@@ -811,7 +813,7 @@ static void test_flip(int i915, int vgem, unsigned hang)
 
 igt_main
 {
-	const struct intel_execution_engine *e;
+	const struct intel_execution_engine2 *e;
 	int i915 = -1;
 	int vgem = -1;
 
@@ -840,39 +842,32 @@ igt_main
 	igt_subtest("coherency-gtt")
 		test_gtt_interleaved(vgem, i915);
 
-	for (e = intel_execution_engines; e->name; e++) {
+	__for_each_physical_engine(i915, e) {
 		igt_subtest_f("%ssync-%s",
-			      e->exec_id == 0 ? "basic-" : "",
-			      e->name) {
-			gem_require_ring(i915, e->exec_id | e->flags);
-			igt_require(gem_can_store_dword(i915, e->exec_id | e->flags));
+			      e->class == I915_ENGINE_CLASS_RENDER ?
+			      "basic-" : "", e->name) {
+			igt_require(gem_class_can_store_dword(i915, e->class));
 
 			gem_quiescent_gpu(i915);
-			test_sync(i915, vgem, e->exec_id, e->flags);
+			test_sync(i915, vgem, e);
 		}
-	}
 
-	for (e = intel_execution_engines; e->name; e++) {
 		igt_subtest_f("%sbusy-%s",
-			      e->exec_id == 0 ? "basic-" : "",
-			      e->name) {
-			gem_require_ring(i915, e->exec_id | e->flags);
-			igt_require(gem_can_store_dword(i915, e->exec_id | e->flags));
+			      e->class == I915_ENGINE_CLASS_RENDER ?
+			      "basic-" : "", e->name) {
+			igt_require(gem_can_store_dword(i915, e->class));
 
 			gem_quiescent_gpu(i915);
-			test_busy(i915, vgem, e->exec_id, e->flags);
+			test_busy(i915, vgem, e);
 		}
-	}
 
-	for (e = intel_execution_engines; e->name; e++) {
 		igt_subtest_f("%swait-%s",
-			      e->exec_id == 0 ? "basic-" : "",
-			      e->name) {
-			gem_require_ring(i915, e->exec_id | e->flags);
-			igt_require(gem_can_store_dword(i915, e->exec_id | e->flags));
+			      e->class == I915_ENGINE_CLASS_RENDER ?
+			      "basic-" : "", e->name) {
+			igt_require(gem_can_store_dword(i915, e->class));
 
 			gem_quiescent_gpu(i915);
-			test_wait(i915, vgem, e->exec_id, e->flags);
+			test_wait(i915, vgem, e);
 		}
 	}
 
@@ -887,15 +882,14 @@ igt_main
 		igt_subtest("basic-fence-mmap")
 			test_fence_mmap(i915, vgem);
 
-		for (e = intel_execution_engines; e->name; e++) {
+		__for_each_physical_engine(i915, e) {
 			igt_subtest_f("%sfence-wait-%s",
-					e->exec_id == 0 ? "basic-" : "",
-					e->name) {
-				gem_require_ring(i915, e->exec_id | e->flags);
-				igt_require(gem_can_store_dword(i915, e->exec_id | e->flags));
+					e->class == I915_ENGINE_CLASS_RENDER ?
+					"basic-" : "", e->name) {
+				igt_require(gem_can_store_dword(i915, e->class));
 
 				gem_quiescent_gpu(i915);
-				test_fence_wait(i915, vgem, e->exec_id, e->flags);
+				test_fence_wait(i915, vgem, e);
 			}
 		}
 
-- 
2.19.1

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

  parent reply	other threads:[~2019-05-30 15:39 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-30 15:42 [igt-dev] [PATCH i-g-t v2 0/5] Engine discovery for few more tests Ramalingam C
2019-05-30 15:42 ` [igt-dev] [PATCH i-g-t v2 1/5] test/i915: gem_bad_reloc: use the gem_engine_topology library Ramalingam C
2019-06-06 14:06   ` Andi Shyti
2019-05-30 15:42 ` [igt-dev] [PATCH i-g-t v2 2/5] test/i915: gem_exec_async: " Ramalingam C
2019-05-30 15:44   ` Chris Wilson
2019-05-30 16:14     ` Ramalingam C
2019-06-06 14:09   ` Andi Shyti
2019-05-30 15:42 ` [igt-dev] [PATCH i-g-t v2 3/5] test/i915: gem_exec_capture: " Ramalingam C
2019-05-30 15:47   ` Chris Wilson
2019-05-30 15:59     ` Ramalingam C
2019-06-06 14:10   ` Andi Shyti
2019-05-30 15:42 ` [igt-dev] [PATCH i-g-t v2 4/5] test/i915: gem_exec_params: " Ramalingam C
2019-05-30 15:49   ` Chris Wilson
2019-05-30 16:13     ` Ramalingam C
2019-06-06 14:12   ` Andi Shyti
2019-05-30 15:42 ` Ramalingam C [this message]
2019-05-30 15:50   ` [igt-dev] [PATCH i-g-t v2 5/5] test/prime_vgem: " Chris Wilson
2019-05-30 16:05     ` Ramalingam C
2019-06-06 14:17   ` Andi Shyti
2019-06-06 14:38     ` Tvrtko Ursulin
2019-06-06 15:31       ` Ramalingam C
2019-06-06 15:34         ` Tvrtko Ursulin
2019-06-06 15:48           ` Ramalingam C
2019-06-06 15:57             ` Tvrtko Ursulin
2019-06-07 10:38             ` Andi Shyti
2019-06-07 10:34       ` Andi Shyti
2019-05-31 11:11 ` [igt-dev] ✓ Fi.CI.BAT: success for Engine discovery for few more tests Patchwork
2019-06-01  2:54 ` [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=20190530154222.16804-6-ramalingam.c@intel.com \
    --to=ramalingam.c@intel.com \
    --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