[i-g-t v2 26/27] tests/kms_cursor_legacy: Use execbuf3 spinner

Bhanuprakash Modem bhanuprakash.modem at intel.com
Tue Jan 24 07:35:10 UTC 2023


Add support to use execbuf3 spinner.

Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
---
 tests/kms_cursor_legacy.c | 32 ++++++++++++++++++++++++++++++--
 1 file changed, 30 insertions(+), 2 deletions(-)

diff --git a/tests/kms_cursor_legacy.c b/tests/kms_cursor_legacy.c
index f1e55906..9142276c 100644
--- a/tests/kms_cursor_legacy.c
+++ b/tests/kms_cursor_legacy.c
@@ -26,6 +26,8 @@
 #include <sys/poll.h>
 
 #include "i915/gem.h"
+#include "i915/gem_vm.h"
+#include "i915/i915_vm_bind.h"
 #include "igt.h"
 #include "igt_psr.h"
 #include "igt_rand.h"
@@ -552,11 +554,30 @@ static void basic_flip_cursor(igt_display_t *display,
 	int i, miss1 = 0, miss2 = 0, delta;
 	igt_output_t *output;
 	igt_plane_t *cursor;
+	uint32_t vm_id = 0;
+	unsigned int spin_flags = IGT_SPIN_NO_PREEMPTION;
 
 	if (flags & BASIC_BUSY)
 	{
 		igt_require_intel(display->drm_fd);
-		ahnd = get_reloc_ahnd(display->drm_fd, 0);
+		if (i915_vm_bind_version(display->drm_fd) == 1) {
+			struct drm_i915_gem_context_param param = {
+				.param = I915_CONTEXT_PARAM_RECOVERABLE,
+				.value = 0,
+			};
+
+			vm_id = gem_vm_create_in_vm_bind_mode(display->drm_fd);
+
+			gem_context_set_param(display->drm_fd, &param);
+			gem_context_set_vm(display->drm_fd, 0, vm_id);
+
+			vm_id = gem_context_get_vm(display->drm_fd, 0);
+			ahnd = get_simple_ahnd(display->drm_fd, 0);
+
+			spin_flags = IGT_SPIN_EXECBUF3;
+		} else {
+			ahnd = get_reloc_ahnd(display->drm_fd, 0);
+		}
 	}
 
 	if (mode >= flip_test_atomic)
@@ -585,10 +606,14 @@ static void basic_flip_cursor(igt_display_t *display,
 		do_ioctl(display->drm_fd, DRM_IOCTL_MODE_CURSOR, &arg[0]);
 
 		spin = NULL;
+
 		if (flags & BASIC_BUSY)
 			spin = igt_spin_new(display->drm_fd,
 					    .ahnd = ahnd,
-					    .dependency = fb_info.gem_handle);
+					    .dependency = fb_info.gem_handle,
+					    .ctx = 0,
+					    .vm_id = vm_id,
+					    .flags = spin_flags);
 
 		/* Start with a synchronous query to align with the vblank */
 		vblank_start = kmstest_get_vblank(display->drm_fd, pipe, DRM_VBLANK_NEXTONMISS);
@@ -636,6 +661,9 @@ static void basic_flip_cursor(igt_display_t *display,
 			igt_spin_free(display->drm_fd, spin);
 		}
 
+		if (vm_id)
+			gem_vm_destroy(display->drm_fd, vm_id);
+
 		if (miss)
 			{ /* compare nothing, already failed */ }
 		else if (!cursor_slowpath(display, mode))
-- 
2.39.0



More information about the Intel-gfx-trybot mailing list