[i-g-t 18/27] tests/i915/vm_bind: Use execbuf3 spinner

Bhanuprakash Modem bhanuprakash.modem at intel.com
Mon Jan 23 09:43:26 UTC 2023


From: Niranjana Vishwanathapura <niranjana.vishwanathapura at intel.com>

Update gem_exec3_balancer test to use execbuf3 spinner.

Reviewed-by: Matthew Auld <matthew.auld at intel.com>
Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura at intel.com>
---
 tests/i915/gem_exec3_balancer.c | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/tests/i915/gem_exec3_balancer.c b/tests/i915/gem_exec3_balancer.c
index cc8c743f..23122f00 100644
--- a/tests/i915/gem_exec3_balancer.c
+++ b/tests/i915/gem_exec3_balancer.c
@@ -11,8 +11,6 @@
  *
  */
 
-#include <poll.h>
-
 #include "i915/gem.h"
 #include "i915/i915_vm_bind.h"
 #include "i915/gem_engine_topology.h"
@@ -173,11 +171,6 @@ static void logical_sort_siblings(int i915,
 	free(engines);
 }
 
-static bool fence_busy(int fence)
-{
-	return poll(&(struct pollfd){fence, POLLIN}, 1, 0) == 0;
-}
-
 /*
  * Always reading from engine instance 0, with GuC submission the values are the
  * same across all instances. Execlists they may differ but quite unlikely they
@@ -217,10 +210,11 @@ static unsigned int get_timeslice(int i915,
  */
 static void parallel_ordering(int i915, unsigned int flags)
 {
-	uint32_t vm_id;
+	uint32_t vm_id, spin_vm_id;
 	int class;
 
 	vm_id = gem_vm_create_in_vm_bind_mode(i915);
+	spin_vm_id = gem_vm_create_in_vm_bind_mode(i915);
 
 	for (class = 0; class < 32; class++) {
 		struct drm_i915_gem_timeline_fence exec_fence = { };
@@ -293,17 +287,22 @@ static void parallel_ordering(int i915, unsigned int flags)
 
 		/* Block parallel submission */
 		spin_ctx = ctx_create_engines(i915, siblings, count);
+		param.ctx_id = spin_ctx->id;
+		gem_context_set_param(i915, &param);
+		gem_context_set_vm(i915, spin_ctx->id, spin_vm_id);
 		ahnd = get_simple_ahnd(i915, spin_ctx->id);
+		igt_require(ahnd);
 		spin = __igt_spin_new(i915,
 				      .ahnd = ahnd,
 				      .ctx = spin_ctx,
-				      .engine = 0,
-				      .flags = IGT_SPIN_FENCE_OUT |
+				      .vm_id = spin_vm_id,
+				      .flags = IGT_SPIN_EXECBUF3 |
 				      IGT_SPIN_NO_PREEMPTION);
 
 		/* Wait for spinners to start */
 		usleep(5 * 10000);
-		igt_assert(fence_busy(spin->out_fence));
+		while (spin->out_syncobj[i])
+			igt_assert(syncobj_busy(i915, spin->out_syncobj[i++]));
 
 		/* Submit parallel execbuf */
 		gem_execbuf3(i915, &execbuf);
@@ -315,7 +314,6 @@ static void parallel_ordering(int i915, unsigned int flags)
 		 * these are changed it is possible for the test to fail.
 		 */
 		usleep(get_timeslice(i915, siblings[0]) * 2);
-		igt_assert(fence_busy(spin->out_fence));
 		igt_assert(syncobj_busy(i915, exec_syncobj));
 		check_bo(i915, obj[0], 0);
 
@@ -345,6 +343,7 @@ static void parallel_ordering(int i915, unsigned int flags)
 		put_ahnd(ahnd);
 	}
 
+	gem_vm_destroy(i915, spin_vm_id);
 	gem_vm_destroy(i915, vm_id);
 }
 
-- 
2.39.0



More information about the Intel-gfx-trybot mailing list