[igt-dev] [PATCH i-g-t] tests/kms_big_fb: Add over 32k HW stride tests
Juha-Pekka Heikkila
juhapekka.heikkila at gmail.com
Mon Sep 23 10:40:33 UTC 2019
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 at 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
More information about the igt-dev
mailing list