Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t 12/12] tests/kms_rotation_crc: Test all pixel formats on all planes.
Date: Tue,  6 Feb 2018 11:14:17 +0100	[thread overview]
Message-ID: <20180206101417.59979-12-maarten.lankhorst@linux.intel.com> (raw)
In-Reply-To: <20180206101417.59979-1-maarten.lankhorst@linux.intel.com>

The test is modified to test all pixel formats on a plane, unless
the pixel format is overridden by the subtest.

Attempting to test all pixel formats requires even more runtime and
the overhead of toggling crc collection to capture a single CRC
becomes significant, so keep the crc collection enabled during the entire test.

This reduces the runtime from ~24s to ~16s per subtest on SKL.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
 tests/kms_rotation_crc.c | 129 ++++++++++++++++++++++++++++-------------------
 1 file changed, 77 insertions(+), 52 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 18c3e13431db..0cd5c6e52b57 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -153,9 +153,10 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
 
 	/* create the pipe_crc object for this pipe */
 	igt_pipe_crc_free(data->pipe_crc);
-	data->pipe_crc = igt_pipe_crc_new(data->gfx_fd, pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
 
 	igt_display_commit2(display, COMMIT_ATOMIC);
+	data->pipe_crc = igt_pipe_crc_new(data->gfx_fd, pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
+	igt_pipe_crc_start(data->pipe_crc);
 }
 
 enum rectangle_type {
@@ -167,7 +168,7 @@ enum rectangle_type {
 };
 
 static void prepare_fbs(data_t *data, igt_output_t *output,
-			igt_plane_t *plane, enum rectangle_type rect)
+			igt_plane_t *plane, enum rectangle_type rect, uint32_t format)
 {
 	drmModeModeInfo *mode;
 	igt_display_t *display = &data->display;
@@ -234,7 +235,8 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
 	if (plane->type != DRM_PLANE_TYPE_CURSOR)
 		igt_plane_set_position(plane, data->pos_x, data->pos_y);
 	igt_display_commit2(display, COMMIT_ATOMIC);
-	igt_pipe_crc_collect_crc(data->pipe_crc, &data->flip_crc);
+	igt_pipe_crc_drain(data->pipe_crc);
+	igt_pipe_crc_get_single(data->pipe_crc, &data->flip_crc);
 
 	/*
 	  * Prepare the non-rotated flip fb.
@@ -257,7 +259,8 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
 		igt_plane_set_position(plane, data->pos_x, data->pos_y);
 	igt_display_commit2(display, COMMIT_ATOMIC);
 
-	igt_pipe_crc_collect_crc(data->pipe_crc, &data->ref_crc);
+	igt_pipe_crc_drain(data->pipe_crc);
+	igt_pipe_crc_get_single(data->pipe_crc, &data->ref_crc);
 
 	/*
 	 * Prepare the non-rotated reference fb.
@@ -298,21 +301,77 @@ static void wait_for_pageflip(int fd)
 	igt_assert(drmHandleEvent(fd, &evctx) == 0);
 }
 
+static void test_single_case(data_t *data, enum pipe pipe,
+			     igt_output_t *output, igt_plane_t *plane,
+			     enum rectangle_type rect,
+			     uint32_t format, bool test_bad_format)
+{
+	igt_display_t *display = &data->display;
+	igt_crc_t crc_output;
+	int ret;
+
+	igt_debug("Testing case %i on pipe %s, format %s\n", rect, kmstest_pipe_name(pipe), igt_format_str(format));
+	prepare_fbs(data, output, plane, rect, format);
+
+	igt_plane_set_rotation(plane, data->rotation);
+	if (data->rotation & (IGT_ROTATION_90 | IGT_ROTATION_270))
+		igt_plane_set_size(plane, data->fb.height, data->fb.width);
+
+	ret = igt_display_try_commit2(display, COMMIT_ATOMIC);
+	if (test_bad_format) {
+		igt_assert_eq(ret, -EINVAL);
+		return;
+	}
+
+	/* Verify commit was ok. */
+	igt_assert_eq(ret, 0);
+
+	/* Check CRC */
+	igt_pipe_crc_drain(data->pipe_crc);
+	igt_pipe_crc_get_single(data->pipe_crc, &crc_output);
+	igt_assert_crc_equal(&data->ref_crc, &crc_output);
+
+	/*
+	 * If flips are requested flip to a different fb and
+	 * check CRC against that one as well.
+	 */
+	if (data->fb_flip.fb_id) {
+		igt_plane_set_fb(plane, &data->fb_flip);
+		if (data->rotation == IGT_ROTATION_90 || data->rotation == IGT_ROTATION_270)
+			igt_plane_set_size(plane, data->fb.height, data->fb.width);
+
+		if (plane->type != DRM_PLANE_TYPE_PRIMARY) {
+			igt_display_commit_atomic(display, DRM_MODE_PAGE_FLIP_EVENT | DRM_MODE_ATOMIC_NONBLOCK, NULL);
+		} else {
+			ret = drmModePageFlip(data->gfx_fd,
+					output->config.crtc->crtc_id,
+					data->fb_flip.fb_id,
+					DRM_MODE_PAGE_FLIP_EVENT,
+					NULL);
+			igt_assert_eq(ret, 0);
+		}
+		wait_for_pageflip(data->gfx_fd);
+		igt_pipe_crc_drain(data->pipe_crc);
+		igt_pipe_crc_get_single(data->pipe_crc, &crc_output);
+		igt_assert_crc_equal(&data->flip_crc,
+				     &crc_output);
+	}
+}
+
 static void test_plane_rotation(data_t *data, int plane_type, bool test_bad_format)
 {
 	igt_display_t *display = &data->display;
 	igt_output_t *output;
 	enum pipe pipe;
-	int valid_tests = 0;
-	igt_crc_t crc_output;
-	int ret;
 
 	if (plane_type == DRM_PLANE_TYPE_CURSOR)
 		igt_require(display->has_cursor_plane);
 
+	igt_display_require_output(display);
+
 	for_each_pipe_with_valid_output(display, pipe, output) {
 		igt_plane_t *plane;
-		int i;
+		int i, j;
 
 		if (IS_CHERRYVIEW(data->devid) && pipe != PIPE_B)
 			continue;
@@ -335,56 +394,22 @@ static void test_plane_rotation(data_t *data, int plane_type, bool test_bad_form
 			    i != rectangle && intel_gen(intel_get_drm_devid(data->gfx_fd)) < 9)
 				continue;
 
-			igt_debug("Testing case %i on pipe %s\n", i, kmstest_pipe_name(pipe));
-			prepare_fbs(data, output, plane, i);
-
-			igt_plane_set_rotation(plane, data->rotation);
-			if (data->rotation & (IGT_ROTATION_90 | IGT_ROTATION_270))
-				igt_plane_set_size(plane, data->fb.height, data->fb.width);
+			if (!data->override_fmt) {
+				for (j = 0; j < plane->drm_plane->count_formats; j++) {
+					uint32_t format = plane->drm_plane->formats[j];
 
-			ret = igt_display_try_commit2(display, COMMIT_ATOMIC);
-			if (test_bad_format) {
-				igt_assert_eq(ret, -EINVAL);
-				continue;
-			}
+					if (!igt_fb_supported_format(format))
+						continue;
 
-			/* Verify commit was ok. */
-			igt_assert_eq(ret, 0);
-
-			/* Check CRC */
-			igt_pipe_crc_collect_crc(data->pipe_crc, &crc_output);
-			igt_assert_crc_equal(&data->ref_crc, &crc_output);
-
-			/*
-			 * If flips are requested flip to a different fb and
-			 * check CRC against that one as well.
-			 */
-			if (data->fb_flip.fb_id) {
-				igt_plane_set_fb(plane, &data->fb_flip);
-				if (data->rotation == IGT_ROTATION_90 || data->rotation == IGT_ROTATION_270)
-					igt_plane_set_size(plane, data->fb.height, data->fb.width);
-
-				if (plane_type != DRM_PLANE_TYPE_PRIMARY) {
-					igt_display_commit_atomic(display, DRM_MODE_PAGE_FLIP_EVENT | DRM_MODE_ATOMIC_NONBLOCK, NULL);
-				} else {
-					ret = drmModePageFlip(data->gfx_fd,
-							output->config.crtc->crtc_id,
-							data->fb_flip.fb_id,
-							DRM_MODE_PAGE_FLIP_EVENT,
-							NULL);
-					igt_assert_eq(ret, 0);
+					test_single_case(data, pipe, output, plane, i,
+							 format, test_bad_format);
 				}
-				wait_for_pageflip(data->gfx_fd);
-				igt_pipe_crc_collect_crc(data->pipe_crc,
-							 &crc_output);
-				igt_assert_crc_equal(&data->flip_crc,
-						     &crc_output);
+			} else {
+				test_single_case(data, pipe, output, plane, i,
+						 data->override_fmt, test_bad_format);
 			}
 		}
-
-		valid_tests++;
 	}
-	igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
 }
 
 static void test_plane_rotation_exhaust_fences(data_t *data,
-- 
2.16.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  parent reply	other threads:[~2018-02-06 10:14 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-06 10:14 [igt-dev] [PATCH i-g-t 01/12] lib/igt_fb: Make igt_remove_fb more robust Maarten Lankhorst
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 02/12] tests: Always call igt_remove_fb without checking Maarten Lankhorst
2018-02-07 13:42   ` Mika Kahola
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 03/12] lib/igt_fb: Add igt_fb_supported_format() Maarten Lankhorst
2018-02-08  8:08   ` Mika Kahola
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 04/12] lib/igt_fb: Remove igt_get_all_cairo_formats() Maarten Lankhorst
2018-02-08  8:15   ` Mika Kahola
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 05/12] lib/igt_debugfs: Add igt_pipe_crc_get_single and igt_pipe_crc_drain Maarten Lankhorst
2018-02-06 16:11   ` Ville Syrjälä
2018-02-06 16:30     ` Maarten Lankhorst
2018-02-07 11:47     ` [igt-dev] [PATCH i-g-t] lib/igt_debugfs: Add igt_pipe_crc_get_single and igt_pipe_crc_drain, v2 Maarten Lankhorst
2018-02-08 11:15       ` Mika Kahola
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 06/12] tests/kms_rotation_crc: Fix bad-tiling testcase Maarten Lankhorst
2018-02-08 12:08   ` Mika Kahola
2018-02-08 12:12     ` Maarten Lankhorst
2018-02-08 12:19   ` Mika Kahola
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 07/12] tests/kms_rotation_crc: Move bad_format parameter to test_plane_rotation Maarten Lankhorst
2018-02-08 13:07   ` Mika Kahola
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 08/12] tests/kms_rotation_crc: Always run the flip tests when available Maarten Lankhorst
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 09/12] tests/kms_rotation_crc: Remove primary-rotation-90-Y-tiled Maarten Lankhorst
2018-02-09  8:25   ` Kahola, Mika
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 10/12] tests/kms_rotation_crc: Perform lazy cleanup and require atomic Maarten Lankhorst
2018-02-09  9:39   ` Kahola, Mika
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 11/12] tests/kms_rotation_crc: Clean up exhaust-fences subtest Maarten Lankhorst
2018-02-12 11:20   ` Mika Kahola
2018-02-06 10:14 ` Maarten Lankhorst [this message]
2018-02-08  3:33   ` [igt-dev] [PATCH i-g-t 12/12] tests/kms_rotation_crc: Test all pixel formats on all planes Srinivas, Vidya
2018-02-12 13:09   ` Mika Kahola
2018-02-12 14:20     ` Maarten Lankhorst
2018-02-06 11:25 ` [igt-dev] ✗ Fi.CI.BAT: warning for series starting with [i-g-t,01/12] lib/igt_fb: Make igt_remove_fb more robust Patchwork
2018-02-07 13:30 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,01/12] lib/igt_fb: Make igt_remove_fb more robust (rev2) Patchwork
2018-02-07 13:39 ` [igt-dev] [PATCH i-g-t 01/12] lib/igt_fb: Make igt_remove_fb more robust Mika Kahola
2018-02-07 16:36 ` [igt-dev] ✗ Fi.CI.IGT: failure for series starting with [i-g-t,01/12] lib/igt_fb: Make igt_remove_fb more robust (rev2) Patchwork
2018-02-09 16:33 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,01/12] lib/igt_fb: Make igt_remove_fb more robust (rev3) Patchwork
2018-02-09 18:21 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180206101417.59979-12-maarten.lankhorst@linux.intel.com \
    --to=maarten.lankhorst@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox