public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t] tests/kms_big_fb: Add over 32k HW stride tests
Date: Mon, 23 Sep 2019 13:40:33 +0300	[thread overview]
Message-ID: <1569235233-15674-2-git-send-email-juhapekka.heikkila@gmail.com> (raw)
In-Reply-To: <1569235233-15674-1-git-send-email-juhapekka.heikkila@gmail.com>

On ICL when using 64bpp formats strides can reach up to
64k. These test try exact maximum HW strides so gtt
remapping will not come in play.

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
---
 tests/kms_big_fb.c | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 103 insertions(+)

diff --git a/tests/kms_big_fb.c b/tests/kms_big_fb.c
index c3498c6..aee4129 100644
--- a/tests/kms_big_fb.c
+++ b/tests/kms_big_fb.c
@@ -568,6 +568,91 @@ test_addfb(data_t *data)
 	gem_close(data->drm_fd, bo);
 }
 
+static void test_stride_size_crc(data_t *data, uint32_t format, uint64_t modifier)
+{
+	drmModeModeInfo *mode;
+	igt_crc_t crc, comparison_crc;
+	igt_output_t *output;
+	struct igt_fb fb, comparison_fb;
+	igt_plane_t *plane;
+	cairo_surface_t *surf;
+	cairo_t *cr;
+	enum pipe pipe = 0;
+	uint32_t maxsize;
+
+	/*
+	 * linear mapping doesn't work all the way to 64k. See
+	 * skl_plane_max_stride() in drm/i915/display/intel_srite.c
+	 * in kernel tree.
+	 */
+	if (modifier == DRM_FORMAT_MOD_LINEAR)
+		maxsize = (65536-64)/8;
+	else
+		maxsize = 65536/8;
+
+	igt_require(igt_display_has_format_mod(&data->display, format, modifier));
+
+	for_each_connected_output(&data->display, output) {
+		igt_output_set_pipe(output, pipe);
+		mode = igt_output_get_mode(output);
+		igt_display_commit2(&data->display, COMMIT_ATOMIC);
+
+		data->pipe_crc = igt_pipe_crc_new(data->drm_fd, data->pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
+		igt_pipe_crc_start(data->pipe_crc);
+
+		igt_create_pattern_fb(data->drm_fd, maxsize, mode->vdisplay,
+				format, modifier, &fb);
+
+		/*
+		 * First get crc by moving plane so that right edge of plane is
+		 * at right edge of display
+		 */
+		plane = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
+		igt_plane_set_fb(plane, &fb);
+		igt_plane_set_position(plane, -(maxsize - mode->hdisplay), 0);
+		igt_fb_set_position(&fb, plane, 0, 0);
+		igt_display_commit2(&data->display, COMMIT_ATOMIC);
+		igt_pipe_crc_get_current(data->display.drm_fd, data->pipe_crc, &crc);
+
+		/*
+		 * Now get crc by moving plane to (0,0), set its size to match
+		 * output and copy comparison fb so that right edge of fb is at right
+		 * edge of output. This way comparison crc can be calculated with
+		 * screen size fb. ..because of this juggling this probably work
+		 * only for rgb modes fbs.
+		 */
+		surf = igt_get_cairo_surface(fb.fd, &fb);
+		igt_assert(igt_create_fb_with_bo_size(fb.fd, mode->hdisplay,
+						mode->vdisplay, fb.drm_format,
+						modifier,
+						IGT_COLOR_YCBCR_BT709,
+						IGT_COLOR_YCBCR_LIMITED_RANGE,
+						&comparison_fb, 0, 0) > 0);
+
+		cr = igt_get_cairo_ctx(comparison_fb.fd, &comparison_fb);
+		cairo_set_source_surface(cr, surf, (int)-(maxsize - mode->hdisplay), 0);
+		cairo_paint(cr);
+		igt_put_cairo_ctx(comparison_fb.fd, &comparison_fb, cr);
+
+		cairo_surface_destroy(surf);
+
+		igt_plane_set_fb(plane, &comparison_fb);
+		igt_plane_set_position(plane, 0, 0);
+		igt_plane_set_size(plane, mode->hdisplay, mode->vdisplay);
+		igt_fb_set_position(&fb, plane, 0, 0);
+		igt_display_commit2(&data->display, COMMIT_ATOMIC);
+		igt_pipe_crc_get_current(data->display.drm_fd, data->pipe_crc, &comparison_crc);
+
+		igt_plane_set_fb(plane, NULL);
+		igt_remove_fb(data->drm_fd, &fb);
+		igt_remove_fb(data->drm_fd, &comparison_fb);
+		igt_pipe_crc_free(data->pipe_crc);
+		igt_output_set_pipe(output, PIPE_ANY);
+
+		igt_assert_crc_equal(&crc, &comparison_crc);
+	}
+}
+
 static data_t data;
 
 static const struct {
@@ -590,6 +675,10 @@ static const struct {
 	{ DRM_FORMAT_XBGR16161616F, 64, },
 };
 
+static const int formats_long_hw_stride[] = {
+	DRM_FORMAT_XBGR16161616F,
+};
+
 static const struct {
 	igt_rotation_t rotation;
 	uint16_t angle;
@@ -704,6 +793,20 @@ igt_main
 		}
 	}
 
+	for (int i = 0; i < ARRAY_SIZE(modifiers); i++) {
+		data.modifier = modifiers[i].modifier;
+
+		igt_subtest_f("%s-over-32k-hw-stride-crc", modifiers[i].name) {
+			igt_require(intel_gen(data.devid) >= 11);
+			igt_require(igt_fb_supported_format(data.format));
+			for (int j = 0; j < ARRAY_SIZE(formats_long_hw_stride); j++) {
+				data.format = formats_long_hw_stride[j];
+
+				test_stride_size_crc(&data, data.format, data.modifier);
+			}
+		}
+	}
+
 	igt_fixture {
 		igt_display_fini(&data.display);
 
-- 
2.7.4

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

  reply	other threads:[~2019-09-23 10:40 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-23 10:40 [igt-dev] [PATCH i-g-t] test longer than 32k strides Juha-Pekka Heikkila
2019-09-23 10:40 ` Juha-Pekka Heikkila [this message]
2019-09-23 12:43   ` [igt-dev] [PATCH i-g-t] tests/kms_big_fb: Add over 32k HW stride tests Ville Syrjälä
2019-09-27 13:43     ` Juha-Pekka Heikkila
2019-09-27 13:50       ` Ville Syrjälä
     [not found]   ` <1571904804-2248-1-git-send-email-juhapekka.heikkila@gmail.com>
2019-10-24 13:55     ` [igt-dev] [PATCH i-g-t] tests/kms_big_fb: Add max HW stride length tests Ville Syrjälä
2019-09-23 11:41 ` [igt-dev] ✗ GitLab.Pipeline: warning for tests/kms_big_fb: Add over 32k HW stride tests Patchwork
2019-09-23 11:45 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2019-09-23 13:01 ` [igt-dev] ✗ GitLab.Pipeline: warning for tests/kms_big_fb: Add over 32k HW stride tests (rev2) Patchwork
2019-09-23 17:18 ` [igt-dev] ✓ Fi.CI.IGT: success for tests/kms_big_fb: Add over 32k HW stride tests Patchwork
2019-10-24  9:19 ` [igt-dev] ✗ GitLab.Pipeline: warning for tests/kms_big_fb: Add over 32k HW stride tests (rev3) Patchwork
2019-10-24  9:35 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2019-10-25 10:46 ` [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=1569235233-15674-2-git-send-email-juhapekka.heikkila@gmail.com \
    --to=juhapekka.heikkila@gmail.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