All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t] tests/kms_yuv: Add yuv specific tests, v6.
@ 2019-05-13 16:53 Maarten Lankhorst
  2019-05-13 17:29 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Maarten Lankhorst @ 2019-05-13 16:53 UTC (permalink / raw)
  To: igt-dev

Add tests excercising switching between various scaled/unscaled
transitions to and from various nv12 formats, since some of the
workarounds mention this may fail.

We also add NV12 specific clipping/scaling tests, to make sure
that YUV src coordinates are always programmed as a multiple of 2
correctly, and verify scaling/clipping works with CRC tests.

crop-scale-bug shows a corruption when scaling and cropping at the
same time.

The subpixel clip test rotates and clips a rectangle on each side,
which should produce the same CRC as when that part of the rectangle
is hidden by a cursor and a whole 2x2 pixel is hidden.

Changes since v1:
- Reset plane position to 0,0 at the start of yuv_valid_width_plane().
- Handle Swati's feedback.
Changes since v2:
- Skip 90°/270° rotation in tests when formats don't support it.
- Add all new HDR formats to test.
- Use igt_plane_has_format_mod.
- Support tests on !i915 by checking if X/Y tiling modifiers are supported.
- Do not enable untested planes to prevent exhausing memory bandwidth
  and available NV12 Y planes in the rgb-switch-scaled test.
Changes since v3:
- Add a sanity test to sanity test YUV conversion paths, on all planes and pipes.
- Dynamically generate list of YUV tests through igt_format_array_fill.
Changes since v4:
- Decrease size to 64x64 to reduce test execution time even more,
  some YUV conversion routines are slow.
- Don't clear degamma/ctm, this is done in core now.
Changes since v5:
- Fix minor compile error.
- Add missing igt_subtest_group

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
 tests/Makefile.sources |   1 +
 tests/kms_yuv.c        | 937 +++++++++++++++++++++++++++++++++++++++++
 tests/meson.build      |   1 +
 3 files changed, 939 insertions(+)
 create mode 100644 tests/kms_yuv.c

diff --git a/tests/Makefile.sources b/tests/Makefile.sources
index 7f921f6c5988..574861b2e30f 100644
--- a/tests/Makefile.sources
+++ b/tests/Makefile.sources
@@ -75,6 +75,7 @@ TESTS_progs = \
 	kms_universal_plane \
 	kms_vblank \
 	kms_vrr \
+	kms_yuv \
 	meta_test \
 	perf \
 	perf_pmu \
