[Intel-gfx] [PATCH i-g-t] kms_universal_plane: Add testcase for when no plane is visible on the crtc.

Maarten Lankhorst maarten.lankhorst at linux.intel.com
Mon Jun 13 09:38:05 UTC 2016


It's completely valid to have a crtc with no active planes, or
only with planes that are invisible. The cursor-only-pipe-* test
will try to set the crtc in a configuration where only the cursor is
visible, then hide the cursor at negative coordinates so no plane is
visible, and finally disables the cursor altogether.

This triggers a WARN_ON in the kernel:
WARN_ON(cstate->plane_mask && total_data_rate == 0);

Signed-off-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
---
diff --git a/tests/kms_universal_plane.c b/tests/kms_universal_plane.c
index b06b51e6934c..30590ebd6a4b 100644
--- a/tests/kms_universal_plane.c
+++ b/tests/kms_universal_plane.c
@@ -739,6 +739,59 @@ gen9_test_pipe(data_t *data, enum pipe pipe, igt_output_t *output)
 }
 
 static void
+cursor_only_test_pipe(data_t *data, enum pipe pipe, igt_output_t *output)
+{
+	igt_display_t *display = &data->display;
+	igt_plane_t *primary, *cursor;
+	drmModeModeInfo *mode;
+	struct igt_fb background_fb, cursor_fb;
+
+	igt_assert(data->display.has_universal_planes);
+	igt_skip_on(pipe >= display->n_pipes);
+
+	igt_output_set_pipe(output, pipe);
+	mode = igt_output_get_mode(output);
+
+	primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+	cursor = igt_output_get_plane(output, IGT_PLANE_CURSOR);
+	if (!primary || !cursor)
+		igt_skip("Primary and/or cursor are unavailable\n");
+
+	igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
+			    DRM_FORMAT_XRGB8888,
+			    false,
+			    0.0, 0.0, 0.0,
+			    &background_fb);
+
+	igt_create_color_fb(data->drm_fd, 64, 64,
+			    DRM_FORMAT_ARGB8888,
+			    false, 0xff, 0xff, 0xff,
+			    &cursor_fb);
+
+	igt_plane_set_fb(primary, &background_fb);
+	igt_display_commit2(display, COMMIT_LEGACY);
+
+	/* Test with only cursor as active plane. */
+	igt_plane_set_fb(primary, NULL);
+	igt_plane_set_position(cursor, 100, 100);
+	igt_plane_set_fb(cursor, &cursor_fb);
+	igt_display_commit2(display, COMMIT_UNIVERSAL);
+
+	/* Test with cursor as the only plane, hidden. */
+	igt_plane_set_position(cursor, -64, -64);
+	igt_display_commit2(display, COMMIT_UNIVERSAL);
+
+	/* Test with 0 active planes. */
+	igt_plane_set_fb(cursor, NULL);
+	igt_display_commit2(display, COMMIT_UNIVERSAL);
+
+	igt_remove_fb(data->drm_fd, &background_fb);
+	igt_remove_fb(data->drm_fd, &cursor_fb);
+
+	igt_output_set_pipe(output, PIPE_ANY);
+}
+
+static void
 run_tests_for_pipe(data_t *data, enum pipe pipe)
 {
 	igt_output_t *output;
@@ -767,6 +820,11 @@ run_tests_for_pipe(data_t *data, enum pipe pipe)
 		      kmstest_pipe_name(pipe))
 		for_each_connected_output(&data->display, output)
 			gen9_test_pipe(data, pipe, output);
+
+	igt_subtest_f("cursor-only-pipe-%s",
+		      kmstest_pipe_name(pipe))
+		for_each_connected_output(&data->display, output)
+			cursor_only_test_pipe(data, pipe, output);
 }
 
 static data_t data;



More information about the Intel-gfx mailing list