[igt-dev] [PATCH i-g-t 3/4] tests/kms_busy: Convert to using igt_get_single_output_for_pipe.

Maarten Lankhorst maarten.lankhorst at linux.intel.com
Wed Feb 21 10:38:43 UTC 2018


Put a single igt_display_require_output_on_pipe in the fixture,
so we know we always have an output on the pipe and can always
assume it's not NULL.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
---
 tests/kms_busy.c | 38 +++++++++++++++-----------------------
 1 file changed, 15 insertions(+), 23 deletions(-)

diff --git a/tests/kms_busy.c b/tests/kms_busy.c
index 0828a8b38a06..5b4959681025 100644
--- a/tests/kms_busy.c
+++ b/tests/kms_busy.c
@@ -35,31 +35,23 @@ IGT_TEST_DESCRIPTION("Basic check of KMS ABI with busy framebuffers.");
 static igt_output_t *
 set_fb_on_crtc(igt_display_t *dpy, int pipe, struct igt_fb *fb)
 {
+	drmModeModeInfoPtr mode;
+	igt_plane_t *primary;
 	igt_output_t *output;
 
-	for_each_valid_output_on_pipe(dpy, pipe, output) {
-		drmModeModeInfoPtr mode;
-		igt_plane_t *primary;
-
-		if (output->pending_pipe != PIPE_NONE)
-			continue;
-
-		igt_output_set_pipe(output, pipe);
-		mode = igt_output_get_mode(output);
+	output = igt_get_single_output_for_pipe(dpy, pipe);
 
-		igt_create_pattern_fb(dpy->drm_fd,
-				      mode->hdisplay, mode->vdisplay,
-				      DRM_FORMAT_XRGB8888,
-				      LOCAL_I915_FORMAT_MOD_X_TILED,
-				      fb);
+	igt_output_set_pipe(output, pipe);
+	mode = igt_output_get_mode(output);
 
-		primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
-		igt_plane_set_fb(primary, fb);
+	igt_create_pattern_fb(dpy->drm_fd, mode->hdisplay, mode->vdisplay,
+			      DRM_FORMAT_XRGB8888,
+			      LOCAL_I915_FORMAT_MOD_X_TILED, fb);
 
-		return output;
-	}
+	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
+	igt_plane_set_fb(primary, fb);
 
-	return NULL;
+	return output;
 }
 
 static void do_cleanup_display(igt_display_t *dpy)
@@ -168,7 +160,7 @@ static void test_flip(igt_display_t *dpy, unsigned ring, int pipe, bool modeset)
 
 	signal(SIGALRM, sighandler);
 
-	igt_require((output = set_fb_on_crtc(dpy, pipe, &fb[0])));
+	output = set_fb_on_crtc(dpy, pipe, &fb[0]);
 	igt_display_commit2(dpy, COMMIT_LEGACY);
 
 	igt_create_pattern_fb(dpy->drm_fd,
@@ -246,7 +238,7 @@ static void test_hang(igt_display_t *dpy, unsigned ring,
 	igt_output_t *output;
 	igt_plane_t *primary;
 
-	igt_require((output = set_fb_on_crtc(dpy, pipe, &fb[0])));
+	output = set_fb_on_crtc(dpy, pipe, &fb[0]);
 	igt_display_commit2(dpy, COMMIT_ATOMIC);
 	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 
@@ -290,7 +282,7 @@ static void test_pageflip_modeset_hang(igt_display_t *dpy,
 	igt_plane_t *primary;
 	igt_spin_t *t;
 
-	igt_require((output = set_fb_on_crtc(dpy, pipe, &fb)));
+	output = set_fb_on_crtc(dpy, pipe, &fb);
 	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 
 	igt_display_commit2(dpy, dpy->is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
@@ -337,7 +329,7 @@ igt_main
 		errno = 0;
 
 		igt_fixture {
-			igt_skip_on(n >= display.n_pipes);
+			igt_display_require_output_on_pipe(&display, n);
 		}
 
 		igt_subtest_f("basic-flip-%s",
-- 
2.16.1



More information about the igt-dev mailing list