diff --git a/tests/kms_yuv.c b/tests/kms_yuv.c
new file mode 100644
index 000000000000..6cf69b0504f8
--- /dev/null
+++ b/tests/kms_yuv.c
@@ -0,0 +1,937 @@
+/*
+ * Copyright © 2019 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ *    Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
+ */
+#include "config.h"
+
+#include "igt.h"
+#include <cairo.h>
+#include <errno.h>
+#include <stdint.h>
+#include <unistd.h>
+#include <sys/time.h>
+
+typedef struct {
+	igt_display_t display;
+
+	igt_pipe_crc_t *pipe_crc;
+	struct igt_fb fb[6];
+} data_t;
+
+static uint64_t x_modifier = LOCAL_DRM_FORMAT_MOD_NONE;
+static uint64_t y_modifier = LOCAL_DRM_FORMAT_MOD_NONE;
+static uint32_t *formats, count_formats;
+
+static bool pipe_supports_format(igt_display_t *display, enum pipe pipe,
+				 uint32_t format, uint64_t tiling)
+{
+	igt_plane_t *plane;
+
+	for_each_plane_on_pipe(display, pipe, plane)
+		if (igt_plane_has_format_mod(plane, format, tiling))
+			return true;
+
+	return false;
+}
+
+
+static void remove_fbs(data_t *data)
+{
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(data->fb); i++)
+		igt_remove_fb(data->display.drm_fd, &data->fb[i]);
+}
+
+static void prepare_crtc(data_t *data, enum pipe pipe, igt_output_t *output)
+{
+	igt_display_t *display = &data->display;
+
+	remove_fbs(data);
+	igt_display_reset(display);
+	igt_output_set_pipe(output, pipe);
+	igt_display_commit2(display, COMMIT_ATOMIC);
+
+	igt_pipe_crc_free(data->pipe_crc);
+	data->pipe_crc = igt_pipe_crc_new(display->drm_fd, pipe,
+					  INTEL_PIPE_CRC_SOURCE_AUTO);
+}
+
+static void fudge_lut(data_t *data, enum pipe pipe, uint16_t mask)
+{
+	igt_pipe_t *pipe_obj = &data->display.pipes[pipe];
+	uint16_t *lut;
+	int i, lut_size;
+
+	if (!igt_pipe_obj_has_prop(pipe_obj, IGT_CRTC_GAMMA_LUT_SIZE))
+		return;
+
+	lut_size = igt_pipe_obj_get_prop(pipe_obj, IGT_CRTC_GAMMA_LUT_SIZE);
+
+	lut = malloc(sizeof(uint16_t) * lut_size);
+	for (i = 0; i < lut_size; i++)
+		lut[i] = (i * 0xffff / (lut_size - 1)) & mask;
+
+	igt_pipe_obj_replace_prop_blob(pipe_obj, IGT_CRTC_GAMMA_LUT, lut, lut_size * sizeof(uint16_t));
+	free(lut);
+}
+
+static void unfudge_lut(data_t *data, enum pipe pipe)
+{
+	igt_pipe_t *pipe_obj = &data->display.pipes[pipe];
+
+	if (igt_pipe_obj_has_prop(pipe_obj, IGT_CRTC_GAMMA_LUT))
+		igt_pipe_obj_replace_prop_blob(pipe_obj, IGT_CRTC_GAMMA_LUT, NULL, 0);
+}
+
+/*
+ * Test that we initialize a YUV fb as black correctly,
+ * that when we write a black FB it will get the same CRC, and that
+ * all colors we test will give the same CRC on all formats.
+ */
+static void yuv_sanity(data_t *data, enum pipe pipe, igt_output_t *output)
+{
+	igt_display_t *display = &data->display;
+	igt_plane_t *plane;
+	igt_crc_t black_crc, color_crc, crc;
+	bool first = true;
+
+	prepare_crtc(data, pipe, output);
+
+	for_each_plane_on_pipe(display, pipe, plane) {
+		for (int i = 0; i < count_formats; i++) {
+			struct igt_fb *fb = &data->fb[0];
+			cairo_t *cr;
+
+			if (!igt_format_is_yuv(formats[i]) ||
+			    !igt_plane_has_format_mod(plane, formats[i], x_modifier))
+				continue;
+
+			igt_debug("Testing format %.4s on plane %i\n",
+				 (char *)&formats[i], plane->index);
+			igt_create_fb(display->drm_fd, 64, 64, formats[i],
+				      x_modifier, fb);
+
+			igt_plane_set_fb(plane, fb);
+			igt_display_commit2(display, COMMIT_ATOMIC);
+			if (!first) {
+				igt_pipe_crc_collect_crc(data->pipe_crc, &crc);
+				igt_assert_crc_equal(&black_crc, &crc);
+			} else {
+				igt_pipe_crc_collect_crc(data->pipe_crc, &black_crc);
+			}
+
+			/* Compare initial black fb with reference painted black color */
+			cr = igt_get_cairo_ctx(display->drm_fd, fb);
+			igt_paint_color(cr, 0, 0, fb->width, fb->height, 0., 0., 0.);
+			igt_put_cairo_ctx(display->drm_fd, fb, cr);
+			igt_dirty_fb(display->drm_fd, fb);
+			igt_wait_for_vblank(display->drm_fd, pipe);
+			igt_pipe_crc_collect_crc(data->pipe_crc, &crc);
+			igt_assert_crc_equal(&black_crc, &crc);
+
+
+			/* Write a color fb */
+			cr = igt_get_cairo_ctx(display->drm_fd, fb);
+			igt_paint_color(cr, 0, 0, fb->width, fb->height, 1., 1., 0.);
+			igt_put_cairo_ctx(display->drm_fd, fb, cr);
+			fudge_lut(data, pipe, 0xfc00);
+			igt_plane_set_fb(plane, fb);
+			igt_display_commit2(display, COMMIT_ATOMIC);
+
+			if (!first) {
+				igt_pipe_crc_collect_crc(data->pipe_crc, &crc);
+				igt_assert_crc_equal(&color_crc, &crc);
+			} else {
+				igt_pipe_crc_collect_crc(data->pipe_crc, &color_crc);
+				first = false;
+			}
+
+			/* Convert from YUV, back to YUV, to expose bugs in conversion routines */
+			cr = igt_get_cairo_ctx(display->drm_fd, fb);
+			igt_put_cairo_ctx(display->drm_fd, fb, cr);
+			igt_dirty_fb(display->drm_fd, fb);
+			igt_wait_for_vblank(display->drm_fd, pipe);
+			igt_pipe_crc_collect_crc(data->pipe_crc, &crc);
+			igt_assert_crc_equal(&color_crc, &crc);
+
+			unfudge_lut(data, pipe);
+			igt_plane_set_fb(plane, NULL);
+			igt_remove_fb(display->drm_fd, &data->fb[0]);
+		}
+	}
+}
+
+static void set_fb(igt_plane_t *plane, struct igt_fb *fb,
+		   bool scaled, igt_rotation_t rot)
+{
+	igt_plane_set_fb(plane, fb);
+
+	if (scaled && fb)
+		igt_fb_set_size(fb, plane, fb->width, 16);
+
+	igt_plane_set_rotation(plane, rot);
+	if (fb && (rot == IGT_ROTATION_90 || rot == IGT_ROTATION_270))
+		igt_plane_set_size(plane, fb->height, fb->width);
+}
+
+static void yuv_rgb_switch(data_t *data, enum pipe pipe,
+			   igt_output_t *output, bool scaled, unsigned format)
+{
+	drmModeModeInfo *mode = igt_output_get_mode(output);
+	igt_display_t *display = &data->display;
+	igt_plane_t *plane;
+	int i;
+	igt_crc_t ref_crc[4], crc;
+	bool valid[4] = {};
+
+	prepare_crtc(data, pipe, output);
+
+	igt_create_pattern_fb(display->drm_fd, mode->hdisplay, mode->vdisplay,
+			      format, x_modifier, &data->fb[0]);
+
+	igt_create_pattern_fb(display->drm_fd, mode->vdisplay, mode->hdisplay,
+			      format, y_modifier, &data->fb[1]);
+
+	igt_create_pattern_fb(display->drm_fd, mode->hdisplay, mode->vdisplay,
+			      DRM_FORMAT_XRGB8888, x_modifier, &data->fb[2]);
+
+	igt_create_pattern_fb(display->drm_fd, mode->vdisplay, mode->hdisplay,
+			      DRM_FORMAT_XRGB8888, y_modifier, &data->fb[3]);
+
+	for_each_plane_on_pipe(display, pipe, plane) {
+		const int seq[] = {
+			2, 0, 2, 1, 3, 1, 3
+		};
+
+		if (!igt_plane_has_format_mod(plane, format, data->fb[0].modifier))
+			continue;
+
+		/* Collect reference crc with toggle in between. */
+		for (i = 0; i < ARRAY_SIZE(ref_crc); i++) {
+			igt_rotation_t rot = (i == 1 || i == 3) ?
+				IGT_ROTATION_90 : IGT_ROTATION_0;
+
+			set_fb(plane, &data->fb[i], scaled, rot);
+
+			igt_display_commit2(display, COMMIT_ATOMIC);
+			igt_pipe_crc_collect_crc(data->pipe_crc, &ref_crc[i]);
+			valid[i] = true;
+
+			set_fb(plane, NULL, scaled, rot);
+			igt_display_commit2(display, COMMIT_ATOMIC);
+		}
+
+		for (i = 0; i < ARRAY_SIZE(seq); i++) {
+			int j = seq[i];
+			igt_rotation_t rot = (j == 1 || j == 3) ?
+				IGT_ROTATION_90 : IGT_ROTATION_0;
+
+			if (!valid[j])
+				continue;
+
+			set_fb(plane, &data->fb[j], scaled, rot);
+			igt_display_commit2(display, COMMIT_ATOMIC);
+
+			igt_pipe_crc_collect_crc(data->pipe_crc, &crc);
+			igt_assert_crc_equal(&ref_crc[j], &crc);
+		}
+
+		/* We only have few scalers, don't use 1 for unused planes */
+		igt_plane_set_fb(plane, NULL);
+	}
+}
+
+#define assert_collected_crc_equal(pipe_crc, crc, ref_crc) \
+	do { \
+		igt_pipe_crc_get_current(display->drm_fd, pipe_crc, crc);	\
+		igt_assert_crc_equal(ref_crc, crc);	\
+	} while (0)
+
+static void set_src_coords(igt_plane_t *plane, struct igt_fb *fb,
+			   igt_rotation_t rot, int vis, int hidden)
+{
+	switch (rot) {
+	case IGT_ROTATION_0:
+		igt_fb_set_position(fb, plane, fb->width / 2 - vis, fb->height / 2 - vis);
+		break;
+	case IGT_ROTATION_90:
+		igt_fb_set_position(fb, plane, fb->width / 2 - hidden, fb->height / 2 - vis);
+		break;
+	case IGT_ROTATION_180:
+		igt_fb_set_position(fb, plane, fb->width / 2 - hidden, fb->height / 2 - hidden);
+		break;
+	case IGT_ROTATION_270:
+		igt_fb_set_position(fb, plane, fb->width / 2 - vis, fb->height / 2 - hidden);
+		break;
+	default: igt_assert(0);
+	}
+	igt_fb_set_size(fb, plane, vis + hidden, vis + hidden);
+}
+
+static void yuv_valid_width_plane(data_t *data, drmModeModeInfo *mode,
+				  igt_plane_t *plane, igt_rotation_t rot,
+				  igt_crc_t *ref_crc)
+{
+	igt_display_t *display = &data->display;
+	igt_crc_t crc;
+	struct igt_fb *clip_fb = &data->fb[2];
+	int i, ret;
+
+	/* Just clipping.. */
+	igt_plane_set_fb(plane, clip_fb);
+	igt_plane_set_rotation(plane, rot);
+	if (rot & (IGT_ROTATION_90 | IGT_ROTATION_270))
+		igt_plane_set_size(plane, clip_fb->height, clip_fb->width);
+	igt_plane_set_position(plane, mode->hdisplay - clip_fb->width / 2, mode->vdisplay - clip_fb->height / 2);
+	if ((rot == IGT_ROTATION_90 || rot == IGT_ROTATION_270) &&
+	    igt_display_try_commit2(display, COMMIT_ATOMIC) < 0) {
+		igt_debug("This rotation not available for this format.\n");
+		return;
+	}
+
+	igt_display_commit2(display, COMMIT_ATOMIC);
+	assert_collected_crc_equal(data->pipe_crc, &crc, ref_crc);
+
+	/* Clipping and scaling. */
+	igt_fb_set_position(clip_fb, plane, clip_fb->width / 2 - 16, clip_fb->height / 2 - 16);
+	igt_fb_set_size(clip_fb, plane, 32, 32);
+	igt_display_commit2(display, COMMIT_ATOMIC);
+	assert_collected_crc_equal(data->pipe_crc, &crc, ref_crc);
+
+	/* Try nvalid < 8 src visible. */
+	set_src_coords(plane, clip_fb, rot, 4, 4);
+	igt_display_try_commit2(display, COMMIT_ATOMIC);
+
+	/* Try different alignments for x/y to see if any hit underruns */
+	for (i = 1; i < 4; i++) {
+		set_src_coords(plane, clip_fb, rot, 16 + 2 * i, 16 - 2 * i);
+		igt_display_commit2(display, COMMIT_ATOMIC);
+		assert_collected_crc_equal(data->pipe_crc, &crc, ref_crc);
+
+		/* And also show more of the screen */
+		set_src_coords(plane, clip_fb, rot, 16 + i, 16 + i);
+		ret = igt_display_try_commit2(display, COMMIT_ATOMIC);
+
+		if (ret == -EINVAL) {
+			igt_assert(i % 2 || rot == IGT_ROTATION_270 || rot == (IGT_ROTATION_90 | IGT_REFLECT_X));
+			continue;
+		} else
+			igt_assert_eq(ret, 0);
+		assert_collected_crc_equal(data->pipe_crc, &crc, ref_crc);
+	}
+
+	/*
+	 * As a final test, try with 16 src visible, and various invisible
+	 * components to check clipping doesn't drop the visible src below 16.
+	 */
+	for (i = 0; i < 16; i += 4) {
+		set_src_coords(plane, clip_fb, rot, 16, i);
+		if (rot & (IGT_ROTATION_90 | IGT_ROTATION_270))
+			igt_plane_set_size(plane, (clip_fb->height / 32) * (16 + i),
+					   (clip_fb->width / 32) * (16 + i));
+		else
+			igt_plane_set_size(plane, (clip_fb->width / 32) * (16 + i),
+					   (clip_fb->height / 32) * (16 + i));
+		igt_display_commit2(display, COMMIT_ATOMIC);
+		assert_collected_crc_equal(data->pipe_crc, &crc, ref_crc);
+	}
+}
+
+static void yuv_valid_width(data_t *data, enum pipe pipe, igt_output_t *output, unsigned format)
+{
+	drmModeModeInfo *mode = igt_output_get_mode(output);
+	igt_display_t *display = &data->display;
+	igt_plane_t *plane;
+	struct igt_fb *clip_fb = &data->fb[2];
+	struct igt_fb *ref_fb = &data->fb[3];
+
+	prepare_crtc(data, pipe, output);
+
+	igt_create_fb(display->drm_fd, 64, 64, format, y_modifier, ref_fb);
+
+	igt_create_fb(display->drm_fd, 2 * ref_fb->width,
+		      2 * ref_fb->height, format, y_modifier, clip_fb);
+
+	igt_pipe_crc_start(data->pipe_crc);
+
+	for_each_plane_on_pipe(display, pipe, plane) {
+		igt_crc_t ref_crc[4];
+		cairo_t *cr;
+		static const double colors[4][3] = {
+			{ 1., 0., 0. },
+			{ 0., 1., 0. },
+			{ 0., 0., 1. },
+			{ 1., 1., 1. }
+		};
+		int i;
+
+		if (!igt_plane_has_format_mod(plane, format, data->fb[0].modifier))
+			continue;
+
+		/* Draw the FB that will be used for clipping tests. */
+		cr = igt_get_cairo_ctx(display->drm_fd, clip_fb);
+		igt_paint_color(cr, 0, 0, clip_fb->width / 2, clip_fb->height / 2,
+				colors[0][0], colors[0][1], colors[0][2]);
+
+		igt_paint_color(cr, clip_fb->width / 2, 0,
+				clip_fb->width / 2, clip_fb->height / 2,
+				colors[1][0], colors[1][1], colors[1][2]);
+
+		igt_paint_color(cr, clip_fb->width / 2, clip_fb->height / 2,
+				clip_fb->width / 2, clip_fb->height / 2,
+				colors[2][0], colors[2][1], colors[2][2]);
+
+		igt_paint_color(cr, 0, clip_fb->height / 2,
+				clip_fb->width / 2, clip_fb->height / 2,
+				colors[3][0], colors[3][1], colors[3][2]);
+
+		igt_put_cairo_ctx(display->drm_fd, clip_fb, cr);
+
+		/* Draw all reference FB's to collect the CRC. */
+		for (i = 0; i < 4; i++) {
+			cr = igt_get_cairo_ctx(display->drm_fd, ref_fb);
+			igt_paint_color(cr, 0, 0, ref_fb->width, ref_fb->height,
+					colors[i][0], colors[i][1], colors[i][2]);
+			igt_put_cairo_ctx(display->drm_fd, &data->fb[3], cr);
+
+			if (!i) {
+				igt_plane_set_fb(plane, ref_fb);
+				igt_plane_set_position(plane, mode->hdisplay - ref_fb->width, mode->vdisplay - ref_fb->height);
+				igt_display_commit2(display, COMMIT_ATOMIC);
+			} else {
+				igt_dirty_fb(display->drm_fd, ref_fb);
+				igt_wait_for_vblank(display->drm_fd, pipe);
+			}
+
+			igt_pipe_crc_drain(data->pipe_crc);
+			igt_pipe_crc_get_single(data->pipe_crc, &ref_crc[i]);
+		}
+
+		igt_plane_set_fb(plane, NULL);
+		igt_plane_set_position(plane, 0, 0);
+
+		yuv_valid_width_plane(data, mode, plane, IGT_ROTATION_0, &ref_crc[0]);
+		yuv_valid_width_plane(data, mode, plane, IGT_ROTATION_90, &ref_crc[1]);
+		yuv_valid_width_plane(data, mode, plane, IGT_ROTATION_180, &ref_crc[2]);
+		yuv_valid_width_plane(data, mode, plane, IGT_ROTATION_270, &ref_crc[3]);
+
+		igt_plane_set_fb(plane, NULL);
+	}
+}
+
+static bool yuv_commit_rotated(igt_display_t *display, igt_rotation_t rot)
+{
+	if (igt_display_try_commit2(display, COMMIT_ATOMIC) < 0) {
+		igt_debug("Skipping rotated test, alignment is wrong.\n");
+		return false;
+	}
+
+	return true;
+}
+
+static void yuv_crop_scale_bug_plane(data_t *data, drmModeModeInfo *mode,
+				      igt_plane_t *plane, struct igt_fb *fb,
+				      igt_rotation_t rot, igt_crc_t *ref_crc)
+{
+	igt_display_t *display = &data->display;
+	igt_crc_t crc;
+	int ofs[] = { 0, 1, -1, 2, -2 };
+	int i, j;
+
+	igt_plane_set_fb(plane, fb);
+	igt_plane_set_rotation(plane, rot);
+	igt_plane_set_position(plane, 64, 64);
+	igt_plane_set_size(plane, 256, 256);
+
+	igt_fb_set_position(fb, plane, fb->width / 4, fb->height / 4);
+	igt_fb_set_size(fb, plane, fb->width / 2, fb->height / 2);
+	if ((rot == IGT_ROTATION_90 || rot == IGT_ROTATION_270) &&
+	    igt_display_try_commit2(display, COMMIT_ATOMIC) < 0) {
+		igt_debug("This rotation not available for this format.\n");
+		return;
+	}
+
+	igt_display_commit2(display, COMMIT_ATOMIC);
+	assert_collected_crc_equal(data->pipe_crc, &crc, ref_crc);
+
+	/* Make sure boundaries match */
+	igt_fb_set_position(fb, plane, fb->width / 4 - 2, fb->height / 4 - 2);
+	igt_fb_set_size(fb, plane, fb->width / 2 + 4, fb->height / 2 + 4);
+	igt_display_commit2(display, COMMIT_ATOMIC);
+	assert_collected_crc_equal(data->pipe_crc, &crc, ref_crc);
+
+	for (i = 1; i < ARRAY_SIZE(ofs); i++) {
+		igt_debug("Testing with rot %x and extra %i on the left side\n", rot, ofs[i]);
+		igt_fb_set_position(fb, plane, fb->width / 4 + ofs[i], fb->height / 4 - 2);
+		igt_fb_set_size(fb, plane, fb->width / 2 + 2 - ofs[i], fb->height / 2 + 4);
+		if (yuv_commit_rotated(display, rot))
+			assert_collected_crc_equal(data->pipe_crc, &crc, ref_crc);
+
+		igt_debug("Testing with rot %x and extra %i on the top side\n", rot, ofs[i]);
+		igt_fb_set_position(fb, plane, fb->width / 4 - 2, fb->height / 4 + ofs[i]);
+		igt_fb_set_size(fb, plane, fb->width / 2 + 4, fb->height / 2 + 2 - ofs[i]);
+		if (yuv_commit_rotated(display, rot))
+			assert_collected_crc_equal(data->pipe_crc, &crc, ref_crc);
+
+		igt_debug("Testing with rot %x and extra %i on the right side\n", rot, ofs[i]);
+		igt_fb_set_position(fb, plane, fb->width / 4 - 2, fb->height / 4);
+		igt_fb_set_size(fb, plane, fb->width / 2 + 2 + ofs[i], fb->height / 2);
+		if (yuv_commit_rotated(display, rot))
+			assert_collected_crc_equal(data->pipe_crc, &crc, ref_crc);
+
+		igt_debug("Testing with rot %x and extra %i on the bottom side\n", rot, ofs[i]);
+		igt_fb_set_position(fb, plane, fb->width / 4 - 2, fb->height / 4 - 2);
+		igt_fb_set_size(fb, plane, fb->width / 2 + 4, fb->height / 2 + 2 + ofs[i]);
+		if (yuv_commit_rotated(display, rot))
+			assert_collected_crc_equal(data->pipe_crc, &crc, ref_crc);
+
+	}
+
+	for (i = 0; i < ARRAY_SIZE(ofs); i++)
+		for (j = !i; j < ARRAY_SIZE(ofs); j++) {
+			igt_debug("Testing with rot %x and extra (%i, %i) at the edges\n", rot, ofs[i], ofs[j]);
+
+			igt_fb_set_position(fb, plane, fb->width / 4 + ofs[i], fb->height / 4 + ofs[j]);
+			igt_fb_set_size(fb, plane, fb->width / 2 - 2 * ofs[i], fb->height / 2 - 2 * ofs[j]);
+
+			if (yuv_commit_rotated(display, rot))
+				assert_collected_crc_equal(data->pipe_crc, &crc, ref_crc);
+		}
+}
+
+static void draw_clip_fb(igt_display_t *display, struct igt_fb *clip_fb)
+{
+	cairo_t *cr = igt_get_cairo_ctx(display->drm_fd, clip_fb);
+
+	igt_paint_color(cr, 0, 0, clip_fb->width, clip_fb->height, .0, .0, .5);
+	igt_paint_color(cr, clip_fb->width / 4 - 2, clip_fb->height / 4 - 2,
+			clip_fb->width / 2 + 4, clip_fb->height / 2 + 4, 1., 1., 1.);
+
+	igt_put_cairo_ctx(display->drm_fd, clip_fb, cr);
+}
+
+static void yuv_crop_scale_bug(data_t *data, enum pipe pipe, igt_output_t *output, unsigned format)
+{
+	drmModeModeInfo *mode = igt_output_get_mode(output);
+	igt_display_t *display = &data->display;
+	igt_plane_t *plane, *primary = igt_pipe_get_plane_type(&display->pipes[pipe], DRM_PLANE_TYPE_PRIMARY);
+	struct igt_fb *ref_fb = &data->fb[2];
+	struct igt_fb *clip_fb = &data->fb[3];
+	struct igt_fb *clip_fb_xtiled = &data->fb[4];
+	struct igt_fb *clip_fb_ytiled = &data->fb[5];
+
+	prepare_crtc(data, pipe, output);
+
+	igt_create_color_fb(display->drm_fd, mode->hdisplay, mode->vdisplay,
+			    format, x_modifier, .5, .5, .5, &data->fb[0]);
+
+	igt_create_color_fb(display->drm_fd, 256, 256, format,
+			    x_modifier, 1., 1., 1., ref_fb);
+
+	igt_create_fb(display->drm_fd, 80, 128, format,
+		      LOCAL_DRM_FORMAT_MOD_NONE, clip_fb);
+
+	igt_create_fb(display->drm_fd, 80, 128, format,
+		      x_modifier, clip_fb_xtiled);
+	igt_create_fb(display->drm_fd, 80, 128, format,
+		      y_modifier, clip_fb_ytiled);
+
+	draw_clip_fb(display, clip_fb);
+	draw_clip_fb(display, clip_fb_xtiled);
+	draw_clip_fb(display, clip_fb_ytiled);
+
+	igt_plane_set_fb(primary, &data->fb[0]);
+
+	for_each_plane_on_pipe(display, pipe, plane) {
+		igt_crc_t ref_crc;
+
+		if (!igt_plane_has_format_mod(plane, format, data->fb[0].modifier))
+			continue;
+
+		igt_plane_set_fb(plane, ref_fb);
+		igt_plane_set_position(plane, 64, 64);
+		igt_display_commit2(display, COMMIT_ATOMIC);
+
+		igt_pipe_crc_start(data->pipe_crc);
+		igt_pipe_crc_get_single(data->pipe_crc, &ref_crc);
+
+		yuv_crop_scale_bug_plane(data, mode, plane, clip_fb, IGT_ROTATION_0, &ref_crc);
+		yuv_crop_scale_bug_plane(data, mode, plane, clip_fb_xtiled, IGT_ROTATION_0, &ref_crc);
+		yuv_crop_scale_bug_plane(data, mode, plane, clip_fb_ytiled, IGT_ROTATION_0, &ref_crc);
+		yuv_crop_scale_bug_plane(data, mode, plane, clip_fb_ytiled, IGT_ROTATION_90, &ref_crc);
+		yuv_crop_scale_bug_plane(data, mode, plane, clip_fb, IGT_ROTATION_180, &ref_crc);
+		yuv_crop_scale_bug_plane(data, mode, plane, clip_fb_xtiled, IGT_ROTATION_180, &ref_crc);
+		yuv_crop_scale_bug_plane(data, mode, plane, clip_fb_ytiled, IGT_ROTATION_180, &ref_crc);
+		yuv_crop_scale_bug_plane(data, mode, plane, clip_fb_ytiled, IGT_ROTATION_270, &ref_crc);
+
+		igt_plane_set_fb(plane, plane != primary ? NULL : &data->fb[0]);
+		break;
+	}
+}
+
+static void yuv_chroma_subpixel_clip_plane_with_cursor(data_t *data,
+							igt_plane_t *plane,
+							struct igt_fb *clip_fb,
+							igt_plane_t *cursor,
+							struct igt_fb *cursor_fb,
+							igt_crc_t *ref_crc,
+							int cursor_x, int cursor_y)
+{
+	igt_display_t *display = &data->display;
+
+	igt_plane_set_fb(plane, clip_fb);
+	igt_plane_set_position(plane, 64, 64);
+	igt_plane_set_rotation(plane, IGT_ROTATION_0);
+
+	igt_plane_set_fb(cursor, cursor_fb);
+	igt_plane_set_position(cursor, cursor_x, cursor_y);
+	igt_display_commit2(display, COMMIT_ATOMIC);
+
+	igt_pipe_crc_drain(data->pipe_crc);
+	igt_pipe_crc_get_single(data->pipe_crc, ref_crc);
+
+	igt_plane_set_fb(cursor, NULL);
+}
+
+static bool yuv_chroma_subpixel_clip_plane_right(data_t *data,
+						 igt_rotation_t rotation,
+						 igt_plane_t *plane,
+						 struct igt_fb *clip_fb,
+						 igt_crc_t *ref_crc)
+{
+	igt_display_t *display = &data->display;
+	igt_crc_t crc = {};
+
+	igt_plane_set_fb(plane, clip_fb);
+	igt_plane_set_position(plane, 64, 64);
+	igt_plane_set_rotation(plane, rotation);
+	igt_plane_set_size(plane, clip_fb->width - 1, clip_fb->height);
+
+	switch (rotation) {
+	case IGT_ROTATION_180:
+		igt_fb_set_position(clip_fb, plane, 1, 0);
+	case IGT_ROTATION_0:
+		igt_fb_set_size(clip_fb, plane, clip_fb->width - 1, clip_fb->height);
+		break;
+
+	case IGT_ROTATION_270:
+		igt_fb_set_position(clip_fb, plane, 0, 1);
+	case IGT_ROTATION_90:
+		igt_fb_set_size(clip_fb, plane, clip_fb->width, clip_fb->height - 1);
+		break;
+	default:
+		igt_assert_f(0, "Unhandled rotation %x\n", rotation);
+	}
+
+	if (igt_display_try_commit2(display, COMMIT_ATOMIC) < 0)
+		return false;
+
+	assert_collected_crc_equal(data->pipe_crc, &crc, ref_crc);
+	return true;
+}
+
+static bool yuv_chroma_subpixel_clip_plane_bottom(data_t *data,
+						  igt_rotation_t rotation,
+						  igt_plane_t *plane,
+						  struct igt_fb *clip_fb,
+						  igt_crc_t *ref_crc)
+{
+	igt_display_t *display = &data->display;
+	igt_crc_t crc = {};
+
+	igt_plane_set_fb(plane, clip_fb);
+	igt_plane_set_position(plane, 64, 64);
+	igt_plane_set_rotation(plane, rotation);
+	igt_plane_set_size(plane, clip_fb->width, clip_fb->height - 1);
+
+	switch (rotation) {
+	case IGT_ROTATION_180:
+		igt_fb_set_position(clip_fb, plane, 0, 1);
+	case IGT_ROTATION_0:
+		igt_fb_set_size(clip_fb, plane, clip_fb->width, clip_fb->height - 1);
+		break;
+
+	case IGT_ROTATION_90:
+		igt_fb_set_position(clip_fb, plane, 1, 0);
+	case IGT_ROTATION_270:
+		igt_fb_set_size(clip_fb, plane, clip_fb->width - 1, clip_fb->height);
+		break;
+	default:
+		igt_assert_f(0, "Unhandled rotation %x\n", rotation);
+	}
+
+	if (igt_display_try_commit2(display, COMMIT_ATOMIC) < 0)
+		return false;
+
+	assert_collected_crc_equal(data->pipe_crc, &crc, ref_crc);
+	return true;
+}
+
+static bool yuv_chroma_subpixel_clip_plane_left(data_t *data,
+						igt_rotation_t rotation,
+						igt_plane_t *plane,
+						struct igt_fb *clip_fb,
+						igt_crc_t *ref_crc)
+{
+	igt_display_t *display = &data->display;
+	igt_crc_t crc = {};
+
+	igt_plane_set_fb(plane, clip_fb);
+	igt_plane_set_position(plane, 65, 64);
+	igt_plane_set_rotation(plane, rotation);
+	igt_plane_set_size(plane, clip_fb->width - 1, clip_fb->height);
+
+	switch (rotation) {
+	case IGT_ROTATION_0:
+		igt_fb_set_position(clip_fb, plane, 1, 0);
+	case IGT_ROTATION_180:
+		igt_fb_set_size(clip_fb, plane, clip_fb->width - 1, clip_fb->height);
+		break;
+
+	case IGT_ROTATION_90:
+		igt_fb_set_position(clip_fb, plane, 0, 1);
+	case IGT_ROTATION_270:
+		igt_fb_set_size(clip_fb, plane, clip_fb->width, clip_fb->height - 1);
+		break;
+	default:
+		igt_assert_f(0, "Unhandled rotation %x\n", rotation);
+	}
+
+	if (igt_display_try_commit2(display, COMMIT_ATOMIC) < 0)
+		return false;
+
+	assert_collected_crc_equal(data->pipe_crc, &crc, ref_crc);
+	return true;
+}
+
+
+static bool yuv_chroma_subpixel_clip_plane_top(data_t *data,
+					      igt_rotation_t rotation,
+					      igt_plane_t *plane,
+					      struct igt_fb *clip_fb,
+					      igt_crc_t *ref_crc)
+{
+	igt_display_t *display = &data->display;
+	igt_crc_t crc = {};
+
+	igt_plane_set_fb(plane, clip_fb);
+	igt_plane_set_position(plane, 64, 65);
+	igt_plane_set_rotation(plane, rotation);
+	igt_plane_set_size(plane, clip_fb->width, clip_fb->height - 1);
+
+	switch (rotation) {
+	case IGT_ROTATION_0:
+		igt_fb_set_position(clip_fb, plane, 0, 1);
+	case IGT_ROTATION_180:
+		igt_fb_set_size(clip_fb, plane, clip_fb->width, clip_fb->height - 1);
+		break;
+
+	case IGT_ROTATION_270:
+		igt_fb_set_position(clip_fb, plane, 1, 0);
+	case IGT_ROTATION_90:
+		igt_fb_set_size(clip_fb, plane, clip_fb->width - 1, clip_fb->height);
+		break;
+	default:
+		igt_assert_f(0, "Unhandled rotation %x\n", rotation);
+	}
+
+	if (igt_display_try_commit2(display, COMMIT_ATOMIC) < 0)
+		return false;
+
+	assert_collected_crc_equal(data->pipe_crc, &crc, ref_crc);
+	return true;
+}
+
+static void yuv_chroma_subpixel_clip(data_t *data, enum pipe pipe, igt_output_t *output, unsigned format)
+{
+	drmModeModeInfo *mode = igt_output_get_mode(output);
+	igt_display_t *display = &data->display;
+	igt_pipe_t *pipe_obj = &display->pipes[pipe];
+	struct igt_fb *bg_fb = &data->fb[0];
+	struct igt_fb *bg_cursor_fb = &data->fb[1];
+	struct igt_fb *black_cursor_fb = &data->fb[2];
+	struct igt_fb *clip_fb = &data->fb[3];
+	igt_plane_t *primary = igt_pipe_get_plane_type(pipe_obj, DRM_PLANE_TYPE_PRIMARY);
+	igt_plane_t *cursor = igt_pipe_get_plane_type(pipe_obj, DRM_PLANE_TYPE_CURSOR);
+	igt_plane_t *plane;
+	cairo_t *cr;
+	bool ret = false;
+
+	prepare_crtc(data, pipe, output);
+
+	igt_create_color_fb(display->drm_fd, mode->hdisplay, mode->vdisplay,
+			    DRM_FORMAT_XRGB8888, x_modifier,
+			    .0, .0, 1., bg_fb);
+
+	igt_create_color_fb(display->drm_fd, 256, 256,
+		            DRM_FORMAT_ARGB8888, LOCAL_DRM_FORMAT_MOD_NONE,
+			    .0, .0, 1., bg_cursor_fb);
+
+	igt_create_color_fb(display->drm_fd, 256, 256,
+		            DRM_FORMAT_ARGB8888, LOCAL_DRM_FORMAT_MOD_NONE,
+			    .0, .0, .0, black_cursor_fb);
+
+	igt_create_fb(display->drm_fd, 256, 256,
+		      format, y_modifier, clip_fb);
+
+	/* Draw the FB that will be used for clipping the chroma subpixel test. */
+	cr = igt_get_cairo_ctx(display->drm_fd, clip_fb);
+
+	igt_paint_color(cr, 0, 0, clip_fb->width, clip_fb->height, 1., 0., 0.);
+	igt_paint_color(cr, 2, 2, clip_fb->width - 4, clip_fb->height - 4, 0., 1., 1.);
+	igt_paint_color(cr, 4, 4, clip_fb->width - 8, clip_fb->height - 8, .75, .75, 1.);
+
+	/* White dots in the corners. */
+	igt_paint_color(cr, 0, 0, 6, 6, 1., 1., 1.);
+	igt_paint_color(cr, clip_fb->width - 6, 0, 6, 6, 1., 1., 1.);
+	igt_paint_color(cr, 0, clip_fb->height - 6, 6, 6, 1., 1., 1.);
+	igt_paint_color(cr, clip_fb->width - 6, clip_fb->height - 6, 6, 6, 1., 1., 1.);
+
+	igt_put_cairo_ctx(display->drm_fd, clip_fb, cr);
+
+	igt_pipe_crc_start(data->pipe_crc);
+
+	igt_plane_set_fb(primary, bg_fb);
+	for_each_plane_on_pipe(display, pipe, plane) {
+		struct igt_fb *cursor_fb = plane == primary ? black_cursor_fb : bg_cursor_fb;
+		igt_crc_t ref_crc;
+
+		if (!igt_plane_has_format_mod(plane, format, clip_fb->modifier) || plane == cursor)
+			continue;
+
+		yuv_chroma_subpixel_clip_plane_with_cursor(data, plane, clip_fb, cursor, cursor_fb, &ref_crc, 63 + clip_fb->width, 64);
+		ret |= yuv_chroma_subpixel_clip_plane_right(data, IGT_ROTATION_0, plane, clip_fb, &ref_crc);
+		ret |= yuv_chroma_subpixel_clip_plane_right(data, IGT_ROTATION_90, plane, clip_fb, &ref_crc);
+		ret |= yuv_chroma_subpixel_clip_plane_right(data, IGT_ROTATION_180, plane, clip_fb, &ref_crc);
+		ret |= yuv_chroma_subpixel_clip_plane_right(data, IGT_ROTATION_270, plane, clip_fb, &ref_crc);
+
+		yuv_chroma_subpixel_clip_plane_with_cursor(data, plane, clip_fb, cursor, cursor_fb, &ref_crc, 64, 63 + clip_fb->height);
+		ret |= yuv_chroma_subpixel_clip_plane_bottom(data, IGT_ROTATION_0, plane, clip_fb, &ref_crc);
+		ret |= yuv_chroma_subpixel_clip_plane_bottom(data, IGT_ROTATION_90, plane, clip_fb, &ref_crc);
+		ret |= yuv_chroma_subpixel_clip_plane_bottom(data, IGT_ROTATION_180, plane, clip_fb, &ref_crc);
+		ret |= yuv_chroma_subpixel_clip_plane_bottom(data, IGT_ROTATION_270, plane, clip_fb, &ref_crc);
+
+		yuv_chroma_subpixel_clip_plane_with_cursor(data, plane, clip_fb, cursor, cursor_fb, &ref_crc, 65 - cursor_fb->width, 64);
+		ret |= yuv_chroma_subpixel_clip_plane_left(data, IGT_ROTATION_0, plane, clip_fb, &ref_crc);
+		ret |= yuv_chroma_subpixel_clip_plane_left(data, IGT_ROTATION_90, plane, clip_fb, &ref_crc);
+		ret |= yuv_chroma_subpixel_clip_plane_left(data, IGT_ROTATION_180, plane, clip_fb, &ref_crc);
+		ret |= yuv_chroma_subpixel_clip_plane_left(data, IGT_ROTATION_270, plane, clip_fb, &ref_crc);
+
+		yuv_chroma_subpixel_clip_plane_with_cursor(data, plane, clip_fb, cursor, cursor_fb, &ref_crc, 64, 65 - cursor_fb->height);
+		ret |= yuv_chroma_subpixel_clip_plane_top(data, IGT_ROTATION_0, plane, clip_fb, &ref_crc);
+		ret |= yuv_chroma_subpixel_clip_plane_top(data, IGT_ROTATION_90, plane, clip_fb, &ref_crc);
+		ret |= yuv_chroma_subpixel_clip_plane_top(data, IGT_ROTATION_180, plane, clip_fb, &ref_crc);
+		ret |= yuv_chroma_subpixel_clip_plane_top(data, IGT_ROTATION_270, plane, clip_fb, &ref_crc);
+
+		/* Reset to defaults */
+		igt_plane_set_position(plane, 0, 0);
+		igt_plane_set_rotation(plane, IGT_ROTATION_0);
+		igt_plane_set_fb(plane, plane == primary ? bg_fb : NULL);
+	}
+
+	igt_require_f(ret, "Could not test subpixel clipping in any corner\n");
+}
+
+static const char *prettify(uint32_t fourcc)
+{
+	static char str[5];
+
+	memcpy(str, &fourcc, 4);
+	str[4] = 0;
+	return str;
+}
+
+static void run_tests_for_format(data_t *data, enum pipe pipe, igt_output_t *output, unsigned int format)
+{
+	igt_display_t *display = &data->display;
+	const char *fstr = prettify(format);
+
+	igt_fixture
+		igt_require(pipe_supports_format(display, pipe, format, x_modifier));
+
+	igt_subtest_f("pipe-%s-%s-rgb-switch", kmstest_pipe_name(pipe), fstr)
+		yuv_rgb_switch(data, pipe, output, false, format);
+
+	igt_subtest_f("pipe-%s-%s-rgb-scaled-switch", kmstest_pipe_name(pipe), fstr)
+		yuv_rgb_switch(data, pipe, output, true, format);
+
+	igt_subtest_f("pipe-%s-%s-valid-width", kmstest_pipe_name(pipe), fstr)
+		yuv_valid_width(data, pipe, output, format);
+
+	igt_subtest_f("pipe-%s-%s-crop-scale-bug", kmstest_pipe_name(pipe), fstr)
+		yuv_crop_scale_bug(data, pipe, output, format);
+
+	igt_subtest_f("pipe-%s-%s-chroma-subpixel-clip", kmstest_pipe_name(pipe), fstr)
+		yuv_chroma_subpixel_clip(data, pipe, output, format);
+}
+
+static void run_tests_for_pipe(data_t *data, enum pipe pipe)
+{
+	igt_output_t *output = NULL;
+
+	igt_fixture
+		igt_require((output = igt_get_single_output_for_pipe(&data->display, pipe)));
+
+	igt_subtest_f("pipe-%s-yuv-sanity-crc", kmstest_pipe_name(pipe))
+		yuv_sanity(data, pipe, output);
+
+	for (int i = 0; i < count_formats; i++)
+		if (igt_format_is_yuv(formats[i]))
+			igt_subtest_group
+				run_tests_for_format(data, pipe, output, formats[i]);
+}
+
+igt_main
+{
+	data_t data = {};
+	enum pipe pipe;
+
+	igt_skip_on_simulation();
+
+	igt_fixture {
+		data.display.drm_fd = drm_open_driver_master(DRIVER_ANY);
+
+		kmstest_set_vt_graphics_mode();
+		igt_display_require(&data.display, data.display.drm_fd);
+		igt_require(data.display.is_atomic);
+		igt_require_pipe_crc(data.display.drm_fd);
+
+		if (igt_display_has_format_mod(&data.display, DRM_FORMAT_XRGB8888, LOCAL_I915_FORMAT_MOD_X_TILED))
+			x_modifier = LOCAL_I915_FORMAT_MOD_X_TILED;
+
+		if (igt_display_has_format_mod(&data.display, DRM_FORMAT_XRGB8888, LOCAL_I915_FORMAT_MOD_Y_TILED))
+			y_modifier = LOCAL_I915_FORMAT_MOD_Y_TILED;
+	}
+
+	igt_format_array_fill(&formats, &count_formats, true);
+
+	for_each_pipe_static(pipe)
+		igt_subtest_group
+			run_tests_for_pipe(&data, pipe);
+
+	igt_fixture {
+		igt_display_fini(&data.display);
+		close(data.display.drm_fd);
+	}
+}
diff --git a/tests/meson.build b/tests/meson.build
index 351594fa72f0..fc69ec677e47 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -62,6 +62,7 @@ test_progs = [
 	'kms_universal_plane',
 	'kms_vblank',
 	'kms_vrr',
+	'kms_yuv',
 	'meta_test',
 	'panfrost_get_param',
 	'panfrost_gem_new',
-- 
2.20.1

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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_yuv: Add yuv specific tests, v6.
  2019-05-13 16:53 [igt-dev] [PATCH i-g-t] tests/kms_yuv: Add yuv specific tests, v6 Maarten Lankhorst
@ 2019-05-13 17:29 ` Patchwork
  2019-05-13 22:28 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
  2019-06-12 20:18 ` [igt-dev] [PATCH i-g-t] " Juha-Pekka Heikkila
  2 siblings, 0 replies; 6+ messages in thread
From: Patchwork @ 2019-05-13 17:29 UTC (permalink / raw)
  To: Maarten Lankhorst; +Cc: igt-dev

== Series Details ==

Series: tests/kms_yuv: Add yuv specific tests, v6.
URL   : https://patchwork.freedesktop.org/series/60592/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_6077 -> IGTPW_2974
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/60592/revisions/1/mbox/

Known issues
------------

  Here are the changes found in IGTPW_2974 that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@gem_cpu_reloc@basic:
    - fi-icl-u3:          [PASS][1] -> [INCOMPLETE][2] ([fdo#107713] / [fdo#110246])
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6077/fi-icl-u3/igt@gem_cpu_reloc@basic.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2974/fi-icl-u3/igt@gem_cpu_reloc@basic.html

  * igt@i915_selftest@live_hangcheck:
    - fi-skl-iommu:       [PASS][3] -> [INCOMPLETE][4] ([fdo#108602] / [fdo#108744])
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6077/fi-skl-iommu/igt@i915_selftest@live_hangcheck.html
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2974/fi-skl-iommu/igt@i915_selftest@live_hangcheck.html

  * igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
    - fi-kbl-7500u:       [PASS][5] -> [FAIL][6] ([fdo#103375])
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6077/fi-kbl-7500u/igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a.html
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2974/fi-kbl-7500u/igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a.html

  
  [fdo#103375]: https://bugs.freedesktop.org/show_bug.cgi?id=103375
  [fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
  [fdo#108602]: https://bugs.freedesktop.org/show_bug.cgi?id=108602
  [fdo#108744]: https://bugs.freedesktop.org/show_bug.cgi?id=108744
  [fdo#110246]: https://bugs.freedesktop.org/show_bug.cgi?id=110246


Participating hosts (53 -> 46)
------------------------------

  Missing    (7): fi-kbl-soraka fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-byt-clapper fi-bdw-samus 


Build changes
-------------

  * IGT: IGT_4984 -> IGTPW_2974

  CI_DRM_6077: f175074b17cfeb7d64cfcfd6b2641641a10d4deb @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_2974: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2974/
  IGT_4984: 66c887d2f7a92a4a97acd9611d5342afc5d4f815 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools



== Testlist changes ==

+++ 756 lines
--- 0 lines

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2974/
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [igt-dev] ✗ Fi.CI.IGT: failure for tests/kms_yuv: Add yuv specific tests, v6.
  2019-05-13 16:53 [igt-dev] [PATCH i-g-t] tests/kms_yuv: Add yuv specific tests, v6 Maarten Lankhorst
  2019-05-13 17:29 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
@ 2019-05-13 22:28 ` Patchwork
  2019-06-12 20:18 ` [igt-dev] [PATCH i-g-t] " Juha-Pekka Heikkila
  2 siblings, 0 replies; 6+ messages in thread
From: Patchwork @ 2019-05-13 22:28 UTC (permalink / raw)
  To: Maarten Lankhorst; +Cc: igt-dev

== Series Details ==

Series: tests/kms_yuv: Add yuv specific tests, v6.
URL   : https://patchwork.freedesktop.org/series/60592/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_6077_full -> IGTPW_2974_full
====================================================

Summary
-------

  **FAILURE**

  Serious unknown changes coming with IGTPW_2974_full absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in IGTPW_2974_full, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/60592/revisions/1/mbox/

Possible new issues
-------------------

  Here are the unknown changes that may have been introduced in IGTPW_2974_full:

### IGT changes ###

#### Possible regressions ####

  * igt@gem_eio@in-flight-suspend:
    - shard-glk:          [PASS][1] -> [FAIL][2]
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6077/shard-glk9/igt@gem_eio@in-flight-suspend.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2974/shard-glk9/igt@gem_eio@in-flight-suspend.html

  * {igt@kms_yuv@pipe-a-uyvy-valid-width} (NEW):
    - shard-apl:          NOTRUN -> [FAIL][3]
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2974/shard-apl6/igt@kms_yuv@pipe-a-uyvy-valid-width.html

  * {igt@kms_yuv@pipe-a-vyuy-crop-scale-bug} (NEW):
    - shard-hsw:          NOTRUN -> [FAIL][4] +47 similar issues
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2974/shard-hsw8/igt@kms_yuv@pipe-a-vyuy-crop-scale-bug.html

  * {igt@kms_yuv@pipe-a-yvyu-crop-scale-bug} (NEW):
    - shard-snb:          NOTRUN -> [FAIL][5] +23 similar issues
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2974/shard-snb7/igt@kms_yuv@pipe-a-yvyu-crop-scale-bug.html

  * {igt@kms_yuv@pipe-b-p016-valid-width} (NEW):
    - shard-iclb:         NOTRUN -> [FAIL][6] +8 similar issues
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2974/shard-iclb1/igt@kms_yuv@pipe-b-p016-valid-width.html

  * {igt@kms_yuv@pipe-b-yv12-rgb-switch} (NEW):
    - shard-iclb:         NOTRUN -> [SKIP][7] +176 similar issues
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2974/shard-iclb2/igt@kms_yuv@pipe-b-yv12-rgb-switch.html

  
#### Suppressed ####

  The following results come from untrusted machines, tests, or statuses.
  They do not affect the overall result.

  * {igt@kms_cursor_crc@pipe-b-cursor-suspend}:
    - shard-apl:          [PASS][8] -> [DMESG-WARN][9]
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6077/shard-apl1/igt@kms_cursor_crc@pipe-b-cursor-suspend.html
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2974/shard-apl6/igt@kms_cursor_crc@pipe-b-cursor-suspend.html

  
New tests
---------

  New tests have been introduced between CI_DRM_6077_full and IGTPW_2974_full:

### New IGT tests (378) ###

  * igt@kms_yuv@pipe-a-nv12-chroma-subpixel-clip:
    - Statuses : 6 skip(s)
    - Exec time: [0.0, 0.53] s

  * igt@kms_yuv@pipe-a-nv12-crop-scale-bug:
    - Statuses : 3 pass(s) 3 skip(s)
    - Exec time: [0.0, 5.12] s

  * igt@kms_yuv@pipe-a-nv12-rgb-scaled-switch:
    - Statuses : 3 pass(s) 3 skip(s)
    - Exec time: [0.0, 6.03] s

  * igt@kms_yuv@pipe-a-nv12-rgb-switch:
    - Statuses : 3 pass(s) 2 skip(s)
    - Exec time: [0.0, 6.02] s

  * igt@kms_yuv@pipe-a-nv12-valid-width:
    - Statuses : 3 pass(s) 3 skip(s)
    - Exec time: [0.0, 7.25] s

  * igt@kms_yuv@pipe-a-nv16-chroma-subpixel-clip:
    - Statuses : 5 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-nv16-crop-scale-bug:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-nv16-rgb-scaled-switch:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-nv16-rgb-switch:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-nv16-valid-width:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-nv21-chroma-subpixel-clip:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-nv21-crop-scale-bug:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-nv21-rgb-scaled-switch:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-nv21-rgb-switch:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-nv21-valid-width:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-nv61-chroma-subpixel-clip:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-nv61-crop-scale-bug:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-nv61-rgb-scaled-switch:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-nv61-rgb-switch:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-nv61-valid-width:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-p010-chroma-subpixel-clip:
    - Statuses : 5 skip(s)
    - Exec time: [0.0, 0.74] s

  * igt@kms_yuv@pipe-a-p010-crop-scale-bug:
    - Statuses : 2 pass(s) 4 skip(s)
    - Exec time: [0.0, 5.16] s

  * igt@kms_yuv@pipe-a-p010-rgb-scaled-switch:
    - Statuses : 2 pass(s) 4 skip(s)
    - Exec time: [0.0, 6.13] s

  * igt@kms_yuv@pipe-a-p010-rgb-switch:
    - Statuses : 2 pass(s) 4 skip(s)
    - Exec time: [0.0, 6.03] s

  * igt@kms_yuv@pipe-a-p010-valid-width:
    - Statuses : 1 fail(s) 1 pass(s) 4 skip(s)
    - Exec time: [0.0, 5.78] s

  * igt@kms_yuv@pipe-a-p012-chroma-subpixel-clip:
    - Statuses : 6 skip(s)
    - Exec time: [0.0, 0.75] s

  * igt@kms_yuv@pipe-a-p012-crop-scale-bug:
    - Statuses : 2 pass(s) 4 skip(s)
    - Exec time: [0.0, 5.17] s

  * igt@kms_yuv@pipe-a-p012-rgb-scaled-switch:
    - Statuses : 2 pass(s) 4 skip(s)
    - Exec time: [0.0, 6.05] s

  * igt@kms_yuv@pipe-a-p012-rgb-switch:
    - Statuses : 2 pass(s) 4 skip(s)
    - Exec time: [0.0, 6.04] s

  * igt@kms_yuv@pipe-a-p012-valid-width:
    - Statuses : 2 pass(s) 3 skip(s)
    - Exec time: [0.0, 7.23] s

  * igt@kms_yuv@pipe-a-p016-chroma-subpixel-clip:
    - Statuses : 6 skip(s)
    - Exec time: [0.0, 0.77] s

  * igt@kms_yuv@pipe-a-p016-crop-scale-bug:
    - Statuses : 2 pass(s) 4 skip(s)
    - Exec time: [0.0, 5.20] s

  * igt@kms_yuv@pipe-a-p016-rgb-scaled-switch:
    - Statuses : 2 pass(s) 4 skip(s)
    - Exec time: [0.0, 6.06] s

  * igt@kms_yuv@pipe-a-p016-rgb-switch:
    - Statuses : 2 pass(s) 4 skip(s)
    - Exec time: [0.0, 8.05] s

  * igt@kms_yuv@pipe-a-p016-valid-width:
    - Statuses : 1 fail(s) 1 pass(s) 4 skip(s)
    - Exec time: [0.0, 3.07] s

  * igt@kms_yuv@pipe-a-uyvy-chroma-subpixel-clip:
    - Statuses : 6 pass(s)
    - Exec time: [0.34, 1.32] s

  * igt@kms_yuv@pipe-a-uyvy-crop-scale-bug:
    - Statuses : 2 fail(s) 4 pass(s)
    - Exec time: [0.12, 7.17] s

  * igt@kms_yuv@pipe-a-uyvy-rgb-scaled-switch:
    - Statuses : 2 fail(s) 4 pass(s)
    - Exec time: [0.35, 8.37] s

  * igt@kms_yuv@pipe-a-uyvy-rgb-switch:
    - Statuses : 2 fail(s) 4 pass(s)
    - Exec time: [0.30, 8.35] s

  * igt@kms_yuv@pipe-a-uyvy-valid-width:
    - Statuses : 2 fail(s) 4 pass(s)
    - Exec time: [0.40, 10.34] s

  * igt@kms_yuv@pipe-a-vyuy-chroma-subpixel-clip:
    - Statuses : 6 pass(s)
    - Exec time: [0.36, 1.94] s

  * igt@kms_yuv@pipe-a-vyuy-crop-scale-bug:
    - Statuses : 2 fail(s) 4 pass(s)
    - Exec time: [0.04, 7.14] s

  * igt@kms_yuv@pipe-a-vyuy-rgb-scaled-switch:
    - Statuses : 2 fail(s) 4 pass(s)
    - Exec time: [0.35, 7.08] s

  * igt@kms_yuv@pipe-a-vyuy-rgb-switch:
    - Statuses : 2 fail(s) 4 pass(s)
    - Exec time: [0.18, 8.38] s

  * igt@kms_yuv@pipe-a-vyuy-valid-width:
    - Statuses : 1 fail(s) 5 pass(s)
    - Exec time: [0.35, 6.92] s

  * igt@kms_yuv@pipe-a-xv30-chroma-subpixel-clip:
    - Statuses : 1 pass(s) 5 skip(s)
    - Exec time: [0.0, 4.73] s

  * igt@kms_yuv@pipe-a-xv30-crop-scale-bug:
    - Statuses : 1 pass(s) 5 skip(s)
    - Exec time: [0.0, 11.46] s

  * igt@kms_yuv@pipe-a-xv30-rgb-scaled-switch:
    - Statuses : 1 pass(s) 5 skip(s)
    - Exec time: [0.0, 8.40] s

  * igt@kms_yuv@pipe-a-xv30-rgb-switch:
    - Statuses : 1 pass(s) 5 skip(s)
    - Exec time: [0.0, 8.42] s

  * igt@kms_yuv@pipe-a-xv30-valid-width:
    - Statuses : 1 pass(s) 5 skip(s)
    - Exec time: [0.0, 8.16] s

  * igt@kms_yuv@pipe-a-xv36-chroma-subpixel-clip:
    - Statuses : 1 pass(s) 5 skip(s)
    - Exec time: [0.0, 2.89] s

  * igt@kms_yuv@pipe-a-xv36-crop-scale-bug:
    - Statuses : 1 pass(s) 5 skip(s)
    - Exec time: [0.0, 9.04] s

  * igt@kms_yuv@pipe-a-xv36-rgb-scaled-switch:
    - Statuses : 1 fail(s) 5 skip(s)
    - Exec time: [0.0, 0.73] s

  * igt@kms_yuv@pipe-a-xv36-rgb-switch:
    - Statuses : 1 fail(s) 5 skip(s)
    - Exec time: [0.0, 0.69] s

  * igt@kms_yuv@pipe-a-xv36-valid-width:
    - Statuses : 1 pass(s) 5 skip(s)
    - Exec time: [0.0, 6.59] s

  * igt@kms_yuv@pipe-a-xv48-chroma-subpixel-clip:
    - Statuses : 1 pass(s) 5 skip(s)
    - Exec time: [0.0, 2.99] s

  * igt@kms_yuv@pipe-a-xv48-crop-scale-bug:
    - Statuses : 1 pass(s) 5 skip(s)
    - Exec time: [0.0, 8.82] s

  * igt@kms_yuv@pipe-a-xv48-rgb-scaled-switch:
    - Statuses : 1 fail(s) 5 skip(s)
    - Exec time: [0.0, 0.55] s

  * igt@kms_yuv@pipe-a-xv48-rgb-switch:
    - Statuses : 1 fail(s) 5 skip(s)
    - Exec time: [0.0, 1.33] s

  * igt@kms_yuv@pipe-a-xv48-valid-width:
    - Statuses : 1 fail(s) 5 skip(s)
    - Exec time: [0.0, 2.14] s

  * igt@kms_yuv@pipe-a-xyuv-chroma-subpixel-clip:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-xyuv-crop-scale-bug:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-xyuv-rgb-scaled-switch:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-xyuv-rgb-switch:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-xyuv-valid-width:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-y210-chroma-subpixel-clip:
    - Statuses : 1 pass(s) 5 skip(s)
    - Exec time: [0.0, 1.95] s

  * igt@kms_yuv@pipe-a-y210-crop-scale-bug:
    - Statuses : 1 pass(s) 5 skip(s)
    - Exec time: [0.0, 5.84] s

  * igt@kms_yuv@pipe-a-y210-rgb-scaled-switch:
    - Statuses : 1 fail(s) 5 skip(s)
    - Exec time: [0.0, 0.61] s

  * igt@kms_yuv@pipe-a-y210-rgb-switch:
    - Statuses : 1 fail(s) 5 skip(s)
    - Exec time: [0.0, 0.45] s

  * igt@kms_yuv@pipe-a-y210-valid-width:
    - Statuses : 1 pass(s) 5 skip(s)
    - Exec time: [0.0, 5.65] s

  * igt@kms_yuv@pipe-a-y212-chroma-subpixel-clip:
    - Statuses : 1 pass(s) 5 skip(s)
    - Exec time: [0.0, 1.96] s

  * igt@kms_yuv@pipe-a-y212-crop-scale-bug:
    - Statuses : 1 pass(s) 4 skip(s)
    - Exec time: [0.0, 5.86] s

  * igt@kms_yuv@pipe-a-y212-rgb-scaled-switch:
    - Statuses : 1 fail(s) 5 skip(s)
    - Exec time: [0.0, 0.45] s

  * igt@kms_yuv@pipe-a-y212-rgb-switch:
    - Statuses : 1 fail(s) 5 skip(s)
    - Exec time: [0.0, 0.44] s

  * igt@kms_yuv@pipe-a-y212-valid-width:
    - Statuses : 1 pass(s) 5 skip(s)
    - Exec time: [0.0, 5.67] s

  * igt@kms_yuv@pipe-a-y216-chroma-subpixel-clip:
    - Statuses : 1 pass(s) 5 skip(s)
    - Exec time: [0.0, 1.32] s

  * igt@kms_yuv@pipe-a-y216-crop-scale-bug:
    - Statuses : 1 pass(s) 5 skip(s)
    - Exec time: [0.0, 6.02] s

  * igt@kms_yuv@pipe-a-y216-rgb-scaled-switch:
    - Statuses : 1 fail(s) 5 skip(s)
    - Exec time: [0.0, 0.53] s

  * igt@kms_yuv@pipe-a-y216-rgb-switch:
    - Statuses : 1 fail(s) 4 skip(s)
    - Exec time: [0.0, 0.35] s

  * igt@kms_yuv@pipe-a-y216-valid-width:
    - Statuses : 1 fail(s) 5 skip(s)
    - Exec time: [0.0, 2.74] s

  * igt@kms_yuv@pipe-a-y410-chroma-subpixel-clip:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-y410-crop-scale-bug:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-y410-rgb-scaled-switch:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-y410-rgb-switch:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-y410-valid-width:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-y412-chroma-subpixel-clip:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-y412-crop-scale-bug:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-y412-rgb-scaled-switch:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-y412-rgb-switch:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-y412-valid-width:
    - Statuses : 5 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-y416-chroma-subpixel-clip:
    - Statuses : 5 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-y416-crop-scale-bug:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-y416-rgb-scaled-switch:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-y416-rgb-switch:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-y416-valid-width:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-yu12-chroma-subpixel-clip:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-yu12-crop-scale-bug:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-yu12-rgb-scaled-switch:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-yu12-rgb-switch:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-yu12-valid-width:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-yu16-chroma-subpixel-clip:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-yu16-crop-scale-bug:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-yu16-rgb-scaled-switch:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-yu16-rgb-switch:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-yu16-valid-width:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-yuv-sanity-crc:
    - Statuses : 6 pass(s)
    - Exec time: [1.43, 37.52] s

  * igt@kms_yuv@pipe-a-yuyv-chroma-subpixel-clip:
    - Statuses : 6 pass(s)
    - Exec time: [0.33, 1.33] s

  * igt@kms_yuv@pipe-a-yuyv-crop-scale-bug:
    - Statuses : 2 fail(s) 4 pass(s)
    - Exec time: [0.16, 7.15] s

  * igt@kms_yuv@pipe-a-yuyv-rgb-scaled-switch:
    - Statuses : 2 fail(s) 4 pass(s)
    - Exec time: [0.10, 8.37] s

  * igt@kms_yuv@pipe-a-yuyv-rgb-switch:
    - Statuses : 2 fail(s) 4 pass(s)
    - Exec time: [0.42, 8.51] s

  * igt@kms_yuv@pipe-a-yuyv-valid-width:
    - Statuses : 1 fail(s) 5 pass(s)
    - Exec time: [0.29, 10.34] s

  * igt@kms_yuv@pipe-a-yv12-chroma-subpixel-clip:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-yv12-crop-scale-bug:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-yv12-rgb-scaled-switch:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-yv12-rgb-switch:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-yv12-valid-width:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-yv16-chroma-subpixel-clip:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-yv16-crop-scale-bug:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-yv16-rgb-scaled-switch:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-yv16-rgb-switch:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-yv16-valid-width:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-a-yvyu-chroma-subpixel-clip:
    - Statuses : 6 pass(s)
    - Exec time: [0.34, 1.96] s

  * igt@kms_yuv@pipe-a-yvyu-crop-scale-bug:
    - Statuses : 2 fail(s) 3 pass(s)
    - Exec time: [0.20, 7.15] s

  * igt@kms_yuv@pipe-a-yvyu-rgb-scaled-switch:
    - Statuses : 2 fail(s) 4 pass(s)
    - Exec time: [0.15, 8.37] s

  * igt@kms_yuv@pipe-a-yvyu-rgb-switch:
    - Statuses : 2 fail(s) 4 pass(s)
    - Exec time: [0.17, 8.48] s

  * igt@kms_yuv@pipe-a-yvyu-valid-width:
    - Statuses : 1 fail(s) 5 pass(s)
    - Exec time: [0.29, 10.34] s

  * igt@kms_yuv@pipe-b-nv12-chroma-subpixel-clip:
    - Statuses : 6 skip(s)
    - Exec time: [0.0, 1.86] s

  * igt@kms_yuv@pipe-b-nv12-crop-scale-bug:
    - Statuses : 3 pass(s) 3 skip(s)
    - Exec time: [0.0, 5.14] s

  * igt@kms_yuv@pipe-b-nv12-rgb-scaled-switch:
    - Statuses : 3 pass(s) 3 skip(s)
    - Exec time: [0.0, 7.13] s

  * igt@kms_yuv@pipe-b-nv12-rgb-switch:
    - Statuses : 3 pass(s) 3 skip(s)
    - Exec time: [0.0, 6.22] s

  * igt@kms_yuv@pipe-b-nv12-valid-width:
    - Statuses : 3 pass(s) 3 skip(s)
    - Exec time: [0.0, 8.70] s

  * igt@kms_yuv@pipe-b-nv16-chroma-subpixel-clip:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-b-nv16-crop-scale-bug:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-b-nv16-rgb-scaled-switch:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-b-nv16-rgb-switch:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-b-nv16-valid-width:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-b-nv21-chroma-subpixel-clip:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-b-nv21-crop-scale-bug:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-b-nv21-rgb-scaled-switch:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-b-nv21-rgb-switch:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-b-nv21-valid-width:
    - Statuses : 5 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-b-nv61-chroma-subpixel-clip:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-b-nv61-crop-scale-bug:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-b-nv61-rgb-scaled-switch:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-b-nv61-rgb-switch:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-b-nv61-valid-width:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_yuv@pipe-b-p010-chroma-subpixel-clip:
    - Statuses : 6 skip(s)
    - Exec time: [0.0, 1.87] s

  * igt@kms_yuv@pipe-b-p010-crop-scale-bug:
    - Statuses : 2 pass(s) 4 skip(s)
    - Exec time: [0.0, 6.15] s

  * igt@kms_yuv@pipe-b-p010-rgb-scaled-switch:
    - Statuses : 2 pass(s) 4 skip(s)
    - Exec time: [0.0, 7.20] s

  * igt@kms_yuv@pipe-b-p010-rgb-switch:
    - Statuses : 2 pass(s) 4 skip(s)
    - Exec time: [0.0, 7.16] s

  * igt@kms_yuv@pipe-b-p010-valid-width:
    - Statuses : 2 pass(s) 3 skip(s)
    - Exec time: [0.0, 8.40] s

  * igt@kms_yuv@pipe-b-p012-chroma-subpixel-clip:
    - Statuses : 6 skip(s)
    - Exec time: [0.0, 1.68] s

  * igt@kms_yuv@pipe-b-p012-crop-scale-bug:
    - Statuses : 2 pass(s) 4 skip(s)
    - Exec time: [0.0, 6.12] s

  * igt@kms_yuv@pipe-b-p012-rgb-scaled-switch:
    - Statuses : 2 pass(s) 4 skip(s)
    - Exec time: [0.0, 7.27] s

  * igt@kms_yuv@pipe-b-p012-rgb-switch:
    - Statuses : 2 pass(s) 4 skip(s)
    - Exec time: [0.0, 7.20] s

  * igt@kms_yuv@pipe-b-p012-valid-width:
    - Statuses : 2 pass(s) 4 skip(s)
    - Exec time: [0.0, 8.39] s

  * igt@kms_yuv@pipe-b-p016-chroma-subpixel-clip:
    - Statuses : 6 skip(s)
    - Exec time: [0.0, 1.87] s

  * igt@kms_yuv@pipe-b-p016-crop-scale-bug:
    - Statuses : 2 pass(s) 4 skip(s)
    - Exec time: [0.0, 6.14] s

  * igt@kms_yuv@pipe-b-p016-rgb-scaled-switch:
    - Statuses : 2 pass(s) 4 skip(s)
    - Exec time: [0.0, 7.16] s

  * igt@kms_yuv@pipe-b-p016-rgb-switch:
    - Statuses : 2 pass(s) 3 skip(s)
    - Exec time: [0.0, 7.16] s

  * igt@kms_yuv@pipe-b-p016-valid-width:
    - Statuses : 1 fail(s) 1 pass(s) 4 skip(s)
    - Exec time: [0.0, 7.52] s

  * igt@kms_yuv@pipe-b-uyvy-chroma-subpixel-clip:
    - Statuses : 6 pass(s)
    - Exec time: [0.35, 3.10] s

  * igt@kms_yuv@pipe-b-uyvy-crop-scale-bug:
    - Sta

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2974/
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [igt-dev] [PATCH i-g-t] tests/kms_yuv: Add yuv specific tests, v6.
  2019-05-13 16:53 [igt-dev] [PATCH i-g-t] tests/kms_yuv: Add yuv specific tests, v6 Maarten Lankhorst
  2019-05-13 17:29 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
  2019-05-13 22:28 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
@ 2019-06-12 20:18 ` Juha-Pekka Heikkila
  2019-06-13 13:14   ` Maarten Lankhorst
  2 siblings, 1 reply; 6+ messages in thread
From: Juha-Pekka Heikkila @ 2019-06-12 20:18 UTC (permalink / raw)
  To: Maarten Lankhorst, igt-dev

Sorry for delay Maarten, I've been reading this on several evenings but 
always was interrupted. I think this look all good.

Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>

On 13.5.2019 19.53, Maarten Lankhorst wrote:
> Add tests excercising switching between various scaled/unscaled
> transitions to and from various nv12 formats, since some of the
> workarounds mention this may fail.
> 
> We also add NV12 specific clipping/scaling tests, to make sure
> that YUV src coordinates are always programmed as a multiple of 2
> correctly, and verify scaling/clipping works with CRC tests.
> 
> crop-scale-bug shows a corruption when scaling and cropping at the
> same time.
> 
> The subpixel clip test rotates and clips a rectangle on each side,
> which should produce the same CRC as when that part of the rectangle
> is hidden by a cursor and a whole 2x2 pixel is hidden.
> 
> Changes since v1:
> - Reset plane position to 0,0 at the start of yuv_valid_width_plane().
> - Handle Swati's feedback.
> Changes since v2:
> - Skip 90°/270° rotation in tests when formats don't support it.
> - Add all new HDR formats to test.
> - Use igt_plane_has_format_mod.
> - Support tests on !i915 by checking if X/Y tiling modifiers are supported.
> - Do not enable untested planes to prevent exhausing memory bandwidth
>    and available NV12 Y planes in the rgb-switch-scaled test.
> Changes since v3:
> - Add a sanity test to sanity test YUV conversion paths, on all planes and pipes.
> - Dynamically generate list of YUV tests through igt_format_array_fill.
> Changes since v4:
> - Decrease size to 64x64 to reduce test execution time even more,
>    some YUV conversion routines are slow.
> - Don't clear degamma/ctm, this is done in core now.
> Changes since v5:
> - Fix minor compile error.
> - Add missing igt_subtest_group
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
>   tests/Makefile.sources |   1 +
>   tests/kms_yuv.c        | 937 +++++++++++++++++++++++++++++++++++++++++
>   tests/meson.build      |   1 +
>   3 files changed, 939 insertions(+)
>   create mode 100644 tests/kms_yuv.c
> 
> diff --git a/tests/Makefile.sources b/tests/Makefile.sources
> index 7f921f6c5988..574861b2e30f 100644
> --- a/tests/Makefile.sources
> +++ b/tests/Makefile.sources
> @@ -75,6 +75,7 @@ TESTS_progs = \
>   	kms_universal_plane \
>   	kms_vblank \
>   	kms_vrr \
> +	kms_yuv \
>   	meta_test \
>   	perf \
>   	perf_pmu \
> diff --git a/tests/kms_yuv.c b/tests/kms_yuv.c
> new file mode 100644
> index 000000000000..6cf69b0504f8
> --- /dev/null
> +++ b/tests/kms_yuv.c
> @@ -0,0 +1,937 @@
> +/*
> + * Copyright © 2019 Intel Corporation
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice shall be included in
> + * all copies or substantial portions of the Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> + * IN THE SOFTWARE.
> + *
> + * Authors:
> + *    Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> + */
> +#include "config.h"
> +
> +#include "igt.h"
> +#include <cairo.h>
> +#include <errno.h>
> +#include <stdint.h>
> +#include <unistd.h>
> +#include <sys/time.h>
> +
> +typedef struct {
> +	igt_display_t display;
> +
> +	igt_pipe_crc_t *pipe_crc;
> +	struct igt_fb fb[6];
> +} data_t;
> +
> +static uint64_t x_modifier = LOCAL_DRM_FORMAT_MOD_NONE;
> +static uint64_t y_modifier = LOCAL_DRM_FORMAT_MOD_NONE;
> +static uint32_t *formats, count_formats;
> +
> +static bool pipe_supports_format(igt_display_t *display, enum pipe pipe,
> +				 uint32_t format, uint64_t tiling)
> +{
> +	igt_plane_t *plane;
> +
> +	for_each_plane_on_pipe(display, pipe, plane)
> +		if (igt_plane_has_format_mod(plane, format, tiling))
> +			return true;
> +
> +	return false;
> +}
> +
> +
> +static void remove_fbs(data_t *data)
> +{
> +	int i;
> +
> +	for (i = 0; i < ARRAY_SIZE(data->fb); i++)
> +		igt_remove_fb(data->display.drm_fd, &data->fb[i]);
> +}
> +
> +static void prepare_crtc(data_t *data, enum pipe pipe, igt_output_t *output)
> +{
> +	igt_display_t *display = &data->display;
> +
> +	remove_fbs(data);
> +	igt_display_reset(display);
> +	igt_output_set_pipe(output, pipe);
> +	igt_display_commit2(display, COMMIT_ATOMIC);
> +
> +	igt_pipe_crc_free(data->pipe_crc);
> +	data->pipe_crc = igt_pipe_crc_new(display->drm_fd, pipe,
> +					  INTEL_PIPE_CRC_SOURCE_AUTO);
> +}
> +
> +static void fudge_lut(data_t *data, enum pipe pipe, uint16_t mask)
> +{
> +	igt_pipe_t *pipe_obj = &data->display.pipes[pipe];
> +	uint16_t *lut;
> +	int i, lut_size;
> +
> +	if (!igt_pipe_obj_has_prop(pipe_obj, IGT_CRTC_GAMMA_LUT_SIZE))
> +		return;
> +
> +	lut_size = igt_pipe_obj_get_prop(pipe_obj, IGT_CRTC_GAMMA_LUT_SIZE);
> +
> +	lut = malloc(sizeof(uint16_t) * lut_size);
> +	for (i = 0; i < lut_size; i++)
> +		lut[i] = (i * 0xffff / (lut_size - 1)) & mask;
> +
> +	igt_pipe_obj_replace_prop_blob(pipe_obj, IGT_CRTC_GAMMA_LUT, lut, lut_size * sizeof(uint16_t));
> +	free(lut);
> +}
> +
> +static void unfudge_lut(data_t *data, enum pipe pipe)
> +{
> +	igt_pipe_t *pipe_obj = &data->display.pipes[pipe];
> +
> +	if (igt_pipe_obj_has_prop(pipe_obj, IGT_CRTC_GAMMA_LUT))
> +		igt_pipe_obj_replace_prop_blob(pipe_obj, IGT_CRTC_GAMMA_LUT, NULL, 0);
> +}
> +
> +/*
> + * Test that we initialize a YUV fb as black correctly,
> + * that when we write a black FB it will get the same CRC, and that
> + * all colors we test will give the same CRC on all formats.
> + */
> +static void yuv_sanity(data_t *data, enum pipe pipe, igt_output_t *output)
> +{
> +	igt_display_t *display = &data->display;
> +	igt_plane_t *plane;
> +	igt_crc_t black_crc, color_crc, crc;
> +	bool first = true;
> +
> +	prepare_crtc(data, pipe, output);
> +
> +	for_each_plane_on_pipe(display, pipe, plane) {
> +		for (int i = 0; i < count_formats; i++) {
> +			struct igt_fb *fb = &data->fb[0];
> +			cairo_t *cr;
> +
> +			if (!igt_format_is_yuv(formats[i]) ||
> +			    !igt_plane_has_format_mod(plane, formats[i], x_modifier))
> +				continue;
> +
> +			igt_debug("Testing format %.4s on plane %i\n",
> +				 (char *)&formats[i], plane->index);
> +			igt_create_fb(display->drm_fd, 64, 64, formats[i],
> +				      x_modifier, fb);
> +
> +			igt_plane_set_fb(plane, fb);
> +			igt_display_commit2(display, COMMIT_ATOMIC);
> +			if (!first) {
> +				igt_pipe_crc_collect_crc(data->pipe_crc, &crc);
> +				igt_assert_crc_equal(&black_crc, &crc);
> +			} else {
> +				igt_pipe_crc_collect_crc(data->pipe_crc, &black_crc);
> +			}
> +
> +			/* Compare initial black fb with reference painted black color */
> +			cr = igt_get_cairo_ctx(display->drm_fd, fb);
> +			igt_paint_color(cr, 0, 0, fb->width, fb->height, 0., 0., 0.);
> +			igt_put_cairo_ctx(display->drm_fd, fb, cr);
> +			igt_dirty_fb(display->drm_fd, fb);
> +			igt_wait_for_vblank(display->drm_fd, pipe);
> +			igt_pipe_crc_collect_crc(data->pipe_crc, &crc);
> +			igt_assert_crc_equal(&black_crc, &crc);
> +
> +
> +			/* Write a color fb */
> +			cr = igt_get_cairo_ctx(display->drm_fd, fb);
> +			igt_paint_color(cr, 0, 0, fb->width, fb->height, 1., 1., 0.);
> +			igt_put_cairo_ctx(display->drm_fd, fb, cr);
> +			fudge_lut(data, pipe, 0xfc00);
> +			igt_plane_set_fb(plane, fb);
> +			igt_display_commit2(display, COMMIT_ATOMIC);
> +
> +			if (!first) {
> +				igt_pipe_crc_collect_crc(data->pipe_crc, &crc);
> +				igt_assert_crc_equal(&color_crc, &crc);
> +			} else {
> +				igt_pipe_crc_collect_crc(data->pipe_crc, &color_crc);
> +				first = false;
> +			}
> +
> +			/* Convert from YUV, back to YUV, to expose bugs in conversion routines */
> +			cr = igt_get_cairo_ctx(display->drm_fd, fb);
> +			igt_put_cairo_ctx(display->drm_fd, fb, cr);
> +			igt_dirty_fb(display->drm_fd, fb);
> +			igt_wait_for_vblank(display->drm_fd, pipe);
> +			igt_pipe_crc_collect_crc(data->pipe_crc, &crc);
> +			igt_assert_crc_equal(&color_crc, &crc);
> +
> +			unfudge_lut(data, pipe);
> +			igt_plane_set_fb(plane, NULL);
> +			igt_remove_fb(display->drm_fd, &data->fb[0]);
> +		}
> +	}
> +}
> +
> +static void set_fb(igt_plane_t *plane, struct igt_fb *fb,
> +		   bool scaled, igt_rotation_t rot)
> +{
> +	igt_plane_set_fb(plane, fb);
> +
> +	if (scaled && fb)
> +		igt_fb_set_size(fb, plane, fb->width, 16);
> +
> +	igt_plane_set_rotation(plane, rot);
> +	if (fb && (rot == IGT_ROTATION_90 || rot == IGT_ROTATION_270))
> +		igt_plane_set_size(plane, fb->height, fb->width);
> +}
> +
> +static void yuv_rgb_switch(data_t *data, enum pipe pipe,
> +			   igt_output_t *output, bool scaled, unsigned format)
> +{
> +	drmModeModeInfo *mode = igt_output_get_mode(output);
> +	igt_display_t *display = &data->display;
> +	igt_plane_t *plane;
> +	int i;
> +	igt_crc_t ref_crc[4], crc;
> +	bool valid[4] = {};
> +
> +	prepare_crtc(data, pipe, output);
> +
> +	igt_create_pattern_fb(display->drm_fd, mode->hdisplay, mode->vdisplay,
> +			      format, x_modifier, &data->fb[0]);
> +
> +	igt_create_pattern_fb(display->drm_fd, mode->vdisplay, mode->hdisplay,
> +			      format, y_modifier, &data->fb[1]);
> +
> +	igt_create_pattern_fb(display->drm_fd, mode->hdisplay, mode->vdisplay,
> +			      DRM_FORMAT_XRGB8888, x_modifier, &data->fb[2]);
> +
> +	igt_create_pattern_fb(display->drm_fd, mode->vdisplay, mode->hdisplay,
> +			      DRM_FORMAT_XRGB8888, y_modifier, &data->fb[3]);
> +
> +	for_each_plane_on_pipe(display, pipe, plane) {
> +		const int seq[] = {
> +			2, 0, 2, 1, 3, 1, 3
> +		};
> +
> +		if (!igt_plane_has_format_mod(plane, format, data->fb[0].modifier))
> +			continue;
> +
> +		/* Collect reference crc with toggle in between. */
> +		for (i = 0; i < ARRAY_SIZE(ref_crc); i++) {
> +			igt_rotation_t rot = (i == 1 || i == 3) ?
> +				IGT_ROTATION_90 : IGT_ROTATION_0;
> +
> +			set_fb(plane, &data->fb[i], scaled, rot);
> +
> +			igt_display_commit2(display, COMMIT_ATOMIC);
> +			igt_pipe_crc_collect_crc(data->pipe_crc, &ref_crc[i]);
> +			valid[i] = true;
> +
> +			set_fb(plane, NULL, scaled, rot);
> +			igt_display_commit2(display, COMMIT_ATOMIC);
> +		}
> +
> +		for (i = 0; i < ARRAY_SIZE(seq); i++) {
> +			int j = seq[i];
> +			igt_rotation_t rot = (j == 1 || j == 3) ?
> +				IGT_ROTATION_90 : IGT_ROTATION_0;
> +
> +			if (!valid[j])
> +				continue;
> +
> +			set_fb(plane, &data->fb[j], scaled, rot);
> +			igt_display_commit2(display, COMMIT_ATOMIC);
> +
> +			igt_pipe_crc_collect_crc(data->pipe_crc, &crc);
> +			igt_assert_crc_equal(&ref_crc[j], &crc);
> +		}
> +
> +		/* We only have few scalers, don't use 1 for unused planes */
> +		igt_plane_set_fb(plane, NULL);
> +	}
> +}
> +
> +#define assert_collected_crc_equal(pipe_crc, crc, ref_crc) \
> +	do { \
> +		igt_pipe_crc_get_current(display->drm_fd, pipe_crc, crc);	\
> +		igt_assert_crc_equal(ref_crc, crc);	\
> +	} while (0)
> +
> +static void set_src_coords(igt_plane_t *plane, struct igt_fb *fb,
> +			   igt_rotation_t rot, int vis, int hidden)
> +{
> +	switch (rot) {
> +	case IGT_ROTATION_0:
> +		igt_fb_set_position(fb, plane, fb->width / 2 - vis, fb->height / 2 - vis);
> +		break;
> +	case IGT_ROTATION_90:
> +		igt_fb_set_position(fb, plane, fb->width / 2 - hidden, fb->height / 2 - vis);
> +		break;
> +	case IGT_ROTATION_180:
> +		igt_fb_set_position(fb, plane, fb->width / 2 - hidden, fb->height / 2 - hidden);
> +		break;
> +	case IGT_ROTATION_270:
> +		igt_fb_set_position(fb, plane, fb->width / 2 - vis, fb->height / 2 - hidden);
> +		break;
> +	default: igt_assert(0);
^^
This was the only nit I noticed.

> +	}
> +	igt_fb_set_size(fb, plane, vis + hidden, vis + hidden);
> +}
> +
> +static void yuv_valid_width_plane(data_t *data, drmModeModeInfo *mode,
> +				  igt_plane_t *plane, igt_rotation_t rot,
> +				  igt_crc_t *ref_crc)
> +{
> +	igt_display_t *display = &data->display;
> +	igt_crc_t crc;
> +	struct igt_fb *clip_fb = &data->fb[2];
> +	int i, ret;
> +
> +	/* Just clipping.. */
> +	igt_plane_set_fb(plane, clip_fb);
> +	igt_plane_set_rotation(plane, rot);
> +	if (rot & (IGT_ROTATION_90 | IGT_ROTATION_270))
> +		igt_plane_set_size(plane, clip_fb->height, clip_fb->width);
> +	igt_plane_set_position(plane, mode->hdisplay - clip_fb->width / 2, mode->vdisplay - clip_fb->height / 2);
> +	if ((rot == IGT_ROTATION_90 || rot == IGT_ROTATION_270) &&
> +	    igt_display_try_commit2(display, COMMIT_ATOMIC) < 0) {
> +		igt_debug("This rotation not available for this format.\n");
> +		return;
> +	}
> +
> +	igt_display_commit2(display, COMMIT_ATOMIC);
> +	assert_collected_crc_equal(data->pipe_crc, &crc, ref_crc);
> +
> +	/* Clipping and scaling. */
> +	igt_fb_set_position(clip_fb, plane, clip_fb->width / 2 - 16, clip_fb->height / 2 - 16);
> +	igt_fb_set_size(clip_fb, plane, 32, 32);
> +	igt_display_commit2(display, COMMIT_ATOMIC);
> +	assert_collected_crc_equal(data->pipe_crc, &crc, ref_crc);
> +
> +	/* Try nvalid < 8 src visible. */
> +	set_src_coords(plane, clip_fb, rot, 4, 4);
> +	igt_display_try_commit2(display, COMMIT_ATOMIC);
> +
> +	/* Try different alignments for x/y to see if any hit underruns */
> +	for (i = 1; i < 4; i++) {
> +		set_src_coords(plane, clip_fb, rot, 16 + 2 * i, 16 - 2 * i);
> +		igt_display_commit2(display, COMMIT_ATOMIC);
> +		assert_collected_crc_equal(data->pipe_crc, &crc, ref_crc);
> +
> +		/* And also show more of the screen */
> +		set_src_coords(plane, clip_fb, rot, 16 + i, 16 + i);
> +		ret = igt_display_try_commit2(display, COMMIT_ATOMIC);
> +
> +		if (ret == -EINVAL) {
> +			igt_assert(i % 2 || rot == IGT_ROTATION_270 || rot == (IGT_ROTATION_90 | IGT_REFLECT_X));
> +			continue;
> +		} else
> +			igt_assert_eq(ret, 0);
> +		assert_collected_crc_equal(data->pipe_crc, &crc, ref_crc);
> +	}
> +
> +	/*
> +	 * As a final test, try with 16 src visible, and various invisible
> +	 * components to check clipping doesn't drop the visible src below 16.
> +	 */
> +	for (i = 0; i < 16; i += 4) {
> +		set_src_coords(plane, clip_fb, rot, 16, i);
> +		if (rot & (IGT_ROTATION_90 | IGT_ROTATION_270))
> +			igt_plane_set_size(plane, (clip_fb->height / 32) * (16 + i),
> +					   (clip_fb->width / 32) * (16 + i));
> +		else
> +			igt_plane_set_size(plane, (clip_fb->width / 32) * (16 + i),
> +					   (clip_fb->height / 32) * (16 + i));
> +		igt_display_commit2(display, COMMIT_ATOMIC);
> +		assert_collected_crc_equal(data->pipe_crc, &crc, ref_crc);
> +	}
> +}
> +
> +static void yuv_valid_width(data_t *data, enum pipe pipe, igt_output_t *output, unsigned format)
> +{
> +	drmModeModeInfo *mode = igt_output_get_mode(output);
> +	igt_display_t *display = &data->display;
> +	igt_plane_t *plane;
> +	struct igt_fb *clip_fb = &data->fb[2];
> +	struct igt_fb *ref_fb = &data->fb[3];
> +
> +	prepare_crtc(data, pipe, output);
> +
> +	igt_create_fb(display->drm_fd, 64, 64, format, y_modifier, ref_fb);
> +
> +	igt_create_fb(display->drm_fd, 2 * ref_fb->width,
> +		      2 * ref_fb->height, format, y_modifier, clip_fb);
> +
> +	igt_pipe_crc_start(data->pipe_crc);
> +
> +	for_each_plane_on_pipe(display, pipe, plane) {
> +		igt_crc_t ref_crc[4];
> +		cairo_t *cr;
> +		static const double colors[4][3] = {
> +			{ 1., 0., 0. },
> +			{ 0., 1., 0. },
> +			{ 0., 0., 1. },
> +			{ 1., 1., 1. }
> +		};
> +		int i;
> +
> +		if (!igt_plane_has_format_mod(plane, format, data->fb[0].modifier))
> +			continue;
> +
> +		/* Draw the FB that will be used for clipping tests. */
> +		cr = igt_get_cairo_ctx(display->drm_fd, clip_fb);
> +		igt_paint_color(cr, 0, 0, clip_fb->width / 2, clip_fb->height / 2,
> +				colors[0][0], colors[0][1], colors[0][2]);
> +
> +		igt_paint_color(cr, clip_fb->width / 2, 0,
> +				clip_fb->width / 2, clip_fb->height / 2,
> +				colors[1][0], colors[1][1], colors[1][2]);
> +
> +		igt_paint_color(cr, clip_fb->width / 2, clip_fb->height / 2,
> +				clip_fb->width / 2, clip_fb->height / 2,
> +				colors[2][0], colors[2][1], colors[2][2]);
> +
> +		igt_paint_color(cr, 0, clip_fb->height / 2,
> +				clip_fb->width / 2, clip_fb->height / 2,
> +				colors[3][0], colors[3][1], colors[3][2]);
> +
> +		igt_put_cairo_ctx(display->drm_fd, clip_fb, cr);
> +
> +		/* Draw all reference FB's to collect the CRC. */
> +		for (i = 0; i < 4; i++) {
> +			cr = igt_get_cairo_ctx(display->drm_fd, ref_fb);
> +			igt_paint_color(cr, 0, 0, ref_fb->width, ref_fb->height,
> +					colors[i][0], colors[i][1], colors[i][2]);
> +			igt_put_cairo_ctx(display->drm_fd, &data->fb[3], cr);
> +
> +			if (!i) {
> +				igt_plane_set_fb(plane, ref_fb);
> +				igt_plane_set_position(plane, mode->hdisplay - ref_fb->width, mode->vdisplay - ref_fb->height);
> +				igt_display_commit2(display, COMMIT_ATOMIC);
> +			} else {
> +				igt_dirty_fb(display->drm_fd, ref_fb);
> +				igt_wait_for_vblank(display->drm_fd, pipe);
> +			}
> +
> +			igt_pipe_crc_drain(data->pipe_crc);
> +			igt_pipe_crc_get_single(data->pipe_crc, &ref_crc[i]);
> +		}
> +
> +		igt_plane_set_fb(plane, NULL);
> +		igt_plane_set_position(plane, 0, 0);
> +
> +		yuv_valid_width_plane(data, mode, plane, IGT_ROTATION_0, &ref_crc[0]);
> +		yuv_valid_width_plane(data, mode, plane, IGT_ROTATION_90, &ref_crc[1]);
> +		yuv_valid_width_plane(data, mode, plane, IGT_ROTATION_180, &ref_crc[2]);
> +		yuv_valid_width_plane(data, mode, plane, IGT_ROTATION_270, &ref_crc[3]);
> +
> +		igt_plane_set_fb(plane, NULL);
> +	}
> +}
> +
> +static bool yuv_commit_rotated(igt_display_t *display, igt_rotation_t rot)
> +{
> +	if (igt_display_try_commit2(display, COMMIT_ATOMIC) < 0) {
> +		igt_debug("Skipping rotated test, alignment is wrong.\n");
> +		return false;
> +	}
> +
> +	return true;
> +}
> +
> +static void yuv_crop_scale_bug_plane(data_t *data, drmModeModeInfo *mode,
> +				      igt_plane_t *plane, struct igt_fb *fb,
> +				      igt_rotation_t rot, igt_crc_t *ref_crc)
> +{
> +	igt_display_t *display = &data->display;
> +	igt_crc_t crc;
> +	int ofs[] = { 0, 1, -1, 2, -2 };
> +	int i, j;
> +
> +	igt_plane_set_fb(plane, fb);
> +	igt_plane_set_rotation(plane, rot);
> +	igt_plane_set_position(plane, 64, 64);
> +	igt_plane_set_size(plane, 256, 256);
> +
> +	igt_fb_set_position(fb, plane, fb->width / 4, fb->height / 4);
> +	igt_fb_set_size(fb, plane, fb->width / 2, fb->height / 2);
> +	if ((rot == IGT_ROTATION_90 || rot == IGT_ROTATION_270) &&
> +	    igt_display_try_commit2(display, COMMIT_ATOMIC) < 0) {
> +		igt_debug("This rotation not available for this format.\n");
> +		return;
> +	}
> +
> +	igt_display_commit2(display, COMMIT_ATOMIC);
> +	assert_collected_crc_equal(data->pipe_crc, &crc, ref_crc);
> +
> +	/* Make sure boundaries match */
> +	igt_fb_set_position(fb, plane, fb->width / 4 - 2, fb->height / 4 - 2);
> +	igt_fb_set_size(fb, plane, fb->width / 2 + 4, fb->height / 2 + 4);
> +	igt_display_commit2(display, COMMIT_ATOMIC);
> +	assert_collected_crc_equal(data->pipe_crc, &crc, ref_crc);
> +
> +	for (i = 1; i < ARRAY_SIZE(ofs); i++) {
> +		igt_debug("Testing with rot %x and extra %i on the left side\n", rot, ofs[i]);
> +		igt_fb_set_position(fb, plane, fb->width / 4 + ofs[i], fb->height / 4 - 2);
> +		igt_fb_set_size(fb, plane, fb->width / 2 + 2 - ofs[i], fb->height / 2 + 4);
> +		if (yuv_commit_rotated(display, rot))
> +			assert_collected_crc_equal(data->pipe_crc, &crc, ref_crc);
> +
> +		igt_debug("Testing with rot %x and extra %i on the top side\n", rot, ofs[i]);
> +		igt_fb_set_position(fb, plane, fb->width / 4 - 2, fb->height / 4 + ofs[i]);
> +		igt_fb_set_size(fb, plane, fb->width / 2 + 4, fb->height / 2 + 2 - ofs[i]);
> +		if (yuv_commit_rotated(display, rot))
> +			assert_collected_crc_equal(data->pipe_crc, &crc, ref_crc);
> +
> +		igt_debug("Testing with rot %x and extra %i on the right side\n", rot, ofs[i]);
> +		igt_fb_set_position(fb, plane, fb->width / 4 - 2, fb->height / 4);
> +		igt_fb_set_size(fb, plane, fb->width / 2 + 2 + ofs[i], fb->height / 2);
> +		if (yuv_commit_rotated(display, rot))
> +			assert_collected_crc_equal(data->pipe_crc, &crc, ref_crc);
> +
> +		igt_debug("Testing with rot %x and extra %i on the bottom side\n", rot, ofs[i]);
> +		igt_fb_set_position(fb, plane, fb->width / 4 - 2, fb->height / 4 - 2);
> +		igt_fb_set_size(fb, plane, fb->width / 2 + 4, fb->height / 2 + 2 + ofs[i]);
> +		if (yuv_commit_rotated(display, rot))
> +			assert_collected_crc_equal(data->pipe_crc, &crc, ref_crc);
> +
> +	}
> +
> +	for (i = 0; i < ARRAY_SIZE(ofs); i++)
> +		for (j = !i; j < ARRAY_SIZE(ofs); j++) {
> +			igt_debug("Testing with rot %x and extra (%i, %i) at the edges\n", rot, ofs[i], ofs[j]);
> +
> +			igt_fb_set_position(fb, plane, fb->width / 4 + ofs[i], fb->height / 4 + ofs[j]);
> +			igt_fb_set_size(fb, plane, fb->width / 2 - 2 * ofs[i], fb->height / 2 - 2 * ofs[j]);
> +
> +			if (yuv_commit_rotated(display, rot))
> +				assert_collected_crc_equal(data->pipe_crc, &crc, ref_crc);
> +		}
> +}
> +
> +static void draw_clip_fb(igt_display_t *display, struct igt_fb *clip_fb)
> +{
> +	cairo_t *cr = igt_get_cairo_ctx(display->drm_fd, clip_fb);
> +
> +	igt_paint_color(cr, 0, 0, clip_fb->width, clip_fb->height, .0, .0, .5);
> +	igt_paint_color(cr, clip_fb->width / 4 - 2, clip_fb->height / 4 - 2,
> +			clip_fb->width / 2 + 4, clip_fb->height / 2 + 4, 1., 1., 1.);
> +
> +	igt_put_cairo_ctx(display->drm_fd, clip_fb, cr);
> +}
> +
> +static void yuv_crop_scale_bug(data_t *data, enum pipe pipe, igt_output_t *output, unsigned format)
> +{
> +	drmModeModeInfo *mode = igt_output_get_mode(output);
> +	igt_display_t *display = &data->display;
> +	igt_plane_t *plane, *primary = igt_pipe_get_plane_type(&display->pipes[pipe], DRM_PLANE_TYPE_PRIMARY);
> +	struct igt_fb *ref_fb = &data->fb[2];
> +	struct igt_fb *clip_fb = &data->fb[3];
> +	struct igt_fb *clip_fb_xtiled = &data->fb[4];
> +	struct igt_fb *clip_fb_ytiled = &data->fb[5];
> +
> +	prepare_crtc(data, pipe, output);
> +
> +	igt_create_color_fb(display->drm_fd, mode->hdisplay, mode->vdisplay,
> +			    format, x_modifier, .5, .5, .5, &data->fb[0]);
> +
> +	igt_create_color_fb(display->drm_fd, 256, 256, format,
> +			    x_modifier, 1., 1., 1., ref_fb);
> +
> +	igt_create_fb(display->drm_fd, 80, 128, format,
> +		      LOCAL_DRM_FORMAT_MOD_NONE, clip_fb);
> +
> +	igt_create_fb(display->drm_fd, 80, 128, format,
> +		      x_modifier, clip_fb_xtiled);
> +	igt_create_fb(display->drm_fd, 80, 128, format,
> +		      y_modifier, clip_fb_ytiled);
> +
> +	draw_clip_fb(display, clip_fb);
> +	draw_clip_fb(display, clip_fb_xtiled);
> +	draw_clip_fb(display, clip_fb_ytiled);
> +
> +	igt_plane_set_fb(primary, &data->fb[0]);
> +
> +	for_each_plane_on_pipe(display, pipe, plane) {
> +		igt_crc_t ref_crc;
> +
> +		if (!igt_plane_has_format_mod(plane, format, data->fb[0].modifier))
> +			continue;
> +
> +		igt_plane_set_fb(plane, ref_fb);
> +		igt_plane_set_position(plane, 64, 64);
> +		igt_display_commit2(display, COMMIT_ATOMIC);
> +
> +		igt_pipe_crc_start(data->pipe_crc);
> +		igt_pipe_crc_get_single(data->pipe_crc, &ref_crc);
> +
> +		yuv_crop_scale_bug_plane(data, mode, plane, clip_fb, IGT_ROTATION_0, &ref_crc);
> +		yuv_crop_scale_bug_plane(data, mode, plane, clip_fb_xtiled, IGT_ROTATION_0, &ref_crc);
> +		yuv_crop_scale_bug_plane(data, mode, plane, clip_fb_ytiled, IGT_ROTATION_0, &ref_crc);
> +		yuv_crop_scale_bug_plane(data, mode, plane, clip_fb_ytiled, IGT_ROTATION_90, &ref_crc);
> +		yuv_crop_scale_bug_plane(data, mode, plane, clip_fb, IGT_ROTATION_180, &ref_crc);
> +		yuv_crop_scale_bug_plane(data, mode, plane, clip_fb_xtiled, IGT_ROTATION_180, &ref_crc);
> +		yuv_crop_scale_bug_plane(data, mode, plane, clip_fb_ytiled, IGT_ROTATION_180, &ref_crc);
> +		yuv_crop_scale_bug_plane(data, mode, plane, clip_fb_ytiled, IGT_ROTATION_270, &ref_crc);
> +
> +		igt_plane_set_fb(plane, plane != primary ? NULL : &data->fb[0]);
> +		break;
> +	}
> +}
> +
> +static void yuv_chroma_subpixel_clip_plane_with_cursor(data_t *data,
> +							igt_plane_t *plane,
> +							struct igt_fb *clip_fb,
> +							igt_plane_t *cursor,
> +							struct igt_fb *cursor_fb,
> +							igt_crc_t *ref_crc,
> +							int cursor_x, int cursor_y)
> +{
> +	igt_display_t *display = &data->display;
> +
> +	igt_plane_set_fb(plane, clip_fb);
> +	igt_plane_set_position(plane, 64, 64);
> +	igt_plane_set_rotation(plane, IGT_ROTATION_0);
> +
> +	igt_plane_set_fb(cursor, cursor_fb);
> +	igt_plane_set_position(cursor, cursor_x, cursor_y);
> +	igt_display_commit2(display, COMMIT_ATOMIC);
> +
> +	igt_pipe_crc_drain(data->pipe_crc);
> +	igt_pipe_crc_get_single(data->pipe_crc, ref_crc);
> +
> +	igt_plane_set_fb(cursor, NULL);
> +}
> +
> +static bool yuv_chroma_subpixel_clip_plane_right(data_t *data,
> +						 igt_rotation_t rotation,
> +						 igt_plane_t *plane,
> +						 struct igt_fb *clip_fb,
> +						 igt_crc_t *ref_crc)
> +{
> +	igt_display_t *display = &data->display;
> +	igt_crc_t crc = {};
> +
> +	igt_plane_set_fb(plane, clip_fb);
> +	igt_plane_set_position(plane, 64, 64);
> +	igt_plane_set_rotation(plane, rotation);
> +	igt_plane_set_size(plane, clip_fb->width - 1, clip_fb->height);
> +
> +	switch (rotation) {
> +	case IGT_ROTATION_180:
> +		igt_fb_set_position(clip_fb, plane, 1, 0);
> +	case IGT_ROTATION_0:
> +		igt_fb_set_size(clip_fb, plane, clip_fb->width - 1, clip_fb->height);
> +		break;
> +
> +	case IGT_ROTATION_270:
> +		igt_fb_set_position(clip_fb, plane, 0, 1);
> +	case IGT_ROTATION_90:
> +		igt_fb_set_size(clip_fb, plane, clip_fb->width, clip_fb->height - 1);
> +		break;
> +	default:
> +		igt_assert_f(0, "Unhandled rotation %x\n", rotation);
> +	}
> +
> +	if (igt_display_try_commit2(display, COMMIT_ATOMIC) < 0)
> +		return false;
> +
> +	assert_collected_crc_equal(data->pipe_crc, &crc, ref_crc);
> +	return true;
> +}
> +
> +static bool yuv_chroma_subpixel_clip_plane_bottom(data_t *data,
> +						  igt_rotation_t rotation,
> +						  igt_plane_t *plane,
> +						  struct igt_fb *clip_fb,
> +						  igt_crc_t *ref_crc)
> +{
> +	igt_display_t *display = &data->display;
> +	igt_crc_t crc = {};
> +
> +	igt_plane_set_fb(plane, clip_fb);
> +	igt_plane_set_position(plane, 64, 64);
> +	igt_plane_set_rotation(plane, rotation);
> +	igt_plane_set_size(plane, clip_fb->width, clip_fb->height - 1);
> +
> +	switch (rotation) {
> +	case IGT_ROTATION_180:
> +		igt_fb_set_position(clip_fb, plane, 0, 1);
> +	case IGT_ROTATION_0:
> +		igt_fb_set_size(clip_fb, plane, clip_fb->width, clip_fb->height - 1);
> +		break;
> +
> +	case IGT_ROTATION_90:
> +		igt_fb_set_position(clip_fb, plane, 1, 0);
> +	case IGT_ROTATION_270:
> +		igt_fb_set_size(clip_fb, plane, clip_fb->width - 1, clip_fb->height);
> +		break;
> +	default:
> +		igt_assert_f(0, "Unhandled rotation %x\n", rotation);
> +	}
> +
> +	if (igt_display_try_commit2(display, COMMIT_ATOMIC) < 0)
> +		return false;
> +
> +	assert_collected_crc_equal(data->pipe_crc, &crc, ref_crc);
> +	return true;
> +}
> +
> +static bool yuv_chroma_subpixel_clip_plane_left(data_t *data,
> +						igt_rotation_t rotation,
> +						igt_plane_t *plane,
> +						struct igt_fb *clip_fb,
> +						igt_crc_t *ref_crc)
> +{
> +	igt_display_t *display = &data->display;
> +	igt_crc_t crc = {};
> +
> +	igt_plane_set_fb(plane, clip_fb);
> +	igt_plane_set_position(plane, 65, 64);
> +	igt_plane_set_rotation(plane, rotation);
> +	igt_plane_set_size(plane, clip_fb->width - 1, clip_fb->height);
> +
> +	switch (rotation) {
> +	case IGT_ROTATION_0:
> +		igt_fb_set_position(clip_fb, plane, 1, 0);
> +	case IGT_ROTATION_180:
> +		igt_fb_set_size(clip_fb, plane, clip_fb->width - 1, clip_fb->height);
> +		break;
> +
> +	case IGT_ROTATION_90:
> +		igt_fb_set_position(clip_fb, plane, 0, 1);
> +	case IGT_ROTATION_270:
> +		igt_fb_set_size(clip_fb, plane, clip_fb->width, clip_fb->height - 1);
> +		break;
> +	default:
> +		igt_assert_f(0, "Unhandled rotation %x\n", rotation);
> +	}
> +
> +	if (igt_display_try_commit2(display, COMMIT_ATOMIC) < 0)
> +		return false;
> +
> +	assert_collected_crc_equal(data->pipe_crc, &crc, ref_crc);
> +	return true;
> +}
> +
> +
> +static bool yuv_chroma_subpixel_clip_plane_top(data_t *data,
> +					      igt_rotation_t rotation,
> +					      igt_plane_t *plane,
> +					      struct igt_fb *clip_fb,
> +					      igt_crc_t *ref_crc)
> +{
> +	igt_display_t *display = &data->display;
> +	igt_crc_t crc = {};
> +
> +	igt_plane_set_fb(plane, clip_fb);
> +	igt_plane_set_position(plane, 64, 65);
> +	igt_plane_set_rotation(plane, rotation);
> +	igt_plane_set_size(plane, clip_fb->width, clip_fb->height - 1);
> +
> +	switch (rotation) {
> +	case IGT_ROTATION_0:
> +		igt_fb_set_position(clip_fb, plane, 0, 1);
> +	case IGT_ROTATION_180:
> +		igt_fb_set_size(clip_fb, plane, clip_fb->width, clip_fb->height - 1);
> +		break;
> +
> +	case IGT_ROTATION_270:
> +		igt_fb_set_position(clip_fb, plane, 1, 0);
> +	case IGT_ROTATION_90:
> +		igt_fb_set_size(clip_fb, plane, clip_fb->width - 1, clip_fb->height);
> +		break;
> +	default:
> +		igt_assert_f(0, "Unhandled rotation %x\n", rotation);
> +	}
> +
> +	if (igt_display_try_commit2(display, COMMIT_ATOMIC) < 0)
> +		return false;
> +
> +	assert_collected_crc_equal(data->pipe_crc, &crc, ref_crc);
> +	return true;
> +}
> +
> +static void yuv_chroma_subpixel_clip(data_t *data, enum pipe pipe, igt_output_t *output, unsigned format)
> +{
> +	drmModeModeInfo *mode = igt_output_get_mode(output);
> +	igt_display_t *display = &data->display;
> +	igt_pipe_t *pipe_obj = &display->pipes[pipe];
> +	struct igt_fb *bg_fb = &data->fb[0];
> +	struct igt_fb *bg_cursor_fb = &data->fb[1];
> +	struct igt_fb *black_cursor_fb = &data->fb[2];
> +	struct igt_fb *clip_fb = &data->fb[3];
> +	igt_plane_t *primary = igt_pipe_get_plane_type(pipe_obj, DRM_PLANE_TYPE_PRIMARY);
> +	igt_plane_t *cursor = igt_pipe_get_plane_type(pipe_obj, DRM_PLANE_TYPE_CURSOR);
> +	igt_plane_t *plane;
> +	cairo_t *cr;
> +	bool ret = false;
> +
> +	prepare_crtc(data, pipe, output);
> +
> +	igt_create_color_fb(display->drm_fd, mode->hdisplay, mode->vdisplay,
> +			    DRM_FORMAT_XRGB8888, x_modifier,
> +			    .0, .0, 1., bg_fb);
> +
> +	igt_create_color_fb(display->drm_fd, 256, 256,
> +		            DRM_FORMAT_ARGB8888, LOCAL_DRM_FORMAT_MOD_NONE,
> +			    .0, .0, 1., bg_cursor_fb);
> +
> +	igt_create_color_fb(display->drm_fd, 256, 256,
> +		            DRM_FORMAT_ARGB8888, LOCAL_DRM_FORMAT_MOD_NONE,
> +			    .0, .0, .0, black_cursor_fb);
> +
> +	igt_create_fb(display->drm_fd, 256, 256,
> +		      format, y_modifier, clip_fb);
> +
> +	/* Draw the FB that will be used for clipping the chroma subpixel test. */
> +	cr = igt_get_cairo_ctx(display->drm_fd, clip_fb);
> +
> +	igt_paint_color(cr, 0, 0, clip_fb->width, clip_fb->height, 1., 0., 0.);
> +	igt_paint_color(cr, 2, 2, clip_fb->width - 4, clip_fb->height - 4, 0., 1., 1.);
> +	igt_paint_color(cr, 4, 4, clip_fb->width - 8, clip_fb->height - 8, .75, .75, 1.);
> +
> +	/* White dots in the corners. */
> +	igt_paint_color(cr, 0, 0, 6, 6, 1., 1., 1.);
> +	igt_paint_color(cr, clip_fb->width - 6, 0, 6, 6, 1., 1., 1.);
> +	igt_paint_color(cr, 0, clip_fb->height - 6, 6, 6, 1., 1., 1.);
> +	igt_paint_color(cr, clip_fb->width - 6, clip_fb->height - 6, 6, 6, 1., 1., 1.);
> +
> +	igt_put_cairo_ctx(display->drm_fd, clip_fb, cr);
> +
> +	igt_pipe_crc_start(data->pipe_crc);
> +
> +	igt_plane_set_fb(primary, bg_fb);
> +	for_each_plane_on_pipe(display, pipe, plane) {
> +		struct igt_fb *cursor_fb = plane == primary ? black_cursor_fb : bg_cursor_fb;
> +		igt_crc_t ref_crc;
> +
> +		if (!igt_plane_has_format_mod(plane, format, clip_fb->modifier) || plane == cursor)
> +			continue;
> +
> +		yuv_chroma_subpixel_clip_plane_with_cursor(data, plane, clip_fb, cursor, cursor_fb, &ref_crc, 63 + clip_fb->width, 64);
> +		ret |= yuv_chroma_subpixel_clip_plane_right(data, IGT_ROTATION_0, plane, clip_fb, &ref_crc);
> +		ret |= yuv_chroma_subpixel_clip_plane_right(data, IGT_ROTATION_90, plane, clip_fb, &ref_crc);
> +		ret |= yuv_chroma_subpixel_clip_plane_right(data, IGT_ROTATION_180, plane, clip_fb, &ref_crc);
> +		ret |= yuv_chroma_subpixel_clip_plane_right(data, IGT_ROTATION_270, plane, clip_fb, &ref_crc);
> +
> +		yuv_chroma_subpixel_clip_plane_with_cursor(data, plane, clip_fb, cursor, cursor_fb, &ref_crc, 64, 63 + clip_fb->height);
> +		ret |= yuv_chroma_subpixel_clip_plane_bottom(data, IGT_ROTATION_0, plane, clip_fb, &ref_crc);
> +		ret |= yuv_chroma_subpixel_clip_plane_bottom(data, IGT_ROTATION_90, plane, clip_fb, &ref_crc);
> +		ret |= yuv_chroma_subpixel_clip_plane_bottom(data, IGT_ROTATION_180, plane, clip_fb, &ref_crc);
> +		ret |= yuv_chroma_subpixel_clip_plane_bottom(data, IGT_ROTATION_270, plane, clip_fb, &ref_crc);
> +
> +		yuv_chroma_subpixel_clip_plane_with_cursor(data, plane, clip_fb, cursor, cursor_fb, &ref_crc, 65 - cursor_fb->width, 64);
> +		ret |= yuv_chroma_subpixel_clip_plane_left(data, IGT_ROTATION_0, plane, clip_fb, &ref_crc);
> +		ret |= yuv_chroma_subpixel_clip_plane_left(data, IGT_ROTATION_90, plane, clip_fb, &ref_crc);
> +		ret |= yuv_chroma_subpixel_clip_plane_left(data, IGT_ROTATION_180, plane, clip_fb, &ref_crc);
> +		ret |= yuv_chroma_subpixel_clip_plane_left(data, IGT_ROTATION_270, plane, clip_fb, &ref_crc);
> +
> +		yuv_chroma_subpixel_clip_plane_with_cursor(data, plane, clip_fb, cursor, cursor_fb, &ref_crc, 64, 65 - cursor_fb->height);
> +		ret |= yuv_chroma_subpixel_clip_plane_top(data, IGT_ROTATION_0, plane, clip_fb, &ref_crc);
> +		ret |= yuv_chroma_subpixel_clip_plane_top(data, IGT_ROTATION_90, plane, clip_fb, &ref_crc);
> +		ret |= yuv_chroma_subpixel_clip_plane_top(data, IGT_ROTATION_180, plane, clip_fb, &ref_crc);
> +		ret |= yuv_chroma_subpixel_clip_plane_top(data, IGT_ROTATION_270, plane, clip_fb, &ref_crc);
> +
> +		/* Reset to defaults */
> +		igt_plane_set_position(plane, 0, 0);
> +		igt_plane_set_rotation(plane, IGT_ROTATION_0);
> +		igt_plane_set_fb(plane, plane == primary ? bg_fb : NULL);
> +	}
> +
> +	igt_require_f(ret, "Could not test subpixel clipping in any corner\n");
> +}
> +
> +static const char *prettify(uint32_t fourcc)
> +{
> +	static char str[5];
> +
> +	memcpy(str, &fourcc, 4);
> +	str[4] = 0;
> +	return str;
> +}
> +
> +static void run_tests_for_format(data_t *data, enum pipe pipe, igt_output_t *output, unsigned int format)
> +{
> +	igt_display_t *display = &data->display;
> +	const char *fstr = prettify(format);
> +
> +	igt_fixture
> +		igt_require(pipe_supports_format(display, pipe, format, x_modifier));
> +
> +	igt_subtest_f("pipe-%s-%s-rgb-switch", kmstest_pipe_name(pipe), fstr)
> +		yuv_rgb_switch(data, pipe, output, false, format);
> +
> +	igt_subtest_f("pipe-%s-%s-rgb-scaled-switch", kmstest_pipe_name(pipe), fstr)
> +		yuv_rgb_switch(data, pipe, output, true, format);
> +
> +	igt_subtest_f("pipe-%s-%s-valid-width", kmstest_pipe_name(pipe), fstr)
> +		yuv_valid_width(data, pipe, output, format);
> +
> +	igt_subtest_f("pipe-%s-%s-crop-scale-bug", kmstest_pipe_name(pipe), fstr)
> +		yuv_crop_scale_bug(data, pipe, output, format);
> +
> +	igt_subtest_f("pipe-%s-%s-chroma-subpixel-clip", kmstest_pipe_name(pipe), fstr)
> +		yuv_chroma_subpixel_clip(data, pipe, output, format);
> +}
> +
> +static void run_tests_for_pipe(data_t *data, enum pipe pipe)
> +{
> +	igt_output_t *output = NULL;
> +
> +	igt_fixture
> +		igt_require((output = igt_get_single_output_for_pipe(&data->display, pipe)));
> +
> +	igt_subtest_f("pipe-%s-yuv-sanity-crc", kmstest_pipe_name(pipe))
> +		yuv_sanity(data, pipe, output);
> +
> +	for (int i = 0; i < count_formats; i++)
> +		if (igt_format_is_yuv(formats[i]))
> +			igt_subtest_group
> +				run_tests_for_format(data, pipe, output, formats[i]);
> +}
> +
> +igt_main
> +{
> +	data_t data = {};
> +	enum pipe pipe;
> +
> +	igt_skip_on_simulation();
> +
> +	igt_fixture {
> +		data.display.drm_fd = drm_open_driver_master(DRIVER_ANY);
> +
> +		kmstest_set_vt_graphics_mode();
> +		igt_display_require(&data.display, data.display.drm_fd);
> +		igt_require(data.display.is_atomic);
> +		igt_require_pipe_crc(data.display.drm_fd);
> +
> +		if (igt_display_has_format_mod(&data.display, DRM_FORMAT_XRGB8888, LOCAL_I915_FORMAT_MOD_X_TILED))
> +			x_modifier = LOCAL_I915_FORMAT_MOD_X_TILED;
> +
> +		if (igt_display_has_format_mod(&data.display, DRM_FORMAT_XRGB8888, LOCAL_I915_FORMAT_MOD_Y_TILED))
> +			y_modifier = LOCAL_I915_FORMAT_MOD_Y_TILED;
> +	}
> +
> +	igt_format_array_fill(&formats, &count_formats, true);
> +
> +	for_each_pipe_static(pipe)
> +		igt_subtest_group
> +			run_tests_for_pipe(&data, pipe);
> +
> +	igt_fixture {
> +		igt_display_fini(&data.display);
> +		close(data.display.drm_fd);
> +	}
> +}
> diff --git a/tests/meson.build b/tests/meson.build
> index 351594fa72f0..fc69ec677e47 100644
> --- a/tests/meson.build
> +++ b/tests/meson.build
> @@ -62,6 +62,7 @@ test_progs = [
>   	'kms_universal_plane',
>   	'kms_vblank',
>   	'kms_vrr',
> +	'kms_yuv',
>   	'meta_test',
>   	'panfrost_get_param',
>   	'panfrost_gem_new',
> 

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [igt-dev] [PATCH i-g-t] tests/kms_yuv: Add yuv specific tests, v6.
  2019-06-12 20:18 ` [igt-dev] [PATCH i-g-t] " Juha-Pekka Heikkila
@ 2019-06-13 13:14   ` Maarten Lankhorst
  2019-06-19  8:09     ` Juha-Pekka Heikkila
  0 siblings, 1 reply; 6+ messages in thread
From: Maarten Lankhorst @ 2019-06-13 13:14 UTC (permalink / raw)
  To: juhapekka.heikkila, igt-dev

Op 12-06-2019 om 22:18 schreef Juha-Pekka Heikkila:
> Sorry for delay Maarten, I've been reading this on several evenings but always was interrupted. I think this look all good.
>
> Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
>
> On 13.5.2019 19.53, Maarten Lankhorst wrote:
>> Add tests excercising switching between various scaled/unscaled
>> transitions to and from various nv12 formats, since some of the
>> workarounds mention this may fail.
>>
>> We also add NV12 specific clipping/scaling tests, to make sure
>> that YUV src coordinates are always programmed as a multiple of 2
>> correctly, and verify scaling/clipping works with CRC tests.
>>
>> crop-scale-bug shows a corruption when scaling and cropping at the
>> same time.
>>
>> The subpixel clip test rotates and clips a rectangle on each side,
>> which should produce the same CRC as when that part of the rectangle
>> is hidden by a cursor and a whole 2x2 pixel is hidden.
>>
>> Changes since v1:
>> - Reset plane position to 0,0 at the start of yuv_valid_width_plane().
>> - Handle Swati's feedback.
>> Changes since v2:
>> - Skip 90°/270° rotation in tests when formats don't support it.
>> - Add all new HDR formats to test.
>> - Use igt_plane_has_format_mod.
>> - Support tests on !i915 by checking if X/Y tiling modifiers are supported.
>> - Do not enable untested planes to prevent exhausing memory bandwidth
>>    and available NV12 Y planes in the rgb-switch-scaled test.
>> Changes since v3:
>> - Add a sanity test to sanity test YUV conversion paths, on all planes and pipes.
>> - Dynamically generate list of YUV tests through igt_format_array_fill.
>> Changes since v4:
>> - Decrease size to 64x64 to reduce test execution time even more,
>>    some YUV conversion routines are slow.
>> - Don't clear degamma/ctm, this is done in core now.
>> Changes since v5:
>> - Fix minor compile error.
>> - Add missing igt_subtest_group
>>
>> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>> ---
>>   tests/Makefile.sources |   1 +
>>   tests/kms_yuv.c        | 937 +++++++++++++++++++++++++++++++++++++++++
>>   tests/meson.build      |   1 +
>>   3 files changed, 939 insertions(+)
>>   create mode 100644 tests/kms_yuv.c
>>
>> diff --git a/tests/Makefile.sources b/tests/Makefile.sources
>> index 7f921f6c5988..574861b2e30f 100644
>> --- a/tests/Makefile.sources
>> +++ b/tests/Makefile.sources
>> @@ -75,6 +75,7 @@ TESTS_progs = \
>>       kms_universal_plane \
>>       kms_vblank \
>>       kms_vrr \
>> +    kms_yuv \
>>       meta_test \
>>       perf \
>>       perf_pmu \
>> diff --git a/tests/kms_yuv.c b/tests/kms_yuv.c
>> new file mode 100644
>> index 000000000000..6cf69b0504f8
>> --- /dev/null
>> +++ b/tests/kms_yuv.c
>> @@ -0,0 +1,937 @@
>> +/*
>> + * Copyright © 2019 Intel Corporation
>> + *
>> + * Permission is hereby granted, free of charge, to any person obtaining a
>> + * copy of this software and associated documentation files (the "Software"),
>> + * to deal in the Software without restriction, including without limitation
>> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
>> + * and/or sell copies of the Software, and to permit persons to whom the
>> + * Software is furnished to do so, subject to the following conditions:
>> + *
>> + * The above copyright notice and this permission notice shall be included in
>> + * all copies or substantial portions of the Software.
>> + *
>> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
>> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
>> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
>> + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
>> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
>> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
>> + * IN THE SOFTWARE.
>> + *
>> + * Authors:
>> + *    Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>> + */
>> +#include "config.h"
>> +
>> +#include "igt.h"
>> +#include <cairo.h>
>> +#include <errno.h>
>> +#include <stdint.h>
>> +#include <unistd.h>
>> +#include <sys/time.h>
>> +
>> +typedef struct {
>> +    igt_display_t display;
>> +
>> +    igt_pipe_crc_t *pipe_crc;
>> +    struct igt_fb fb[6];
>> +} data_t;
>> +
>> +static uint64_t x_modifier = LOCAL_DRM_FORMAT_MOD_NONE;
>> +static uint64_t y_modifier = LOCAL_DRM_FORMAT_MOD_NONE;
>> +static uint32_t *formats, count_formats;
>> +
>> +static bool pipe_supports_format(igt_display_t *display, enum pipe pipe,
>> +                 uint32_t format, uint64_t tiling)
>> +{
>> +    igt_plane_t *plane;
>> +
>> +    for_each_plane_on_pipe(display, pipe, plane)
>> +        if (igt_plane_has_format_mod(plane, format, tiling))
>> +            return true;
>> +
>> +    return false;
>> +}
>> +
>> +
>> +static void remove_fbs(data_t *data)
>> +{
>> +    int i;
>> +
>> +    for (i = 0; i < ARRAY_SIZE(data->fb); i++)
>> +        igt_remove_fb(data->display.drm_fd, &data->fb[i]);
>> +}
>> +
>> +static void prepare_crtc(data_t *data, enum pipe pipe, igt_output_t *output)
>> +{
>> +    igt_display_t *display = &data->display;
>> +
>> +    remove_fbs(data);
>> +    igt_display_reset(display);
>> +    igt_output_set_pipe(output, pipe);
>> +    igt_display_commit2(display, COMMIT_ATOMIC);
>> +
>> +    igt_pipe_crc_free(data->pipe_crc);
>> +    data->pipe_crc = igt_pipe_crc_new(display->drm_fd, pipe,
>> +                      INTEL_PIPE_CRC_SOURCE_AUTO);
>> +}
>> +
>> +static void fudge_lut(data_t *data, enum pipe pipe, uint16_t mask)
>> +{
>> +    igt_pipe_t *pipe_obj = &data->display.pipes[pipe];
>> +    uint16_t *lut;
>> +    int i, lut_size;
>> +
>> +    if (!igt_pipe_obj_has_prop(pipe_obj, IGT_CRTC_GAMMA_LUT_SIZE))
>> +        return;
>> +
>> +    lut_size = igt_pipe_obj_get_prop(pipe_obj, IGT_CRTC_GAMMA_LUT_SIZE);
>> +
>> +    lut = malloc(sizeof(uint16_t) * lut_size);
>> +    for (i = 0; i < lut_size; i++)
>> +        lut[i] = (i * 0xffff / (lut_size - 1)) & mask;
>> +
>> +    igt_pipe_obj_replace_prop_blob(pipe_obj, IGT_CRTC_GAMMA_LUT, lut, lut_size * sizeof(uint16_t));
>> +    free(lut);
>> +}
>> +
>> +static void unfudge_lut(data_t *data, enum pipe pipe)
>> +{
>> +    igt_pipe_t *pipe_obj = &data->display.pipes[pipe];
>> +
>> +    if (igt_pipe_obj_has_prop(pipe_obj, IGT_CRTC_GAMMA_LUT))
>> +        igt_pipe_obj_replace_prop_blob(pipe_obj, IGT_CRTC_GAMMA_LUT, NULL, 0);
>> +}
>> +
>> +/*
>> + * Test that we initialize a YUV fb as black correctly,
>> + * that when we write a black FB it will get the same CRC, and that
>> + * all colors we test will give the same CRC on all formats.
>> + */
>> +static void yuv_sanity(data_t *data, enum pipe pipe, igt_output_t *output)
>> +{
>> +    igt_display_t *display = &data->display;
>> +    igt_plane_t *plane;
>> +    igt_crc_t black_crc, color_crc, crc;
>> +    bool first = true;
>> +
>> +    prepare_crtc(data, pipe, output);
>> +
>> +    for_each_plane_on_pipe(display, pipe, plane) {
>> +        for (int i = 0; i < count_formats; i++) {
>> +            struct igt_fb *fb = &data->fb[0];
>> +            cairo_t *cr;
>> +
>> +            if (!igt_format_is_yuv(formats[i]) ||
>> +                !igt_plane_has_format_mod(plane, formats[i], x_modifier))
>> +                continue;
>> +
>> +            igt_debug("Testing format %.4s on plane %i\n",
>> +                 (char *)&formats[i], plane->index);
>> +            igt_create_fb(display->drm_fd, 64, 64, formats[i],
>> +                      x_modifier, fb);
>> +
>> +            igt_plane_set_fb(plane, fb);
>> +            igt_display_commit2(display, COMMIT_ATOMIC);
>> +            if (!first) {
>> +                igt_pipe_crc_collect_crc(data->pipe_crc, &crc);
>> +                igt_assert_crc_equal(&black_crc, &crc);
>> +            } else {
>> +                igt_pipe_crc_collect_crc(data->pipe_crc, &black_crc);
>> +            }
>> +
>> +            /* Compare initial black fb with reference painted black color */
>> +            cr = igt_get_cairo_ctx(display->drm_fd, fb);
>> +            igt_paint_color(cr, 0, 0, fb->width, fb->height, 0., 0., 0.);
>> +            igt_put_cairo_ctx(display->drm_fd, fb, cr);
>> +            igt_dirty_fb(display->drm_fd, fb);
>> +            igt_wait_for_vblank(display->drm_fd, pipe);
>> +            igt_pipe_crc_collect_crc(data->pipe_crc, &crc);
>> +            igt_assert_crc_equal(&black_crc, &crc);
>> +
>> +
>> +            /* Write a color fb */
>> +            cr = igt_get_cairo_ctx(display->drm_fd, fb);
>> +            igt_paint_color(cr, 0, 0, fb->width, fb->height, 1., 1., 0.);
>> +            igt_put_cairo_ctx(display->drm_fd, fb, cr);
>> +            fudge_lut(data, pipe, 0xfc00);
>> +            igt_plane_set_fb(plane, fb);
>> +            igt_display_commit2(display, COMMIT_ATOMIC);
>> +
>> +            if (!first) {
>> +                igt_pipe_crc_collect_crc(data->pipe_crc, &crc);
>> +                igt_assert_crc_equal(&color_crc, &crc);
>> +            } else {
>> +                igt_pipe_crc_collect_crc(data->pipe_crc, &color_crc);
>> +                first = false;
>> +            }
>> +
>> +            /* Convert from YUV, back to YUV, to expose bugs in conversion routines */
>> +            cr = igt_get_cairo_ctx(display->drm_fd, fb);
>> +            igt_put_cairo_ctx(display->drm_fd, fb, cr);
>> +            igt_dirty_fb(display->drm_fd, fb);
>> +            igt_wait_for_vblank(display->drm_fd, pipe);
>> +            igt_pipe_crc_collect_crc(data->pipe_crc, &crc);
>> +            igt_assert_crc_equal(&color_crc, &crc);
>> +
>> +            unfudge_lut(data, pipe);
>> +            igt_plane_set_fb(plane, NULL);
>> +            igt_remove_fb(display->drm_fd, &data->fb[0]);
>> +        }
>> +    }
>> +}
>> +
>> +static void set_fb(igt_plane_t *plane, struct igt_fb *fb,
>> +           bool scaled, igt_rotation_t rot)
>> +{
>> +    igt_plane_set_fb(plane, fb);
>> +
>> +    if (scaled && fb)
>> +        igt_fb_set_size(fb, plane, fb->width, 16);
>> +
>> +    igt_plane_set_rotation(plane, rot);
>> +    if (fb && (rot == IGT_ROTATION_90 || rot == IGT_ROTATION_270))
>> +        igt_plane_set_size(plane, fb->height, fb->width);
>> +}
>> +
>> +static void yuv_rgb_switch(data_t *data, enum pipe pipe,
>> +               igt_output_t *output, bool scaled, unsigned format)
>> +{
>> +    drmModeModeInfo *mode = igt_output_get_mode(output);
>> +    igt_display_t *display = &data->display;
>> +    igt_plane_t *plane;
>> +    int i;
>> +    igt_crc_t ref_crc[4], crc;
>> +    bool valid[4] = {};
>> +
>> +    prepare_crtc(data, pipe, output);
>> +
>> +    igt_create_pattern_fb(display->drm_fd, mode->hdisplay, mode->vdisplay,
>> +                  format, x_modifier, &data->fb[0]);
>> +
>> +    igt_create_pattern_fb(display->drm_fd, mode->vdisplay, mode->hdisplay,
>> +                  format, y_modifier, &data->fb[1]);
>> +
>> +    igt_create_pattern_fb(display->drm_fd, mode->hdisplay, mode->vdisplay,
>> +                  DRM_FORMAT_XRGB8888, x_modifier, &data->fb[2]);
>> +
>> +    igt_create_pattern_fb(display->drm_fd, mode->vdisplay, mode->hdisplay,
>> +                  DRM_FORMAT_XRGB8888, y_modifier, &data->fb[3]);
>> +
>> +    for_each_plane_on_pipe(display, pipe, plane) {
>> +        const int seq[] = {
>> +            2, 0, 2, 1, 3, 1, 3
>> +        };
>> +
>> +        if (!igt_plane_has_format_mod(plane, format, data->fb[0].modifier))
>> +            continue;
>> +
>> +        /* Collect reference crc with toggle in between. */
>> +        for (i = 0; i < ARRAY_SIZE(ref_crc); i++) {
>> +            igt_rotation_t rot = (i == 1 || i == 3) ?
>> +                IGT_ROTATION_90 : IGT_ROTATION_0;
>> +
>> +            set_fb(plane, &data->fb[i], scaled, rot);
>> +
>> +            igt_display_commit2(display, COMMIT_ATOMIC);
>> +            igt_pipe_crc_collect_crc(data->pipe_crc, &ref_crc[i]);
>> +            valid[i] = true;
>> +
>> +            set_fb(plane, NULL, scaled, rot);
>> +            igt_display_commit2(display, COMMIT_ATOMIC);
>> +        }
>> +
>> +        for (i = 0; i < ARRAY_SIZE(seq); i++) {
>> +            int j = seq[i];
>> +            igt_rotation_t rot = (j == 1 || j == 3) ?
>> +                IGT_ROTATION_90 : IGT_ROTATION_0;
>> +
>> +            if (!valid[j])
>> +                continue;
>> +
>> +            set_fb(plane, &data->fb[j], scaled, rot);
>> +            igt_display_commit2(display, COMMIT_ATOMIC);
>> +
>> +            igt_pipe_crc_collect_crc(data->pipe_crc, &crc);
>> +            igt_assert_crc_equal(&ref_crc[j], &crc);
>> +        }
>> +
>> +        /* We only have few scalers, don't use 1 for unused planes */
>> +        igt_plane_set_fb(plane, NULL);
>> +    }
>> +}
>> +
>> +#define assert_collected_crc_equal(pipe_crc, crc, ref_crc) \
>> +    do { \
>> +        igt_pipe_crc_get_current(display->drm_fd, pipe_crc, crc);    \
>> +        igt_assert_crc_equal(ref_crc, crc);    \
>> +    } while (0)
>> +
>> +static void set_src_coords(igt_plane_t *plane, struct igt_fb *fb,
>> +               igt_rotation_t rot, int vis, int hidden)
>> +{
>> +    switch (rot) {
>> +    case IGT_ROTATION_0:
>> +        igt_fb_set_position(fb, plane, fb->width / 2 - vis, fb->height / 2 - vis);
>> +        break;
>> +    case IGT_ROTATION_90:
>> +        igt_fb_set_position(fb, plane, fb->width / 2 - hidden, fb->height / 2 - vis);
>> +        break;
>> +    case IGT_ROTATION_180:
>> +        igt_fb_set_position(fb, plane, fb->width / 2 - hidden, fb->height / 2 - hidden);
>> +        break;
>> +    case IGT_ROTATION_270:
>> +        igt_fb_set_position(fb, plane, fb->width / 2 - vis, fb->height / 2 - hidden);
>> +        break;
>> +    default: igt_assert(0);
> ^^
> This was the only nit I noticed.

What's wrong there? Or do you mean putting it on a newline?

~Maarten

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [igt-dev] [PATCH i-g-t] tests/kms_yuv: Add yuv specific tests, v6.
  2019-06-13 13:14   ` Maarten Lankhorst
@ 2019-06-19  8:09     ` Juha-Pekka Heikkila
  0 siblings, 0 replies; 6+ messages in thread
From: Juha-Pekka Heikkila @ 2019-06-19  8:09 UTC (permalink / raw)
  To: Maarten Lankhorst, igt-dev

On 13.6.2019 16.14, Maarten Lankhorst wrote:
> Op 12-06-2019 om 22:18 schreef Juha-Pekka Heikkila:
>> Sorry for delay Maarten, I've been reading this on several evenings but always was interrupted. I think this look all good.
>>
>> Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
>>
>> On 13.5.2019 19.53, Maarten Lankhorst wrote:
>>> Add tests excercising switching between various scaled/unscaled
>>> transitions to and from various nv12 formats, since some of the
>>> workarounds mention this may fail.
>>>
>>> We also add NV12 specific clipping/scaling tests, to make sure
>>> that YUV src coordinates are always programmed as a multiple of 2
>>> correctly, and verify scaling/clipping works with CRC tests.
>>>
>>> crop-scale-bug shows a corruption when scaling and cropping at the
>>> same time.
>>>
>>> The subpixel clip test rotates and clips a rectangle on each side,
>>> which should produce the same CRC as when that part of the rectangle
>>> is hidden by a cursor and a whole 2x2 pixel is hidden.
>>>
>>> Changes since v1:
>>> - Reset plane position to 0,0 at the start of yuv_valid_width_plane().
>>> - Handle Swati's feedback.
>>> Changes since v2:
>>> - Skip 90°/270° rotation in tests when formats don't support it.
>>> - Add all new HDR formats to test.
>>> - Use igt_plane_has_format_mod.
>>> - Support tests on !i915 by checking if X/Y tiling modifiers are supported.
>>> - Do not enable untested planes to prevent exhausing memory bandwidth
>>>     and available NV12 Y planes in the rgb-switch-scaled test.
>>> Changes since v3:
>>> - Add a sanity test to sanity test YUV conversion paths, on all planes and pipes.
>>> - Dynamically generate list of YUV tests through igt_format_array_fill.
>>> Changes since v4:
>>> - Decrease size to 64x64 to reduce test execution time even more,
>>>     some YUV conversion routines are slow.
>>> - Don't clear degamma/ctm, this is done in core now.
>>> Changes since v5:
>>> - Fix minor compile error.
>>> - Add missing igt_subtest_group
>>>
>>> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>>> ---
>>>    tests/Makefile.sources |   1 +
>>>    tests/kms_yuv.c        | 937 +++++++++++++++++++++++++++++++++++++++++
>>>    tests/meson.build      |   1 +
>>>    3 files changed, 939 insertions(+)
>>>    create mode 100644 tests/kms_yuv.c
>>>
>>> diff --git a/tests/Makefile.sources b/tests/Makefile.sources
>>> index 7f921f6c5988..574861b2e30f 100644
>>> --- a/tests/Makefile.sources
>>> +++ b/tests/Makefile.sources
>>> @@ -75,6 +75,7 @@ TESTS_progs = \
>>>        kms_universal_plane \
>>>        kms_vblank \
>>>        kms_vrr \
>>> +    kms_yuv \
>>>        meta_test \
>>>        perf \
>>>        perf_pmu \
>>> diff --git a/tests/kms_yuv.c b/tests/kms_yuv.c
>>> new file mode 100644
>>> index 000000000000..6cf69b0504f8
>>> --- /dev/null
>>> +++ b/tests/kms_yuv.c
>>> @@ -0,0 +1,937 @@
>>> +/*
>>> + * Copyright © 2019 Intel Corporation
>>> + *
>>> + * Permission is hereby granted, free of charge, to any person obtaining a
>>> + * copy of this software and associated documentation files (the "Software"),
>>> + * to deal in the Software without restriction, including without limitation
>>> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
>>> + * and/or sell copies of the Software, and to permit persons to whom the
>>> + * Software is furnished to do so, subject to the following conditions:
>>> + *
>>> + * The above copyright notice and this permission notice shall be included in
>>> + * all copies or substantial portions of the Software.
>>> + *
>>> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
>>> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
>>> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
>>> + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
>>> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
>>> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
>>> + * IN THE SOFTWARE.
>>> + *
>>> + * Authors:
>>> + *    Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>>> + */
>>> +#include "config.h"
>>> +
>>> +#include "igt.h"
>>> +#include <cairo.h>
>>> +#include <errno.h>
>>> +#include <stdint.h>
>>> +#include <unistd.h>
>>> +#include <sys/time.h>
>>> +
>>> +typedef struct {
>>> +    igt_display_t display;
>>> +
>>> +    igt_pipe_crc_t *pipe_crc;
>>> +    struct igt_fb fb[6];
>>> +} data_t;
>>> +
>>> +static uint64_t x_modifier = LOCAL_DRM_FORMAT_MOD_NONE;
>>> +static uint64_t y_modifier = LOCAL_DRM_FORMAT_MOD_NONE;
>>> +static uint32_t *formats, count_formats;
>>> +
>>> +static bool pipe_supports_format(igt_display_t *display, enum pipe pipe,
>>> +                 uint32_t format, uint64_t tiling)
>>> +{
>>> +    igt_plane_t *plane;
>>> +
>>> +    for_each_plane_on_pipe(display, pipe, plane)
>>> +        if (igt_plane_has_format_mod(plane, format, tiling))
>>> +            return true;
>>> +
>>> +    return false;
>>> +}
>>> +
>>> +
>>> +static void remove_fbs(data_t *data)
>>> +{
>>> +    int i;
>>> +
>>> +    for (i = 0; i < ARRAY_SIZE(data->fb); i++)
>>> +        igt_remove_fb(data->display.drm_fd, &data->fb[i]);
>>> +}
>>> +
>>> +static void prepare_crtc(data_t *data, enum pipe pipe, igt_output_t *output)
>>> +{
>>> +    igt_display_t *display = &data->display;
>>> +
>>> +    remove_fbs(data);
>>> +    igt_display_reset(display);
>>> +    igt_output_set_pipe(output, pipe);
>>> +    igt_display_commit2(display, COMMIT_ATOMIC);
>>> +
>>> +    igt_pipe_crc_free(data->pipe_crc);
>>> +    data->pipe_crc = igt_pipe_crc_new(display->drm_fd, pipe,
>>> +                      INTEL_PIPE_CRC_SOURCE_AUTO);
>>> +}
>>> +
>>> +static void fudge_lut(data_t *data, enum pipe pipe, uint16_t mask)
>>> +{
>>> +    igt_pipe_t *pipe_obj = &data->display.pipes[pipe];
>>> +    uint16_t *lut;
>>> +    int i, lut_size;
>>> +
>>> +    if (!igt_pipe_obj_has_prop(pipe_obj, IGT_CRTC_GAMMA_LUT_SIZE))
>>> +        return;
>>> +
>>> +    lut_size = igt_pipe_obj_get_prop(pipe_obj, IGT_CRTC_GAMMA_LUT_SIZE);
>>> +
>>> +    lut = malloc(sizeof(uint16_t) * lut_size);
>>> +    for (i = 0; i < lut_size; i++)
>>> +        lut[i] = (i * 0xffff / (lut_size - 1)) & mask;
>>> +
>>> +    igt_pipe_obj_replace_prop_blob(pipe_obj, IGT_CRTC_GAMMA_LUT, lut, lut_size * sizeof(uint16_t));
>>> +    free(lut);
>>> +}
>>> +
>>> +static void unfudge_lut(data_t *data, enum pipe pipe)
>>> +{
>>> +    igt_pipe_t *pipe_obj = &data->display.pipes[pipe];
>>> +
>>> +    if (igt_pipe_obj_has_prop(pipe_obj, IGT_CRTC_GAMMA_LUT))
>>> +        igt_pipe_obj_replace_prop_blob(pipe_obj, IGT_CRTC_GAMMA_LUT, NULL, 0);
>>> +}
>>> +
>>> +/*
>>> + * Test that we initialize a YUV fb as black correctly,
>>> + * that when we write a black FB it will get the same CRC, and that
>>> + * all colors we test will give the same CRC on all formats.
>>> + */
>>> +static void yuv_sanity(data_t *data, enum pipe pipe, igt_output_t *output)
>>> +{
>>> +    igt_display_t *display = &data->display;
>>> +    igt_plane_t *plane;
>>> +    igt_crc_t black_crc, color_crc, crc;
>>> +    bool first = true;
>>> +
>>> +    prepare_crtc(data, pipe, output);
>>> +
>>> +    for_each_plane_on_pipe(display, pipe, plane) {
>>> +        for (int i = 0; i < count_formats; i++) {
>>> +            struct igt_fb *fb = &data->fb[0];
>>> +            cairo_t *cr;
>>> +
>>> +            if (!igt_format_is_yuv(formats[i]) ||
>>> +                !igt_plane_has_format_mod(plane, formats[i], x_modifier))
>>> +                continue;
>>> +
>>> +            igt_debug("Testing format %.4s on plane %i\n",
>>> +                 (char *)&formats[i], plane->index);
>>> +            igt_create_fb(display->drm_fd, 64, 64, formats[i],
>>> +                      x_modifier, fb);
>>> +
>>> +            igt_plane_set_fb(plane, fb);
>>> +            igt_display_commit2(display, COMMIT_ATOMIC);
>>> +            if (!first) {
>>> +                igt_pipe_crc_collect_crc(data->pipe_crc, &crc);
>>> +                igt_assert_crc_equal(&black_crc, &crc);
>>> +            } else {
>>> +                igt_pipe_crc_collect_crc(data->pipe_crc, &black_crc);
>>> +            }
>>> +
>>> +            /* Compare initial black fb with reference painted black color */
>>> +            cr = igt_get_cairo_ctx(display->drm_fd, fb);
>>> +            igt_paint_color(cr, 0, 0, fb->width, fb->height, 0., 0., 0.);
>>> +            igt_put_cairo_ctx(display->drm_fd, fb, cr);
>>> +            igt_dirty_fb(display->drm_fd, fb);
>>> +            igt_wait_for_vblank(display->drm_fd, pipe);
>>> +            igt_pipe_crc_collect_crc(data->pipe_crc, &crc);
>>> +            igt_assert_crc_equal(&black_crc, &crc);
>>> +
>>> +
>>> +            /* Write a color fb */
>>> +            cr = igt_get_cairo_ctx(display->drm_fd, fb);
>>> +            igt_paint_color(cr, 0, 0, fb->width, fb->height, 1., 1., 0.);
>>> +            igt_put_cairo_ctx(display->drm_fd, fb, cr);
>>> +            fudge_lut(data, pipe, 0xfc00);
>>> +            igt_plane_set_fb(plane, fb);
>>> +            igt_display_commit2(display, COMMIT_ATOMIC);
>>> +
>>> +            if (!first) {
>>> +                igt_pipe_crc_collect_crc(data->pipe_crc, &crc);
>>> +                igt_assert_crc_equal(&color_crc, &crc);
>>> +            } else {
>>> +                igt_pipe_crc_collect_crc(data->pipe_crc, &color_crc);
>>> +                first = false;
>>> +            }
>>> +
>>> +            /* Convert from YUV, back to YUV, to expose bugs in conversion routines */
>>> +            cr = igt_get_cairo_ctx(display->drm_fd, fb);
>>> +            igt_put_cairo_ctx(display->drm_fd, fb, cr);
>>> +            igt_dirty_fb(display->drm_fd, fb);
>>> +            igt_wait_for_vblank(display->drm_fd, pipe);
>>> +            igt_pipe_crc_collect_crc(data->pipe_crc, &crc);
>>> +            igt_assert_crc_equal(&color_crc, &crc);
>>> +
>>> +            unfudge_lut(data, pipe);
>>> +            igt_plane_set_fb(plane, NULL);
>>> +            igt_remove_fb(display->drm_fd, &data->fb[0]);
>>> +        }
>>> +    }
>>> +}
>>> +
>>> +static void set_fb(igt_plane_t *plane, struct igt_fb *fb,
>>> +           bool scaled, igt_rotation_t rot)
>>> +{
>>> +    igt_plane_set_fb(plane, fb);
>>> +
>>> +    if (scaled && fb)
>>> +        igt_fb_set_size(fb, plane, fb->width, 16);
>>> +
>>> +    igt_plane_set_rotation(plane, rot);
>>> +    if (fb && (rot == IGT_ROTATION_90 || rot == IGT_ROTATION_270))
>>> +        igt_plane_set_size(plane, fb->height, fb->width);
>>> +}
>>> +
>>> +static void yuv_rgb_switch(data_t *data, enum pipe pipe,
>>> +               igt_output_t *output, bool scaled, unsigned format)
>>> +{
>>> +    drmModeModeInfo *mode = igt_output_get_mode(output);
>>> +    igt_display_t *display = &data->display;
>>> +    igt_plane_t *plane;
>>> +    int i;
>>> +    igt_crc_t ref_crc[4], crc;
>>> +    bool valid[4] = {};
>>> +
>>> +    prepare_crtc(data, pipe, output);
>>> +
>>> +    igt_create_pattern_fb(display->drm_fd, mode->hdisplay, mode->vdisplay,
>>> +                  format, x_modifier, &data->fb[0]);
>>> +
>>> +    igt_create_pattern_fb(display->drm_fd, mode->vdisplay, mode->hdisplay,
>>> +                  format, y_modifier, &data->fb[1]);
>>> +
>>> +    igt_create_pattern_fb(display->drm_fd, mode->hdisplay, mode->vdisplay,
>>> +                  DRM_FORMAT_XRGB8888, x_modifier, &data->fb[2]);
>>> +
>>> +    igt_create_pattern_fb(display->drm_fd, mode->vdisplay, mode->hdisplay,
>>> +                  DRM_FORMAT_XRGB8888, y_modifier, &data->fb[3]);
>>> +
>>> +    for_each_plane_on_pipe(display, pipe, plane) {
>>> +        const int seq[] = {
>>> +            2, 0, 2, 1, 3, 1, 3
>>> +        };
>>> +
>>> +        if (!igt_plane_has_format_mod(plane, format, data->fb[0].modifier))
>>> +            continue;
>>> +
>>> +        /* Collect reference crc with toggle in between. */
>>> +        for (i = 0; i < ARRAY_SIZE(ref_crc); i++) {
>>> +            igt_rotation_t rot = (i == 1 || i == 3) ?
>>> +                IGT_ROTATION_90 : IGT_ROTATION_0;
>>> +
>>> +            set_fb(plane, &data->fb[i], scaled, rot);
>>> +
>>> +            igt_display_commit2(display, COMMIT_ATOMIC);
>>> +            igt_pipe_crc_collect_crc(data->pipe_crc, &ref_crc[i]);
>>> +            valid[i] = true;
>>> +
>>> +            set_fb(plane, NULL, scaled, rot);
>>> +            igt_display_commit2(display, COMMIT_ATOMIC);
>>> +        }
>>> +
>>> +        for (i = 0; i < ARRAY_SIZE(seq); i++) {
>>> +            int j = seq[i];
>>> +            igt_rotation_t rot = (j == 1 || j == 3) ?
>>> +                IGT_ROTATION_90 : IGT_ROTATION_0;
>>> +
>>> +            if (!valid[j])
>>> +                continue;
>>> +
>>> +            set_fb(plane, &data->fb[j], scaled, rot);
>>> +            igt_display_commit2(display, COMMIT_ATOMIC);
>>> +
>>> +            igt_pipe_crc_collect_crc(data->pipe_crc, &crc);
>>> +            igt_assert_crc_equal(&ref_crc[j], &crc);
>>> +        }
>>> +
>>> +        /* We only have few scalers, don't use 1 for unused planes */
>>> +        igt_plane_set_fb(plane, NULL);
>>> +    }
>>> +}
>>> +
>>> +#define assert_collected_crc_equal(pipe_crc, crc, ref_crc) \
>>> +    do { \
>>> +        igt_pipe_crc_get_current(display->drm_fd, pipe_crc, crc);    \
>>> +        igt_assert_crc_equal(ref_crc, crc);    \
>>> +    } while (0)
>>> +
>>> +static void set_src_coords(igt_plane_t *plane, struct igt_fb *fb,
>>> +               igt_rotation_t rot, int vis, int hidden)
>>> +{
>>> +    switch (rot) {
>>> +    case IGT_ROTATION_0:
>>> +        igt_fb_set_position(fb, plane, fb->width / 2 - vis, fb->height / 2 - vis);
>>> +        break;
>>> +    case IGT_ROTATION_90:
>>> +        igt_fb_set_position(fb, plane, fb->width / 2 - hidden, fb->height / 2 - vis);
>>> +        break;
>>> +    case IGT_ROTATION_180:
>>> +        igt_fb_set_position(fb, plane, fb->width / 2 - hidden, fb->height / 2 - hidden);
>>> +        break;
>>> +    case IGT_ROTATION_270:
>>> +        igt_fb_set_position(fb, plane, fb->width / 2 - vis, fb->height / 2 - hidden);
>>> +        break;
>>> +    default: igt_assert(0);
>> ^^
>> This was the only nit I noticed.
> 
> What's wrong there? Or do you mean putting it on a newline?
yes, default case on its own line but its just minor type detail.

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-06-19  8:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-13 16:53 [igt-dev] [PATCH i-g-t] tests/kms_yuv: Add yuv specific tests, v6 Maarten Lankhorst
2019-05-13 17:29 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2019-05-13 22:28 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2019-06-12 20:18 ` [igt-dev] [PATCH i-g-t] " Juha-Pekka Heikkila
2019-06-13 13:14   ` Maarten Lankhorst
2019-06-19  8:09     ` Juha-Pekka Heikkila

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.