[igt-dev] [RFC v2 38/43] tests/kms_busy: use the gem_engine_topology library

Ramalingam C ramalingam.c at intel.com
Fri Jun 21 10:03:40 UTC 2019


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

Signed-off-by: Ramalingam C <ramalingam.c at intel.com>
---
 tests/kms_busy.c | 62 ++++++++++++++++++++++++------------------------
 1 file changed, 31 insertions(+), 31 deletions(-)

diff --git a/tests/kms_busy.c b/tests/kms_busy.c
index 66f26cd08f31..43da5e87694a 100644
--- a/tests/kms_busy.c
+++ b/tests/kms_busy.c
@@ -69,7 +69,7 @@ static void do_cleanup_display(igt_display_t *dpy)
 
 static void flip_to_fb(igt_display_t *dpy, int pipe,
 		       igt_output_t *output,
-		       struct igt_fb *fb, unsigned ring,
+		       struct igt_fb *fb, const struct intel_execution_engine2 *e,
 		       const char *name, bool modeset)
 {
 	struct pollfd pfd = { .fd = dpy->drm_fd, .events = POLLIN };
@@ -77,7 +77,7 @@ static void flip_to_fb(igt_display_t *dpy, int pipe,
 	struct drm_event_vblank ev;
 
 	igt_spin_t *t = igt_spin_new(dpy->drm_fd,
-				     .engine = ring,
+				     .engine = e->flags,
 				     .dependency = fb->gem_handle);
 
 	if (modeset) {
@@ -134,7 +134,9 @@ static void flip_to_fb(igt_display_t *dpy, int pipe,
 	igt_spin_free(dpy->drm_fd, t);
 }
 
-static void test_flip(igt_display_t *dpy, unsigned ring, int pipe, bool modeset)
+static void test_flip(igt_display_t *dpy,
+		      const struct intel_execution_engine2 *e, int pipe,
+		      bool modeset)
 {
 	struct igt_fb fb[2];
 	int warmup[] = { 0, 1, 0, -1 };
@@ -167,10 +169,10 @@ static void test_flip(igt_display_t *dpy, unsigned ring, int pipe, bool modeset)
 	}
 
 	/* Make the frontbuffer busy and try to flip to itself */
-	flip_to_fb(dpy, pipe, output, &fb[0], ring, "fb[0]", modeset);
+	flip_to_fb(dpy, pipe, output, &fb[0], e, "fb[0]", modeset);
 
 	/* Repeat for flip to second buffer */
-	flip_to_fb(dpy, pipe, output, &fb[1], ring, "fb[1]", modeset);
+	flip_to_fb(dpy, pipe, output, &fb[1], e, "fb[1]", modeset);
 
 	do_cleanup_display(dpy);
 	igt_remove_fb(dpy->drm_fd, &fb[1]);
@@ -178,10 +180,11 @@ static void test_flip(igt_display_t *dpy, unsigned ring, int pipe, bool modeset)
 }
 
 static void test_atomic_commit_hang(igt_display_t *dpy, igt_plane_t *primary,
-				    struct igt_fb *busy_fb, unsigned ring)
+				    struct igt_fb *busy_fb,
+				    const struct intel_execution_engine2 *e)
 {
 	igt_spin_t *t = igt_spin_new(dpy->drm_fd,
-				     .engine = ring,
+				     .engine = e->flags,
 				     .dependency = busy_fb->gem_handle);
 	struct pollfd pfd = { .fd = dpy->drm_fd, .events = POLLIN };
 	unsigned flags = 0;
@@ -213,7 +216,7 @@ static void test_atomic_commit_hang(igt_display_t *dpy, igt_plane_t *primary,
 	igt_spin_end(t);
 }
 
-static void test_hang(igt_display_t *dpy, unsigned ring,
+static void test_hang(igt_display_t *dpy, const struct intel_execution_engine2 *e,
 		      enum pipe pipe, bool modeset, bool hang_newfb)
 {
 	struct igt_fb fb[2];
@@ -234,12 +237,12 @@ static void test_hang(igt_display_t *dpy, unsigned ring,
 		/* Test modeset disable with hang */
 		igt_output_set_pipe(output, PIPE_NONE);
 		igt_plane_set_fb(primary, &fb[1]);
-		test_atomic_commit_hang(dpy, primary, &fb[hang_newfb], ring);
+		test_atomic_commit_hang(dpy, primary, &fb[hang_newfb], e);
 
 		/* Test modeset enable with hang */
 		igt_plane_set_fb(primary, &fb[0]);
 		igt_output_set_pipe(output, pipe);
-		test_atomic_commit_hang(dpy, primary, &fb[!hang_newfb], ring);
+		test_atomic_commit_hang(dpy, primary, &fb[!hang_newfb], e);
 	} else {
 		/*
 		 * Test what happens with a single hanging pageflip.
@@ -247,7 +250,7 @@ static void test_hang(igt_display_t *dpy, unsigned ring,
 		 * timeouts taking care of it.
 		 */
 		igt_plane_set_fb(primary, &fb[1]);
-		test_atomic_commit_hang(dpy, primary, &fb[hang_newfb], ring);
+		test_atomic_commit_hang(dpy, primary, &fb[hang_newfb], e);
 	}
 
 	do_cleanup_display(dpy);
@@ -256,7 +259,8 @@ static void test_hang(igt_display_t *dpy, unsigned ring,
 }
 
 static void test_pageflip_modeset_hang(igt_display_t *dpy,
-				       unsigned ring, enum pipe pipe)
+				       const struct intel_execution_engine2 *e,
+				       enum pipe pipe)
 {
 	struct igt_fb fb;
 	struct drm_event_vblank ev;
@@ -270,7 +274,7 @@ static void test_pageflip_modeset_hang(igt_display_t *dpy,
 	igt_display_commit2(dpy, dpy->is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
 
 	t = igt_spin_new(dpy->drm_fd,
-			 .engine = ring,
+			 .engine = e->flags,
 			 .dependency = fb.gem_handle);
 
 	do_or_die(drmModePageFlip(dpy->drm_fd, dpy->pipes[pipe].crtc_id, fb.fb_id, DRM_MODE_PAGE_FLIP_EVENT, &fb));
@@ -291,7 +295,7 @@ igt_main
 {
 	igt_display_t display = { .drm_fd = -1, .n_pipes = IGT_MAX_PIPES };
 	/* we only test on render */
-	const struct intel_execution_engine *e = &intel_execution_engines[1];
+	const struct intel_execution_engine2 *e = &intel_execution_engines2[0];
 	enum pipe n;
 
 	igt_skip_on_simulation();
@@ -319,32 +323,28 @@ igt_main
 
 		igt_subtest_f("basic-flip-%s",
 			kmstest_pipe_name(n)) {
-			igt_require(gem_has_ring(display.drm_fd,
-						e->exec_id | e->flags));
+			igt_require(gem_has_ring(display.drm_fd, e->flags));
 
-			test_flip(&display, e->exec_id | e->flags, n, false);
+			test_flip(&display, e, n, false);
 		}
 		igt_subtest_f("basic-modeset-%s",
 			kmstest_pipe_name(n)) {
-			igt_require(gem_has_ring(display.drm_fd,
-						e->exec_id | e->flags));
+			igt_require(gem_has_ring(display.drm_fd, e->flags));
 
-			test_flip(&display, e->exec_id | e->flags, n, true);
+			test_flip(&display, e, n, true);
 		}
 
 		igt_fixture {
-			igt_require(gem_has_ring(display.drm_fd,
-						e->exec_id | e->flags));
+			igt_require(gem_has_ring(display.drm_fd, e->flags));
 
 			hang = igt_allow_hang(display.drm_fd, 0, 0);
 		}
 
 		igt_subtest_f("extended-pageflip-modeset-hang-oldfb-%s-%s",
 				e->name, kmstest_pipe_name(n)) {
-			igt_require(gem_has_ring(display.drm_fd,
-						e->exec_id | e->flags));
+			igt_require(gem_has_ring(display.drm_fd, e->flags));
 
-			test_pageflip_modeset_hang(&display, e->exec_id | e->flags, n);
+			test_pageflip_modeset_hang(&display, e, n);
 		}
 
 		igt_fixture
@@ -352,25 +352,25 @@ igt_main
 
 		igt_subtest_f("extended-pageflip-hang-oldfb-%s-%s",
 				e->name, kmstest_pipe_name(n))
-			test_hang(&display, e->exec_id | e->flags, n, false, false);
+			test_hang(&display, e, n, false, false);
 
 		igt_subtest_f("extended-pageflip-hang-newfb-%s-%s",
 				e->name, kmstest_pipe_name(n))
-			test_hang(&display, e->exec_id | e->flags, n, false, true);
+			test_hang(&display, e, n, false, true);
 
 		igt_subtest_f("extended-modeset-hang-oldfb-%s-%s",
 				e->name, kmstest_pipe_name(n))
-			test_hang(&display, e->exec_id | e->flags, n, true, false);
+			test_hang(&display, e, n, true, false);
 
 		igt_subtest_f("extended-modeset-hang-newfb-%s-%s",
 				e->name, kmstest_pipe_name(n))
-			test_hang(&display, e->exec_id | e->flags, n, true, true);
+			test_hang(&display, e, n, true, true);
 
 		igt_subtest_f("extended-modeset-hang-oldfb-with-reset-%s-%s",
 				e->name, kmstest_pipe_name(n)) {
 			igt_set_module_param_int("force_reset_modeset_test", 1);
 
-			test_hang(&display, e->exec_id | e->flags, n, true, false);
+			test_hang(&display, e, n, true, false);
 
 			igt_set_module_param_int("force_reset_modeset_test", 0);
 		}
@@ -379,7 +379,7 @@ igt_main
 				e->name, kmstest_pipe_name(n)) {
 			igt_set_module_param_int("force_reset_modeset_test", 1);
 
-			test_hang(&display, e->exec_id | e->flags, n, true, true);
+			test_hang(&display, e, n, true, true);
 
 			igt_set_module_param_int("force_reset_modeset_test", 0);
 		}
-- 
2.19.1



More information about the igt-dev mailing list