All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t 1/2] tests/kms_cursor_crc: Separate hw and sw runs on tests
@ 2021-08-17  9:27 Juha-Pekka Heikkila
  2021-08-17  9:27 ` [igt-dev] [PATCH i-g-t 2/2] tests/kms_plane_alpha_blend: reset display after test Juha-Pekka Heikkila
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Juha-Pekka Heikkila @ 2021-08-17  9:27 UTC (permalink / raw)
  To: igt-dev; +Cc: Juha-Pekka Heikkila

Reset display structure settings and commit them in before starting
test in case some earlier test left tail.

Separate hw and sw test runs for optimizing test.

Simple cleanup.

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

diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c
index a9bc3a745..f478ae08d 100644
--- a/tests/kms_cursor_crc.c
+++ b/tests/kms_cursor_crc.c
@@ -46,10 +46,17 @@ IGT_TEST_DESCRIPTION(
 #define DRM_CAP_CURSOR_HEIGHT 0x9
 #endif
 
+enum cursor_buffers {
+	HWCURSORBUFFER,
+	SWCOMPARISONBUFFER1,
+	SWCOMPARISONBUFFER2,
+	MAXCURSORBUFFER
+};
+
 typedef struct {
 	int drm_fd;
 	igt_display_t display;
-	struct igt_fb primary_fb[2];
+	struct igt_fb primary_fb[MAXCURSORBUFFER];
 	struct igt_fb fb;
 	igt_output_t *output;
 	enum pipe pipe;
@@ -70,29 +77,40 @@ typedef struct {
 #define TEST_DPMS (1<<0)
 #define TEST_SUSPEND (1<<1)
 
-#define HWCURSORBUFFER 0
-#define SWCOMPARISONBUFFER 1
+#define RED 1.0, 0.0, 0.0
+#define GREEN 0.0, 1.0, 0.0
+#define BLUE 0.0, 0.0, 1.0
+#define WHITE 1.0, 1.0, 1.0
+
+typedef struct {
+	int x;
+	int y;
+	int width;
+	int height;
+} cursorarea;
 
-static void draw_cursor(cairo_t *cr, int x, int y, int cw, int ch, double a)
+static void draw_cursor(cairo_t *cr, cursorarea *cursor)
 {
 	int wl, wr, ht, hb;
 
 	/* deal with odd cursor width/height */
-	wl = cw / 2;
-	wr = (cw + 1) / 2;
-	ht = ch / 2;
-	hb = (ch + 1) / 2;
+	wl = cursor->width / 2;
+	wr = (cursor->width + 1) / 2;
+	ht = cursor->height / 2;
+	hb = (cursor->height + 1) / 2;
 
 	/* Cairo doesn't like to be fed numbers that are too wild */
-	if ((x < SHRT_MIN) || (x > SHRT_MAX) || (y < SHRT_MIN) || (y > SHRT_MAX))
+	if ((cursor->x < SHRT_MIN) || (cursor->x > SHRT_MAX) ||
+	    (cursor->y < SHRT_MIN) || (cursor->y > SHRT_MAX))
 		return;
+
 	cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
 	cairo_set_antialias(cr, CAIRO_ANTIALIAS_NONE);
 	/* 4 color rectangles in the corners, RGBY */
-	igt_paint_color_alpha(cr, x,      y,      wl, ht, 1.0, 0.0, 0.0, a);
-	igt_paint_color_alpha(cr, x + wl, y,      wr, ht, 0.0, 1.0, 0.0, a);
-	igt_paint_color_alpha(cr, x,      y + ht, wl, hb, 0.0, 0.0, 1.0, a);
-	igt_paint_color_alpha(cr, x + wl, y + ht, wr, hb, 1.0, 1.0, 1.0, a);
+	igt_paint_color(cr, cursor->x, cursor->y, wl, ht, RED);
+	igt_paint_color(cr, cursor->x + wl, cursor->y, wr, ht, GREEN);
+	igt_paint_color(cr, cursor->x, cursor->y + ht, wl, hb, BLUE);
+	igt_paint_color(cr, cursor->x + wl, cursor->y + ht, wr, hb, WHITE);
 }
 
 static void cursor_enable(data_t *data)
@@ -144,7 +162,7 @@ static bool cursor_visible(data_t *data, int x, int y)
 	return true;
 }
 
-static void restore_image(data_t *data, uint32_t buffer)
+static void restore_image(data_t *data, uint32_t buffer, cursorarea *cursor)
 {
 	cairo_t *cr;
 
@@ -153,80 +171,84 @@ static void restore_image(data_t *data, uint32_t buffer)
 	cairo_set_source_surface(cr, data->surface, 0, 0);
 	cairo_rectangle(cr, 0, 0, data->screenw, data->screenh);
 	cairo_fill(cr);
+
+	if (cursor)
+		draw_cursor(cr, cursor);
+
 	igt_put_cairo_ctx(cr);
 }
 
-static void do_single_test(data_t *data, int x, int y)
+static void do_single_test(data_t *data, int x, int y, bool hw_test,
+			   igt_crc_t *hwcrc)
 {
 	igt_display_t *display = &data->display;
 	igt_pipe_crc_t *pipe_crc = data->pipe_crc;
-	igt_crc_t crc, ref_crc;
-	cairo_t *cr;
-	int ret = 0;
+	igt_crc_t crc;
+	int ret = 0, swbufidx;
 
 	igt_print_activity();
 
-	/* Hardware test */
-	igt_plane_set_position(data->cursor, x, y);
-	cursor_enable(data);
+	if (hw_test) {
+		/* Hardware test */
+		igt_plane_set_position(data->cursor, x, y);
 
-	if (chv_cursor_broken(data, x) && cursor_visible(data, x, y)) {
-		ret = igt_display_try_commit2(display, COMMIT_LEGACY);
-		igt_assert_eq(ret, -EINVAL);
-		igt_plane_set_position(data->cursor, 0, y);
-		return;
-	}
+		if (chv_cursor_broken(data, x) && cursor_visible(data, x, y)) {
+			ret = igt_display_try_commit2(display, COMMIT_LEGACY);
+			igt_assert_eq(ret, -EINVAL);
+			igt_plane_set_position(data->cursor, 0, y);
+			return;
+		}
 
-	igt_plane_set_fb(data->primary, &data->primary_fb[HWCURSORBUFFER]);
-	igt_display_commit(display);
+		igt_display_commit(display);
 
-	/* Extra vblank wait is because nonblocking cursor ioctl */
-	igt_wait_for_vblank(data->drm_fd,
-			    display->pipes[data->pipe].crtc_offset);
+		/* Extra vblank wait is because nonblocking cursor ioctl */
+		igt_wait_for_vblank(data->drm_fd,
+				display->pipes[data->pipe].crtc_offset);
 
-	igt_pipe_crc_get_current(data->drm_fd, pipe_crc, &crc);
-	restore_image(data, SWCOMPARISONBUFFER);
+		igt_pipe_crc_get_current(data->drm_fd, pipe_crc, hwcrc);
 
-	if (data->flags & (TEST_DPMS | TEST_SUSPEND)) {
-		igt_crc_t crc_after;
-		/*
-		 * stop/start crc to avoid dmesg notifications about userspace
-		 * reading too slow.
-		 */
-		igt_pipe_crc_stop(pipe_crc);
-
-		if (data->flags & TEST_DPMS) {
-			igt_debug("dpms off/on cycle\n");
-			kmstest_set_connector_dpms(data->drm_fd,
-						   data->output->config.connector,
-						   DRM_MODE_DPMS_OFF);
-			kmstest_set_connector_dpms(data->drm_fd,
-						   data->output->config.connector,
-						   DRM_MODE_DPMS_ON);
+		if (data->flags & (TEST_DPMS | TEST_SUSPEND)) {
+			igt_crc_t crc_after;
+			/*
+			* stop/start crc to avoid dmesg notifications about userspace
+			* reading too slow.
+			*/
+			igt_pipe_crc_stop(pipe_crc);
+
+			if (data->flags & TEST_DPMS) {
+				igt_debug("dpms off/on cycle\n");
+				kmstest_set_connector_dpms(data->drm_fd,
+							data->output->config.connector,
+							DRM_MODE_DPMS_OFF);
+				kmstest_set_connector_dpms(data->drm_fd,
+							data->output->config.connector,
+							DRM_MODE_DPMS_ON);
+			}
+
+			if (data->flags & TEST_SUSPEND)
+				igt_system_suspend_autoresume(SUSPEND_STATE_MEM,
+							SUSPEND_TEST_NONE);
+
+			igt_pipe_crc_start(pipe_crc);
+			igt_pipe_crc_get_current(data->drm_fd, pipe_crc, &crc_after);
+			igt_assert_crc_equal(hwcrc, &crc_after);
 		}
+	} else {
+		/* Now render the same in software and collect crc */
+		swbufidx = (data->primary->drm_plane->fb_id ==
+			    data->primary_fb[SWCOMPARISONBUFFER1].fb_id) ?
+			    SWCOMPARISONBUFFER2 : SWCOMPARISONBUFFER1;
 
-		if (data->flags & TEST_SUSPEND)
-			igt_system_suspend_autoresume(SUSPEND_STATE_MEM,
-						      SUSPEND_TEST_NONE);
-
-		igt_pipe_crc_start(pipe_crc);
-		igt_pipe_crc_get_current(data->drm_fd, pipe_crc, &crc_after);
-		igt_assert_crc_equal(&crc, &crc_after);
-	}
-
-	/* Now render the same in software and collect crc */
-	cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb[SWCOMPARISONBUFFER]);
-	draw_cursor(cr, x, y, data->curw, data->curh, 1.0);
-	igt_put_cairo_ctx(cr);
-	igt_plane_set_fb(data->primary, &data->primary_fb[SWCOMPARISONBUFFER]);
-	cursor_disable(data);
-	igt_display_commit(display);
+		restore_image(data, swbufidx, &((cursorarea){x, y, data->curw, data->curh}));
+		igt_plane_set_fb(data->primary, &data->primary_fb[swbufidx]);
 
-	igt_wait_for_vblank(data->drm_fd,
-			display->pipes[data->pipe].crtc_offset);
+		igt_display_commit(display);
+		igt_wait_for_vblank(data->drm_fd,
+				display->pipes[data->pipe].crtc_offset);
 
-	igt_pipe_crc_get_current(data->drm_fd, pipe_crc, &ref_crc);
-	igt_assert_crc_equal(&crc, &ref_crc);
+		igt_pipe_crc_get_current(data->drm_fd, pipe_crc, &crc);
+		igt_assert_crc_equal(&crc, hwcrc);
+	}
 }
 
 static void do_fail_test(data_t *data, int x, int y, int expect)
@@ -248,70 +270,112 @@ static void do_fail_test(data_t *data, int x, int y, int expect)
 	igt_assert_eq(ret, expect);
 }
 
-static void do_test(data_t *data,
-		    int left, int right, int top, int bottom)
+static void do_test(data_t *data, const cursorarea *coords, igt_crc_t crc[4],
+		    bool hwtest)
 {
-	do_single_test(data, left, top);
-	do_single_test(data, right, top);
-	do_single_test(data, right, bottom);
-	do_single_test(data, left, bottom);
+	do_single_test(data, coords->x, coords->width, hwtest, &crc[0]);
+	do_single_test(data, coords->y, coords->width, hwtest, &crc[1]);
+	do_single_test(data, coords->y, coords->height, hwtest, &crc[2]);
+	do_single_test(data, coords->x, coords->height, hwtest, &crc[3]);
 }
 
 static void test_crc_onscreen(data_t *data)
 {
-	int left = data->left;
-	int right = data->right;
-	int top = data->top;
-	int bottom = data->bottom;
-	int cursor_w = data->curw;
-	int cursor_h = data->curh;
-
-	/* fully inside  */
-	do_test(data, left, right, top, bottom);
-
-	/* 2 pixels inside */
-	do_test(data, left - (cursor_w-2), right + (cursor_w-2), top               , bottom               );
-	do_test(data, left               , right               , top - (cursor_h-2), bottom + (cursor_h-2));
-	do_test(data, left - (cursor_w-2), right + (cursor_w-2), top - (cursor_h-2), bottom + (cursor_h-2));
-
-	/* 1 pixel inside */
-	do_test(data, left - (cursor_w-1), right + (cursor_w-1), top               , bottom               );
-	do_test(data, left               , right               , top - (cursor_h-1), bottom + (cursor_h-1));
-	do_test(data, left - (cursor_w-1), right + (cursor_w-1), top - (cursor_h-1), bottom + (cursor_h-1));
+	const int left = data->left;
+	const int right = data->right;
+	const int top = data->top;
+	const int bottom = data->bottom;
+	const int cursor_w = data->curw;
+	const int cursor_h = data->curh;
+
+	struct {
+		const cursorarea coords;
+		igt_crc_t crc[4];
+	} tests[] = {
+		/* fully inside  */
+		{{left, right, top, bottom}},
+		/* 2 pixels inside */
+		{{left - (cursor_w - 2), right + (cursor_w - 2), top, bottom}},
+		{{left, right, top - (cursor_h - 2), bottom + (cursor_h - 2)}},
+		{{left - (cursor_w - 2), right + (cursor_w - 2),
+		  top - (cursor_h - 2), bottom + (cursor_h - 2)}},
+		/* 1 pixel inside */
+		{{left - (cursor_w - 1), right + (cursor_w - 1), top, bottom}},
+		{{left, right, top - (cursor_h - 1), bottom + (cursor_h - 1)}},
+		{{left - (cursor_w - 1), right + (cursor_w - 1),
+		  top - (cursor_h - 1), bottom + (cursor_h - 1)}},
+	};
+
+	/* HW test */
+	cursor_enable(data);
+	igt_plane_set_fb(data->primary, &data->primary_fb[HWCURSORBUFFER]);
+	for (int i = 0; i < ARRAY_SIZE(tests); i++)
+		do_test(data, &tests[i].coords, tests[i].crc, true);
+
+	/* SW test */
+	cursor_disable(data);
+	for (int i = 0; i < ARRAY_SIZE(tests); i++)
+		do_test(data, &tests[i].coords, tests[i].crc, false);
 }
 
 static void test_crc_offscreen(data_t *data)
 {
-	int left = data->left;
-	int right = data->right;
-	int top = data->top;
-	int bottom = data->bottom;
-	int cursor_w = data->curw;
-	int cursor_h = data->curh;
-
-	/* fully outside */
-	do_test(data, left - (cursor_w), right + (cursor_w), top             , bottom             );
-	do_test(data, left             , right             , top - (cursor_h), bottom + (cursor_h));
-	do_test(data, left - (cursor_w), right + (cursor_w), top - (cursor_h), bottom + (cursor_h));
-
-	/* fully outside by 1 extra pixels */
-	do_test(data, left - (cursor_w+1), right + (cursor_w+1), top               , bottom               );
-	do_test(data, left               , right               , top - (cursor_h+1), bottom + (cursor_h+1));
-	do_test(data, left - (cursor_w+1), right + (cursor_w+1), top - (cursor_h+1), bottom + (cursor_h+1));
-
-	/* fully outside by 2 extra pixels */
-	do_test(data, left - (cursor_w+2), right + (cursor_w+2), top               , bottom               );
-	do_test(data, left               , right               , top - (cursor_h+2), bottom + (cursor_h+2));
-	do_test(data, left - (cursor_w+2), right + (cursor_w+2), top - (cursor_h+2), bottom + (cursor_h+2));
-
-	/* fully outside by a lot of extra pixels */
-	do_test(data, left - (cursor_w+512), right + (cursor_w+512), top                 , bottom                 );
-	do_test(data, left                 , right                 , top - (cursor_h+512), bottom + (cursor_h+512));
-	do_test(data, left - (cursor_w+512), right + (cursor_w+512), top - (cursor_h+512), bottom + (cursor_h+512));
-
-	/* go nuts */
-	do_test(data, INT_MIN, INT_MAX - cursor_w, INT_MIN, INT_MAX - cursor_h);
-	do_test(data, SHRT_MIN, SHRT_MAX, SHRT_MIN, SHRT_MAX);
+	const int left = data->left;
+	const int right = data->right;
+	const int top = data->top;
+	const int bottom = data->bottom;
+	const int cursor_w = data->curw;
+	const int cursor_h = data->curh;
+
+	struct {
+		const cursorarea coords;
+		igt_crc_t crc[4];
+	} tests[] = {
+		/* fully outside */
+		{{left - (cursor_w), right + (cursor_w), top, bottom}},
+		{{left, right, top - (cursor_h), bottom + (cursor_h)}},
+		{{left - (cursor_w), right + (cursor_w), top - (cursor_h),
+		  bottom + (cursor_h)}},
+		/* fully outside by 1 extra pixels */
+		{{left - (cursor_w + 1), right + (cursor_w + 1), top, bottom}},
+		{{left, right, top - (cursor_h + 1), bottom + (cursor_h + 1)}},
+		{{left - (cursor_w + 1), right + (cursor_w + 1),
+		  top - (cursor_h + 1), bottom + (cursor_h + 1)}},
+		/* fully outside by 2 extra pixels */
+		{{left - (cursor_w + 2), right + (cursor_w + 2), top, bottom}},
+		{{left, right, top - (cursor_h + 2), bottom + (cursor_h + 2)}},
+		{{left - (cursor_w + 2), right + (cursor_w + 2),
+		  top - (cursor_h + 2), bottom + (cursor_h + 2)}},
+		/* fully outside by a lot of extra pixels */
+		{{left - (cursor_w + 512), right + (cursor_w + 512), top, bottom}},
+		{{left, right, top - (cursor_h + 512), bottom + (cursor_h + 512)}},
+		{{left - (cursor_w + 512), right + (cursor_w + 512),
+		  top - (cursor_h + 512), bottom + (cursor_h + 512)}},
+		/* go nuts */
+		{{INT_MIN, INT_MAX - cursor_w, INT_MIN, INT_MAX - cursor_h}},
+		{{SHRT_MIN, SHRT_MAX, SHRT_MIN, SHRT_MAX}},
+	};
+
+	/* HW test */
+	cursor_enable(data);
+	igt_plane_set_fb(data->primary, &data->primary_fb[HWCURSORBUFFER]);
+	for (int i = 0; i < ARRAY_SIZE(tests); i++)
+		do_test(data, &tests[i].coords, tests[i].crc, true);
+
+	/* SW test */
+	cursor_disable(data);
+	/*
+	 * all these crc's should be the same, actually render only first image
+	 * to check crc and then compare rest of crc are matching
+	 */
+	do_test(data, &tests[0].coords, tests[0].crc, false);
+
+	for (int i = 1; i < ARRAY_SIZE(tests); i++) {
+		igt_assert_crc_equal(&tests[0].crc[0], &tests[i].crc[0]);
+		igt_assert_crc_equal(&tests[0].crc[0], &tests[i].crc[1]);
+		igt_assert_crc_equal(&tests[0].crc[0], &tests[i].crc[2]);
+		igt_assert_crc_equal(&tests[0].crc[0], &tests[i].crc[3]);
+	}
 
 	/* Make sure we get -ERANGE on integer overflow */
 	do_fail_test(data, INT_MAX - cursor_w + 1, INT_MAX - cursor_h + 1, -ERANGE);
@@ -320,29 +384,57 @@ static void test_crc_offscreen(data_t *data)
 static void test_crc_sliding(data_t *data)
 {
 	int i;
+	struct {
+		igt_crc_t crc[3];
+	} rounds[16] = {};
 
 	/* Make sure cursor moves smoothly and pixel-by-pixel, and that there are
 	 * no alignment issues. Horizontal, vertical and diagonal test.
 	 */
-	for (i = 0; i < 16; i++) {
-		do_single_test(data, i, 0);
-		do_single_test(data, 0, i);
-		do_single_test(data, i, i);
+
+	/* HW test */
+	cursor_enable(data);
+	igt_plane_set_fb(data->primary, &data->primary_fb[HWCURSORBUFFER]);
+
+	for (i = 0; i < ARRAY_SIZE(rounds); i++) {
+		do_single_test(data, i, 0, true, &rounds[i].crc[0]);
+		do_single_test(data, 0, i, true, &rounds[i].crc[1]);
+		do_single_test(data, i, i, true, &rounds[i].crc[2]);
+	}
+
+	/* SW test */
+	cursor_disable(data);
+	for (i = 0; i < ARRAY_SIZE(rounds); i++) {
+		do_single_test(data, i, 0, false, &rounds[i].crc[0]);
+		do_single_test(data, 0, i, false, &rounds[i].crc[1]);
+		do_single_test(data, i, i, false, &rounds[i].crc[2]);
 	}
 }
 
 static void test_crc_random(data_t *data)
 {
-	int i, max;
+	igt_crc_t crc[50];
+	int i, max, x[ARRAY_SIZE(crc)], y[ARRAY_SIZE(crc)];
 
-	max = data->flags & (TEST_DPMS | TEST_SUSPEND) ? 2 : 50;
+	max = data->flags & (TEST_DPMS | TEST_SUSPEND) ? 2 : ARRAY_SIZE(crc);
 
 	/* Random cursor placement */
+
+	/* HW test */
+	cursor_enable(data);
+	igt_plane_set_fb(data->primary, &data->primary_fb[HWCURSORBUFFER]);
+
 	for (i = 0; i < max; i++) {
-		int x = rand() % (data->screenw + data->curw * 2) - data->curw;
-		int y = rand() % (data->screenh + data->curh * 2) - data->curh;
-		do_single_test(data, x, y);
+		x[i] = rand() % (data->screenw + data->curw * 2) - data->curw;
+		y[i] = rand() % (data->screenh + data->curh * 2) - data->curh;
+		do_single_test(data, x[i], y[i], true, &crc[i]);
 	}
+
+	/* SW test */
+	cursor_disable(data);
+	for (i = 0; i < max; i++)
+		do_single_test(data, x[i], y[i], false, &crc[i]);
+
 }
 
 static void cleanup_crtc(data_t *data)
@@ -362,7 +454,8 @@ static void cleanup_crtc(data_t *data)
 	igt_display_commit(display);
 
 	igt_remove_fb(data->drm_fd, &data->primary_fb[HWCURSORBUFFER]);
-	igt_remove_fb(data->drm_fd, &data->primary_fb[SWCOMPARISONBUFFER]);
+	igt_remove_fb(data->drm_fd, &data->primary_fb[SWCOMPARISONBUFFER1]);
+	igt_remove_fb(data->drm_fd, &data->primary_fb[SWCOMPARISONBUFFER2]);
 
 	igt_display_reset(display);
 }
@@ -379,22 +472,22 @@ static void prepare_crtc(data_t *data, igt_output_t *output,
 
 	/* create and set the primary plane fbs */
 	mode = igt_output_get_mode(output);
-	igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
-			    DRM_FORMAT_XRGB8888,
-			    DRM_FORMAT_MOD_NONE,
-			    0.0, 0.0, 0.0,
-			    &data->primary_fb[HWCURSORBUFFER]);
-
-	igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
-			    DRM_FORMAT_XRGB8888,
-			    DRM_FORMAT_MOD_NONE,
-			    0.0, 0.0, 0.0,
-			    &data->primary_fb[SWCOMPARISONBUFFER]);
+	igt_create_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
+		      DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE,
+		      &data->primary_fb[HWCURSORBUFFER]);
+
+	igt_create_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
+		      DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE,
+		      &data->primary_fb[SWCOMPARISONBUFFER1]);
+
+	igt_create_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
+		      DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE,
+		      &data->primary_fb[SWCOMPARISONBUFFER2]);
 
 	data->primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 	data->cursor = igt_output_get_plane_type(output, DRM_PLANE_TYPE_CURSOR);
 
-	igt_plane_set_fb(data->primary, &data->primary_fb[SWCOMPARISONBUFFER]);
+	igt_plane_set_fb(data->primary, &data->primary_fb[SWCOMPARISONBUFFER1]);
 
 	igt_display_commit(display);
 
@@ -427,7 +520,7 @@ static void prepare_crtc(data_t *data, igt_output_t *output,
 		cairo_destroy(cr);
 
 		/* Set HW cursor buffer in place */
-			restore_image(data, HWCURSORBUFFER);
+		restore_image(data, HWCURSORBUFFER, NULL);
 	} else
 		data->surface = NULL;
 
@@ -469,10 +562,10 @@ static void test_cursor_alpha(data_t *data, double a)
 	igt_remove_fb(data->drm_fd, &data->fb);
 
 	/* Software Test - render cursor in software, drawn it directly on PF */
-	cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb[SWCOMPARISONBUFFER]);
+	cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb[SWCOMPARISONBUFFER1]);
 	igt_paint_color_alpha(cr, 0, 0, curw, curh, 1.0, 1.0, 1.0, a);
 	igt_put_cairo_ctx(cr);
-	igt_plane_set_fb(data->primary, &data->primary_fb[SWCOMPARISONBUFFER]);
+	igt_plane_set_fb(data->primary, &data->primary_fb[SWCOMPARISONBUFFER1]);
 	igt_display_commit(display);
 	igt_wait_for_vblank(data->drm_fd,
 			display->pipes[data->pipe].crtc_offset);
@@ -513,7 +606,7 @@ static void create_cursor_fb(data_t *data, int cur_w, int cur_h)
 	igt_assert(fb_id);
 
 	cr = igt_get_cairo_ctx(data->drm_fd, &data->fb);
-	draw_cursor(cr, 0, 0, cur_w, cur_h, 1.0);
+	draw_cursor(cr, &((cursorarea){0, 0, cur_w, cur_h}));
 	igt_put_cairo_ctx(cr);
 }
 
@@ -610,7 +703,7 @@ static void test_cursor_size(data_t *data)
 		igt_display_commit(display);
 
 		/* Now render the same in software and collect crc */
-		cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb[SWCOMPARISONBUFFER]);
+		cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb[SWCOMPARISONBUFFER1]);
 
 		/* remove previous cursor sw image */
 		if (prevsize > 0)
@@ -619,7 +712,7 @@ static void test_cursor_size(data_t *data)
 
 		igt_paint_color_alpha(cr, 0, 0, size, size, 1.0, 1.0, 1.0, 1.0);
 		igt_put_cairo_ctx(cr);
-		igt_plane_set_fb(data->primary, &data->primary_fb[SWCOMPARISONBUFFER]);
+		igt_plane_set_fb(data->primary, &data->primary_fb[SWCOMPARISONBUFFER1]);
 		igt_display_commit(display);
 		igt_pipe_crc_get_current(data->drm_fd, pipe_crc, &ref_crc);
 
@@ -657,6 +750,8 @@ static void test_rapid_movement(data_t *data)
 	}
 	gettimeofday(&end, NULL);
 
+	cursor_disable(data);
+
 	/*
 	 * We've done 400 cursor updates now.  If we're being throttled to
 	 * vblank, then that would take roughly 400/refresh seconds.  If the
@@ -813,6 +908,9 @@ igt_main
 		igt_require_pipe_crc(data.drm_fd);
 
 		igt_display_require(&data.display, data.drm_fd);
+		igt_display_reset(&data.display);
+		igt_display_commit2(&data.display, data.display.is_atomic ?
+				    COMMIT_ATOMIC : COMMIT_LEGACY);
 	}
 
 	data.cursor_max_w = cursor_width;
-- 
2.28.0

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

* [igt-dev] [PATCH i-g-t 2/2] tests/kms_plane_alpha_blend: reset display after test
  2021-08-17  9:27 [igt-dev] [PATCH i-g-t 1/2] tests/kms_cursor_crc: Separate hw and sw runs on tests Juha-Pekka Heikkila
@ 2021-08-17  9:27 ` Juha-Pekka Heikkila
  2021-08-19 12:07   ` Kahola, Mika
  2021-08-17 12:47 ` [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [i-g-t,1/2] tests/kms_cursor_crc: Separate hw and sw runs on tests Patchwork
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Juha-Pekka Heikkila @ 2021-08-17  9:27 UTC (permalink / raw)
  To: igt-dev; +Cc: Juha-Pekka Heikkila

If test would fail alpha/blend settings would be left on random
setting. Clean up before exiting.

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

diff --git a/tests/kms_plane_alpha_blend.c b/tests/kms_plane_alpha_blend.c
index cb8f92891..cff9a9eff 100644
--- a/tests/kms_plane_alpha_blend.c
+++ b/tests/kms_plane_alpha_blend.c
@@ -586,6 +586,11 @@ igt_main
 		igt_subtest_group
 			run_subtests(&data, pipe);
 
-	igt_fixture
+	igt_fixture {
+		igt_display_reset(&data.display);
+		igt_display_commit2(&data.display, data.display.is_atomic ?
+				    COMMIT_ATOMIC : COMMIT_LEGACY);
+
 		igt_display_fini(&data.display);
+	}
 }
-- 
2.28.0

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

* [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [i-g-t,1/2] tests/kms_cursor_crc: Separate hw and sw runs on tests
  2021-08-17  9:27 [igt-dev] [PATCH i-g-t 1/2] tests/kms_cursor_crc: Separate hw and sw runs on tests Juha-Pekka Heikkila
  2021-08-17  9:27 ` [igt-dev] [PATCH i-g-t 2/2] tests/kms_plane_alpha_blend: reset display after test Juha-Pekka Heikkila
@ 2021-08-17 12:47 ` Patchwork
  2021-08-17 14:18 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/2] tests/kms_cursor_crc: Separate hw and sw runs on tests (rev2) Patchwork
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: Patchwork @ 2021-08-17 12:47 UTC (permalink / raw)
  To: Juha-Pekka Heikkila; +Cc: igt-dev

[-- Attachment #1: Type: text/plain, Size: 4378 bytes --]

== Series Details ==

Series: series starting with [i-g-t,1/2] tests/kms_cursor_crc: Separate hw and sw runs on tests
URL   : https://patchwork.freedesktop.org/series/93745/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_10490 -> IGTPW_6127
====================================================

Summary
-------

  **FAILURE**

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

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6127/index.html

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

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

### IGT changes ###

#### Possible regressions ####

  * igt@runner@aborted:
    - fi-tgl-1115g4:      NOTRUN -> [FAIL][1]
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6127/fi-tgl-1115g4/igt@runner@aborted.html

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

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

### IGT changes ###

#### Issues hit ####

  * igt@amdgpu/amd_basic@semaphore:
    - fi-bdw-5557u:       NOTRUN -> [SKIP][2] ([fdo#109271]) +27 similar issues
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6127/fi-bdw-5557u/igt@amdgpu/amd_basic@semaphore.html

  * igt@core_hotunplug@unbind-rebind:
    - fi-bdw-5557u:       NOTRUN -> [WARN][3] ([i915#3718])
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6127/fi-bdw-5557u/igt@core_hotunplug@unbind-rebind.html

  * igt@gem_exec_parallel@engines@userptr:
    - fi-pnv-d510:        [PASS][4] -> [INCOMPLETE][5] ([i915#299])
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10490/fi-pnv-d510/igt@gem_exec_parallel@engines@userptr.html
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6127/fi-pnv-d510/igt@gem_exec_parallel@engines@userptr.html

  * igt@gem_exec_suspend@basic-s0:
    - fi-tgl-1115g4:      [PASS][6] -> [FAIL][7] ([i915#1888])
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10490/fi-tgl-1115g4/igt@gem_exec_suspend@basic-s0.html
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6127/fi-tgl-1115g4/igt@gem_exec_suspend@basic-s0.html

  * igt@kms_chamelium@dp-crc-fast:
    - fi-bdw-5557u:       NOTRUN -> [SKIP][8] ([fdo#109271] / [fdo#111827]) +8 similar issues
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6127/fi-bdw-5557u/igt@kms_chamelium@dp-crc-fast.html

  * igt@runner@aborted:
    - fi-pnv-d510:        NOTRUN -> [FAIL][9] ([i915#2403] / [i915#2505] / [i915#2722])
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6127/fi-pnv-d510/igt@runner@aborted.html

  
#### Warnings ####

  * igt@kms_chamelium@hdmi-hpd-fast:
    - fi-tgl-1115g4:      [SKIP][10] ([fdo#111827]) -> [SKIP][11] ([fdo#111827] / [i915#1887])
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10490/fi-tgl-1115g4/igt@kms_chamelium@hdmi-hpd-fast.html
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6127/fi-tgl-1115g4/igt@kms_chamelium@hdmi-hpd-fast.html

  
  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
  [i915#1887]: https://gitlab.freedesktop.org/drm/intel/issues/1887
  [i915#1888]: https://gitlab.freedesktop.org/drm/intel/issues/1888
  [i915#2403]: https://gitlab.freedesktop.org/drm/intel/issues/2403
  [i915#2505]: https://gitlab.freedesktop.org/drm/intel/issues/2505
  [i915#2722]: https://gitlab.freedesktop.org/drm/intel/issues/2722
  [i915#299]: https://gitlab.freedesktop.org/drm/intel/issues/299
  [i915#3718]: https://gitlab.freedesktop.org/drm/intel/issues/3718


Participating hosts (36 -> 34)
------------------------------

  Missing    (2): fi-bsw-cyan fi-bdw-samus 


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

  * CI: CI-20190529 -> None
  * IGT: IGT_6177 -> IGTPW_6127

  CI-20190529: 20190529
  CI_DRM_10490: 3bd74b377986fcb89cf4563629f97c5b3199ca6f @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_6127: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6127/index.html
  IGT_6177: f474644e7226dd319195ca03b3cde82ad10ac54c @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6127/index.html

[-- Attachment #2: Type: text/html, Size: 5359 bytes --]

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

* [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/2] tests/kms_cursor_crc: Separate hw and sw runs on tests (rev2)
  2021-08-17  9:27 [igt-dev] [PATCH i-g-t 1/2] tests/kms_cursor_crc: Separate hw and sw runs on tests Juha-Pekka Heikkila
  2021-08-17  9:27 ` [igt-dev] [PATCH i-g-t 2/2] tests/kms_plane_alpha_blend: reset display after test Juha-Pekka Heikkila
  2021-08-17 12:47 ` [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [i-g-t,1/2] tests/kms_cursor_crc: Separate hw and sw runs on tests Patchwork
@ 2021-08-17 14:18 ` Patchwork
  2021-08-17 15:56 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
  2021-08-17 15:59 ` [igt-dev] [PATCH i-g-t 1/2] tests/kms_cursor_crc: Separate hw and sw runs on tests Petri Latvala
  4 siblings, 0 replies; 11+ messages in thread
From: Patchwork @ 2021-08-17 14:18 UTC (permalink / raw)
  To: Juha-Pekka Heikkila; +Cc: igt-dev

[-- Attachment #1: Type: text/plain, Size: 2973 bytes --]

== Series Details ==

Series: series starting with [i-g-t,1/2] tests/kms_cursor_crc: Separate hw and sw runs on tests (rev2)
URL   : https://patchwork.freedesktop.org/series/93745/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_10490 -> IGTPW_6128
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/index.html

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

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

### IGT changes ###

#### Issues hit ####

  * igt@amdgpu/amd_basic@semaphore:
    - fi-bdw-5557u:       NOTRUN -> [SKIP][1] ([fdo#109271]) +27 similar issues
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/fi-bdw-5557u/igt@amdgpu/amd_basic@semaphore.html

  * igt@core_hotunplug@unbind-rebind:
    - fi-bdw-5557u:       NOTRUN -> [WARN][2] ([i915#3718])
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/fi-bdw-5557u/igt@core_hotunplug@unbind-rebind.html

  * igt@i915_selftest@live@workarounds:
    - fi-rkl-guc:         [PASS][3] -> [DMESG-FAIL][4] ([i915#3928])
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10490/fi-rkl-guc/igt@i915_selftest@live@workarounds.html
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/fi-rkl-guc/igt@i915_selftest@live@workarounds.html

  * igt@kms_chamelium@dp-crc-fast:
    - fi-bdw-5557u:       NOTRUN -> [SKIP][5] ([fdo#109271] / [fdo#111827]) +8 similar issues
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/fi-bdw-5557u/igt@kms_chamelium@dp-crc-fast.html

  * igt@runner@aborted:
    - fi-rkl-guc:         NOTRUN -> [FAIL][6] ([i915#3928])
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/fi-rkl-guc/igt@runner@aborted.html

  
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
  [i915#2122]: https://gitlab.freedesktop.org/drm/intel/issues/2122
  [i915#3303]: https://gitlab.freedesktop.org/drm/intel/issues/3303
  [i915#3718]: https://gitlab.freedesktop.org/drm/intel/issues/3718
  [i915#3928]: https://gitlab.freedesktop.org/drm/intel/issues/3928


Participating hosts (36 -> 33)
------------------------------

  Missing    (3): fi-tgl-1115g4 fi-bsw-cyan fi-bdw-samus 


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

  * CI: CI-20190529 -> None
  * IGT: IGT_6177 -> IGTPW_6128

  CI-20190529: 20190529
  CI_DRM_10490: 3bd74b377986fcb89cf4563629f97c5b3199ca6f @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_6128: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/index.html
  IGT_6177: f474644e7226dd319195ca03b3cde82ad10ac54c @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/index.html

[-- Attachment #2: Type: text/html, Size: 3682 bytes --]

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

* [igt-dev] ✓ Fi.CI.IGT: success for series starting with [i-g-t,1/2] tests/kms_cursor_crc: Separate hw and sw runs on tests (rev2)
  2021-08-17  9:27 [igt-dev] [PATCH i-g-t 1/2] tests/kms_cursor_crc: Separate hw and sw runs on tests Juha-Pekka Heikkila
                   ` (2 preceding siblings ...)
  2021-08-17 14:18 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/2] tests/kms_cursor_crc: Separate hw and sw runs on tests (rev2) Patchwork
@ 2021-08-17 15:56 ` Patchwork
  2021-08-17 15:59 ` [igt-dev] [PATCH i-g-t 1/2] tests/kms_cursor_crc: Separate hw and sw runs on tests Petri Latvala
  4 siblings, 0 replies; 11+ messages in thread
From: Patchwork @ 2021-08-17 15:56 UTC (permalink / raw)
  To: Juha-Pekka Heikkila; +Cc: igt-dev

[-- Attachment #1: Type: text/plain, Size: 30312 bytes --]

== Series Details ==

Series: series starting with [i-g-t,1/2] tests/kms_cursor_crc: Separate hw and sw runs on tests (rev2)
URL   : https://patchwork.freedesktop.org/series/93745/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_10490_full -> IGTPW_6128_full
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/index.html

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

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

### IGT changes ###

#### Issues hit ####

  * igt@gem_ctx_persistence@legacy-engines-queued:
    - shard-snb:          NOTRUN -> [SKIP][1] ([fdo#109271] / [i915#1099]) +2 similar issues
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-snb2/igt@gem_ctx_persistence@legacy-engines-queued.html

  * igt@gem_ctx_sseu@invalid-sseu:
    - shard-tglb:         NOTRUN -> [SKIP][2] ([i915#280])
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-tglb3/igt@gem_ctx_sseu@invalid-sseu.html

  * igt@gem_exec_fair@basic-none-share@rcs0:
    - shard-tglb:         [PASS][3] -> [FAIL][4] ([i915#2842])
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10490/shard-tglb7/igt@gem_exec_fair@basic-none-share@rcs0.html
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-tglb3/igt@gem_exec_fair@basic-none-share@rcs0.html

  * igt@gem_exec_fair@basic-none-solo@rcs0:
    - shard-kbl:          [PASS][5] -> [FAIL][6] ([i915#2842]) +1 similar issue
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10490/shard-kbl6/igt@gem_exec_fair@basic-none-solo@rcs0.html
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-kbl2/igt@gem_exec_fair@basic-none-solo@rcs0.html

  * igt@gem_exec_fair@basic-none@vcs1:
    - shard-iclb:         NOTRUN -> [FAIL][7] ([i915#2842])
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-iclb1/igt@gem_exec_fair@basic-none@vcs1.html

  * igt@gem_exec_fair@basic-pace-share@rcs0:
    - shard-glk:          [PASS][8] -> [FAIL][9] ([i915#2842]) +1 similar issue
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10490/shard-glk7/igt@gem_exec_fair@basic-pace-share@rcs0.html
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-glk1/igt@gem_exec_fair@basic-pace-share@rcs0.html

  * igt@gem_exec_suspend@basic-s4-devices:
    - shard-glk:          NOTRUN -> [DMESG-WARN][10] ([i915#1610])
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-glk6/igt@gem_exec_suspend@basic-s4-devices.html

  * igt@gem_huc_copy@huc-copy:
    - shard-apl:          NOTRUN -> [SKIP][11] ([fdo#109271] / [i915#2190])
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-apl7/igt@gem_huc_copy@huc-copy.html

  * igt@gem_pread@exhaustion:
    - shard-glk:          NOTRUN -> [WARN][12] ([i915#2658])
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-glk3/igt@gem_pread@exhaustion.html
    - shard-apl:          NOTRUN -> [WARN][13] ([i915#2658])
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-apl3/igt@gem_pread@exhaustion.html

  * igt@gem_pwrite@basic-exhaustion:
    - shard-tglb:         NOTRUN -> [WARN][14] ([i915#2658])
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-tglb5/igt@gem_pwrite@basic-exhaustion.html

  * igt@gem_render_copy@linear-to-vebox-yf-tiled:
    - shard-iclb:         NOTRUN -> [SKIP][15] ([i915#768]) +1 similar issue
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-iclb5/igt@gem_render_copy@linear-to-vebox-yf-tiled.html

  * igt@gem_userptr_blits@access-control:
    - shard-tglb:         NOTRUN -> [SKIP][16] ([i915#3297]) +1 similar issue
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-tglb8/igt@gem_userptr_blits@access-control.html
    - shard-iclb:         NOTRUN -> [SKIP][17] ([i915#3297]) +1 similar issue
   [17]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-iclb6/igt@gem_userptr_blits@access-control.html

  * igt@gem_userptr_blits@input-checking:
    - shard-apl:          NOTRUN -> [DMESG-WARN][18] ([i915#3002])
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-apl1/igt@gem_userptr_blits@input-checking.html

  * igt@gen3_render_tiledy_blits:
    - shard-tglb:         NOTRUN -> [SKIP][19] ([fdo#109289]) +1 similar issue
   [19]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-tglb3/igt@gen3_render_tiledy_blits.html
    - shard-iclb:         NOTRUN -> [SKIP][20] ([fdo#109289]) +1 similar issue
   [20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-iclb2/igt@gen3_render_tiledy_blits.html

  * igt@i915_query@query-topology-unsupported:
    - shard-iclb:         NOTRUN -> [SKIP][21] ([fdo#109302])
   [21]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-iclb2/igt@i915_query@query-topology-unsupported.html
    - shard-tglb:         NOTRUN -> [SKIP][22] ([fdo#109302])
   [22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-tglb5/igt@i915_query@query-topology-unsupported.html

  * igt@i915_selftest@live@hangcheck:
    - shard-snb:          NOTRUN -> [INCOMPLETE][23] ([i915#3921])
   [23]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-snb7/igt@i915_selftest@live@hangcheck.html

  * igt@kms_addfb_basic@invalid-smem-bo-on-discrete:
    - shard-tglb:         NOTRUN -> [SKIP][24] ([i915#3826])
   [24]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-tglb3/igt@kms_addfb_basic@invalid-smem-bo-on-discrete.html
    - shard-iclb:         NOTRUN -> [SKIP][25] ([i915#3826])
   [25]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-iclb7/igt@kms_addfb_basic@invalid-smem-bo-on-discrete.html

  * igt@kms_atomic@plane-primary-overlay-mutable-zpos:
    - shard-tglb:         NOTRUN -> [SKIP][26] ([i915#404])
   [26]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-tglb6/igt@kms_atomic@plane-primary-overlay-mutable-zpos.html
    - shard-iclb:         NOTRUN -> [SKIP][27] ([i915#404])
   [27]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-iclb1/igt@kms_atomic@plane-primary-overlay-mutable-zpos.html

  * igt@kms_big_fb@x-tiled-max-hw-stride-64bpp-rotate-180-hflip:
    - shard-kbl:          NOTRUN -> [SKIP][28] ([fdo#109271] / [i915#3777]) +1 similar issue
   [28]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-kbl6/igt@kms_big_fb@x-tiled-max-hw-stride-64bpp-rotate-180-hflip.html
    - shard-glk:          NOTRUN -> [SKIP][29] ([fdo#109271] / [i915#3777]) +1 similar issue
   [29]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-glk4/igt@kms_big_fb@x-tiled-max-hw-stride-64bpp-rotate-180-hflip.html

  * igt@kms_big_fb@y-tiled-max-hw-stride-64bpp-rotate-0-hflip:
    - shard-apl:          NOTRUN -> [SKIP][30] ([fdo#109271] / [i915#3777]) +3 similar issues
   [30]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-apl8/igt@kms_big_fb@y-tiled-max-hw-stride-64bpp-rotate-0-hflip.html

  * igt@kms_big_fb@yf-tiled-8bpp-rotate-180:
    - shard-tglb:         NOTRUN -> [SKIP][31] ([fdo#111615]) +1 similar issue
   [31]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-tglb3/igt@kms_big_fb@yf-tiled-8bpp-rotate-180.html

  * igt@kms_big_fb@yf-tiled-max-hw-stride-64bpp-rotate-0-async-flip:
    - shard-iclb:         NOTRUN -> [SKIP][32] ([fdo#110723])
   [32]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-iclb4/igt@kms_big_fb@yf-tiled-max-hw-stride-64bpp-rotate-0-async-flip.html

  * igt@kms_ccs@pipe-a-ccs-on-another-bo-y_tiled_gen12_mc_ccs:
    - shard-apl:          NOTRUN -> [SKIP][33] ([fdo#109271] / [i915#3886]) +17 similar issues
   [33]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-apl8/igt@kms_ccs@pipe-a-ccs-on-another-bo-y_tiled_gen12_mc_ccs.html

  * igt@kms_ccs@pipe-b-bad-aux-stride-y_tiled_gen12_rc_ccs_cc:
    - shard-glk:          NOTRUN -> [SKIP][34] ([fdo#109271] / [i915#3886]) +4 similar issues
   [34]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-glk5/igt@kms_ccs@pipe-b-bad-aux-stride-y_tiled_gen12_rc_ccs_cc.html

  * igt@kms_ccs@pipe-b-bad-rotation-90-yf_tiled_ccs:
    - shard-tglb:         NOTRUN -> [SKIP][35] ([i915#3689]) +4 similar issues
   [35]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-tglb3/igt@kms_ccs@pipe-b-bad-rotation-90-yf_tiled_ccs.html

  * igt@kms_ccs@pipe-b-missing-ccs-buffer-y_tiled_gen12_rc_ccs_cc:
    - shard-kbl:          NOTRUN -> [SKIP][36] ([fdo#109271] / [i915#3886]) +4 similar issues
   [36]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-kbl4/igt@kms_ccs@pipe-b-missing-ccs-buffer-y_tiled_gen12_rc_ccs_cc.html

  * igt@kms_ccs@pipe-c-bad-rotation-90-y_tiled_gen12_rc_ccs_cc:
    - shard-iclb:         NOTRUN -> [SKIP][37] ([fdo#109278] / [i915#3886]) +3 similar issues
   [37]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-iclb6/igt@kms_ccs@pipe-c-bad-rotation-90-y_tiled_gen12_rc_ccs_cc.html

  * igt@kms_ccs@pipe-c-crc-sprite-planes-basic-y_tiled_gen12_mc_ccs:
    - shard-tglb:         NOTRUN -> [SKIP][38] ([i915#3689] / [i915#3886]) +1 similar issue
   [38]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-tglb7/igt@kms_ccs@pipe-c-crc-sprite-planes-basic-y_tiled_gen12_mc_ccs.html

  * igt@kms_ccs@pipe-d-bad-pixel-format-y_tiled_ccs:
    - shard-snb:          NOTRUN -> [SKIP][39] ([fdo#109271]) +354 similar issues
   [39]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-snb2/igt@kms_ccs@pipe-d-bad-pixel-format-y_tiled_ccs.html

  * igt@kms_cdclk@mode-transition:
    - shard-apl:          NOTRUN -> [SKIP][40] ([fdo#109271]) +302 similar issues
   [40]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-apl8/igt@kms_cdclk@mode-transition.html

  * igt@kms_cdclk@plane-scaling:
    - shard-iclb:         NOTRUN -> [SKIP][41] ([i915#3742])
   [41]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-iclb6/igt@kms_cdclk@plane-scaling.html
    - shard-tglb:         NOTRUN -> [SKIP][42] ([i915#3742])
   [42]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-tglb8/igt@kms_cdclk@plane-scaling.html

  * igt@kms_color_chamelium@pipe-a-ctm-blue-to-red:
    - shard-snb:          NOTRUN -> [SKIP][43] ([fdo#109271] / [fdo#111827]) +16 similar issues
   [43]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-snb2/igt@kms_color_chamelium@pipe-a-ctm-blue-to-red.html
    - shard-kbl:          NOTRUN -> [SKIP][44] ([fdo#109271] / [fdo#111827]) +5 similar issues
   [44]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-kbl4/igt@kms_color_chamelium@pipe-a-ctm-blue-to-red.html

  * igt@kms_color_chamelium@pipe-a-ctm-limited-range:
    - shard-apl:          NOTRUN -> [SKIP][45] ([fdo#109271] / [fdo#111827]) +27 similar issues
   [45]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-apl2/igt@kms_color_chamelium@pipe-a-ctm-limited-range.html

  * igt@kms_color_chamelium@pipe-a-gamma:
    - shard-iclb:         NOTRUN -> [SKIP][46] ([fdo#109284] / [fdo#111827]) +3 similar issues
   [46]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-iclb5/igt@kms_color_chamelium@pipe-a-gamma.html

  * igt@kms_color_chamelium@pipe-d-ctm-0-25:
    - shard-glk:          NOTRUN -> [SKIP][47] ([fdo#109271] / [fdo#111827]) +6 similar issues
   [47]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-glk9/igt@kms_color_chamelium@pipe-d-ctm-0-25.html
    - shard-tglb:         NOTRUN -> [SKIP][48] ([fdo#109284] / [fdo#111827]) +4 similar issues
   [48]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-tglb2/igt@kms_color_chamelium@pipe-d-ctm-0-25.html
    - shard-iclb:         NOTRUN -> [SKIP][49] ([fdo#109278] / [fdo#109284] / [fdo#111827])
   [49]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-iclb4/igt@kms_color_chamelium@pipe-d-ctm-0-25.html

  * igt@kms_content_protection@atomic:
    - shard-apl:          NOTRUN -> [TIMEOUT][50] ([i915#1319])
   [50]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-apl7/igt@kms_content_protection@atomic.html

  * igt@kms_cursor_crc@pipe-a-cursor-32x32-random:
    - shard-tglb:         NOTRUN -> [SKIP][51] ([i915#3319])
   [51]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-tglb2/igt@kms_cursor_crc@pipe-a-cursor-32x32-random.html

  * igt@kms_cursor_crc@pipe-a-cursor-512x170-random:
    - shard-tglb:         NOTRUN -> [SKIP][52] ([fdo#109279] / [i915#3359]) +2 similar issues
   [52]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-tglb2/igt@kms_cursor_crc@pipe-a-cursor-512x170-random.html

  * igt@kms_cursor_crc@pipe-a-cursor-512x512-rapid-movement:
    - shard-iclb:         NOTRUN -> [SKIP][53] ([fdo#109278] / [fdo#109279]) +2 similar issues
   [53]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-iclb1/igt@kms_cursor_crc@pipe-a-cursor-512x512-rapid-movement.html

  * igt@kms_cursor_crc@pipe-c-cursor-32x10-sliding:
    - shard-tglb:         NOTRUN -> [SKIP][54] ([i915#3359]) +1 similar issue
   [54]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-tglb1/igt@kms_cursor_crc@pipe-c-cursor-32x10-sliding.html

  * igt@kms_cursor_crc@pipe-d-cursor-64x64-rapid-movement:
    - shard-iclb:         NOTRUN -> [SKIP][55] ([fdo#109278]) +12 similar issues
   [55]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-iclb5/igt@kms_cursor_crc@pipe-d-cursor-64x64-rapid-movement.html

  * igt@kms_flip@2x-wf_vblank-ts-check:
    - shard-iclb:         NOTRUN -> [SKIP][56] ([fdo#109274]) +1 similar issue
   [56]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-iclb6/igt@kms_flip@2x-wf_vblank-ts-check.html

  * igt@kms_flip_scaled_crc@flip-64bpp-ytile-to-32bpp-ytilercccs:
    - shard-apl:          NOTRUN -> [SKIP][57] ([fdo#109271] / [i915#2672])
   [57]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-apl8/igt@kms_flip_scaled_crc@flip-64bpp-ytile-to-32bpp-ytilercccs.html

  * igt@kms_frontbuffer_tracking@fbc-2p-primscrn-spr-indfb-draw-blt:
    - shard-kbl:          NOTRUN -> [SKIP][58] ([fdo#109271]) +72 similar issues
   [58]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-kbl7/igt@kms_frontbuffer_tracking@fbc-2p-primscrn-spr-indfb-draw-blt.html

  * igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-cur-indfb-onoff:
    - shard-tglb:         NOTRUN -> [SKIP][59] ([fdo#111825]) +20 similar issues
   [59]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-tglb1/igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-cur-indfb-onoff.html

  * igt@kms_frontbuffer_tracking@fbcpsr-2p-scndscrn-spr-indfb-draw-mmap-wc:
    - shard-iclb:         NOTRUN -> [SKIP][60] ([fdo#109280]) +15 similar issues
   [60]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-iclb3/igt@kms_frontbuffer_tracking@fbcpsr-2p-scndscrn-spr-indfb-draw-mmap-wc.html

  * igt@kms_frontbuffer_tracking@psr-rgb565-draw-mmap-cpu:
    - shard-glk:          NOTRUN -> [SKIP][61] ([fdo#109271]) +66 similar issues
   [61]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-glk4/igt@kms_frontbuffer_tracking@psr-rgb565-draw-mmap-cpu.html

  * igt@kms_hdr@bpc-switch-suspend:
    - shard-apl:          NOTRUN -> [DMESG-WARN][62] ([i915#180]) +2 similar issues
   [62]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-apl7/igt@kms_hdr@bpc-switch-suspend.html

  * igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-d:
    - shard-apl:          NOTRUN -> [SKIP][63] ([fdo#109271] / [i915#533]) +2 similar issues
   [63]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-apl2/igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-d.html

  * igt@kms_plane@plane-panning-bottom-right-suspend@pipe-b-planes:
    - shard-kbl:          [PASS][64] -> [DMESG-WARN][65] ([i915#180]) +1 similar issue
   [64]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10490/shard-kbl4/igt@kms_plane@plane-panning-bottom-right-suspend@pipe-b-planes.html
   [65]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-kbl1/igt@kms_plane@plane-panning-bottom-right-suspend@pipe-b-planes.html

  * igt@kms_plane_alpha_blend@pipe-a-alpha-opaque-fb:
    - shard-apl:          NOTRUN -> [FAIL][66] ([fdo#108145] / [i915#265]) +2 similar issues
   [66]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-apl2/igt@kms_plane_alpha_blend@pipe-a-alpha-opaque-fb.html

  * igt@kms_plane_alpha_blend@pipe-a-alpha-transparent-fb:
    - shard-apl:          NOTRUN -> [FAIL][67] ([i915#265])
   [67]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-apl6/igt@kms_plane_alpha_blend@pipe-a-alpha-transparent-fb.html

  * igt@kms_plane_alpha_blend@pipe-a-constant-alpha-max:
    - shard-glk:          NOTRUN -> [FAIL][68] ([fdo#108145] / [i915#265]) +1 similar issue
   [68]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-glk3/igt@kms_plane_alpha_blend@pipe-a-constant-alpha-max.html
    - shard-kbl:          NOTRUN -> [FAIL][69] ([fdo#108145] / [i915#265])
   [69]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-kbl2/igt@kms_plane_alpha_blend@pipe-a-constant-alpha-max.html

  * igt@kms_plane_lowres@pipe-a-tiling-x:
    - shard-iclb:         NOTRUN -> [SKIP][70] ([i915#3536])
   [70]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-iclb5/igt@kms_plane_lowres@pipe-a-tiling-x.html
    - shard-tglb:         NOTRUN -> [SKIP][71] ([i915#3536])
   [71]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-tglb3/igt@kms_plane_lowres@pipe-a-tiling-x.html

  * igt@kms_plane_scaling@scaler-with-clipping-clamping@pipe-c-scaler-with-clipping-clamping:
    - shard-kbl:          NOTRUN -> [SKIP][72] ([fdo#109271] / [i915#2733])
   [72]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-kbl3/igt@kms_plane_scaling@scaler-with-clipping-clamping@pipe-c-scaler-with-clipping-clamping.html
    - shard-glk:          NOTRUN -> [SKIP][73] ([fdo#109271] / [i915#2733])
   [73]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-glk5/igt@kms_plane_scaling@scaler-with-clipping-clamping@pipe-c-scaler-with-clipping-clamping.html

  * igt@kms_psr2_sf@cursor-plane-update-sf:
    - shard-tglb:         NOTRUN -> [SKIP][74] ([i915#2920]) +2 similar issues
   [74]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-tglb1/igt@kms_psr2_sf@cursor-plane-update-sf.html

  * igt@kms_psr2_sf@plane-move-sf-dmg-area-2:
    - shard-apl:          NOTRUN -> [SKIP][75] ([fdo#109271] / [i915#658]) +6 similar issues
   [75]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-apl2/igt@kms_psr2_sf@plane-move-sf-dmg-area-2.html

  * igt@kms_psr2_sf@primary-plane-update-sf-dmg-area-1:
    - shard-iclb:         NOTRUN -> [SKIP][76] ([i915#658]) +2 similar issues
   [76]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-iclb3/igt@kms_psr2_sf@primary-plane-update-sf-dmg-area-1.html
    - shard-glk:          NOTRUN -> [SKIP][77] ([fdo#109271] / [i915#658]) +1 similar issue
   [77]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-glk6/igt@kms_psr2_sf@primary-plane-update-sf-dmg-area-1.html
    - shard-kbl:          NOTRUN -> [SKIP][78] ([fdo#109271] / [i915#658]) +1 similar issue
   [78]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-kbl1/igt@kms_psr2_sf@primary-plane-update-sf-dmg-area-1.html

  * igt@kms_psr@psr2_no_drrs:
    - shard-iclb:         [PASS][79] -> [SKIP][80] ([fdo#109441]) +1 similar issue
   [79]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10490/shard-iclb2/igt@kms_psr@psr2_no_drrs.html
   [80]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-iclb5/igt@kms_psr@psr2_no_drrs.html

  * igt@kms_psr@psr2_primary_mmap_cpu:
    - shard-iclb:         NOTRUN -> [SKIP][81] ([fdo#109441])
   [81]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-iclb6/igt@kms_psr@psr2_primary_mmap_cpu.html
    - shard-tglb:         NOTRUN -> [FAIL][82] ([i915#132] / [i915#3467])
   [82]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-tglb8/igt@kms_psr@psr2_primary_mmap_cpu.html

  * igt@kms_vrr@flipline:
    - shard-tglb:         NOTRUN -> [SKIP][83] ([fdo#109502])
   [83]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-tglb5/igt@kms_vrr@flipline.html
    - shard-iclb:         NOTRUN -> [SKIP][84] ([fdo#109502])
   [84]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-iclb2/igt@kms_vrr@flipline.html

  * igt@nouveau_crc@pipe-a-ctx-flip-skip-current-frame:
    - shard-tglb:         NOTRUN -> [SKIP][85] ([i915#2530]) +1 similar issue
   [85]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-tglb8/igt@nouveau_crc@pipe-a-ctx-flip-skip-current-frame.html
    - shard-iclb:         NOTRUN -> [SKIP][86] ([i915#2530])
   [86]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-iclb4/igt@nouveau_crc@pipe-a-ctx-flip-skip-current-frame.html

  * igt@nouveau_crc@pipe-d-ctx-flip-skip-current-frame:
    - shard-iclb:         NOTRUN -> [SKIP][87] ([fdo#109278] / [i915#2530])
   [87]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-iclb5/igt@nouveau_crc@pipe-d-ctx-flip-skip-current-frame.html

  * igt@prime_nv_pcopy@test1_macro:
    - shard-tglb:         NOTRUN -> [SKIP][88] ([fdo#109291])
   [88]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-tglb5/igt@prime_nv_pcopy@test1_macro.html
    - shard-iclb:         NOTRUN -> [SKIP][89] ([fdo#109291])
   [89]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-iclb1/igt@prime_nv_pcopy@test1_macro.html

  * igt@sysfs_clients@fair-7:
    - shard-iclb:         NOTRUN -> [SKIP][90] ([i915#2994])
   [90]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-iclb1/igt@sysfs_clients@fair-7.html
    - shard-kbl:          NOTRUN -> [SKIP][91] ([fdo#109271] / [i915#2994])
   [91]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-kbl6/igt@sysfs_clients@fair-7.html
    - shard-tglb:         NOTRUN -> [SKIP][92] ([i915#2994])
   [92]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-tglb6/igt@sysfs_clients@fair-7.html

  * igt@sysfs_clients@sema-10:
    - shard-apl:          NOTRUN -> [SKIP][93] ([fdo#109271] / [i915#2994]) +3 similar issues
   [93]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-apl1/igt@sysfs_clients@sema-10.html

  * igt@sysfs_clients@sema-50:
    - shard-glk:          NOTRUN -> [SKIP][94] ([fdo#109271] / [i915#2994]) +1 similar issue
   [94]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-glk4/igt@sysfs_clients@sema-50.html

  
#### Possible fixes ####

  * igt@gem_eio@unwedge-stress:
    - shard-iclb:         [TIMEOUT][95] ([i915#2369] / [i915#2481] / [i915#3070]) -> [PASS][96]
   [95]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10490/shard-iclb8/igt@gem_eio@unwedge-stress.html
   [96]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-iclb3/igt@gem_eio@unwedge-stress.html

  * igt@gem_exec_fair@basic-pace@rcs0:
    - shard-kbl:          [FAIL][97] ([i915#2842]) -> [PASS][98] +1 similar issue
   [97]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10490/shard-kbl7/igt@gem_exec_fair@basic-pace@rcs0.html
   [98]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-kbl1/igt@gem_exec_fair@basic-pace@rcs0.html
    - shard-tglb:         [FAIL][99] ([i915#2842]) -> [PASS][100]
   [99]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10490/shard-tglb5/igt@gem_exec_fair@basic-pace@rcs0.html
   [100]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-tglb3/igt@gem_exec_fair@basic-pace@rcs0.html

  * igt@gem_workarounds@suspend-resume-context:
    - shard-apl:          [DMESG-WARN][101] ([i915#180]) -> [PASS][102]
   [101]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10490/shard-apl1/igt@gem_workarounds@suspend-resume-context.html
   [102]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-apl8/igt@gem_workarounds@suspend-resume-context.html

  * igt@gen9_exec_parse@allowed-all:
    - shard-glk:          [DMESG-WARN][103] ([i915#1436] / [i915#716]) -> [PASS][104]
   [103]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10490/shard-glk4/igt@gen9_exec_parse@allowed-all.html
   [104]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-glk9/igt@gen9_exec_parse@allowed-all.html

  * igt@i915_suspend@forcewake:
    - shard-kbl:          [INCOMPLETE][105] ([i915#636]) -> [PASS][106]
   [105]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10490/shard-kbl4/igt@i915_suspend@forcewake.html
   [106]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-kbl6/igt@i915_suspend@forcewake.html

  * igt@kms_big_fb@linear-32bpp-rotate-180:
    - shard-glk:          [DMESG-WARN][107] ([i915#118] / [i915#95]) -> [PASS][108]
   [107]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10490/shard-glk4/igt@kms_big_fb@linear-32bpp-rotate-180.html
   [108]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-glk3/igt@kms_big_fb@linear-32bpp-rotate-180.html

  * igt@kms_cursor_crc@pipe-b-cursor-suspend:
    - shard-kbl:          [DMESG-WARN][109] ([i915#180]) -> [PASS][110]
   [109]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10490/shard-kbl7/igt@kms_cursor_crc@pipe-b-cursor-suspend.html
   [110]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-kbl4/igt@kms_cursor_crc@pipe-b-cursor-suspend.html

  * igt@kms_hdmi_inject@inject-audio:
    - shard-tglb:         [SKIP][111] ([i915#433]) -> [PASS][112]
   [111]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10490/shard-tglb1/igt@kms_hdmi_inject@inject-audio.html
   [112]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-tglb6/igt@kms_hdmi_inject@inject-audio.html

  * igt@kms_psr@psr2_cursor_plane_onoff:
    - shard-iclb:         [SKIP][113] ([fdo#109441]) -> [PASS][114] +2 similar issues
   [113]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10490/shard-iclb5/igt@kms_psr@psr2_cursor_plane_onoff.html
   [114]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-iclb2/igt@kms_psr@psr2_cursor_plane_onoff.html

  
#### Warnings ####

  * igt@i915_pm_rc6_residency@rc6-fence:
    - shard-iclb:         [WARN][115] ([i915#2684]) -> [WARN][116] ([i915#1804] / [i915#2684])
   [115]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10490/shard-iclb8/igt@i915_pm_rc6_residency@rc6-fence.html
   [116]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-iclb4/igt@i915_pm_rc6_residency@rc6-fence.html

  * igt@kms_psr2_sf@primary-plane-update-sf-dmg-area-2:
    - shard-iclb:         [SKIP][117] ([i915#658]) -> [SKIP][118] ([i915#2920]) +2 similar issues
   [117]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10490/shard-iclb7/igt@kms_psr2_sf@primary-plane-update-sf-dmg-area-2.html
   [118]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-iclb2/igt@kms_psr2_sf@primary-plane-update-sf-dmg-area-2.html

  * igt@kms_psr2_sf@primary-plane-update-sf-dmg-area-4:
    - shard-iclb:         [SKIP][119] ([i915#2920]) -> [SKIP][120] ([i915#658]) +1 similar issue
   [119]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10490/shard-iclb2/igt@kms_psr2_sf@primary-plane-update-sf-dmg-area-4.html
   [120]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-iclb3/igt@kms_psr2_sf@primary-plane-update-sf-dmg-area-4.html

  * igt@runner@aborted:
    - shard-apl:          ([FAIL][121], [FAIL][122], [FAIL][123], [FAIL][124], [FAIL][125]) ([fdo#109271] / [i915#180] / [i915#1814] / [i915#3002] / [i915#3363]) -> ([FAIL][126], [FAIL][127], [FAIL][128], [FAIL][129], [FAIL][130]) ([i915#180] / [i915#1814] / [i915#3002] / [i915#3363])
   [121]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10490/shard-apl1/igt@runner@aborted.html
   [122]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10490/shard-apl1/igt@runner@aborted.html
   [123]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10490/shard-apl6/igt@runner@aborted.html
   [124]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10490/shard-apl2/igt@runner@aborted.html
   [125]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10490/shard-apl8/igt@runner@aborted.html
   [126]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-apl6/igt@runner@aborted.html
   [127]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-apl7/igt@runner@aborted.html
   [128]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-apl1/igt@runner@aborted.html
   [129]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-apl1/igt@runner@aborted.html
   [130]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/shard-apl7/igt@runner@aborted.html

  
  [fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#109274]: https://bugs.freedesktop.org/show_bug.cgi?id=109274
  [fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
  [fdo#109279]: https://bugs.freedesktop.org/show_bug.cgi?id=109279
  [fdo#109280]: https://bugs.freedesktop.org/show_bug.cgi?id=109280
  [fdo#109284]: https://bugs.freedesktop.org/show_bug.cgi?id=109284
  [fdo#109289]: https://bugs.freedesktop.org/show_bug.cgi?id=109289
  [fdo#109291]: https://bugs.freedesktop.org/show_bug.cgi?id=109291
  [fdo#109302]: https://bugs.freedesktop.org/show_bug.cgi?id=109302
  [fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
  [fdo#109502]: https://bugs.freedesktop.org/show_bug.cgi?id=109502
  [fdo#110723]: https://bugs.freedesktop.org/show_bug.cgi?id=110723
  [fdo#111615]: https://bugs.freedesktop.org/show_bug.cgi?id=111615
  [fdo#111825]: https://bugs.freedesktop.org/show_bug.cgi?id=111825
  [fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
  [i915#1099]: https://gitlab.freedesktop.org/drm/intel/issues/1099
  [i915#118]: https://gitlab.freedesktop.org/drm/intel/issues/118
  [i915#1319]: https://gitlab.freedesktop.org/drm/intel/issues/1319
  [i915#132]: https://gitlab.freedesktop.org/drm/intel/issues/132
  [i915#1436]: https://gitlab.freedesktop.org/drm/intel/issues/1436
  [i915#1610]: https://gitlab.freedesktop.org/drm/intel/issues/1610
  [i915#180]: https://gitlab.freedesktop.org/drm/intel/issues/180
  [i915#1804]: https://gitlab.freedesktop.org/drm/intel/issues/1804
  [i915#1814]: https://gitlab.freedesktop.org/drm/intel/issues/1814
  [i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
  [i915#2369]: https://gitlab.freedesktop.org/drm/intel/issues/2369
  [i915#2481]: https://gitlab.freedesktop.org/drm/intel/issues/2481
  [i915#2530]: https://gitlab.f

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6128/index.html

[-- Attachment #2: Type: text/html, Size: 37599 bytes --]

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

* Re: [igt-dev] [PATCH i-g-t 1/2] tests/kms_cursor_crc: Separate hw and sw runs on tests
  2021-08-17  9:27 [igt-dev] [PATCH i-g-t 1/2] tests/kms_cursor_crc: Separate hw and sw runs on tests Juha-Pekka Heikkila
                   ` (3 preceding siblings ...)
  2021-08-17 15:56 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
@ 2021-08-17 15:59 ` Petri Latvala
  2021-08-17 17:46   ` Juha-Pekka Heikkila
  4 siblings, 1 reply; 11+ messages in thread
From: Petri Latvala @ 2021-08-17 15:59 UTC (permalink / raw)
  To: Juha-Pekka Heikkila; +Cc: igt-dev

On Tue, Aug 17, 2021 at 12:27:23PM +0300, Juha-Pekka Heikkila wrote:
> Reset display structure settings and commit them in before starting
> test in case some earlier test left tail.
> 
> Separate hw and sw test runs for optimizing test.
> 
> Simple cleanup.
> 
> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
> ---
>  tests/kms_cursor_crc.c | 404 +++++++++++++++++++++++++----------------
>  1 file changed, 251 insertions(+), 153 deletions(-)
> 
> diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c
> index a9bc3a745..f478ae08d 100644
> --- a/tests/kms_cursor_crc.c
> +++ b/tests/kms_cursor_crc.c
> @@ -46,10 +46,17 @@ IGT_TEST_DESCRIPTION(
>  #define DRM_CAP_CURSOR_HEIGHT 0x9
>  #endif
>  
> +enum cursor_buffers {
> +	HWCURSORBUFFER,
> +	SWCOMPARISONBUFFER1,
> +	SWCOMPARISONBUFFER2,
> +	MAXCURSORBUFFER
> +};
> +
>  typedef struct {
>  	int drm_fd;
>  	igt_display_t display;
> -	struct igt_fb primary_fb[2];
> +	struct igt_fb primary_fb[MAXCURSORBUFFER];
>  	struct igt_fb fb;
>  	igt_output_t *output;
>  	enum pipe pipe;
> @@ -70,29 +77,40 @@ typedef struct {
>  #define TEST_DPMS (1<<0)
>  #define TEST_SUSPEND (1<<1)
>  
> -#define HWCURSORBUFFER 0
> -#define SWCOMPARISONBUFFER 1
> +#define RED 1.0, 0.0, 0.0
> +#define GREEN 0.0, 1.0, 0.0
> +#define BLUE 0.0, 0.0, 1.0
> +#define WHITE 1.0, 1.0, 1.0
> +
> +typedef struct {
> +	int x;
> +	int y;
> +	int width;
> +	int height;
> +} cursorarea;
>  
> -static void draw_cursor(cairo_t *cr, int x, int y, int cw, int ch, double a)
> +static void draw_cursor(cairo_t *cr, cursorarea *cursor)
>  {
>  	int wl, wr, ht, hb;
>  
>  	/* deal with odd cursor width/height */
> -	wl = cw / 2;
> -	wr = (cw + 1) / 2;
> -	ht = ch / 2;
> -	hb = (ch + 1) / 2;
> +	wl = cursor->width / 2;
> +	wr = (cursor->width + 1) / 2;
> +	ht = cursor->height / 2;
> +	hb = (cursor->height + 1) / 2;
>  
>  	/* Cairo doesn't like to be fed numbers that are too wild */
> -	if ((x < SHRT_MIN) || (x > SHRT_MAX) || (y < SHRT_MIN) || (y > SHRT_MAX))
> +	if ((cursor->x < SHRT_MIN) || (cursor->x > SHRT_MAX) ||
> +	    (cursor->y < SHRT_MIN) || (cursor->y > SHRT_MAX))
>  		return;
> +
>  	cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
>  	cairo_set_antialias(cr, CAIRO_ANTIALIAS_NONE);
>  	/* 4 color rectangles in the corners, RGBY */
> -	igt_paint_color_alpha(cr, x,      y,      wl, ht, 1.0, 0.0, 0.0, a);
> -	igt_paint_color_alpha(cr, x + wl, y,      wr, ht, 0.0, 1.0, 0.0, a);
> -	igt_paint_color_alpha(cr, x,      y + ht, wl, hb, 0.0, 0.0, 1.0, a);
> -	igt_paint_color_alpha(cr, x + wl, y + ht, wr, hb, 1.0, 1.0, 1.0, a);
> +	igt_paint_color(cr, cursor->x, cursor->y, wl, ht, RED);
> +	igt_paint_color(cr, cursor->x + wl, cursor->y, wr, ht, GREEN);
> +	igt_paint_color(cr, cursor->x, cursor->y + ht, wl, hb, BLUE);
> +	igt_paint_color(cr, cursor->x + wl, cursor->y + ht, wr, hb, WHITE);
>  }
>  
>  static void cursor_enable(data_t *data)
> @@ -144,7 +162,7 @@ static bool cursor_visible(data_t *data, int x, int y)
>  	return true;
>  }
>  
> -static void restore_image(data_t *data, uint32_t buffer)
> +static void restore_image(data_t *data, uint32_t buffer, cursorarea *cursor)
>  {
>  	cairo_t *cr;
>  
> @@ -153,80 +171,84 @@ static void restore_image(data_t *data, uint32_t buffer)
>  	cairo_set_source_surface(cr, data->surface, 0, 0);
>  	cairo_rectangle(cr, 0, 0, data->screenw, data->screenh);
>  	cairo_fill(cr);
> +
> +	if (cursor)
> +		draw_cursor(cr, cursor);
> +
>  	igt_put_cairo_ctx(cr);
>  }
>  
> -static void do_single_test(data_t *data, int x, int y)
> +static void do_single_test(data_t *data, int x, int y, bool hw_test,
> +			   igt_crc_t *hwcrc)
>  {
>  	igt_display_t *display = &data->display;
>  	igt_pipe_crc_t *pipe_crc = data->pipe_crc;
> -	igt_crc_t crc, ref_crc;
> -	cairo_t *cr;
> -	int ret = 0;
> +	igt_crc_t crc;
> +	int ret = 0, swbufidx;
>  
>  	igt_print_activity();
>  
> -	/* Hardware test */
> -	igt_plane_set_position(data->cursor, x, y);
> -	cursor_enable(data);
> +	if (hw_test) {
> +		/* Hardware test */
> +		igt_plane_set_position(data->cursor, x, y);
>  
> -	if (chv_cursor_broken(data, x) && cursor_visible(data, x, y)) {
> -		ret = igt_display_try_commit2(display, COMMIT_LEGACY);
> -		igt_assert_eq(ret, -EINVAL);
> -		igt_plane_set_position(data->cursor, 0, y);
> -		return;
> -	}
> +		if (chv_cursor_broken(data, x) && cursor_visible(data, x, y)) {
> +			ret = igt_display_try_commit2(display, COMMIT_LEGACY);
> +			igt_assert_eq(ret, -EINVAL);
> +			igt_plane_set_position(data->cursor, 0, y);
> +			return;
> +		}
>  
> -	igt_plane_set_fb(data->primary, &data->primary_fb[HWCURSORBUFFER]);
> -	igt_display_commit(display);
> +		igt_display_commit(display);
>  
> -	/* Extra vblank wait is because nonblocking cursor ioctl */
> -	igt_wait_for_vblank(data->drm_fd,
> -			    display->pipes[data->pipe].crtc_offset);
> +		/* Extra vblank wait is because nonblocking cursor ioctl */
> +		igt_wait_for_vblank(data->drm_fd,
> +				display->pipes[data->pipe].crtc_offset);
>  
> -	igt_pipe_crc_get_current(data->drm_fd, pipe_crc, &crc);
> -	restore_image(data, SWCOMPARISONBUFFER);
> +		igt_pipe_crc_get_current(data->drm_fd, pipe_crc, hwcrc);
>  
> -	if (data->flags & (TEST_DPMS | TEST_SUSPEND)) {
> -		igt_crc_t crc_after;
> -		/*
> -		 * stop/start crc to avoid dmesg notifications about userspace
> -		 * reading too slow.
> -		 */
> -		igt_pipe_crc_stop(pipe_crc);
> -
> -		if (data->flags & TEST_DPMS) {
> -			igt_debug("dpms off/on cycle\n");
> -			kmstest_set_connector_dpms(data->drm_fd,
> -						   data->output->config.connector,
> -						   DRM_MODE_DPMS_OFF);
> -			kmstest_set_connector_dpms(data->drm_fd,
> -						   data->output->config.connector,
> -						   DRM_MODE_DPMS_ON);
> +		if (data->flags & (TEST_DPMS | TEST_SUSPEND)) {
> +			igt_crc_t crc_after;
> +			/*
> +			* stop/start crc to avoid dmesg notifications about userspace
> +			* reading too slow.
> +			*/
> +			igt_pipe_crc_stop(pipe_crc);
> +
> +			if (data->flags & TEST_DPMS) {
> +				igt_debug("dpms off/on cycle\n");
> +				kmstest_set_connector_dpms(data->drm_fd,
> +							data->output->config.connector,
> +							DRM_MODE_DPMS_OFF);
> +				kmstest_set_connector_dpms(data->drm_fd,
> +							data->output->config.connector,
> +							DRM_MODE_DPMS_ON);
> +			}
> +
> +			if (data->flags & TEST_SUSPEND)
> +				igt_system_suspend_autoresume(SUSPEND_STATE_MEM,
> +							SUSPEND_TEST_NONE);
> +
> +			igt_pipe_crc_start(pipe_crc);
> +			igt_pipe_crc_get_current(data->drm_fd, pipe_crc, &crc_after);
> +			igt_assert_crc_equal(hwcrc, &crc_after);
>  		}
> +	} else {
> +		/* Now render the same in software and collect crc */
> +		swbufidx = (data->primary->drm_plane->fb_id ==
> +			    data->primary_fb[SWCOMPARISONBUFFER1].fb_id) ?
> +			    SWCOMPARISONBUFFER2 : SWCOMPARISONBUFFER1;
>  
> -		if (data->flags & TEST_SUSPEND)
> -			igt_system_suspend_autoresume(SUSPEND_STATE_MEM,
> -						      SUSPEND_TEST_NONE);
> -
> -		igt_pipe_crc_start(pipe_crc);
> -		igt_pipe_crc_get_current(data->drm_fd, pipe_crc, &crc_after);
> -		igt_assert_crc_equal(&crc, &crc_after);
> -	}
> -
> -	/* Now render the same in software and collect crc */
> -	cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb[SWCOMPARISONBUFFER]);
> -	draw_cursor(cr, x, y, data->curw, data->curh, 1.0);
> -	igt_put_cairo_ctx(cr);
> -	igt_plane_set_fb(data->primary, &data->primary_fb[SWCOMPARISONBUFFER]);
> -	cursor_disable(data);
> -	igt_display_commit(display);
> +		restore_image(data, swbufidx, &((cursorarea){x, y, data->curw, data->curh}));
> +		igt_plane_set_fb(data->primary, &data->primary_fb[swbufidx]);
>  
> -	igt_wait_for_vblank(data->drm_fd,
> -			display->pipes[data->pipe].crtc_offset);
> +		igt_display_commit(display);
> +		igt_wait_for_vblank(data->drm_fd,
> +				display->pipes[data->pipe].crtc_offset);
>  
> -	igt_pipe_crc_get_current(data->drm_fd, pipe_crc, &ref_crc);
> -	igt_assert_crc_equal(&crc, &ref_crc);
> +		igt_pipe_crc_get_current(data->drm_fd, pipe_crc, &crc);
> +		igt_assert_crc_equal(&crc, hwcrc);
> +	}
>  }
>  
>  static void do_fail_test(data_t *data, int x, int y, int expect)
> @@ -248,70 +270,112 @@ static void do_fail_test(data_t *data, int x, int y, int expect)
>  	igt_assert_eq(ret, expect);
>  }
>  
> -static void do_test(data_t *data,
> -		    int left, int right, int top, int bottom)
> +static void do_test(data_t *data, const cursorarea *coords, igt_crc_t crc[4],
> +		    bool hwtest)
>  {
> -	do_single_test(data, left, top);
> -	do_single_test(data, right, top);
> -	do_single_test(data, right, bottom);
> -	do_single_test(data, left, bottom);
> +	do_single_test(data, coords->x, coords->width, hwtest, &crc[0]);
> +	do_single_test(data, coords->y, coords->width, hwtest, &crc[1]);
> +	do_single_test(data, coords->y, coords->height, hwtest, &crc[2]);
> +	do_single_test(data, coords->x, coords->height, hwtest, &crc[3]);
>  }
>  
>  static void test_crc_onscreen(data_t *data)
>  {
> -	int left = data->left;
> -	int right = data->right;
> -	int top = data->top;
> -	int bottom = data->bottom;
> -	int cursor_w = data->curw;
> -	int cursor_h = data->curh;
> -
> -	/* fully inside  */
> -	do_test(data, left, right, top, bottom);
> -
> -	/* 2 pixels inside */
> -	do_test(data, left - (cursor_w-2), right + (cursor_w-2), top               , bottom               );
> -	do_test(data, left               , right               , top - (cursor_h-2), bottom + (cursor_h-2));
> -	do_test(data, left - (cursor_w-2), right + (cursor_w-2), top - (cursor_h-2), bottom + (cursor_h-2));
> -
> -	/* 1 pixel inside */
> -	do_test(data, left - (cursor_w-1), right + (cursor_w-1), top               , bottom               );
> -	do_test(data, left               , right               , top - (cursor_h-1), bottom + (cursor_h-1));
> -	do_test(data, left - (cursor_w-1), right + (cursor_w-1), top - (cursor_h-1), bottom + (cursor_h-1));
> +	const int left = data->left;
> +	const int right = data->right;
> +	const int top = data->top;
> +	const int bottom = data->bottom;
> +	const int cursor_w = data->curw;
> +	const int cursor_h = data->curh;
> +
> +	struct {
> +		const cursorarea coords;
> +		igt_crc_t crc[4];
> +	} tests[] = {
> +		/* fully inside  */
> +		{{left, right, top, bottom}},
> +		/* 2 pixels inside */
> +		{{left - (cursor_w - 2), right + (cursor_w - 2), top, bottom}},
> +		{{left, right, top - (cursor_h - 2), bottom + (cursor_h - 2)}},
> +		{{left - (cursor_w - 2), right + (cursor_w - 2),
> +		  top - (cursor_h - 2), bottom + (cursor_h - 2)}},
> +		/* 1 pixel inside */
> +		{{left - (cursor_w - 1), right + (cursor_w - 1), top, bottom}},
> +		{{left, right, top - (cursor_h - 1), bottom + (cursor_h - 1)}},
> +		{{left - (cursor_w - 1), right + (cursor_w - 1),
> +		  top - (cursor_h - 1), bottom + (cursor_h - 1)}},
> +	};
> +
> +	/* HW test */
> +	cursor_enable(data);
> +	igt_plane_set_fb(data->primary, &data->primary_fb[HWCURSORBUFFER]);
> +	for (int i = 0; i < ARRAY_SIZE(tests); i++)
> +		do_test(data, &tests[i].coords, tests[i].crc, true);
> +
> +	/* SW test */
> +	cursor_disable(data);
> +	for (int i = 0; i < ARRAY_SIZE(tests); i++)
> +		do_test(data, &tests[i].coords, tests[i].crc, false);
>  }
>  
>  static void test_crc_offscreen(data_t *data)
>  {
> -	int left = data->left;
> -	int right = data->right;
> -	int top = data->top;
> -	int bottom = data->bottom;
> -	int cursor_w = data->curw;
> -	int cursor_h = data->curh;
> -
> -	/* fully outside */
> -	do_test(data, left - (cursor_w), right + (cursor_w), top             , bottom             );
> -	do_test(data, left             , right             , top - (cursor_h), bottom + (cursor_h));
> -	do_test(data, left - (cursor_w), right + (cursor_w), top - (cursor_h), bottom + (cursor_h));
> -
> -	/* fully outside by 1 extra pixels */
> -	do_test(data, left - (cursor_w+1), right + (cursor_w+1), top               , bottom               );
> -	do_test(data, left               , right               , top - (cursor_h+1), bottom + (cursor_h+1));
> -	do_test(data, left - (cursor_w+1), right + (cursor_w+1), top - (cursor_h+1), bottom + (cursor_h+1));
> -
> -	/* fully outside by 2 extra pixels */
> -	do_test(data, left - (cursor_w+2), right + (cursor_w+2), top               , bottom               );
> -	do_test(data, left               , right               , top - (cursor_h+2), bottom + (cursor_h+2));
> -	do_test(data, left - (cursor_w+2), right + (cursor_w+2), top - (cursor_h+2), bottom + (cursor_h+2));
> -
> -	/* fully outside by a lot of extra pixels */
> -	do_test(data, left - (cursor_w+512), right + (cursor_w+512), top                 , bottom                 );
> -	do_test(data, left                 , right                 , top - (cursor_h+512), bottom + (cursor_h+512));
> -	do_test(data, left - (cursor_w+512), right + (cursor_w+512), top - (cursor_h+512), bottom + (cursor_h+512));
> -
> -	/* go nuts */
> -	do_test(data, INT_MIN, INT_MAX - cursor_w, INT_MIN, INT_MAX - cursor_h);
> -	do_test(data, SHRT_MIN, SHRT_MAX, SHRT_MIN, SHRT_MAX);
> +	const int left = data->left;
> +	const int right = data->right;
> +	const int top = data->top;
> +	const int bottom = data->bottom;
> +	const int cursor_w = data->curw;
> +	const int cursor_h = data->curh;
> +
> +	struct {
> +		const cursorarea coords;
> +		igt_crc_t crc[4];
> +	} tests[] = {
> +		/* fully outside */
> +		{{left - (cursor_w), right + (cursor_w), top, bottom}},
> +		{{left, right, top - (cursor_h), bottom + (cursor_h)}},
> +		{{left - (cursor_w), right + (cursor_w), top - (cursor_h),
> +		  bottom + (cursor_h)}},
> +		/* fully outside by 1 extra pixels */
> +		{{left - (cursor_w + 1), right + (cursor_w + 1), top, bottom}},
> +		{{left, right, top - (cursor_h + 1), bottom + (cursor_h + 1)}},
> +		{{left - (cursor_w + 1), right + (cursor_w + 1),
> +		  top - (cursor_h + 1), bottom + (cursor_h + 1)}},
> +		/* fully outside by 2 extra pixels */
> +		{{left - (cursor_w + 2), right + (cursor_w + 2), top, bottom}},
> +		{{left, right, top - (cursor_h + 2), bottom + (cursor_h + 2)}},
> +		{{left - (cursor_w + 2), right + (cursor_w + 2),
> +		  top - (cursor_h + 2), bottom + (cursor_h + 2)}},
> +		/* fully outside by a lot of extra pixels */
> +		{{left - (cursor_w + 512), right + (cursor_w + 512), top, bottom}},
> +		{{left, right, top - (cursor_h + 512), bottom + (cursor_h + 512)}},
> +		{{left - (cursor_w + 512), right + (cursor_w + 512),
> +		  top - (cursor_h + 512), bottom + (cursor_h + 512)}},
> +		/* go nuts */
> +		{{INT_MIN, INT_MAX - cursor_w, INT_MIN, INT_MAX - cursor_h}},
> +		{{SHRT_MIN, SHRT_MAX, SHRT_MIN, SHRT_MAX}},
> +	};
> +
> +	/* HW test */
> +	cursor_enable(data);
> +	igt_plane_set_fb(data->primary, &data->primary_fb[HWCURSORBUFFER]);
> +	for (int i = 0; i < ARRAY_SIZE(tests); i++)
> +		do_test(data, &tests[i].coords, tests[i].crc, true);
> +
> +	/* SW test */
> +	cursor_disable(data);
> +	/*
> +	 * all these crc's should be the same, actually render only first image
> +	 * to check crc and then compare rest of crc are matching
> +	 */
> +	do_test(data, &tests[0].coords, tests[0].crc, false);
> +
> +	for (int i = 1; i < ARRAY_SIZE(tests); i++) {
> +		igt_assert_crc_equal(&tests[0].crc[0], &tests[i].crc[0]);
> +		igt_assert_crc_equal(&tests[0].crc[0], &tests[i].crc[1]);
> +		igt_assert_crc_equal(&tests[0].crc[0], &tests[i].crc[2]);
> +		igt_assert_crc_equal(&tests[0].crc[0], &tests[i].crc[3]);
> +	}
>  
>  	/* Make sure we get -ERANGE on integer overflow */
>  	do_fail_test(data, INT_MAX - cursor_w + 1, INT_MAX - cursor_h + 1, -ERANGE);
> @@ -320,29 +384,57 @@ static void test_crc_offscreen(data_t *data)
>  static void test_crc_sliding(data_t *data)
>  {
>  	int i;
> +	struct {
> +		igt_crc_t crc[3];
> +	} rounds[16] = {};
>  
>  	/* Make sure cursor moves smoothly and pixel-by-pixel, and that there are
>  	 * no alignment issues. Horizontal, vertical and diagonal test.
>  	 */
> -	for (i = 0; i < 16; i++) {
> -		do_single_test(data, i, 0);
> -		do_single_test(data, 0, i);
> -		do_single_test(data, i, i);
> +
> +	/* HW test */
> +	cursor_enable(data);
> +	igt_plane_set_fb(data->primary, &data->primary_fb[HWCURSORBUFFER]);
> +
> +	for (i = 0; i < ARRAY_SIZE(rounds); i++) {
> +		do_single_test(data, i, 0, true, &rounds[i].crc[0]);
> +		do_single_test(data, 0, i, true, &rounds[i].crc[1]);
> +		do_single_test(data, i, i, true, &rounds[i].crc[2]);
> +	}
> +
> +	/* SW test */
> +	cursor_disable(data);
> +	for (i = 0; i < ARRAY_SIZE(rounds); i++) {
> +		do_single_test(data, i, 0, false, &rounds[i].crc[0]);
> +		do_single_test(data, 0, i, false, &rounds[i].crc[1]);
> +		do_single_test(data, i, i, false, &rounds[i].crc[2]);
>  	}
>  }
>  
>  static void test_crc_random(data_t *data)
>  {
> -	int i, max;
> +	igt_crc_t crc[50];
> +	int i, max, x[ARRAY_SIZE(crc)], y[ARRAY_SIZE(crc)];
>  
> -	max = data->flags & (TEST_DPMS | TEST_SUSPEND) ? 2 : 50;
> +	max = data->flags & (TEST_DPMS | TEST_SUSPEND) ? 2 : ARRAY_SIZE(crc);
>  
>  	/* Random cursor placement */
> +
> +	/* HW test */
> +	cursor_enable(data);
> +	igt_plane_set_fb(data->primary, &data->primary_fb[HWCURSORBUFFER]);
> +
>  	for (i = 0; i < max; i++) {
> -		int x = rand() % (data->screenw + data->curw * 2) - data->curw;
> -		int y = rand() % (data->screenh + data->curh * 2) - data->curh;
> -		do_single_test(data, x, y);
> +		x[i] = rand() % (data->screenw + data->curw * 2) - data->curw;
> +		y[i] = rand() % (data->screenh + data->curh * 2) - data->curh;
> +		do_single_test(data, x[i], y[i], true, &crc[i]);
>  	}
> +
> +	/* SW test */
> +	cursor_disable(data);
> +	for (i = 0; i < max; i++)
> +		do_single_test(data, x[i], y[i], false, &crc[i]);
> +
>  }
>  
>  static void cleanup_crtc(data_t *data)
> @@ -362,7 +454,8 @@ static void cleanup_crtc(data_t *data)
>  	igt_display_commit(display);
>  
>  	igt_remove_fb(data->drm_fd, &data->primary_fb[HWCURSORBUFFER]);
> -	igt_remove_fb(data->drm_fd, &data->primary_fb[SWCOMPARISONBUFFER]);
> +	igt_remove_fb(data->drm_fd, &data->primary_fb[SWCOMPARISONBUFFER1]);
> +	igt_remove_fb(data->drm_fd, &data->primary_fb[SWCOMPARISONBUFFER2]);
>  
>  	igt_display_reset(display);
>  }
> @@ -379,22 +472,22 @@ static void prepare_crtc(data_t *data, igt_output_t *output,
>  
>  	/* create and set the primary plane fbs */
>  	mode = igt_output_get_mode(output);
> -	igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
> -			    DRM_FORMAT_XRGB8888,
> -			    DRM_FORMAT_MOD_NONE,
> -			    0.0, 0.0, 0.0,
> -			    &data->primary_fb[HWCURSORBUFFER]);
> -
> -	igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
> -			    DRM_FORMAT_XRGB8888,
> -			    DRM_FORMAT_MOD_NONE,
> -			    0.0, 0.0, 0.0,
> -			    &data->primary_fb[SWCOMPARISONBUFFER]);
> +	igt_create_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
> +		      DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE,
> +		      &data->primary_fb[HWCURSORBUFFER]);
> +
> +	igt_create_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
> +		      DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE,
> +		      &data->primary_fb[SWCOMPARISONBUFFER1]);
> +
> +	igt_create_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
> +		      DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE,
> +		      &data->primary_fb[SWCOMPARISONBUFFER2]);
>  
>  	data->primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
>  	data->cursor = igt_output_get_plane_type(output, DRM_PLANE_TYPE_CURSOR);
>  
> -	igt_plane_set_fb(data->primary, &data->primary_fb[SWCOMPARISONBUFFER]);
> +	igt_plane_set_fb(data->primary, &data->primary_fb[SWCOMPARISONBUFFER1]);
>  
>  	igt_display_commit(display);
>  
> @@ -427,7 +520,7 @@ static void prepare_crtc(data_t *data, igt_output_t *output,
>  		cairo_destroy(cr);
>  
>  		/* Set HW cursor buffer in place */
> -			restore_image(data, HWCURSORBUFFER);
> +		restore_image(data, HWCURSORBUFFER, NULL);
>  	} else
>  		data->surface = NULL;
>  
> @@ -469,10 +562,10 @@ static void test_cursor_alpha(data_t *data, double a)
>  	igt_remove_fb(data->drm_fd, &data->fb);
>  
>  	/* Software Test - render cursor in software, drawn it directly on PF */
> -	cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb[SWCOMPARISONBUFFER]);
> +	cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb[SWCOMPARISONBUFFER1]);
>  	igt_paint_color_alpha(cr, 0, 0, curw, curh, 1.0, 1.0, 1.0, a);
>  	igt_put_cairo_ctx(cr);
> -	igt_plane_set_fb(data->primary, &data->primary_fb[SWCOMPARISONBUFFER]);
> +	igt_plane_set_fb(data->primary, &data->primary_fb[SWCOMPARISONBUFFER1]);
>  	igt_display_commit(display);
>  	igt_wait_for_vblank(data->drm_fd,
>  			display->pipes[data->pipe].crtc_offset);
> @@ -513,7 +606,7 @@ static void create_cursor_fb(data_t *data, int cur_w, int cur_h)
>  	igt_assert(fb_id);
>  
>  	cr = igt_get_cairo_ctx(data->drm_fd, &data->fb);
> -	draw_cursor(cr, 0, 0, cur_w, cur_h, 1.0);
> +	draw_cursor(cr, &((cursorarea){0, 0, cur_w, cur_h}));
>  	igt_put_cairo_ctx(cr);
>  }
>  
> @@ -610,7 +703,7 @@ static void test_cursor_size(data_t *data)
>  		igt_display_commit(display);
>  
>  		/* Now render the same in software and collect crc */
> -		cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb[SWCOMPARISONBUFFER]);
> +		cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb[SWCOMPARISONBUFFER1]);
>  
>  		/* remove previous cursor sw image */
>  		if (prevsize > 0)
> @@ -619,7 +712,7 @@ static void test_cursor_size(data_t *data)
>  
>  		igt_paint_color_alpha(cr, 0, 0, size, size, 1.0, 1.0, 1.0, 1.0);
>  		igt_put_cairo_ctx(cr);
> -		igt_plane_set_fb(data->primary, &data->primary_fb[SWCOMPARISONBUFFER]);
> +		igt_plane_set_fb(data->primary, &data->primary_fb[SWCOMPARISONBUFFER1]);
>  		igt_display_commit(display);
>  		igt_pipe_crc_get_current(data->drm_fd, pipe_crc, &ref_crc);
>  
> @@ -657,6 +750,8 @@ static void test_rapid_movement(data_t *data)
>  	}
>  	gettimeofday(&end, NULL);
>  
> +	cursor_disable(data);
> +
>  	/*
>  	 * We've done 400 cursor updates now.  If we're being throttled to
>  	 * vblank, then that would take roughly 400/refresh seconds.  If the
> @@ -813,6 +908,9 @@ igt_main
>  		igt_require_pipe_crc(data.drm_fd);
>  
>  		igt_display_require(&data.display, data.drm_fd);
> +		igt_display_reset(&data.display);
> +		igt_display_commit2(&data.display, data.display.is_atomic ?
> +				    COMMIT_ATOMIC : COMMIT_LEGACY);
>  	}

igt_display_require() calls igt_display_reset at the end of it... but
after that does igt_enable_connectors. Is that why this extra
igt_display_reset is needed here?


-- 
Petri Latvala


>  
>  	data.cursor_max_w = cursor_width;
> -- 
> 2.28.0
> 

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

* Re: [igt-dev] [PATCH i-g-t 1/2] tests/kms_cursor_crc: Separate hw and sw runs on tests
  2021-08-17 15:59 ` [igt-dev] [PATCH i-g-t 1/2] tests/kms_cursor_crc: Separate hw and sw runs on tests Petri Latvala
@ 2021-08-17 17:46   ` Juha-Pekka Heikkila
  2021-08-18  9:17     ` Petri Latvala
  0 siblings, 1 reply; 11+ messages in thread
From: Juha-Pekka Heikkila @ 2021-08-17 17:46 UTC (permalink / raw)
  To: Petri Latvala; +Cc: igt-dev

On 17.8.2021 18.59, Petri Latvala wrote:
> On Tue, Aug 17, 2021 at 12:27:23PM +0300, Juha-Pekka Heikkila wrote:
>> Reset display structure settings and commit them in before starting
>> test in case some earlier test left tail.
>>
>> Separate hw and sw test runs for optimizing test.
>>
>> Simple cleanup.
>>
>> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
>> ---
>>   tests/kms_cursor_crc.c | 404 +++++++++++++++++++++++++----------------
>>   1 file changed, 251 insertions(+), 153 deletions(-)
>>
>> diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c
>> index a9bc3a745..f478ae08d 100644
>> --- a/tests/kms_cursor_crc.c
>> +++ b/tests/kms_cursor_crc.c
>> @@ -46,10 +46,17 @@ IGT_TEST_DESCRIPTION(
>>   #define DRM_CAP_CURSOR_HEIGHT 0x9
>>   #endif
>>   
>> +enum cursor_buffers {
>> +	HWCURSORBUFFER,
>> +	SWCOMPARISONBUFFER1,
>> +	SWCOMPARISONBUFFER2,
>> +	MAXCURSORBUFFER
>> +};
>> +
>>   typedef struct {
>>   	int drm_fd;
>>   	igt_display_t display;
>> -	struct igt_fb primary_fb[2];
>> +	struct igt_fb primary_fb[MAXCURSORBUFFER];
>>   	struct igt_fb fb;
>>   	igt_output_t *output;
>>   	enum pipe pipe;
>> @@ -70,29 +77,40 @@ typedef struct {
>>   #define TEST_DPMS (1<<0)
>>   #define TEST_SUSPEND (1<<1)
>>   
>> -#define HWCURSORBUFFER 0
>> -#define SWCOMPARISONBUFFER 1
>> +#define RED 1.0, 0.0, 0.0
>> +#define GREEN 0.0, 1.0, 0.0
>> +#define BLUE 0.0, 0.0, 1.0
>> +#define WHITE 1.0, 1.0, 1.0
>> +
>> +typedef struct {
>> +	int x;
>> +	int y;
>> +	int width;
>> +	int height;
>> +} cursorarea;
>>   
>> -static void draw_cursor(cairo_t *cr, int x, int y, int cw, int ch, double a)
>> +static void draw_cursor(cairo_t *cr, cursorarea *cursor)
>>   {
>>   	int wl, wr, ht, hb;
>>   
>>   	/* deal with odd cursor width/height */
>> -	wl = cw / 2;
>> -	wr = (cw + 1) / 2;
>> -	ht = ch / 2;
>> -	hb = (ch + 1) / 2;
>> +	wl = cursor->width / 2;
>> +	wr = (cursor->width + 1) / 2;
>> +	ht = cursor->height / 2;
>> +	hb = (cursor->height + 1) / 2;
>>   
>>   	/* Cairo doesn't like to be fed numbers that are too wild */
>> -	if ((x < SHRT_MIN) || (x > SHRT_MAX) || (y < SHRT_MIN) || (y > SHRT_MAX))
>> +	if ((cursor->x < SHRT_MIN) || (cursor->x > SHRT_MAX) ||
>> +	    (cursor->y < SHRT_MIN) || (cursor->y > SHRT_MAX))
>>   		return;
>> +
>>   	cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
>>   	cairo_set_antialias(cr, CAIRO_ANTIALIAS_NONE);
>>   	/* 4 color rectangles in the corners, RGBY */
>> -	igt_paint_color_alpha(cr, x,      y,      wl, ht, 1.0, 0.0, 0.0, a);
>> -	igt_paint_color_alpha(cr, x + wl, y,      wr, ht, 0.0, 1.0, 0.0, a);
>> -	igt_paint_color_alpha(cr, x,      y + ht, wl, hb, 0.0, 0.0, 1.0, a);
>> -	igt_paint_color_alpha(cr, x + wl, y + ht, wr, hb, 1.0, 1.0, 1.0, a);
>> +	igt_paint_color(cr, cursor->x, cursor->y, wl, ht, RED);
>> +	igt_paint_color(cr, cursor->x + wl, cursor->y, wr, ht, GREEN);
>> +	igt_paint_color(cr, cursor->x, cursor->y + ht, wl, hb, BLUE);
>> +	igt_paint_color(cr, cursor->x + wl, cursor->y + ht, wr, hb, WHITE);
>>   }
>>   
>>   static void cursor_enable(data_t *data)
>> @@ -144,7 +162,7 @@ static bool cursor_visible(data_t *data, int x, int y)
>>   	return true;
>>   }
>>   
>> -static void restore_image(data_t *data, uint32_t buffer)
>> +static void restore_image(data_t *data, uint32_t buffer, cursorarea *cursor)
>>   {
>>   	cairo_t *cr;
>>   
>> @@ -153,80 +171,84 @@ static void restore_image(data_t *data, uint32_t buffer)
>>   	cairo_set_source_surface(cr, data->surface, 0, 0);
>>   	cairo_rectangle(cr, 0, 0, data->screenw, data->screenh);
>>   	cairo_fill(cr);
>> +
>> +	if (cursor)
>> +		draw_cursor(cr, cursor);
>> +
>>   	igt_put_cairo_ctx(cr);
>>   }
>>   
>> -static void do_single_test(data_t *data, int x, int y)
>> +static void do_single_test(data_t *data, int x, int y, bool hw_test,
>> +			   igt_crc_t *hwcrc)
>>   {
>>   	igt_display_t *display = &data->display;
>>   	igt_pipe_crc_t *pipe_crc = data->pipe_crc;
>> -	igt_crc_t crc, ref_crc;
>> -	cairo_t *cr;
>> -	int ret = 0;
>> +	igt_crc_t crc;
>> +	int ret = 0, swbufidx;
>>   
>>   	igt_print_activity();
>>   
>> -	/* Hardware test */
>> -	igt_plane_set_position(data->cursor, x, y);
>> -	cursor_enable(data);
>> +	if (hw_test) {
>> +		/* Hardware test */
>> +		igt_plane_set_position(data->cursor, x, y);
>>   
>> -	if (chv_cursor_broken(data, x) && cursor_visible(data, x, y)) {
>> -		ret = igt_display_try_commit2(display, COMMIT_LEGACY);
>> -		igt_assert_eq(ret, -EINVAL);
>> -		igt_plane_set_position(data->cursor, 0, y);
>> -		return;
>> -	}
>> +		if (chv_cursor_broken(data, x) && cursor_visible(data, x, y)) {
>> +			ret = igt_display_try_commit2(display, COMMIT_LEGACY);
>> +			igt_assert_eq(ret, -EINVAL);
>> +			igt_plane_set_position(data->cursor, 0, y);
>> +			return;
>> +		}
>>   
>> -	igt_plane_set_fb(data->primary, &data->primary_fb[HWCURSORBUFFER]);
>> -	igt_display_commit(display);
>> +		igt_display_commit(display);
>>   
>> -	/* Extra vblank wait is because nonblocking cursor ioctl */
>> -	igt_wait_for_vblank(data->drm_fd,
>> -			    display->pipes[data->pipe].crtc_offset);
>> +		/* Extra vblank wait is because nonblocking cursor ioctl */
>> +		igt_wait_for_vblank(data->drm_fd,
>> +				display->pipes[data->pipe].crtc_offset);
>>   
>> -	igt_pipe_crc_get_current(data->drm_fd, pipe_crc, &crc);
>> -	restore_image(data, SWCOMPARISONBUFFER);
>> +		igt_pipe_crc_get_current(data->drm_fd, pipe_crc, hwcrc);
>>   
>> -	if (data->flags & (TEST_DPMS | TEST_SUSPEND)) {
>> -		igt_crc_t crc_after;
>> -		/*
>> -		 * stop/start crc to avoid dmesg notifications about userspace
>> -		 * reading too slow.
>> -		 */
>> -		igt_pipe_crc_stop(pipe_crc);
>> -
>> -		if (data->flags & TEST_DPMS) {
>> -			igt_debug("dpms off/on cycle\n");
>> -			kmstest_set_connector_dpms(data->drm_fd,
>> -						   data->output->config.connector,
>> -						   DRM_MODE_DPMS_OFF);
>> -			kmstest_set_connector_dpms(data->drm_fd,
>> -						   data->output->config.connector,
>> -						   DRM_MODE_DPMS_ON);
>> +		if (data->flags & (TEST_DPMS | TEST_SUSPEND)) {
>> +			igt_crc_t crc_after;
>> +			/*
>> +			* stop/start crc to avoid dmesg notifications about userspace
>> +			* reading too slow.
>> +			*/
>> +			igt_pipe_crc_stop(pipe_crc);
>> +
>> +			if (data->flags & TEST_DPMS) {
>> +				igt_debug("dpms off/on cycle\n");
>> +				kmstest_set_connector_dpms(data->drm_fd,
>> +							data->output->config.connector,
>> +							DRM_MODE_DPMS_OFF);
>> +				kmstest_set_connector_dpms(data->drm_fd,
>> +							data->output->config.connector,
>> +							DRM_MODE_DPMS_ON);
>> +			}
>> +
>> +			if (data->flags & TEST_SUSPEND)
>> +				igt_system_suspend_autoresume(SUSPEND_STATE_MEM,
>> +							SUSPEND_TEST_NONE);
>> +
>> +			igt_pipe_crc_start(pipe_crc);
>> +			igt_pipe_crc_get_current(data->drm_fd, pipe_crc, &crc_after);
>> +			igt_assert_crc_equal(hwcrc, &crc_after);
>>   		}
>> +	} else {
>> +		/* Now render the same in software and collect crc */
>> +		swbufidx = (data->primary->drm_plane->fb_id ==
>> +			    data->primary_fb[SWCOMPARISONBUFFER1].fb_id) ?
>> +			    SWCOMPARISONBUFFER2 : SWCOMPARISONBUFFER1;
>>   
>> -		if (data->flags & TEST_SUSPEND)
>> -			igt_system_suspend_autoresume(SUSPEND_STATE_MEM,
>> -						      SUSPEND_TEST_NONE);
>> -
>> -		igt_pipe_crc_start(pipe_crc);
>> -		igt_pipe_crc_get_current(data->drm_fd, pipe_crc, &crc_after);
>> -		igt_assert_crc_equal(&crc, &crc_after);
>> -	}
>> -
>> -	/* Now render the same in software and collect crc */
>> -	cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb[SWCOMPARISONBUFFER]);
>> -	draw_cursor(cr, x, y, data->curw, data->curh, 1.0);
>> -	igt_put_cairo_ctx(cr);
>> -	igt_plane_set_fb(data->primary, &data->primary_fb[SWCOMPARISONBUFFER]);
>> -	cursor_disable(data);
>> -	igt_display_commit(display);
>> +		restore_image(data, swbufidx, &((cursorarea){x, y, data->curw, data->curh}));
>> +		igt_plane_set_fb(data->primary, &data->primary_fb[swbufidx]);
>>   
>> -	igt_wait_for_vblank(data->drm_fd,
>> -			display->pipes[data->pipe].crtc_offset);
>> +		igt_display_commit(display);
>> +		igt_wait_for_vblank(data->drm_fd,
>> +				display->pipes[data->pipe].crtc_offset);
>>   
>> -	igt_pipe_crc_get_current(data->drm_fd, pipe_crc, &ref_crc);
>> -	igt_assert_crc_equal(&crc, &ref_crc);
>> +		igt_pipe_crc_get_current(data->drm_fd, pipe_crc, &crc);
>> +		igt_assert_crc_equal(&crc, hwcrc);
>> +	}
>>   }
>>   
>>   static void do_fail_test(data_t *data, int x, int y, int expect)
>> @@ -248,70 +270,112 @@ static void do_fail_test(data_t *data, int x, int y, int expect)
>>   	igt_assert_eq(ret, expect);
>>   }
>>   
>> -static void do_test(data_t *data,
>> -		    int left, int right, int top, int bottom)
>> +static void do_test(data_t *data, const cursorarea *coords, igt_crc_t crc[4],
>> +		    bool hwtest)
>>   {
>> -	do_single_test(data, left, top);
>> -	do_single_test(data, right, top);
>> -	do_single_test(data, right, bottom);
>> -	do_single_test(data, left, bottom);
>> +	do_single_test(data, coords->x, coords->width, hwtest, &crc[0]);
>> +	do_single_test(data, coords->y, coords->width, hwtest, &crc[1]);
>> +	do_single_test(data, coords->y, coords->height, hwtest, &crc[2]);
>> +	do_single_test(data, coords->x, coords->height, hwtest, &crc[3]);
>>   }
>>   
>>   static void test_crc_onscreen(data_t *data)
>>   {
>> -	int left = data->left;
>> -	int right = data->right;
>> -	int top = data->top;
>> -	int bottom = data->bottom;
>> -	int cursor_w = data->curw;
>> -	int cursor_h = data->curh;
>> -
>> -	/* fully inside  */
>> -	do_test(data, left, right, top, bottom);
>> -
>> -	/* 2 pixels inside */
>> -	do_test(data, left - (cursor_w-2), right + (cursor_w-2), top               , bottom               );
>> -	do_test(data, left               , right               , top - (cursor_h-2), bottom + (cursor_h-2));
>> -	do_test(data, left - (cursor_w-2), right + (cursor_w-2), top - (cursor_h-2), bottom + (cursor_h-2));
>> -
>> -	/* 1 pixel inside */
>> -	do_test(data, left - (cursor_w-1), right + (cursor_w-1), top               , bottom               );
>> -	do_test(data, left               , right               , top - (cursor_h-1), bottom + (cursor_h-1));
>> -	do_test(data, left - (cursor_w-1), right + (cursor_w-1), top - (cursor_h-1), bottom + (cursor_h-1));
>> +	const int left = data->left;
>> +	const int right = data->right;
>> +	const int top = data->top;
>> +	const int bottom = data->bottom;
>> +	const int cursor_w = data->curw;
>> +	const int cursor_h = data->curh;
>> +
>> +	struct {
>> +		const cursorarea coords;
>> +		igt_crc_t crc[4];
>> +	} tests[] = {
>> +		/* fully inside  */
>> +		{{left, right, top, bottom}},
>> +		/* 2 pixels inside */
>> +		{{left - (cursor_w - 2), right + (cursor_w - 2), top, bottom}},
>> +		{{left, right, top - (cursor_h - 2), bottom + (cursor_h - 2)}},
>> +		{{left - (cursor_w - 2), right + (cursor_w - 2),
>> +		  top - (cursor_h - 2), bottom + (cursor_h - 2)}},
>> +		/* 1 pixel inside */
>> +		{{left - (cursor_w - 1), right + (cursor_w - 1), top, bottom}},
>> +		{{left, right, top - (cursor_h - 1), bottom + (cursor_h - 1)}},
>> +		{{left - (cursor_w - 1), right + (cursor_w - 1),
>> +		  top - (cursor_h - 1), bottom + (cursor_h - 1)}},
>> +	};
>> +
>> +	/* HW test */
>> +	cursor_enable(data);
>> +	igt_plane_set_fb(data->primary, &data->primary_fb[HWCURSORBUFFER]);
>> +	for (int i = 0; i < ARRAY_SIZE(tests); i++)
>> +		do_test(data, &tests[i].coords, tests[i].crc, true);
>> +
>> +	/* SW test */
>> +	cursor_disable(data);
>> +	for (int i = 0; i < ARRAY_SIZE(tests); i++)
>> +		do_test(data, &tests[i].coords, tests[i].crc, false);
>>   }
>>   
>>   static void test_crc_offscreen(data_t *data)
>>   {
>> -	int left = data->left;
>> -	int right = data->right;
>> -	int top = data->top;
>> -	int bottom = data->bottom;
>> -	int cursor_w = data->curw;
>> -	int cursor_h = data->curh;
>> -
>> -	/* fully outside */
>> -	do_test(data, left - (cursor_w), right + (cursor_w), top             , bottom             );
>> -	do_test(data, left             , right             , top - (cursor_h), bottom + (cursor_h));
>> -	do_test(data, left - (cursor_w), right + (cursor_w), top - (cursor_h), bottom + (cursor_h));
>> -
>> -	/* fully outside by 1 extra pixels */
>> -	do_test(data, left - (cursor_w+1), right + (cursor_w+1), top               , bottom               );
>> -	do_test(data, left               , right               , top - (cursor_h+1), bottom + (cursor_h+1));
>> -	do_test(data, left - (cursor_w+1), right + (cursor_w+1), top - (cursor_h+1), bottom + (cursor_h+1));
>> -
>> -	/* fully outside by 2 extra pixels */
>> -	do_test(data, left - (cursor_w+2), right + (cursor_w+2), top               , bottom               );
>> -	do_test(data, left               , right               , top - (cursor_h+2), bottom + (cursor_h+2));
>> -	do_test(data, left - (cursor_w+2), right + (cursor_w+2), top - (cursor_h+2), bottom + (cursor_h+2));
>> -
>> -	/* fully outside by a lot of extra pixels */
>> -	do_test(data, left - (cursor_w+512), right + (cursor_w+512), top                 , bottom                 );
>> -	do_test(data, left                 , right                 , top - (cursor_h+512), bottom + (cursor_h+512));
>> -	do_test(data, left - (cursor_w+512), right + (cursor_w+512), top - (cursor_h+512), bottom + (cursor_h+512));
>> -
>> -	/* go nuts */
>> -	do_test(data, INT_MIN, INT_MAX - cursor_w, INT_MIN, INT_MAX - cursor_h);
>> -	do_test(data, SHRT_MIN, SHRT_MAX, SHRT_MIN, SHRT_MAX);
>> +	const int left = data->left;
>> +	const int right = data->right;
>> +	const int top = data->top;
>> +	const int bottom = data->bottom;
>> +	const int cursor_w = data->curw;
>> +	const int cursor_h = data->curh;
>> +
>> +	struct {
>> +		const cursorarea coords;
>> +		igt_crc_t crc[4];
>> +	} tests[] = {
>> +		/* fully outside */
>> +		{{left - (cursor_w), right + (cursor_w), top, bottom}},
>> +		{{left, right, top - (cursor_h), bottom + (cursor_h)}},
>> +		{{left - (cursor_w), right + (cursor_w), top - (cursor_h),
>> +		  bottom + (cursor_h)}},
>> +		/* fully outside by 1 extra pixels */
>> +		{{left - (cursor_w + 1), right + (cursor_w + 1), top, bottom}},
>> +		{{left, right, top - (cursor_h + 1), bottom + (cursor_h + 1)}},
>> +		{{left - (cursor_w + 1), right + (cursor_w + 1),
>> +		  top - (cursor_h + 1), bottom + (cursor_h + 1)}},
>> +		/* fully outside by 2 extra pixels */
>> +		{{left - (cursor_w + 2), right + (cursor_w + 2), top, bottom}},
>> +		{{left, right, top - (cursor_h + 2), bottom + (cursor_h + 2)}},
>> +		{{left - (cursor_w + 2), right + (cursor_w + 2),
>> +		  top - (cursor_h + 2), bottom + (cursor_h + 2)}},
>> +		/* fully outside by a lot of extra pixels */
>> +		{{left - (cursor_w + 512), right + (cursor_w + 512), top, bottom}},
>> +		{{left, right, top - (cursor_h + 512), bottom + (cursor_h + 512)}},
>> +		{{left - (cursor_w + 512), right + (cursor_w + 512),
>> +		  top - (cursor_h + 512), bottom + (cursor_h + 512)}},
>> +		/* go nuts */
>> +		{{INT_MIN, INT_MAX - cursor_w, INT_MIN, INT_MAX - cursor_h}},
>> +		{{SHRT_MIN, SHRT_MAX, SHRT_MIN, SHRT_MAX}},
>> +	};
>> +
>> +	/* HW test */
>> +	cursor_enable(data);
>> +	igt_plane_set_fb(data->primary, &data->primary_fb[HWCURSORBUFFER]);
>> +	for (int i = 0; i < ARRAY_SIZE(tests); i++)
>> +		do_test(data, &tests[i].coords, tests[i].crc, true);
>> +
>> +	/* SW test */
>> +	cursor_disable(data);
>> +	/*
>> +	 * all these crc's should be the same, actually render only first image
>> +	 * to check crc and then compare rest of crc are matching
>> +	 */
>> +	do_test(data, &tests[0].coords, tests[0].crc, false);
>> +
>> +	for (int i = 1; i < ARRAY_SIZE(tests); i++) {
>> +		igt_assert_crc_equal(&tests[0].crc[0], &tests[i].crc[0]);
>> +		igt_assert_crc_equal(&tests[0].crc[0], &tests[i].crc[1]);
>> +		igt_assert_crc_equal(&tests[0].crc[0], &tests[i].crc[2]);
>> +		igt_assert_crc_equal(&tests[0].crc[0], &tests[i].crc[3]);
>> +	}
>>   
>>   	/* Make sure we get -ERANGE on integer overflow */
>>   	do_fail_test(data, INT_MAX - cursor_w + 1, INT_MAX - cursor_h + 1, -ERANGE);
>> @@ -320,29 +384,57 @@ static void test_crc_offscreen(data_t *data)
>>   static void test_crc_sliding(data_t *data)
>>   {
>>   	int i;
>> +	struct {
>> +		igt_crc_t crc[3];
>> +	} rounds[16] = {};
>>   
>>   	/* Make sure cursor moves smoothly and pixel-by-pixel, and that there are
>>   	 * no alignment issues. Horizontal, vertical and diagonal test.
>>   	 */
>> -	for (i = 0; i < 16; i++) {
>> -		do_single_test(data, i, 0);
>> -		do_single_test(data, 0, i);
>> -		do_single_test(data, i, i);
>> +
>> +	/* HW test */
>> +	cursor_enable(data);
>> +	igt_plane_set_fb(data->primary, &data->primary_fb[HWCURSORBUFFER]);
>> +
>> +	for (i = 0; i < ARRAY_SIZE(rounds); i++) {
>> +		do_single_test(data, i, 0, true, &rounds[i].crc[0]);
>> +		do_single_test(data, 0, i, true, &rounds[i].crc[1]);
>> +		do_single_test(data, i, i, true, &rounds[i].crc[2]);
>> +	}
>> +
>> +	/* SW test */
>> +	cursor_disable(data);
>> +	for (i = 0; i < ARRAY_SIZE(rounds); i++) {
>> +		do_single_test(data, i, 0, false, &rounds[i].crc[0]);
>> +		do_single_test(data, 0, i, false, &rounds[i].crc[1]);
>> +		do_single_test(data, i, i, false, &rounds[i].crc[2]);
>>   	}
>>   }
>>   
>>   static void test_crc_random(data_t *data)
>>   {
>> -	int i, max;
>> +	igt_crc_t crc[50];
>> +	int i, max, x[ARRAY_SIZE(crc)], y[ARRAY_SIZE(crc)];
>>   
>> -	max = data->flags & (TEST_DPMS | TEST_SUSPEND) ? 2 : 50;
>> +	max = data->flags & (TEST_DPMS | TEST_SUSPEND) ? 2 : ARRAY_SIZE(crc);
>>   
>>   	/* Random cursor placement */
>> +
>> +	/* HW test */
>> +	cursor_enable(data);
>> +	igt_plane_set_fb(data->primary, &data->primary_fb[HWCURSORBUFFER]);
>> +
>>   	for (i = 0; i < max; i++) {
>> -		int x = rand() % (data->screenw + data->curw * 2) - data->curw;
>> -		int y = rand() % (data->screenh + data->curh * 2) - data->curh;
>> -		do_single_test(data, x, y);
>> +		x[i] = rand() % (data->screenw + data->curw * 2) - data->curw;
>> +		y[i] = rand() % (data->screenh + data->curh * 2) - data->curh;
>> +		do_single_test(data, x[i], y[i], true, &crc[i]);
>>   	}
>> +
>> +	/* SW test */
>> +	cursor_disable(data);
>> +	for (i = 0; i < max; i++)
>> +		do_single_test(data, x[i], y[i], false, &crc[i]);
>> +
>>   }
>>   
>>   static void cleanup_crtc(data_t *data)
>> @@ -362,7 +454,8 @@ static void cleanup_crtc(data_t *data)
>>   	igt_display_commit(display);
>>   
>>   	igt_remove_fb(data->drm_fd, &data->primary_fb[HWCURSORBUFFER]);
>> -	igt_remove_fb(data->drm_fd, &data->primary_fb[SWCOMPARISONBUFFER]);
>> +	igt_remove_fb(data->drm_fd, &data->primary_fb[SWCOMPARISONBUFFER1]);
>> +	igt_remove_fb(data->drm_fd, &data->primary_fb[SWCOMPARISONBUFFER2]);
>>   
>>   	igt_display_reset(display);
>>   }
>> @@ -379,22 +472,22 @@ static void prepare_crtc(data_t *data, igt_output_t *output,
>>   
>>   	/* create and set the primary plane fbs */
>>   	mode = igt_output_get_mode(output);
>> -	igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
>> -			    DRM_FORMAT_XRGB8888,
>> -			    DRM_FORMAT_MOD_NONE,
>> -			    0.0, 0.0, 0.0,
>> -			    &data->primary_fb[HWCURSORBUFFER]);
>> -
>> -	igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
>> -			    DRM_FORMAT_XRGB8888,
>> -			    DRM_FORMAT_MOD_NONE,
>> -			    0.0, 0.0, 0.0,
>> -			    &data->primary_fb[SWCOMPARISONBUFFER]);
>> +	igt_create_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
>> +		      DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE,
>> +		      &data->primary_fb[HWCURSORBUFFER]);
>> +
>> +	igt_create_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
>> +		      DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE,
>> +		      &data->primary_fb[SWCOMPARISONBUFFER1]);
>> +
>> +	igt_create_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
>> +		      DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE,
>> +		      &data->primary_fb[SWCOMPARISONBUFFER2]);
>>   
>>   	data->primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
>>   	data->cursor = igt_output_get_plane_type(output, DRM_PLANE_TYPE_CURSOR);
>>   
>> -	igt_plane_set_fb(data->primary, &data->primary_fb[SWCOMPARISONBUFFER]);
>> +	igt_plane_set_fb(data->primary, &data->primary_fb[SWCOMPARISONBUFFER1]);
>>   
>>   	igt_display_commit(display);
>>   
>> @@ -427,7 +520,7 @@ static void prepare_crtc(data_t *data, igt_output_t *output,
>>   		cairo_destroy(cr);
>>   
>>   		/* Set HW cursor buffer in place */
>> -			restore_image(data, HWCURSORBUFFER);
>> +		restore_image(data, HWCURSORBUFFER, NULL);
>>   	} else
>>   		data->surface = NULL;
>>   
>> @@ -469,10 +562,10 @@ static void test_cursor_alpha(data_t *data, double a)
>>   	igt_remove_fb(data->drm_fd, &data->fb);
>>   
>>   	/* Software Test - render cursor in software, drawn it directly on PF */
>> -	cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb[SWCOMPARISONBUFFER]);
>> +	cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb[SWCOMPARISONBUFFER1]);
>>   	igt_paint_color_alpha(cr, 0, 0, curw, curh, 1.0, 1.0, 1.0, a);
>>   	igt_put_cairo_ctx(cr);
>> -	igt_plane_set_fb(data->primary, &data->primary_fb[SWCOMPARISONBUFFER]);
>> +	igt_plane_set_fb(data->primary, &data->primary_fb[SWCOMPARISONBUFFER1]);
>>   	igt_display_commit(display);
>>   	igt_wait_for_vblank(data->drm_fd,
>>   			display->pipes[data->pipe].crtc_offset);
>> @@ -513,7 +606,7 @@ static void create_cursor_fb(data_t *data, int cur_w, int cur_h)
>>   	igt_assert(fb_id);
>>   
>>   	cr = igt_get_cairo_ctx(data->drm_fd, &data->fb);
>> -	draw_cursor(cr, 0, 0, cur_w, cur_h, 1.0);
>> +	draw_cursor(cr, &((cursorarea){0, 0, cur_w, cur_h}));
>>   	igt_put_cairo_ctx(cr);
>>   }
>>   
>> @@ -610,7 +703,7 @@ static void test_cursor_size(data_t *data)
>>   		igt_display_commit(display);
>>   
>>   		/* Now render the same in software and collect crc */
>> -		cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb[SWCOMPARISONBUFFER]);
>> +		cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb[SWCOMPARISONBUFFER1]);
>>   
>>   		/* remove previous cursor sw image */
>>   		if (prevsize > 0)
>> @@ -619,7 +712,7 @@ static void test_cursor_size(data_t *data)
>>   
>>   		igt_paint_color_alpha(cr, 0, 0, size, size, 1.0, 1.0, 1.0, 1.0);
>>   		igt_put_cairo_ctx(cr);
>> -		igt_plane_set_fb(data->primary, &data->primary_fb[SWCOMPARISONBUFFER]);
>> +		igt_plane_set_fb(data->primary, &data->primary_fb[SWCOMPARISONBUFFER1]);
>>   		igt_display_commit(display);
>>   		igt_pipe_crc_get_current(data->drm_fd, pipe_crc, &ref_crc);
>>   
>> @@ -657,6 +750,8 @@ static void test_rapid_movement(data_t *data)
>>   	}
>>   	gettimeofday(&end, NULL);
>>   
>> +	cursor_disable(data);
>> +
>>   	/*
>>   	 * We've done 400 cursor updates now.  If we're being throttled to
>>   	 * vblank, then that would take roughly 400/refresh seconds.  If the
>> @@ -813,6 +908,9 @@ igt_main
>>   		igt_require_pipe_crc(data.drm_fd);
>>   
>>   		igt_display_require(&data.display, data.drm_fd);
>> +		igt_display_reset(&data.display);
>> +		igt_display_commit2(&data.display, data.display.is_atomic ?
>> +				    COMMIT_ATOMIC : COMMIT_LEGACY);
>>   	}
> 
> igt_display_require() calls igt_display_reset at the end of it... but
> after that does igt_enable_connectors. Is that why this extra
> igt_display_reset is needed here?
> 

This is something I don't yet know where exactly the problem exists, 
earlier failed tests may leave tail which this is able to clear out. I 
coined this for myself to do some debugging:
https://patchwork.freedesktop.org/series/93756/

Those igt_display_reset(..) followed by atomic and legacy commit and get 
crc of white imo should match but they don't do that for me. Situation 
is the same as kms_plane_alpha_blend failed and will arrive to new test, 
there maybe differences if test uses legacy or atomic commits.

/Juha-Pekka

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

* Re: [igt-dev] [PATCH i-g-t 1/2] tests/kms_cursor_crc: Separate hw and sw runs on tests
  2021-08-17 17:46   ` Juha-Pekka Heikkila
@ 2021-08-18  9:17     ` Petri Latvala
  2021-08-18 14:31       ` Juha-Pekka Heikkila
  0 siblings, 1 reply; 11+ messages in thread
From: Petri Latvala @ 2021-08-18  9:17 UTC (permalink / raw)
  To: Juha-Pekka Heikkila; +Cc: igt-dev

On Tue, Aug 17, 2021 at 08:46:22PM +0300, Juha-Pekka Heikkila wrote:
> On 17.8.2021 18.59, Petri Latvala wrote:
> > On Tue, Aug 17, 2021 at 12:27:23PM +0300, Juha-Pekka Heikkila wrote:
> > > Reset display structure settings and commit them in before starting
> > > test in case some earlier test left tail.
> > > 
> > > Separate hw and sw test runs for optimizing test.
> > > 
> > > Simple cleanup.
> > > 
> > > Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
> > > ---
> > >   tests/kms_cursor_crc.c | 404 +++++++++++++++++++++++++----------------
> > >   1 file changed, 251 insertions(+), 153 deletions(-)
> > > 
> > > diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c
> > > index a9bc3a745..f478ae08d 100644
> > > --- a/tests/kms_cursor_crc.c
> > > +++ b/tests/kms_cursor_crc.c
> > > @@ -46,10 +46,17 @@ IGT_TEST_DESCRIPTION(
> > >   #define DRM_CAP_CURSOR_HEIGHT 0x9
> > >   #endif
> > > +enum cursor_buffers {
> > > +	HWCURSORBUFFER,
> > > +	SWCOMPARISONBUFFER1,
> > > +	SWCOMPARISONBUFFER2,
> > > +	MAXCURSORBUFFER
> > > +};
> > > +
> > >   typedef struct {
> > >   	int drm_fd;
> > >   	igt_display_t display;
> > > -	struct igt_fb primary_fb[2];
> > > +	struct igt_fb primary_fb[MAXCURSORBUFFER];
> > >   	struct igt_fb fb;
> > >   	igt_output_t *output;
> > >   	enum pipe pipe;
> > > @@ -70,29 +77,40 @@ typedef struct {
> > >   #define TEST_DPMS (1<<0)
> > >   #define TEST_SUSPEND (1<<1)
> > > -#define HWCURSORBUFFER 0
> > > -#define SWCOMPARISONBUFFER 1
> > > +#define RED 1.0, 0.0, 0.0
> > > +#define GREEN 0.0, 1.0, 0.0
> > > +#define BLUE 0.0, 0.0, 1.0
> > > +#define WHITE 1.0, 1.0, 1.0
> > > +
> > > +typedef struct {
> > > +	int x;
> > > +	int y;
> > > +	int width;
> > > +	int height;
> > > +} cursorarea;
> > > -static void draw_cursor(cairo_t *cr, int x, int y, int cw, int ch, double a)
> > > +static void draw_cursor(cairo_t *cr, cursorarea *cursor)
> > >   {
> > >   	int wl, wr, ht, hb;
> > >   	/* deal with odd cursor width/height */
> > > -	wl = cw / 2;
> > > -	wr = (cw + 1) / 2;
> > > -	ht = ch / 2;
> > > -	hb = (ch + 1) / 2;
> > > +	wl = cursor->width / 2;
> > > +	wr = (cursor->width + 1) / 2;
> > > +	ht = cursor->height / 2;
> > > +	hb = (cursor->height + 1) / 2;
> > >   	/* Cairo doesn't like to be fed numbers that are too wild */
> > > -	if ((x < SHRT_MIN) || (x > SHRT_MAX) || (y < SHRT_MIN) || (y > SHRT_MAX))
> > > +	if ((cursor->x < SHRT_MIN) || (cursor->x > SHRT_MAX) ||
> > > +	    (cursor->y < SHRT_MIN) || (cursor->y > SHRT_MAX))
> > >   		return;
> > > +
> > >   	cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
> > >   	cairo_set_antialias(cr, CAIRO_ANTIALIAS_NONE);
> > >   	/* 4 color rectangles in the corners, RGBY */
> > > -	igt_paint_color_alpha(cr, x,      y,      wl, ht, 1.0, 0.0, 0.0, a);
> > > -	igt_paint_color_alpha(cr, x + wl, y,      wr, ht, 0.0, 1.0, 0.0, a);
> > > -	igt_paint_color_alpha(cr, x,      y + ht, wl, hb, 0.0, 0.0, 1.0, a);
> > > -	igt_paint_color_alpha(cr, x + wl, y + ht, wr, hb, 1.0, 1.0, 1.0, a);
> > > +	igt_paint_color(cr, cursor->x, cursor->y, wl, ht, RED);
> > > +	igt_paint_color(cr, cursor->x + wl, cursor->y, wr, ht, GREEN);
> > > +	igt_paint_color(cr, cursor->x, cursor->y + ht, wl, hb, BLUE);
> > > +	igt_paint_color(cr, cursor->x + wl, cursor->y + ht, wr, hb, WHITE);
> > >   }
> > >   static void cursor_enable(data_t *data)
> > > @@ -144,7 +162,7 @@ static bool cursor_visible(data_t *data, int x, int y)
> > >   	return true;
> > >   }
> > > -static void restore_image(data_t *data, uint32_t buffer)
> > > +static void restore_image(data_t *data, uint32_t buffer, cursorarea *cursor)
> > >   {
> > >   	cairo_t *cr;
> > > @@ -153,80 +171,84 @@ static void restore_image(data_t *data, uint32_t buffer)
> > >   	cairo_set_source_surface(cr, data->surface, 0, 0);
> > >   	cairo_rectangle(cr, 0, 0, data->screenw, data->screenh);
> > >   	cairo_fill(cr);
> > > +
> > > +	if (cursor)
> > > +		draw_cursor(cr, cursor);
> > > +
> > >   	igt_put_cairo_ctx(cr);
> > >   }
> > > -static void do_single_test(data_t *data, int x, int y)
> > > +static void do_single_test(data_t *data, int x, int y, bool hw_test,
> > > +			   igt_crc_t *hwcrc)
> > >   {
> > >   	igt_display_t *display = &data->display;
> > >   	igt_pipe_crc_t *pipe_crc = data->pipe_crc;
> > > -	igt_crc_t crc, ref_crc;
> > > -	cairo_t *cr;
> > > -	int ret = 0;
> > > +	igt_crc_t crc;
> > > +	int ret = 0, swbufidx;
> > >   	igt_print_activity();
> > > -	/* Hardware test */
> > > -	igt_plane_set_position(data->cursor, x, y);
> > > -	cursor_enable(data);
> > > +	if (hw_test) {
> > > +		/* Hardware test */
> > > +		igt_plane_set_position(data->cursor, x, y);
> > > -	if (chv_cursor_broken(data, x) && cursor_visible(data, x, y)) {
> > > -		ret = igt_display_try_commit2(display, COMMIT_LEGACY);
> > > -		igt_assert_eq(ret, -EINVAL);
> > > -		igt_plane_set_position(data->cursor, 0, y);
> > > -		return;
> > > -	}
> > > +		if (chv_cursor_broken(data, x) && cursor_visible(data, x, y)) {
> > > +			ret = igt_display_try_commit2(display, COMMIT_LEGACY);
> > > +			igt_assert_eq(ret, -EINVAL);
> > > +			igt_plane_set_position(data->cursor, 0, y);
> > > +			return;
> > > +		}
> > > -	igt_plane_set_fb(data->primary, &data->primary_fb[HWCURSORBUFFER]);
> > > -	igt_display_commit(display);
> > > +		igt_display_commit(display);
> > > -	/* Extra vblank wait is because nonblocking cursor ioctl */
> > > -	igt_wait_for_vblank(data->drm_fd,
> > > -			    display->pipes[data->pipe].crtc_offset);
> > > +		/* Extra vblank wait is because nonblocking cursor ioctl */
> > > +		igt_wait_for_vblank(data->drm_fd,
> > > +				display->pipes[data->pipe].crtc_offset);
> > > -	igt_pipe_crc_get_current(data->drm_fd, pipe_crc, &crc);
> > > -	restore_image(data, SWCOMPARISONBUFFER);
> > > +		igt_pipe_crc_get_current(data->drm_fd, pipe_crc, hwcrc);
> > > -	if (data->flags & (TEST_DPMS | TEST_SUSPEND)) {
> > > -		igt_crc_t crc_after;
> > > -		/*
> > > -		 * stop/start crc to avoid dmesg notifications about userspace
> > > -		 * reading too slow.
> > > -		 */
> > > -		igt_pipe_crc_stop(pipe_crc);
> > > -
> > > -		if (data->flags & TEST_DPMS) {
> > > -			igt_debug("dpms off/on cycle\n");
> > > -			kmstest_set_connector_dpms(data->drm_fd,
> > > -						   data->output->config.connector,
> > > -						   DRM_MODE_DPMS_OFF);
> > > -			kmstest_set_connector_dpms(data->drm_fd,
> > > -						   data->output->config.connector,
> > > -						   DRM_MODE_DPMS_ON);
> > > +		if (data->flags & (TEST_DPMS | TEST_SUSPEND)) {
> > > +			igt_crc_t crc_after;
> > > +			/*
> > > +			* stop/start crc to avoid dmesg notifications about userspace
> > > +			* reading too slow.
> > > +			*/
> > > +			igt_pipe_crc_stop(pipe_crc);
> > > +
> > > +			if (data->flags & TEST_DPMS) {
> > > +				igt_debug("dpms off/on cycle\n");
> > > +				kmstest_set_connector_dpms(data->drm_fd,
> > > +							data->output->config.connector,
> > > +							DRM_MODE_DPMS_OFF);
> > > +				kmstest_set_connector_dpms(data->drm_fd,
> > > +							data->output->config.connector,
> > > +							DRM_MODE_DPMS_ON);
> > > +			}
> > > +
> > > +			if (data->flags & TEST_SUSPEND)
> > > +				igt_system_suspend_autoresume(SUSPEND_STATE_MEM,
> > > +							SUSPEND_TEST_NONE);
> > > +
> > > +			igt_pipe_crc_start(pipe_crc);
> > > +			igt_pipe_crc_get_current(data->drm_fd, pipe_crc, &crc_after);
> > > +			igt_assert_crc_equal(hwcrc, &crc_after);
> > >   		}
> > > +	} else {
> > > +		/* Now render the same in software and collect crc */
> > > +		swbufidx = (data->primary->drm_plane->fb_id ==
> > > +			    data->primary_fb[SWCOMPARISONBUFFER1].fb_id) ?
> > > +			    SWCOMPARISONBUFFER2 : SWCOMPARISONBUFFER1;
> > > -		if (data->flags & TEST_SUSPEND)
> > > -			igt_system_suspend_autoresume(SUSPEND_STATE_MEM,
> > > -						      SUSPEND_TEST_NONE);
> > > -
> > > -		igt_pipe_crc_start(pipe_crc);
> > > -		igt_pipe_crc_get_current(data->drm_fd, pipe_crc, &crc_after);
> > > -		igt_assert_crc_equal(&crc, &crc_after);
> > > -	}
> > > -
> > > -	/* Now render the same in software and collect crc */
> > > -	cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb[SWCOMPARISONBUFFER]);
> > > -	draw_cursor(cr, x, y, data->curw, data->curh, 1.0);
> > > -	igt_put_cairo_ctx(cr);
> > > -	igt_plane_set_fb(data->primary, &data->primary_fb[SWCOMPARISONBUFFER]);
> > > -	cursor_disable(data);
> > > -	igt_display_commit(display);
> > > +		restore_image(data, swbufidx, &((cursorarea){x, y, data->curw, data->curh}));
> > > +		igt_plane_set_fb(data->primary, &data->primary_fb[swbufidx]);
> > > -	igt_wait_for_vblank(data->drm_fd,
> > > -			display->pipes[data->pipe].crtc_offset);
> > > +		igt_display_commit(display);
> > > +		igt_wait_for_vblank(data->drm_fd,
> > > +				display->pipes[data->pipe].crtc_offset);
> > > -	igt_pipe_crc_get_current(data->drm_fd, pipe_crc, &ref_crc);
> > > -	igt_assert_crc_equal(&crc, &ref_crc);
> > > +		igt_pipe_crc_get_current(data->drm_fd, pipe_crc, &crc);
> > > +		igt_assert_crc_equal(&crc, hwcrc);
> > > +	}
> > >   }
> > >   static void do_fail_test(data_t *data, int x, int y, int expect)
> > > @@ -248,70 +270,112 @@ static void do_fail_test(data_t *data, int x, int y, int expect)
> > >   	igt_assert_eq(ret, expect);
> > >   }
> > > -static void do_test(data_t *data,
> > > -		    int left, int right, int top, int bottom)
> > > +static void do_test(data_t *data, const cursorarea *coords, igt_crc_t crc[4],
> > > +		    bool hwtest)
> > >   {
> > > -	do_single_test(data, left, top);
> > > -	do_single_test(data, right, top);
> > > -	do_single_test(data, right, bottom);
> > > -	do_single_test(data, left, bottom);
> > > +	do_single_test(data, coords->x, coords->width, hwtest, &crc[0]);
> > > +	do_single_test(data, coords->y, coords->width, hwtest, &crc[1]);
> > > +	do_single_test(data, coords->y, coords->height, hwtest, &crc[2]);
> > > +	do_single_test(data, coords->x, coords->height, hwtest, &crc[3]);
> > >   }
> > >   static void test_crc_onscreen(data_t *data)
> > >   {
> > > -	int left = data->left;
> > > -	int right = data->right;
> > > -	int top = data->top;
> > > -	int bottom = data->bottom;
> > > -	int cursor_w = data->curw;
> > > -	int cursor_h = data->curh;
> > > -
> > > -	/* fully inside  */
> > > -	do_test(data, left, right, top, bottom);
> > > -
> > > -	/* 2 pixels inside */
> > > -	do_test(data, left - (cursor_w-2), right + (cursor_w-2), top               , bottom               );
> > > -	do_test(data, left               , right               , top - (cursor_h-2), bottom + (cursor_h-2));
> > > -	do_test(data, left - (cursor_w-2), right + (cursor_w-2), top - (cursor_h-2), bottom + (cursor_h-2));
> > > -
> > > -	/* 1 pixel inside */
> > > -	do_test(data, left - (cursor_w-1), right + (cursor_w-1), top               , bottom               );
> > > -	do_test(data, left               , right               , top - (cursor_h-1), bottom + (cursor_h-1));
> > > -	do_test(data, left - (cursor_w-1), right + (cursor_w-1), top - (cursor_h-1), bottom + (cursor_h-1));
> > > +	const int left = data->left;
> > > +	const int right = data->right;
> > > +	const int top = data->top;
> > > +	const int bottom = data->bottom;
> > > +	const int cursor_w = data->curw;
> > > +	const int cursor_h = data->curh;
> > > +
> > > +	struct {
> > > +		const cursorarea coords;
> > > +		igt_crc_t crc[4];
> > > +	} tests[] = {
> > > +		/* fully inside  */
> > > +		{{left, right, top, bottom}},
> > > +		/* 2 pixels inside */
> > > +		{{left - (cursor_w - 2), right + (cursor_w - 2), top, bottom}},
> > > +		{{left, right, top - (cursor_h - 2), bottom + (cursor_h - 2)}},
> > > +		{{left - (cursor_w - 2), right + (cursor_w - 2),
> > > +		  top - (cursor_h - 2), bottom + (cursor_h - 2)}},
> > > +		/* 1 pixel inside */
> > > +		{{left - (cursor_w - 1), right + (cursor_w - 1), top, bottom}},
> > > +		{{left, right, top - (cursor_h - 1), bottom + (cursor_h - 1)}},
> > > +		{{left - (cursor_w - 1), right + (cursor_w - 1),
> > > +		  top - (cursor_h - 1), bottom + (cursor_h - 1)}},
> > > +	};
> > > +
> > > +	/* HW test */
> > > +	cursor_enable(data);
> > > +	igt_plane_set_fb(data->primary, &data->primary_fb[HWCURSORBUFFER]);
> > > +	for (int i = 0; i < ARRAY_SIZE(tests); i++)
> > > +		do_test(data, &tests[i].coords, tests[i].crc, true);
> > > +
> > > +	/* SW test */
> > > +	cursor_disable(data);
> > > +	for (int i = 0; i < ARRAY_SIZE(tests); i++)
> > > +		do_test(data, &tests[i].coords, tests[i].crc, false);
> > >   }
> > >   static void test_crc_offscreen(data_t *data)
> > >   {
> > > -	int left = data->left;
> > > -	int right = data->right;
> > > -	int top = data->top;
> > > -	int bottom = data->bottom;
> > > -	int cursor_w = data->curw;
> > > -	int cursor_h = data->curh;
> > > -
> > > -	/* fully outside */
> > > -	do_test(data, left - (cursor_w), right + (cursor_w), top             , bottom             );
> > > -	do_test(data, left             , right             , top - (cursor_h), bottom + (cursor_h));
> > > -	do_test(data, left - (cursor_w), right + (cursor_w), top - (cursor_h), bottom + (cursor_h));
> > > -
> > > -	/* fully outside by 1 extra pixels */
> > > -	do_test(data, left - (cursor_w+1), right + (cursor_w+1), top               , bottom               );
> > > -	do_test(data, left               , right               , top - (cursor_h+1), bottom + (cursor_h+1));
> > > -	do_test(data, left - (cursor_w+1), right + (cursor_w+1), top - (cursor_h+1), bottom + (cursor_h+1));
> > > -
> > > -	/* fully outside by 2 extra pixels */
> > > -	do_test(data, left - (cursor_w+2), right + (cursor_w+2), top               , bottom               );
> > > -	do_test(data, left               , right               , top - (cursor_h+2), bottom + (cursor_h+2));
> > > -	do_test(data, left - (cursor_w+2), right + (cursor_w+2), top - (cursor_h+2), bottom + (cursor_h+2));
> > > -
> > > -	/* fully outside by a lot of extra pixels */
> > > -	do_test(data, left - (cursor_w+512), right + (cursor_w+512), top                 , bottom                 );
> > > -	do_test(data, left                 , right                 , top - (cursor_h+512), bottom + (cursor_h+512));
> > > -	do_test(data, left - (cursor_w+512), right + (cursor_w+512), top - (cursor_h+512), bottom + (cursor_h+512));
> > > -
> > > -	/* go nuts */
> > > -	do_test(data, INT_MIN, INT_MAX - cursor_w, INT_MIN, INT_MAX - cursor_h);
> > > -	do_test(data, SHRT_MIN, SHRT_MAX, SHRT_MIN, SHRT_MAX);
> > > +	const int left = data->left;
> > > +	const int right = data->right;
> > > +	const int top = data->top;
> > > +	const int bottom = data->bottom;
> > > +	const int cursor_w = data->curw;
> > > +	const int cursor_h = data->curh;
> > > +
> > > +	struct {
> > > +		const cursorarea coords;
> > > +		igt_crc_t crc[4];
> > > +	} tests[] = {
> > > +		/* fully outside */
> > > +		{{left - (cursor_w), right + (cursor_w), top, bottom}},
> > > +		{{left, right, top - (cursor_h), bottom + (cursor_h)}},
> > > +		{{left - (cursor_w), right + (cursor_w), top - (cursor_h),
> > > +		  bottom + (cursor_h)}},
> > > +		/* fully outside by 1 extra pixels */
> > > +		{{left - (cursor_w + 1), right + (cursor_w + 1), top, bottom}},
> > > +		{{left, right, top - (cursor_h + 1), bottom + (cursor_h + 1)}},
> > > +		{{left - (cursor_w + 1), right + (cursor_w + 1),
> > > +		  top - (cursor_h + 1), bottom + (cursor_h + 1)}},
> > > +		/* fully outside by 2 extra pixels */
> > > +		{{left - (cursor_w + 2), right + (cursor_w + 2), top, bottom}},
> > > +		{{left, right, top - (cursor_h + 2), bottom + (cursor_h + 2)}},
> > > +		{{left - (cursor_w + 2), right + (cursor_w + 2),
> > > +		  top - (cursor_h + 2), bottom + (cursor_h + 2)}},
> > > +		/* fully outside by a lot of extra pixels */
> > > +		{{left - (cursor_w + 512), right + (cursor_w + 512), top, bottom}},
> > > +		{{left, right, top - (cursor_h + 512), bottom + (cursor_h + 512)}},
> > > +		{{left - (cursor_w + 512), right + (cursor_w + 512),
> > > +		  top - (cursor_h + 512), bottom + (cursor_h + 512)}},
> > > +		/* go nuts */
> > > +		{{INT_MIN, INT_MAX - cursor_w, INT_MIN, INT_MAX - cursor_h}},
> > > +		{{SHRT_MIN, SHRT_MAX, SHRT_MIN, SHRT_MAX}},
> > > +	};
> > > +
> > > +	/* HW test */
> > > +	cursor_enable(data);
> > > +	igt_plane_set_fb(data->primary, &data->primary_fb[HWCURSORBUFFER]);
> > > +	for (int i = 0; i < ARRAY_SIZE(tests); i++)
> > > +		do_test(data, &tests[i].coords, tests[i].crc, true);
> > > +
> > > +	/* SW test */
> > > +	cursor_disable(data);
> > > +	/*
> > > +	 * all these crc's should be the same, actually render only first image
> > > +	 * to check crc and then compare rest of crc are matching
> > > +	 */
> > > +	do_test(data, &tests[0].coords, tests[0].crc, false);
> > > +
> > > +	for (int i = 1; i < ARRAY_SIZE(tests); i++) {
> > > +		igt_assert_crc_equal(&tests[0].crc[0], &tests[i].crc[0]);
> > > +		igt_assert_crc_equal(&tests[0].crc[0], &tests[i].crc[1]);
> > > +		igt_assert_crc_equal(&tests[0].crc[0], &tests[i].crc[2]);
> > > +		igt_assert_crc_equal(&tests[0].crc[0], &tests[i].crc[3]);
> > > +	}
> > >   	/* Make sure we get -ERANGE on integer overflow */
> > >   	do_fail_test(data, INT_MAX - cursor_w + 1, INT_MAX - cursor_h + 1, -ERANGE);
> > > @@ -320,29 +384,57 @@ static void test_crc_offscreen(data_t *data)
> > >   static void test_crc_sliding(data_t *data)
> > >   {
> > >   	int i;
> > > +	struct {
> > > +		igt_crc_t crc[3];
> > > +	} rounds[16] = {};
> > >   	/* Make sure cursor moves smoothly and pixel-by-pixel, and that there are
> > >   	 * no alignment issues. Horizontal, vertical and diagonal test.
> > >   	 */
> > > -	for (i = 0; i < 16; i++) {
> > > -		do_single_test(data, i, 0);
> > > -		do_single_test(data, 0, i);
> > > -		do_single_test(data, i, i);
> > > +
> > > +	/* HW test */
> > > +	cursor_enable(data);
> > > +	igt_plane_set_fb(data->primary, &data->primary_fb[HWCURSORBUFFER]);
> > > +
> > > +	for (i = 0; i < ARRAY_SIZE(rounds); i++) {
> > > +		do_single_test(data, i, 0, true, &rounds[i].crc[0]);
> > > +		do_single_test(data, 0, i, true, &rounds[i].crc[1]);
> > > +		do_single_test(data, i, i, true, &rounds[i].crc[2]);
> > > +	}
> > > +
> > > +	/* SW test */
> > > +	cursor_disable(data);
> > > +	for (i = 0; i < ARRAY_SIZE(rounds); i++) {
> > > +		do_single_test(data, i, 0, false, &rounds[i].crc[0]);
> > > +		do_single_test(data, 0, i, false, &rounds[i].crc[1]);
> > > +		do_single_test(data, i, i, false, &rounds[i].crc[2]);
> > >   	}
> > >   }
> > >   static void test_crc_random(data_t *data)
> > >   {
> > > -	int i, max;
> > > +	igt_crc_t crc[50];
> > > +	int i, max, x[ARRAY_SIZE(crc)], y[ARRAY_SIZE(crc)];
> > > -	max = data->flags & (TEST_DPMS | TEST_SUSPEND) ? 2 : 50;
> > > +	max = data->flags & (TEST_DPMS | TEST_SUSPEND) ? 2 : ARRAY_SIZE(crc);
> > >   	/* Random cursor placement */
> > > +
> > > +	/* HW test */
> > > +	cursor_enable(data);
> > > +	igt_plane_set_fb(data->primary, &data->primary_fb[HWCURSORBUFFER]);
> > > +
> > >   	for (i = 0; i < max; i++) {
> > > -		int x = rand() % (data->screenw + data->curw * 2) - data->curw;
> > > -		int y = rand() % (data->screenh + data->curh * 2) - data->curh;
> > > -		do_single_test(data, x, y);
> > > +		x[i] = rand() % (data->screenw + data->curw * 2) - data->curw;
> > > +		y[i] = rand() % (data->screenh + data->curh * 2) - data->curh;
> > > +		do_single_test(data, x[i], y[i], true, &crc[i]);
> > >   	}
> > > +
> > > +	/* SW test */
> > > +	cursor_disable(data);
> > > +	for (i = 0; i < max; i++)
> > > +		do_single_test(data, x[i], y[i], false, &crc[i]);
> > > +
> > >   }
> > >   static void cleanup_crtc(data_t *data)
> > > @@ -362,7 +454,8 @@ static void cleanup_crtc(data_t *data)
> > >   	igt_display_commit(display);
> > >   	igt_remove_fb(data->drm_fd, &data->primary_fb[HWCURSORBUFFER]);
> > > -	igt_remove_fb(data->drm_fd, &data->primary_fb[SWCOMPARISONBUFFER]);
> > > +	igt_remove_fb(data->drm_fd, &data->primary_fb[SWCOMPARISONBUFFER1]);
> > > +	igt_remove_fb(data->drm_fd, &data->primary_fb[SWCOMPARISONBUFFER2]);
> > >   	igt_display_reset(display);
> > >   }
> > > @@ -379,22 +472,22 @@ static void prepare_crtc(data_t *data, igt_output_t *output,
> > >   	/* create and set the primary plane fbs */
> > >   	mode = igt_output_get_mode(output);
> > > -	igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
> > > -			    DRM_FORMAT_XRGB8888,
> > > -			    DRM_FORMAT_MOD_NONE,
> > > -			    0.0, 0.0, 0.0,
> > > -			    &data->primary_fb[HWCURSORBUFFER]);
> > > -
> > > -	igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
> > > -			    DRM_FORMAT_XRGB8888,
> > > -			    DRM_FORMAT_MOD_NONE,
> > > -			    0.0, 0.0, 0.0,
> > > -			    &data->primary_fb[SWCOMPARISONBUFFER]);
> > > +	igt_create_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
> > > +		      DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE,
> > > +		      &data->primary_fb[HWCURSORBUFFER]);
> > > +
> > > +	igt_create_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
> > > +		      DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE,
> > > +		      &data->primary_fb[SWCOMPARISONBUFFER1]);
> > > +
> > > +	igt_create_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
> > > +		      DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE,
> > > +		      &data->primary_fb[SWCOMPARISONBUFFER2]);
> > >   	data->primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
> > >   	data->cursor = igt_output_get_plane_type(output, DRM_PLANE_TYPE_CURSOR);
> > > -	igt_plane_set_fb(data->primary, &data->primary_fb[SWCOMPARISONBUFFER]);
> > > +	igt_plane_set_fb(data->primary, &data->primary_fb[SWCOMPARISONBUFFER1]);
> > >   	igt_display_commit(display);
> > > @@ -427,7 +520,7 @@ static void prepare_crtc(data_t *data, igt_output_t *output,
> > >   		cairo_destroy(cr);
> > >   		/* Set HW cursor buffer in place */
> > > -			restore_image(data, HWCURSORBUFFER);
> > > +		restore_image(data, HWCURSORBUFFER, NULL);
> > >   	} else
> > >   		data->surface = NULL;
> > > @@ -469,10 +562,10 @@ static void test_cursor_alpha(data_t *data, double a)
> > >   	igt_remove_fb(data->drm_fd, &data->fb);
> > >   	/* Software Test - render cursor in software, drawn it directly on PF */
> > > -	cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb[SWCOMPARISONBUFFER]);
> > > +	cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb[SWCOMPARISONBUFFER1]);
> > >   	igt_paint_color_alpha(cr, 0, 0, curw, curh, 1.0, 1.0, 1.0, a);
> > >   	igt_put_cairo_ctx(cr);
> > > -	igt_plane_set_fb(data->primary, &data->primary_fb[SWCOMPARISONBUFFER]);
> > > +	igt_plane_set_fb(data->primary, &data->primary_fb[SWCOMPARISONBUFFER1]);
> > >   	igt_display_commit(display);
> > >   	igt_wait_for_vblank(data->drm_fd,
> > >   			display->pipes[data->pipe].crtc_offset);
> > > @@ -513,7 +606,7 @@ static void create_cursor_fb(data_t *data, int cur_w, int cur_h)
> > >   	igt_assert(fb_id);
> > >   	cr = igt_get_cairo_ctx(data->drm_fd, &data->fb);
> > > -	draw_cursor(cr, 0, 0, cur_w, cur_h, 1.0);
> > > +	draw_cursor(cr, &((cursorarea){0, 0, cur_w, cur_h}));
> > >   	igt_put_cairo_ctx(cr);
> > >   }
> > > @@ -610,7 +703,7 @@ static void test_cursor_size(data_t *data)
> > >   		igt_display_commit(display);
> > >   		/* Now render the same in software and collect crc */
> > > -		cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb[SWCOMPARISONBUFFER]);
> > > +		cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb[SWCOMPARISONBUFFER1]);
> > >   		/* remove previous cursor sw image */
> > >   		if (prevsize > 0)
> > > @@ -619,7 +712,7 @@ static void test_cursor_size(data_t *data)
> > >   		igt_paint_color_alpha(cr, 0, 0, size, size, 1.0, 1.0, 1.0, 1.0);
> > >   		igt_put_cairo_ctx(cr);
> > > -		igt_plane_set_fb(data->primary, &data->primary_fb[SWCOMPARISONBUFFER]);
> > > +		igt_plane_set_fb(data->primary, &data->primary_fb[SWCOMPARISONBUFFER1]);
> > >   		igt_display_commit(display);
> > >   		igt_pipe_crc_get_current(data->drm_fd, pipe_crc, &ref_crc);
> > > @@ -657,6 +750,8 @@ static void test_rapid_movement(data_t *data)
> > >   	}
> > >   	gettimeofday(&end, NULL);
> > > +	cursor_disable(data);
> > > +
> > >   	/*
> > >   	 * We've done 400 cursor updates now.  If we're being throttled to
> > >   	 * vblank, then that would take roughly 400/refresh seconds.  If the
> > > @@ -813,6 +908,9 @@ igt_main
> > >   		igt_require_pipe_crc(data.drm_fd);
> > >   		igt_display_require(&data.display, data.drm_fd);
> > > +		igt_display_reset(&data.display);
> > > +		igt_display_commit2(&data.display, data.display.is_atomic ?
> > > +				    COMMIT_ATOMIC : COMMIT_LEGACY);
> > >   	}
> > 
> > igt_display_require() calls igt_display_reset at the end of it... but
> > after that does igt_enable_connectors. Is that why this extra
> > igt_display_reset is needed here?
> > 
> 
> This is something I don't yet know where exactly the problem exists, earlier
> failed tests may leave tail which this is able to clear out. I coined this
> for myself to do some debugging:
> https://patchwork.freedesktop.org/series/93756/
> 
> Those igt_display_reset(..) followed by atomic and legacy commit and get crc
> of white imo should match but they don't do that for me. Situation is the
> same as kms_plane_alpha_blend failed and will arrive to new test, there
> maybe differences if test uses legacy or atomic commits.


Well if this series helps, it's
Acked-by: Petri Latvala <petri.latvala@intel.com>

My concern is whether that's all tests covered that need this dancing,
and what kind of dancing is _actually_ required. And whether we can
make this cleaner without requiring all tests to call all kinds of
functions if they're already calling a helper that by its name is
claiming to do all the necessary initialization.


-- 
Petri Latvala

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

* Re: [igt-dev] [PATCH i-g-t 1/2] tests/kms_cursor_crc: Separate hw and sw runs on tests
  2021-08-18  9:17     ` Petri Latvala
@ 2021-08-18 14:31       ` Juha-Pekka Heikkila
  2021-08-19 12:06         ` Kahola, Mika
  0 siblings, 1 reply; 11+ messages in thread
From: Juha-Pekka Heikkila @ 2021-08-18 14:31 UTC (permalink / raw)
  To: Petri Latvala; +Cc: igt-dev

On 18.8.2021 12.17, Petri Latvala wrote:
> On Tue, Aug 17, 2021 at 08:46:22PM +0300, Juha-Pekka Heikkila wrote:
>> On 17.8.2021 18.59, Petri Latvala wrote:
>>> On Tue, Aug 17, 2021 at 12:27:23PM +0300, Juha-Pekka Heikkila wrote:
>>>> Reset display structure settings and commit them in before starting
>>>> test in case some earlier test left tail.
>>>>
>>>> Separate hw and sw test runs for optimizing test.
>>>>
>>>> Simple cleanup.
>>>>
>>>> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
>>>> ---
>>>>    tests/kms_cursor_crc.c | 404 +++++++++++++++++++++++++----------------
>>>>    1 file changed, 251 insertions(+), 153 deletions(-)
>>>>
>>>> diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c
>>>> index a9bc3a745..f478ae08d 100644
>>>> --- a/tests/kms_cursor_crc.c
>>>> +++ b/tests/kms_cursor_crc.c
>>>> @@ -46,10 +46,17 @@ IGT_TEST_DESCRIPTION(
>>>>    #define DRM_CAP_CURSOR_HEIGHT 0x9
>>>>    #endif
>>>> +enum cursor_buffers {
>>>> +	HWCURSORBUFFER,
>>>> +	SWCOMPARISONBUFFER1,
>>>> +	SWCOMPARISONBUFFER2,
>>>> +	MAXCURSORBUFFER
>>>> +};
>>>> +
>>>>    typedef struct {
>>>>    	int drm_fd;
>>>>    	igt_display_t display;
>>>> -	struct igt_fb primary_fb[2];
>>>> +	struct igt_fb primary_fb[MAXCURSORBUFFER];
>>>>    	struct igt_fb fb;
>>>>    	igt_output_t *output;
>>>>    	enum pipe pipe;
>>>> @@ -70,29 +77,40 @@ typedef struct {
>>>>    #define TEST_DPMS (1<<0)
>>>>    #define TEST_SUSPEND (1<<1)
>>>> -#define HWCURSORBUFFER 0
>>>> -#define SWCOMPARISONBUFFER 1
>>>> +#define RED 1.0, 0.0, 0.0
>>>> +#define GREEN 0.0, 1.0, 0.0
>>>> +#define BLUE 0.0, 0.0, 1.0
>>>> +#define WHITE 1.0, 1.0, 1.0
>>>> +
>>>> +typedef struct {
>>>> +	int x;
>>>> +	int y;
>>>> +	int width;
>>>> +	int height;
>>>> +} cursorarea;
>>>> -static void draw_cursor(cairo_t *cr, int x, int y, int cw, int ch, double a)
>>>> +static void draw_cursor(cairo_t *cr, cursorarea *cursor)
>>>>    {
>>>>    	int wl, wr, ht, hb;
>>>>    	/* deal with odd cursor width/height */
>>>> -	wl = cw / 2;
>>>> -	wr = (cw + 1) / 2;
>>>> -	ht = ch / 2;
>>>> -	hb = (ch + 1) / 2;
>>>> +	wl = cursor->width / 2;
>>>> +	wr = (cursor->width + 1) / 2;
>>>> +	ht = cursor->height / 2;
>>>> +	hb = (cursor->height + 1) / 2;
>>>>    	/* Cairo doesn't like to be fed numbers that are too wild */
>>>> -	if ((x < SHRT_MIN) || (x > SHRT_MAX) || (y < SHRT_MIN) || (y > SHRT_MAX))
>>>> +	if ((cursor->x < SHRT_MIN) || (cursor->x > SHRT_MAX) ||
>>>> +	    (cursor->y < SHRT_MIN) || (cursor->y > SHRT_MAX))
>>>>    		return;
>>>> +
>>>>    	cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
>>>>    	cairo_set_antialias(cr, CAIRO_ANTIALIAS_NONE);
>>>>    	/* 4 color rectangles in the corners, RGBY */
>>>> -	igt_paint_color_alpha(cr, x,      y,      wl, ht, 1.0, 0.0, 0.0, a);
>>>> -	igt_paint_color_alpha(cr, x + wl, y,      wr, ht, 0.0, 1.0, 0.0, a);
>>>> -	igt_paint_color_alpha(cr, x,      y + ht, wl, hb, 0.0, 0.0, 1.0, a);
>>>> -	igt_paint_color_alpha(cr, x + wl, y + ht, wr, hb, 1.0, 1.0, 1.0, a);
>>>> +	igt_paint_color(cr, cursor->x, cursor->y, wl, ht, RED);
>>>> +	igt_paint_color(cr, cursor->x + wl, cursor->y, wr, ht, GREEN);
>>>> +	igt_paint_color(cr, cursor->x, cursor->y + ht, wl, hb, BLUE);
>>>> +	igt_paint_color(cr, cursor->x + wl, cursor->y + ht, wr, hb, WHITE);
>>>>    }
>>>>    static void cursor_enable(data_t *data)
>>>> @@ -144,7 +162,7 @@ static bool cursor_visible(data_t *data, int x, int y)
>>>>    	return true;
>>>>    }
>>>> -static void restore_image(data_t *data, uint32_t buffer)
>>>> +static void restore_image(data_t *data, uint32_t buffer, cursorarea *cursor)
>>>>    {
>>>>    	cairo_t *cr;
>>>> @@ -153,80 +171,84 @@ static void restore_image(data_t *data, uint32_t buffer)
>>>>    	cairo_set_source_surface(cr, data->surface, 0, 0);
>>>>    	cairo_rectangle(cr, 0, 0, data->screenw, data->screenh);
>>>>    	cairo_fill(cr);
>>>> +
>>>> +	if (cursor)
>>>> +		draw_cursor(cr, cursor);
>>>> +
>>>>    	igt_put_cairo_ctx(cr);
>>>>    }
>>>> -static void do_single_test(data_t *data, int x, int y)
>>>> +static void do_single_test(data_t *data, int x, int y, bool hw_test,
>>>> +			   igt_crc_t *hwcrc)
>>>>    {
>>>>    	igt_display_t *display = &data->display;
>>>>    	igt_pipe_crc_t *pipe_crc = data->pipe_crc;
>>>> -	igt_crc_t crc, ref_crc;
>>>> -	cairo_t *cr;
>>>> -	int ret = 0;
>>>> +	igt_crc_t crc;
>>>> +	int ret = 0, swbufidx;
>>>>    	igt_print_activity();
>>>> -	/* Hardware test */
>>>> -	igt_plane_set_position(data->cursor, x, y);
>>>> -	cursor_enable(data);
>>>> +	if (hw_test) {
>>>> +		/* Hardware test */
>>>> +		igt_plane_set_position(data->cursor, x, y);
>>>> -	if (chv_cursor_broken(data, x) && cursor_visible(data, x, y)) {
>>>> -		ret = igt_display_try_commit2(display, COMMIT_LEGACY);
>>>> -		igt_assert_eq(ret, -EINVAL);
>>>> -		igt_plane_set_position(data->cursor, 0, y);
>>>> -		return;
>>>> -	}
>>>> +		if (chv_cursor_broken(data, x) && cursor_visible(data, x, y)) {
>>>> +			ret = igt_display_try_commit2(display, COMMIT_LEGACY);
>>>> +			igt_assert_eq(ret, -EINVAL);
>>>> +			igt_plane_set_position(data->cursor, 0, y);
>>>> +			return;
>>>> +		}
>>>> -	igt_plane_set_fb(data->primary, &data->primary_fb[HWCURSORBUFFER]);
>>>> -	igt_display_commit(display);
>>>> +		igt_display_commit(display);
>>>> -	/* Extra vblank wait is because nonblocking cursor ioctl */
>>>> -	igt_wait_for_vblank(data->drm_fd,
>>>> -			    display->pipes[data->pipe].crtc_offset);
>>>> +		/* Extra vblank wait is because nonblocking cursor ioctl */
>>>> +		igt_wait_for_vblank(data->drm_fd,
>>>> +				display->pipes[data->pipe].crtc_offset);
>>>> -	igt_pipe_crc_get_current(data->drm_fd, pipe_crc, &crc);
>>>> -	restore_image(data, SWCOMPARISONBUFFER);
>>>> +		igt_pipe_crc_get_current(data->drm_fd, pipe_crc, hwcrc);
>>>> -	if (data->flags & (TEST_DPMS | TEST_SUSPEND)) {
>>>> -		igt_crc_t crc_after;
>>>> -		/*
>>>> -		 * stop/start crc to avoid dmesg notifications about userspace
>>>> -		 * reading too slow.
>>>> -		 */
>>>> -		igt_pipe_crc_stop(pipe_crc);
>>>> -
>>>> -		if (data->flags & TEST_DPMS) {
>>>> -			igt_debug("dpms off/on cycle\n");
>>>> -			kmstest_set_connector_dpms(data->drm_fd,
>>>> -						   data->output->config.connector,
>>>> -						   DRM_MODE_DPMS_OFF);
>>>> -			kmstest_set_connector_dpms(data->drm_fd,
>>>> -						   data->output->config.connector,
>>>> -						   DRM_MODE_DPMS_ON);
>>>> +		if (data->flags & (TEST_DPMS | TEST_SUSPEND)) {
>>>> +			igt_crc_t crc_after;
>>>> +			/*
>>>> +			* stop/start crc to avoid dmesg notifications about userspace
>>>> +			* reading too slow.
>>>> +			*/
>>>> +			igt_pipe_crc_stop(pipe_crc);
>>>> +
>>>> +			if (data->flags & TEST_DPMS) {
>>>> +				igt_debug("dpms off/on cycle\n");
>>>> +				kmstest_set_connector_dpms(data->drm_fd,
>>>> +							data->output->config.connector,
>>>> +							DRM_MODE_DPMS_OFF);
>>>> +				kmstest_set_connector_dpms(data->drm_fd,
>>>> +							data->output->config.connector,
>>>> +							DRM_MODE_DPMS_ON);
>>>> +			}
>>>> +
>>>> +			if (data->flags & TEST_SUSPEND)
>>>> +				igt_system_suspend_autoresume(SUSPEND_STATE_MEM,
>>>> +							SUSPEND_TEST_NONE);
>>>> +
>>>> +			igt_pipe_crc_start(pipe_crc);
>>>> +			igt_pipe_crc_get_current(data->drm_fd, pipe_crc, &crc_after);
>>>> +			igt_assert_crc_equal(hwcrc, &crc_after);
>>>>    		}
>>>> +	} else {
>>>> +		/* Now render the same in software and collect crc */
>>>> +		swbufidx = (data->primary->drm_plane->fb_id ==
>>>> +			    data->primary_fb[SWCOMPARISONBUFFER1].fb_id) ?
>>>> +			    SWCOMPARISONBUFFER2 : SWCOMPARISONBUFFER1;
>>>> -		if (data->flags & TEST_SUSPEND)
>>>> -			igt_system_suspend_autoresume(SUSPEND_STATE_MEM,
>>>> -						      SUSPEND_TEST_NONE);
>>>> -
>>>> -		igt_pipe_crc_start(pipe_crc);
>>>> -		igt_pipe_crc_get_current(data->drm_fd, pipe_crc, &crc_after);
>>>> -		igt_assert_crc_equal(&crc, &crc_after);
>>>> -	}
>>>> -
>>>> -	/* Now render the same in software and collect crc */
>>>> -	cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb[SWCOMPARISONBUFFER]);
>>>> -	draw_cursor(cr, x, y, data->curw, data->curh, 1.0);
>>>> -	igt_put_cairo_ctx(cr);
>>>> -	igt_plane_set_fb(data->primary, &data->primary_fb[SWCOMPARISONBUFFER]);
>>>> -	cursor_disable(data);
>>>> -	igt_display_commit(display);
>>>> +		restore_image(data, swbufidx, &((cursorarea){x, y, data->curw, data->curh}));
>>>> +		igt_plane_set_fb(data->primary, &data->primary_fb[swbufidx]);
>>>> -	igt_wait_for_vblank(data->drm_fd,
>>>> -			display->pipes[data->pipe].crtc_offset);
>>>> +		igt_display_commit(display);
>>>> +		igt_wait_for_vblank(data->drm_fd,
>>>> +				display->pipes[data->pipe].crtc_offset);
>>>> -	igt_pipe_crc_get_current(data->drm_fd, pipe_crc, &ref_crc);
>>>> -	igt_assert_crc_equal(&crc, &ref_crc);
>>>> +		igt_pipe_crc_get_current(data->drm_fd, pipe_crc, &crc);
>>>> +		igt_assert_crc_equal(&crc, hwcrc);
>>>> +	}
>>>>    }
>>>>    static void do_fail_test(data_t *data, int x, int y, int expect)
>>>> @@ -248,70 +270,112 @@ static void do_fail_test(data_t *data, int x, int y, int expect)
>>>>    	igt_assert_eq(ret, expect);
>>>>    }
>>>> -static void do_test(data_t *data,
>>>> -		    int left, int right, int top, int bottom)
>>>> +static void do_test(data_t *data, const cursorarea *coords, igt_crc_t crc[4],
>>>> +		    bool hwtest)
>>>>    {
>>>> -	do_single_test(data, left, top);
>>>> -	do_single_test(data, right, top);
>>>> -	do_single_test(data, right, bottom);
>>>> -	do_single_test(data, left, bottom);
>>>> +	do_single_test(data, coords->x, coords->width, hwtest, &crc[0]);
>>>> +	do_single_test(data, coords->y, coords->width, hwtest, &crc[1]);
>>>> +	do_single_test(data, coords->y, coords->height, hwtest, &crc[2]);
>>>> +	do_single_test(data, coords->x, coords->height, hwtest, &crc[3]);
>>>>    }
>>>>    static void test_crc_onscreen(data_t *data)
>>>>    {
>>>> -	int left = data->left;
>>>> -	int right = data->right;
>>>> -	int top = data->top;
>>>> -	int bottom = data->bottom;
>>>> -	int cursor_w = data->curw;
>>>> -	int cursor_h = data->curh;
>>>> -
>>>> -	/* fully inside  */
>>>> -	do_test(data, left, right, top, bottom);
>>>> -
>>>> -	/* 2 pixels inside */
>>>> -	do_test(data, left - (cursor_w-2), right + (cursor_w-2), top               , bottom               );
>>>> -	do_test(data, left               , right               , top - (cursor_h-2), bottom + (cursor_h-2));
>>>> -	do_test(data, left - (cursor_w-2), right + (cursor_w-2), top - (cursor_h-2), bottom + (cursor_h-2));
>>>> -
>>>> -	/* 1 pixel inside */
>>>> -	do_test(data, left - (cursor_w-1), right + (cursor_w-1), top               , bottom               );
>>>> -	do_test(data, left               , right               , top - (cursor_h-1), bottom + (cursor_h-1));
>>>> -	do_test(data, left - (cursor_w-1), right + (cursor_w-1), top - (cursor_h-1), bottom + (cursor_h-1));
>>>> +	const int left = data->left;
>>>> +	const int right = data->right;
>>>> +	const int top = data->top;
>>>> +	const int bottom = data->bottom;
>>>> +	const int cursor_w = data->curw;
>>>> +	const int cursor_h = data->curh;
>>>> +
>>>> +	struct {
>>>> +		const cursorarea coords;
>>>> +		igt_crc_t crc[4];
>>>> +	} tests[] = {
>>>> +		/* fully inside  */
>>>> +		{{left, right, top, bottom}},
>>>> +		/* 2 pixels inside */
>>>> +		{{left - (cursor_w - 2), right + (cursor_w - 2), top, bottom}},
>>>> +		{{left, right, top - (cursor_h - 2), bottom + (cursor_h - 2)}},
>>>> +		{{left - (cursor_w - 2), right + (cursor_w - 2),
>>>> +		  top - (cursor_h - 2), bottom + (cursor_h - 2)}},
>>>> +		/* 1 pixel inside */
>>>> +		{{left - (cursor_w - 1), right + (cursor_w - 1), top, bottom}},
>>>> +		{{left, right, top - (cursor_h - 1), bottom + (cursor_h - 1)}},
>>>> +		{{left - (cursor_w - 1), right + (cursor_w - 1),
>>>> +		  top - (cursor_h - 1), bottom + (cursor_h - 1)}},
>>>> +	};
>>>> +
>>>> +	/* HW test */
>>>> +	cursor_enable(data);
>>>> +	igt_plane_set_fb(data->primary, &data->primary_fb[HWCURSORBUFFER]);
>>>> +	for (int i = 0; i < ARRAY_SIZE(tests); i++)
>>>> +		do_test(data, &tests[i].coords, tests[i].crc, true);
>>>> +
>>>> +	/* SW test */
>>>> +	cursor_disable(data);
>>>> +	for (int i = 0; i < ARRAY_SIZE(tests); i++)
>>>> +		do_test(data, &tests[i].coords, tests[i].crc, false);
>>>>    }
>>>>    static void test_crc_offscreen(data_t *data)
>>>>    {
>>>> -	int left = data->left;
>>>> -	int right = data->right;
>>>> -	int top = data->top;
>>>> -	int bottom = data->bottom;
>>>> -	int cursor_w = data->curw;
>>>> -	int cursor_h = data->curh;
>>>> -
>>>> -	/* fully outside */
>>>> -	do_test(data, left - (cursor_w), right + (cursor_w), top             , bottom             );
>>>> -	do_test(data, left             , right             , top - (cursor_h), bottom + (cursor_h));
>>>> -	do_test(data, left - (cursor_w), right + (cursor_w), top - (cursor_h), bottom + (cursor_h));
>>>> -
>>>> -	/* fully outside by 1 extra pixels */
>>>> -	do_test(data, left - (cursor_w+1), right + (cursor_w+1), top               , bottom               );
>>>> -	do_test(data, left               , right               , top - (cursor_h+1), bottom + (cursor_h+1));
>>>> -	do_test(data, left - (cursor_w+1), right + (cursor_w+1), top - (cursor_h+1), bottom + (cursor_h+1));
>>>> -
>>>> -	/* fully outside by 2 extra pixels */
>>>> -	do_test(data, left - (cursor_w+2), right + (cursor_w+2), top               , bottom               );
>>>> -	do_test(data, left               , right               , top - (cursor_h+2), bottom + (cursor_h+2));
>>>> -	do_test(data, left - (cursor_w+2), right + (cursor_w+2), top - (cursor_h+2), bottom + (cursor_h+2));
>>>> -
>>>> -	/* fully outside by a lot of extra pixels */
>>>> -	do_test(data, left - (cursor_w+512), right + (cursor_w+512), top                 , bottom                 );
>>>> -	do_test(data, left                 , right                 , top - (cursor_h+512), bottom + (cursor_h+512));
>>>> -	do_test(data, left - (cursor_w+512), right + (cursor_w+512), top - (cursor_h+512), bottom + (cursor_h+512));
>>>> -
>>>> -	/* go nuts */
>>>> -	do_test(data, INT_MIN, INT_MAX - cursor_w, INT_MIN, INT_MAX - cursor_h);
>>>> -	do_test(data, SHRT_MIN, SHRT_MAX, SHRT_MIN, SHRT_MAX);
>>>> +	const int left = data->left;
>>>> +	const int right = data->right;
>>>> +	const int top = data->top;
>>>> +	const int bottom = data->bottom;
>>>> +	const int cursor_w = data->curw;
>>>> +	const int cursor_h = data->curh;
>>>> +
>>>> +	struct {
>>>> +		const cursorarea coords;
>>>> +		igt_crc_t crc[4];
>>>> +	} tests[] = {
>>>> +		/* fully outside */
>>>> +		{{left - (cursor_w), right + (cursor_w), top, bottom}},
>>>> +		{{left, right, top - (cursor_h), bottom + (cursor_h)}},
>>>> +		{{left - (cursor_w), right + (cursor_w), top - (cursor_h),
>>>> +		  bottom + (cursor_h)}},
>>>> +		/* fully outside by 1 extra pixels */
>>>> +		{{left - (cursor_w + 1), right + (cursor_w + 1), top, bottom}},
>>>> +		{{left, right, top - (cursor_h + 1), bottom + (cursor_h + 1)}},
>>>> +		{{left - (cursor_w + 1), right + (cursor_w + 1),
>>>> +		  top - (cursor_h + 1), bottom + (cursor_h + 1)}},
>>>> +		/* fully outside by 2 extra pixels */
>>>> +		{{left - (cursor_w + 2), right + (cursor_w + 2), top, bottom}},
>>>> +		{{left, right, top - (cursor_h + 2), bottom + (cursor_h + 2)}},
>>>> +		{{left - (cursor_w + 2), right + (cursor_w + 2),
>>>> +		  top - (cursor_h + 2), bottom + (cursor_h + 2)}},
>>>> +		/* fully outside by a lot of extra pixels */
>>>> +		{{left - (cursor_w + 512), right + (cursor_w + 512), top, bottom}},
>>>> +		{{left, right, top - (cursor_h + 512), bottom + (cursor_h + 512)}},
>>>> +		{{left - (cursor_w + 512), right + (cursor_w + 512),
>>>> +		  top - (cursor_h + 512), bottom + (cursor_h + 512)}},
>>>> +		/* go nuts */
>>>> +		{{INT_MIN, INT_MAX - cursor_w, INT_MIN, INT_MAX - cursor_h}},
>>>> +		{{SHRT_MIN, SHRT_MAX, SHRT_MIN, SHRT_MAX}},
>>>> +	};
>>>> +
>>>> +	/* HW test */
>>>> +	cursor_enable(data);
>>>> +	igt_plane_set_fb(data->primary, &data->primary_fb[HWCURSORBUFFER]);
>>>> +	for (int i = 0; i < ARRAY_SIZE(tests); i++)
>>>> +		do_test(data, &tests[i].coords, tests[i].crc, true);
>>>> +
>>>> +	/* SW test */
>>>> +	cursor_disable(data);
>>>> +	/*
>>>> +	 * all these crc's should be the same, actually render only first image
>>>> +	 * to check crc and then compare rest of crc are matching
>>>> +	 */
>>>> +	do_test(data, &tests[0].coords, tests[0].crc, false);
>>>> +
>>>> +	for (int i = 1; i < ARRAY_SIZE(tests); i++) {
>>>> +		igt_assert_crc_equal(&tests[0].crc[0], &tests[i].crc[0]);
>>>> +		igt_assert_crc_equal(&tests[0].crc[0], &tests[i].crc[1]);
>>>> +		igt_assert_crc_equal(&tests[0].crc[0], &tests[i].crc[2]);
>>>> +		igt_assert_crc_equal(&tests[0].crc[0], &tests[i].crc[3]);
>>>> +	}
>>>>    	/* Make sure we get -ERANGE on integer overflow */
>>>>    	do_fail_test(data, INT_MAX - cursor_w + 1, INT_MAX - cursor_h + 1, -ERANGE);
>>>> @@ -320,29 +384,57 @@ static void test_crc_offscreen(data_t *data)
>>>>    static void test_crc_sliding(data_t *data)
>>>>    {
>>>>    	int i;
>>>> +	struct {
>>>> +		igt_crc_t crc[3];
>>>> +	} rounds[16] = {};
>>>>    	/* Make sure cursor moves smoothly and pixel-by-pixel, and that there are
>>>>    	 * no alignment issues. Horizontal, vertical and diagonal test.
>>>>    	 */
>>>> -	for (i = 0; i < 16; i++) {
>>>> -		do_single_test(data, i, 0);
>>>> -		do_single_test(data, 0, i);
>>>> -		do_single_test(data, i, i);
>>>> +
>>>> +	/* HW test */
>>>> +	cursor_enable(data);
>>>> +	igt_plane_set_fb(data->primary, &data->primary_fb[HWCURSORBUFFER]);
>>>> +
>>>> +	for (i = 0; i < ARRAY_SIZE(rounds); i++) {
>>>> +		do_single_test(data, i, 0, true, &rounds[i].crc[0]);
>>>> +		do_single_test(data, 0, i, true, &rounds[i].crc[1]);
>>>> +		do_single_test(data, i, i, true, &rounds[i].crc[2]);
>>>> +	}
>>>> +
>>>> +	/* SW test */
>>>> +	cursor_disable(data);
>>>> +	for (i = 0; i < ARRAY_SIZE(rounds); i++) {
>>>> +		do_single_test(data, i, 0, false, &rounds[i].crc[0]);
>>>> +		do_single_test(data, 0, i, false, &rounds[i].crc[1]);
>>>> +		do_single_test(data, i, i, false, &rounds[i].crc[2]);
>>>>    	}
>>>>    }
>>>>    static void test_crc_random(data_t *data)
>>>>    {
>>>> -	int i, max;
>>>> +	igt_crc_t crc[50];
>>>> +	int i, max, x[ARRAY_SIZE(crc)], y[ARRAY_SIZE(crc)];
>>>> -	max = data->flags & (TEST_DPMS | TEST_SUSPEND) ? 2 : 50;
>>>> +	max = data->flags & (TEST_DPMS | TEST_SUSPEND) ? 2 : ARRAY_SIZE(crc);
>>>>    	/* Random cursor placement */
>>>> +
>>>> +	/* HW test */
>>>> +	cursor_enable(data);
>>>> +	igt_plane_set_fb(data->primary, &data->primary_fb[HWCURSORBUFFER]);
>>>> +
>>>>    	for (i = 0; i < max; i++) {
>>>> -		int x = rand() % (data->screenw + data->curw * 2) - data->curw;
>>>> -		int y = rand() % (data->screenh + data->curh * 2) - data->curh;
>>>> -		do_single_test(data, x, y);
>>>> +		x[i] = rand() % (data->screenw + data->curw * 2) - data->curw;
>>>> +		y[i] = rand() % (data->screenh + data->curh * 2) - data->curh;
>>>> +		do_single_test(data, x[i], y[i], true, &crc[i]);
>>>>    	}
>>>> +
>>>> +	/* SW test */
>>>> +	cursor_disable(data);
>>>> +	for (i = 0; i < max; i++)
>>>> +		do_single_test(data, x[i], y[i], false, &crc[i]);
>>>> +
>>>>    }
>>>>    static void cleanup_crtc(data_t *data)
>>>> @@ -362,7 +454,8 @@ static void cleanup_crtc(data_t *data)
>>>>    	igt_display_commit(display);
>>>>    	igt_remove_fb(data->drm_fd, &data->primary_fb[HWCURSORBUFFER]);
>>>> -	igt_remove_fb(data->drm_fd, &data->primary_fb[SWCOMPARISONBUFFER]);
>>>> +	igt_remove_fb(data->drm_fd, &data->primary_fb[SWCOMPARISONBUFFER1]);
>>>> +	igt_remove_fb(data->drm_fd, &data->primary_fb[SWCOMPARISONBUFFER2]);
>>>>    	igt_display_reset(display);
>>>>    }
>>>> @@ -379,22 +472,22 @@ static void prepare_crtc(data_t *data, igt_output_t *output,
>>>>    	/* create and set the primary plane fbs */
>>>>    	mode = igt_output_get_mode(output);
>>>> -	igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
>>>> -			    DRM_FORMAT_XRGB8888,
>>>> -			    DRM_FORMAT_MOD_NONE,
>>>> -			    0.0, 0.0, 0.0,
>>>> -			    &data->primary_fb[HWCURSORBUFFER]);
>>>> -
>>>> -	igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
>>>> -			    DRM_FORMAT_XRGB8888,
>>>> -			    DRM_FORMAT_MOD_NONE,
>>>> -			    0.0, 0.0, 0.0,
>>>> -			    &data->primary_fb[SWCOMPARISONBUFFER]);
>>>> +	igt_create_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
>>>> +		      DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE,
>>>> +		      &data->primary_fb[HWCURSORBUFFER]);
>>>> +
>>>> +	igt_create_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
>>>> +		      DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE,
>>>> +		      &data->primary_fb[SWCOMPARISONBUFFER1]);
>>>> +
>>>> +	igt_create_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
>>>> +		      DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE,
>>>> +		      &data->primary_fb[SWCOMPARISONBUFFER2]);
>>>>    	data->primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
>>>>    	data->cursor = igt_output_get_plane_type(output, DRM_PLANE_TYPE_CURSOR);
>>>> -	igt_plane_set_fb(data->primary, &data->primary_fb[SWCOMPARISONBUFFER]);
>>>> +	igt_plane_set_fb(data->primary, &data->primary_fb[SWCOMPARISONBUFFER1]);
>>>>    	igt_display_commit(display);
>>>> @@ -427,7 +520,7 @@ static void prepare_crtc(data_t *data, igt_output_t *output,
>>>>    		cairo_destroy(cr);
>>>>    		/* Set HW cursor buffer in place */
>>>> -			restore_image(data, HWCURSORBUFFER);
>>>> +		restore_image(data, HWCURSORBUFFER, NULL);
>>>>    	} else
>>>>    		data->surface = NULL;
>>>> @@ -469,10 +562,10 @@ static void test_cursor_alpha(data_t *data, double a)
>>>>    	igt_remove_fb(data->drm_fd, &data->fb);
>>>>    	/* Software Test - render cursor in software, drawn it directly on PF */
>>>> -	cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb[SWCOMPARISONBUFFER]);
>>>> +	cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb[SWCOMPARISONBUFFER1]);
>>>>    	igt_paint_color_alpha(cr, 0, 0, curw, curh, 1.0, 1.0, 1.0, a);
>>>>    	igt_put_cairo_ctx(cr);
>>>> -	igt_plane_set_fb(data->primary, &data->primary_fb[SWCOMPARISONBUFFER]);
>>>> +	igt_plane_set_fb(data->primary, &data->primary_fb[SWCOMPARISONBUFFER1]);
>>>>    	igt_display_commit(display);
>>>>    	igt_wait_for_vblank(data->drm_fd,
>>>>    			display->pipes[data->pipe].crtc_offset);
>>>> @@ -513,7 +606,7 @@ static void create_cursor_fb(data_t *data, int cur_w, int cur_h)
>>>>    	igt_assert(fb_id);
>>>>    	cr = igt_get_cairo_ctx(data->drm_fd, &data->fb);
>>>> -	draw_cursor(cr, 0, 0, cur_w, cur_h, 1.0);
>>>> +	draw_cursor(cr, &((cursorarea){0, 0, cur_w, cur_h}));
>>>>    	igt_put_cairo_ctx(cr);
>>>>    }
>>>> @@ -610,7 +703,7 @@ static void test_cursor_size(data_t *data)
>>>>    		igt_display_commit(display);
>>>>    		/* Now render the same in software and collect crc */
>>>> -		cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb[SWCOMPARISONBUFFER]);
>>>> +		cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb[SWCOMPARISONBUFFER1]);
>>>>    		/* remove previous cursor sw image */
>>>>    		if (prevsize > 0)
>>>> @@ -619,7 +712,7 @@ static void test_cursor_size(data_t *data)
>>>>    		igt_paint_color_alpha(cr, 0, 0, size, size, 1.0, 1.0, 1.0, 1.0);
>>>>    		igt_put_cairo_ctx(cr);
>>>> -		igt_plane_set_fb(data->primary, &data->primary_fb[SWCOMPARISONBUFFER]);
>>>> +		igt_plane_set_fb(data->primary, &data->primary_fb[SWCOMPARISONBUFFER1]);
>>>>    		igt_display_commit(display);
>>>>    		igt_pipe_crc_get_current(data->drm_fd, pipe_crc, &ref_crc);
>>>> @@ -657,6 +750,8 @@ static void test_rapid_movement(data_t *data)
>>>>    	}
>>>>    	gettimeofday(&end, NULL);
>>>> +	cursor_disable(data);
>>>> +
>>>>    	/*
>>>>    	 * We've done 400 cursor updates now.  If we're being throttled to
>>>>    	 * vblank, then that would take roughly 400/refresh seconds.  If the
>>>> @@ -813,6 +908,9 @@ igt_main
>>>>    		igt_require_pipe_crc(data.drm_fd);
>>>>    		igt_display_require(&data.display, data.drm_fd);
>>>> +		igt_display_reset(&data.display);
>>>> +		igt_display_commit2(&data.display, data.display.is_atomic ?
>>>> +				    COMMIT_ATOMIC : COMMIT_LEGACY);
>>>>    	}
>>>
>>> igt_display_require() calls igt_display_reset at the end of it... but
>>> after that does igt_enable_connectors. Is that why this extra
>>> igt_display_reset is needed here?
>>>
>>
>> This is something I don't yet know where exactly the problem exists, earlier
>> failed tests may leave tail which this is able to clear out. I coined this
>> for myself to do some debugging:
>> https://patchwork.freedesktop.org/series/93756/
>>
>> Those igt_display_reset(..) followed by atomic and legacy commit and get crc
>> of white imo should match but they don't do that for me. Situation is the
>> same as kms_plane_alpha_blend failed and will arrive to new test, there
>> maybe differences if test uses legacy or atomic commits.
> 
> 
> Well if this series helps, it's
> Acked-by: Petri Latvala <petri.latvala@intel.com>
> 
> My concern is whether that's all tests covered that need this dancing,
> and what kind of dancing is _actually_ required. And whether we can
> make this cleaner without requiring all tests to call all kinds of
> functions if they're already calling a helper that by its name is
> claiming to do all the necessary initialization.
> 

Reason for this anomaly happening is in igt_kms.c 
igt_primary_plane_commit_legacy(..) there's missing setting all plane 
properties. It could be added there but it seems to make tests which use 
legacy commits dead slow. I'd say it's more convenient to acknowledge 
this issue and those tests which use legacy commits pad them with 
something like above if it seems they start to flip flop results in a 
way kms_cursor_crc has been doing.

/Juha-Pekka


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

* Re: [igt-dev] [PATCH i-g-t 1/2] tests/kms_cursor_crc: Separate hw and sw runs on tests
  2021-08-18 14:31       ` Juha-Pekka Heikkila
@ 2021-08-19 12:06         ` Kahola, Mika
  0 siblings, 0 replies; 11+ messages in thread
From: Kahola, Mika @ 2021-08-19 12:06 UTC (permalink / raw)
  To: juhapekka.heikkila, Latvala, Petri; +Cc: igt-dev

> -----Original Message-----
> From: igt-dev <igt-dev-bounces@lists.freedesktop.org> On Behalf Of Juha-
> Pekka Heikkila
> Sent: Wednesday, August 18, 2021 5:31 PM
> To: Latvala, Petri <petri.latvala@intel.com>
> Cc: igt-dev@lists.freedesktop.org
> Subject: Re: [igt-dev] [PATCH i-g-t 1/2] tests/kms_cursor_crc: Separate hw and
> sw runs on tests
> 
> On 18.8.2021 12.17, Petri Latvala wrote:
> > On Tue, Aug 17, 2021 at 08:46:22PM +0300, Juha-Pekka Heikkila wrote:
> >> On 17.8.2021 18.59, Petri Latvala wrote:
> >>> On Tue, Aug 17, 2021 at 12:27:23PM +0300, Juha-Pekka Heikkila wrote:
> >>>> Reset display structure settings and commit them in before starting
> >>>> test in case some earlier test left tail.
> >>>>
> >>>> Separate hw and sw test runs for optimizing test.
> >>>>
> >>>> Simple cleanup.
> >>>>
> >>>> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
> >>>> ---
> >>>>    tests/kms_cursor_crc.c | 404 +++++++++++++++++++++++++---------------
> -
> >>>>    1 file changed, 251 insertions(+), 153 deletions(-)
> >>>>
> >>>> diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c index
> >>>> a9bc3a745..f478ae08d 100644
> >>>> --- a/tests/kms_cursor_crc.c
> >>>> +++ b/tests/kms_cursor_crc.c
> >>>> @@ -46,10 +46,17 @@ IGT_TEST_DESCRIPTION(
> >>>>    #define DRM_CAP_CURSOR_HEIGHT 0x9
> >>>>    #endif
> >>>> +enum cursor_buffers {
> >>>> +	HWCURSORBUFFER,
> >>>> +	SWCOMPARISONBUFFER1,
> >>>> +	SWCOMPARISONBUFFER2,
> >>>> +	MAXCURSORBUFFER
> >>>> +};
> >>>> +
> >>>>    typedef struct {
> >>>>    	int drm_fd;
> >>>>    	igt_display_t display;
> >>>> -	struct igt_fb primary_fb[2];
> >>>> +	struct igt_fb primary_fb[MAXCURSORBUFFER];
> >>>>    	struct igt_fb fb;
> >>>>    	igt_output_t *output;
> >>>>    	enum pipe pipe;
> >>>> @@ -70,29 +77,40 @@ typedef struct {
> >>>>    #define TEST_DPMS (1<<0)
> >>>>    #define TEST_SUSPEND (1<<1)
> >>>> -#define HWCURSORBUFFER 0
> >>>> -#define SWCOMPARISONBUFFER 1
> >>>> +#define RED 1.0, 0.0, 0.0
> >>>> +#define GREEN 0.0, 1.0, 0.0
> >>>> +#define BLUE 0.0, 0.0, 1.0
> >>>> +#define WHITE 1.0, 1.0, 1.0
> >>>> +
> >>>> +typedef struct {
> >>>> +	int x;
> >>>> +	int y;
> >>>> +	int width;
> >>>> +	int height;
> >>>> +} cursorarea;
> >>>> -static void draw_cursor(cairo_t *cr, int x, int y, int cw, int ch,
> >>>> double a)
> >>>> +static void draw_cursor(cairo_t *cr, cursorarea *cursor)
> >>>>    {
> >>>>    	int wl, wr, ht, hb;
> >>>>    	/* deal with odd cursor width/height */
> >>>> -	wl = cw / 2;
> >>>> -	wr = (cw + 1) / 2;
> >>>> -	ht = ch / 2;
> >>>> -	hb = (ch + 1) / 2;
> >>>> +	wl = cursor->width / 2;
> >>>> +	wr = (cursor->width + 1) / 2;
> >>>> +	ht = cursor->height / 2;
> >>>> +	hb = (cursor->height + 1) / 2;
> >>>>    	/* Cairo doesn't like to be fed numbers that are too wild */
> >>>> -	if ((x < SHRT_MIN) || (x > SHRT_MAX) || (y < SHRT_MIN) || (y >
> SHRT_MAX))
> >>>> +	if ((cursor->x < SHRT_MIN) || (cursor->x > SHRT_MAX) ||
> >>>> +	    (cursor->y < SHRT_MIN) || (cursor->y > SHRT_MAX))
> >>>>    		return;
> >>>> +
> >>>>    	cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
> >>>>    	cairo_set_antialias(cr, CAIRO_ANTIALIAS_NONE);
> >>>>    	/* 4 color rectangles in the corners, RGBY */
> >>>> -	igt_paint_color_alpha(cr, x,      y,      wl, ht, 1.0, 0.0, 0.0, a);
> >>>> -	igt_paint_color_alpha(cr, x + wl, y,      wr, ht, 0.0, 1.0, 0.0, a);
> >>>> -	igt_paint_color_alpha(cr, x,      y + ht, wl, hb, 0.0, 0.0, 1.0, a);
> >>>> -	igt_paint_color_alpha(cr, x + wl, y + ht, wr, hb, 1.0, 1.0, 1.0, a);
> >>>> +	igt_paint_color(cr, cursor->x, cursor->y, wl, ht, RED);
> >>>> +	igt_paint_color(cr, cursor->x + wl, cursor->y, wr, ht, GREEN);
> >>>> +	igt_paint_color(cr, cursor->x, cursor->y + ht, wl, hb, BLUE);
> >>>> +	igt_paint_color(cr, cursor->x + wl, cursor->y + ht, wr, hb,
> >>>> +WHITE);
> >>>>    }
> >>>>    static void cursor_enable(data_t *data) @@ -144,7 +162,7 @@
> >>>> static bool cursor_visible(data_t *data, int x, int y)
> >>>>    	return true;
> >>>>    }
> >>>> -static void restore_image(data_t *data, uint32_t buffer)
> >>>> +static void restore_image(data_t *data, uint32_t buffer,
> >>>> +cursorarea *cursor)
> >>>>    {
> >>>>    	cairo_t *cr;
> >>>> @@ -153,80 +171,84 @@ static void restore_image(data_t *data,
> uint32_t buffer)
> >>>>    	cairo_set_source_surface(cr, data->surface, 0, 0);
> >>>>    	cairo_rectangle(cr, 0, 0, data->screenw, data->screenh);
> >>>>    	cairo_fill(cr);
> >>>> +
> >>>> +	if (cursor)
> >>>> +		draw_cursor(cr, cursor);
> >>>> +
> >>>>    	igt_put_cairo_ctx(cr);
> >>>>    }
> >>>> -static void do_single_test(data_t *data, int x, int y)
> >>>> +static void do_single_test(data_t *data, int x, int y, bool hw_test,
> >>>> +			   igt_crc_t *hwcrc)
> >>>>    {
> >>>>    	igt_display_t *display = &data->display;
> >>>>    	igt_pipe_crc_t *pipe_crc = data->pipe_crc;
> >>>> -	igt_crc_t crc, ref_crc;
> >>>> -	cairo_t *cr;
> >>>> -	int ret = 0;
> >>>> +	igt_crc_t crc;
> >>>> +	int ret = 0, swbufidx;
> >>>>    	igt_print_activity();
> >>>> -	/* Hardware test */
> >>>> -	igt_plane_set_position(data->cursor, x, y);
> >>>> -	cursor_enable(data);
> >>>> +	if (hw_test) {
> >>>> +		/* Hardware test */
> >>>> +		igt_plane_set_position(data->cursor, x, y);
> >>>> -	if (chv_cursor_broken(data, x) && cursor_visible(data, x, y)) {
> >>>> -		ret = igt_display_try_commit2(display, COMMIT_LEGACY);
> >>>> -		igt_assert_eq(ret, -EINVAL);
> >>>> -		igt_plane_set_position(data->cursor, 0, y);
> >>>> -		return;
> >>>> -	}
> >>>> +		if (chv_cursor_broken(data, x) && cursor_visible(data, x, y)) {
> >>>> +			ret = igt_display_try_commit2(display,
> COMMIT_LEGACY);
> >>>> +			igt_assert_eq(ret, -EINVAL);
> >>>> +			igt_plane_set_position(data->cursor, 0, y);
> >>>> +			return;
> >>>> +		}
> >>>> -	igt_plane_set_fb(data->primary, &data-
> >primary_fb[HWCURSORBUFFER]);
> >>>> -	igt_display_commit(display);
> >>>> +		igt_display_commit(display);
> >>>> -	/* Extra vblank wait is because nonblocking cursor ioctl */
> >>>> -	igt_wait_for_vblank(data->drm_fd,
> >>>> -			    display->pipes[data->pipe].crtc_offset);
> >>>> +		/* Extra vblank wait is because nonblocking cursor ioctl */
> >>>> +		igt_wait_for_vblank(data->drm_fd,
> >>>> +				display->pipes[data->pipe].crtc_offset);
> >>>> -	igt_pipe_crc_get_current(data->drm_fd, pipe_crc, &crc);
> >>>> -	restore_image(data, SWCOMPARISONBUFFER);
> >>>> +		igt_pipe_crc_get_current(data->drm_fd, pipe_crc, hwcrc);
> >>>> -	if (data->flags & (TEST_DPMS | TEST_SUSPEND)) {
> >>>> -		igt_crc_t crc_after;
> >>>> -		/*
> >>>> -		 * stop/start crc to avoid dmesg notifications about userspace
> >>>> -		 * reading too slow.
> >>>> -		 */
> >>>> -		igt_pipe_crc_stop(pipe_crc);
> >>>> -
> >>>> -		if (data->flags & TEST_DPMS) {
> >>>> -			igt_debug("dpms off/on cycle\n");
> >>>> -			kmstest_set_connector_dpms(data->drm_fd,
> >>>> -						   data->output-
> >config.connector,
> >>>> -						   DRM_MODE_DPMS_OFF);
> >>>> -			kmstest_set_connector_dpms(data->drm_fd,
> >>>> -						   data->output-
> >config.connector,
> >>>> -						   DRM_MODE_DPMS_ON);
> >>>> +		if (data->flags & (TEST_DPMS | TEST_SUSPEND)) {
> >>>> +			igt_crc_t crc_after;
> >>>> +			/*
> >>>> +			* stop/start crc to avoid dmesg notifications about
> userspace
> >>>> +			* reading too slow.
> >>>> +			*/
> >>>> +			igt_pipe_crc_stop(pipe_crc);
> >>>> +
> >>>> +			if (data->flags & TEST_DPMS) {
> >>>> +				igt_debug("dpms off/on cycle\n");
> >>>> +				kmstest_set_connector_dpms(data->drm_fd,
> >>>> +							data->output-
> >config.connector,
> >>>> +
> 	DRM_MODE_DPMS_OFF);
> >>>> +				kmstest_set_connector_dpms(data->drm_fd,
> >>>> +							data->output-
> >config.connector,
> >>>> +
> 	DRM_MODE_DPMS_ON);
> >>>> +			}
> >>>> +
> >>>> +			if (data->flags & TEST_SUSPEND)
> >>>> +
> 	igt_system_suspend_autoresume(SUSPEND_STATE_MEM,
> >>>> +
> 	SUSPEND_TEST_NONE);
> >>>> +
> >>>> +			igt_pipe_crc_start(pipe_crc);
> >>>> +			igt_pipe_crc_get_current(data->drm_fd, pipe_crc,
> &crc_after);
> >>>> +			igt_assert_crc_equal(hwcrc, &crc_after);
> >>>>    		}
> >>>> +	} else {
> >>>> +		/* Now render the same in software and collect crc */
> >>>> +		swbufidx = (data->primary->drm_plane->fb_id ==
> >>>> +			    data->primary_fb[SWCOMPARISONBUFFER1].fb_id) ?
> >>>> +			    SWCOMPARISONBUFFER2 :
> SWCOMPARISONBUFFER1;
> >>>> -		if (data->flags & TEST_SUSPEND)
> >>>> -
> 	igt_system_suspend_autoresume(SUSPEND_STATE_MEM,
> >>>> -						      SUSPEND_TEST_NONE);
> >>>> -
> >>>> -		igt_pipe_crc_start(pipe_crc);
> >>>> -		igt_pipe_crc_get_current(data->drm_fd, pipe_crc, &crc_after);
> >>>> -		igt_assert_crc_equal(&crc, &crc_after);
> >>>> -	}
> >>>> -
> >>>> -	/* Now render the same in software and collect crc */
> >>>> -	cr = igt_get_cairo_ctx(data->drm_fd, &data-
> >primary_fb[SWCOMPARISONBUFFER]);
> >>>> -	draw_cursor(cr, x, y, data->curw, data->curh, 1.0);
> >>>> -	igt_put_cairo_ctx(cr);
> >>>> -	igt_plane_set_fb(data->primary, &data-
> >primary_fb[SWCOMPARISONBUFFER]);
> >>>> -	cursor_disable(data);
> >>>> -	igt_display_commit(display);
> >>>> +		restore_image(data, swbufidx, &((cursorarea){x, y, data->curw,
> data->curh}));
> >>>> +		igt_plane_set_fb(data->primary, &data->primary_fb[swbufidx]);
> >>>> -	igt_wait_for_vblank(data->drm_fd,
> >>>> -			display->pipes[data->pipe].crtc_offset);
> >>>> +		igt_display_commit(display);
> >>>> +		igt_wait_for_vblank(data->drm_fd,
> >>>> +				display->pipes[data->pipe].crtc_offset);
> >>>> -	igt_pipe_crc_get_current(data->drm_fd, pipe_crc, &ref_crc);
> >>>> -	igt_assert_crc_equal(&crc, &ref_crc);
> >>>> +		igt_pipe_crc_get_current(data->drm_fd, pipe_crc, &crc);
> >>>> +		igt_assert_crc_equal(&crc, hwcrc);
> >>>> +	}
> >>>>    }
> >>>>    static void do_fail_test(data_t *data, int x, int y, int expect)
> >>>> @@ -248,70 +270,112 @@ static void do_fail_test(data_t *data, int x, int
> y, int expect)
> >>>>    	igt_assert_eq(ret, expect);
> >>>>    }
> >>>> -static void do_test(data_t *data,
> >>>> -		    int left, int right, int top, int bottom)
> >>>> +static void do_test(data_t *data, const cursorarea *coords, igt_crc_t
> crc[4],
> >>>> +		    bool hwtest)
> >>>>    {
> >>>> -	do_single_test(data, left, top);
> >>>> -	do_single_test(data, right, top);
> >>>> -	do_single_test(data, right, bottom);
> >>>> -	do_single_test(data, left, bottom);
> >>>> +	do_single_test(data, coords->x, coords->width, hwtest, &crc[0]);
> >>>> +	do_single_test(data, coords->y, coords->width, hwtest, &crc[1]);
> >>>> +	do_single_test(data, coords->y, coords->height, hwtest, &crc[2]);
> >>>> +	do_single_test(data, coords->x, coords->height, hwtest, &crc[3]);
> >>>>    }
> >>>>    static void test_crc_onscreen(data_t *data)
> >>>>    {
> >>>> -	int left = data->left;
> >>>> -	int right = data->right;
> >>>> -	int top = data->top;
> >>>> -	int bottom = data->bottom;
> >>>> -	int cursor_w = data->curw;
> >>>> -	int cursor_h = data->curh;
> >>>> -
> >>>> -	/* fully inside  */
> >>>> -	do_test(data, left, right, top, bottom);
> >>>> -
> >>>> -	/* 2 pixels inside */
> >>>> -	do_test(data, left - (cursor_w-2), right + (cursor_w-2), top               ,
> bottom               );
> >>>> -	do_test(data, left               , right               , top - (cursor_h-2), bottom +
> (cursor_h-2));
> >>>> -	do_test(data, left - (cursor_w-2), right + (cursor_w-2), top - (cursor_h-
> 2), bottom + (cursor_h-2));
> >>>> -
> >>>> -	/* 1 pixel inside */
> >>>> -	do_test(data, left - (cursor_w-1), right + (cursor_w-1), top               ,
> bottom               );
> >>>> -	do_test(data, left               , right               , top - (cursor_h-1), bottom +
> (cursor_h-1));
> >>>> -	do_test(data, left - (cursor_w-1), right + (cursor_w-1), top - (cursor_h-
> 1), bottom + (cursor_h-1));
> >>>> +	const int left = data->left;
> >>>> +	const int right = data->right;
> >>>> +	const int top = data->top;
> >>>> +	const int bottom = data->bottom;
> >>>> +	const int cursor_w = data->curw;
> >>>> +	const int cursor_h = data->curh;
> >>>> +
> >>>> +	struct {
> >>>> +		const cursorarea coords;
> >>>> +		igt_crc_t crc[4];
> >>>> +	} tests[] = {
> >>>> +		/* fully inside  */
> >>>> +		{{left, right, top, bottom}},
> >>>> +		/* 2 pixels inside */
> >>>> +		{{left - (cursor_w - 2), right + (cursor_w - 2), top, bottom}},
> >>>> +		{{left, right, top - (cursor_h - 2), bottom + (cursor_h - 2)}},
> >>>> +		{{left - (cursor_w - 2), right + (cursor_w - 2),
> >>>> +		  top - (cursor_h - 2), bottom + (cursor_h - 2)}},
> >>>> +		/* 1 pixel inside */
> >>>> +		{{left - (cursor_w - 1), right + (cursor_w - 1), top, bottom}},
> >>>> +		{{left, right, top - (cursor_h - 1), bottom + (cursor_h - 1)}},
> >>>> +		{{left - (cursor_w - 1), right + (cursor_w - 1),
> >>>> +		  top - (cursor_h - 1), bottom + (cursor_h - 1)}},
> >>>> +	};
> >>>> +
> >>>> +	/* HW test */
> >>>> +	cursor_enable(data);
> >>>> +	igt_plane_set_fb(data->primary, &data-
> >primary_fb[HWCURSORBUFFER]);
> >>>> +	for (int i = 0; i < ARRAY_SIZE(tests); i++)
> >>>> +		do_test(data, &tests[i].coords, tests[i].crc, true);
> >>>> +
> >>>> +	/* SW test */
> >>>> +	cursor_disable(data);
> >>>> +	for (int i = 0; i < ARRAY_SIZE(tests); i++)
> >>>> +		do_test(data, &tests[i].coords, tests[i].crc, false);
> >>>>    }
> >>>>    static void test_crc_offscreen(data_t *data)
> >>>>    {
> >>>> -	int left = data->left;
> >>>> -	int right = data->right;
> >>>> -	int top = data->top;
> >>>> -	int bottom = data->bottom;
> >>>> -	int cursor_w = data->curw;
> >>>> -	int cursor_h = data->curh;
> >>>> -
> >>>> -	/* fully outside */
> >>>> -	do_test(data, left - (cursor_w), right + (cursor_w), top             , bottom
> );
> >>>> -	do_test(data, left             , right             , top - (cursor_h), bottom +
> (cursor_h));
> >>>> -	do_test(data, left - (cursor_w), right + (cursor_w), top - (cursor_h),
> bottom + (cursor_h));
> >>>> -
> >>>> -	/* fully outside by 1 extra pixels */
> >>>> -	do_test(data, left - (cursor_w+1), right + (cursor_w+1), top               ,
> bottom               );
> >>>> -	do_test(data, left               , right               , top - (cursor_h+1), bottom +
> (cursor_h+1));
> >>>> -	do_test(data, left - (cursor_w+1), right + (cursor_w+1), top -
> (cursor_h+1), bottom + (cursor_h+1));
> >>>> -
> >>>> -	/* fully outside by 2 extra pixels */
> >>>> -	do_test(data, left - (cursor_w+2), right + (cursor_w+2), top               ,
> bottom               );
> >>>> -	do_test(data, left               , right               , top - (cursor_h+2), bottom +
> (cursor_h+2));
> >>>> -	do_test(data, left - (cursor_w+2), right + (cursor_w+2), top -
> (cursor_h+2), bottom + (cursor_h+2));
> >>>> -
> >>>> -	/* fully outside by a lot of extra pixels */
> >>>> -	do_test(data, left - (cursor_w+512), right + (cursor_w+512), top
> , bottom                 );
> >>>> -	do_test(data, left                 , right                 , top - (cursor_h+512),
> bottom + (cursor_h+512));
> >>>> -	do_test(data, left - (cursor_w+512), right + (cursor_w+512), top -
> (cursor_h+512), bottom + (cursor_h+512));
> >>>> -
> >>>> -	/* go nuts */
> >>>> -	do_test(data, INT_MIN, INT_MAX - cursor_w, INT_MIN, INT_MAX -
> cursor_h);
> >>>> -	do_test(data, SHRT_MIN, SHRT_MAX, SHRT_MIN, SHRT_MAX);
> >>>> +	const int left = data->left;
> >>>> +	const int right = data->right;
> >>>> +	const int top = data->top;
> >>>> +	const int bottom = data->bottom;
> >>>> +	const int cursor_w = data->curw;
> >>>> +	const int cursor_h = data->curh;
> >>>> +
> >>>> +	struct {
> >>>> +		const cursorarea coords;
> >>>> +		igt_crc_t crc[4];
> >>>> +	} tests[] = {
> >>>> +		/* fully outside */
> >>>> +		{{left - (cursor_w), right + (cursor_w), top, bottom}},
> >>>> +		{{left, right, top - (cursor_h), bottom + (cursor_h)}},
> >>>> +		{{left - (cursor_w), right + (cursor_w), top - (cursor_h),
> >>>> +		  bottom + (cursor_h)}},
> >>>> +		/* fully outside by 1 extra pixels */
> >>>> +		{{left - (cursor_w + 1), right + (cursor_w + 1), top, bottom}},
> >>>> +		{{left, right, top - (cursor_h + 1), bottom + (cursor_h + 1)}},
> >>>> +		{{left - (cursor_w + 1), right + (cursor_w + 1),
> >>>> +		  top - (cursor_h + 1), bottom + (cursor_h + 1)}},
> >>>> +		/* fully outside by 2 extra pixels */
> >>>> +		{{left - (cursor_w + 2), right + (cursor_w + 2), top, bottom}},
> >>>> +		{{left, right, top - (cursor_h + 2), bottom + (cursor_h + 2)}},
> >>>> +		{{left - (cursor_w + 2), right + (cursor_w + 2),
> >>>> +		  top - (cursor_h + 2), bottom + (cursor_h + 2)}},
> >>>> +		/* fully outside by a lot of extra pixels */
> >>>> +		{{left - (cursor_w + 512), right + (cursor_w + 512), top,
> bottom}},
> >>>> +		{{left, right, top - (cursor_h + 512), bottom + (cursor_h + 512)}},
> >>>> +		{{left - (cursor_w + 512), right + (cursor_w + 512),
> >>>> +		  top - (cursor_h + 512), bottom + (cursor_h + 512)}},
> >>>> +		/* go nuts */
> >>>> +		{{INT_MIN, INT_MAX - cursor_w, INT_MIN, INT_MAX -
> cursor_h}},
> >>>> +		{{SHRT_MIN, SHRT_MAX, SHRT_MIN, SHRT_MAX}},
> >>>> +	};
> >>>> +
> >>>> +	/* HW test */
> >>>> +	cursor_enable(data);
> >>>> +	igt_plane_set_fb(data->primary, &data-
> >primary_fb[HWCURSORBUFFER]);
> >>>> +	for (int i = 0; i < ARRAY_SIZE(tests); i++)
> >>>> +		do_test(data, &tests[i].coords, tests[i].crc, true);
> >>>> +
> >>>> +	/* SW test */
> >>>> +	cursor_disable(data);
> >>>> +	/*
> >>>> +	 * all these crc's should be the same, actually render only first image
> >>>> +	 * to check crc and then compare rest of crc are matching
> >>>> +	 */
> >>>> +	do_test(data, &tests[0].coords, tests[0].crc, false);
> >>>> +
> >>>> +	for (int i = 1; i < ARRAY_SIZE(tests); i++) {
> >>>> +		igt_assert_crc_equal(&tests[0].crc[0], &tests[i].crc[0]);
> >>>> +		igt_assert_crc_equal(&tests[0].crc[0], &tests[i].crc[1]);
> >>>> +		igt_assert_crc_equal(&tests[0].crc[0], &tests[i].crc[2]);
> >>>> +		igt_assert_crc_equal(&tests[0].crc[0], &tests[i].crc[3]);
> >>>> +	}
> >>>>    	/* Make sure we get -ERANGE on integer overflow */
> >>>>    	do_fail_test(data, INT_MAX - cursor_w + 1, INT_MAX - cursor_h +
> >>>> 1, -ERANGE); @@ -320,29 +384,57 @@ static void
> test_crc_offscreen(data_t *data)
> >>>>    static void test_crc_sliding(data_t *data)
> >>>>    {
> >>>>    	int i;
> >>>> +	struct {
> >>>> +		igt_crc_t crc[3];
> >>>> +	} rounds[16] = {};
> >>>>    	/* Make sure cursor moves smoothly and pixel-by-pixel, and that there
> are
> >>>>    	 * no alignment issues. Horizontal, vertical and diagonal test.
> >>>>    	 */
> >>>> -	for (i = 0; i < 16; i++) {
> >>>> -		do_single_test(data, i, 0);
> >>>> -		do_single_test(data, 0, i);
> >>>> -		do_single_test(data, i, i);
> >>>> +
> >>>> +	/* HW test */
> >>>> +	cursor_enable(data);
> >>>> +	igt_plane_set_fb(data->primary,
> >>>> +&data->primary_fb[HWCURSORBUFFER]);
> >>>> +
> >>>> +	for (i = 0; i < ARRAY_SIZE(rounds); i++) {
> >>>> +		do_single_test(data, i, 0, true, &rounds[i].crc[0]);
> >>>> +		do_single_test(data, 0, i, true, &rounds[i].crc[1]);
> >>>> +		do_single_test(data, i, i, true, &rounds[i].crc[2]);
> >>>> +	}
> >>>> +
> >>>> +	/* SW test */
> >>>> +	cursor_disable(data);
> >>>> +	for (i = 0; i < ARRAY_SIZE(rounds); i++) {
> >>>> +		do_single_test(data, i, 0, false, &rounds[i].crc[0]);
> >>>> +		do_single_test(data, 0, i, false, &rounds[i].crc[1]);
> >>>> +		do_single_test(data, i, i, false, &rounds[i].crc[2]);
> >>>>    	}
> >>>>    }
> >>>>    static void test_crc_random(data_t *data)
> >>>>    {
> >>>> -	int i, max;
> >>>> +	igt_crc_t crc[50];
> >>>> +	int i, max, x[ARRAY_SIZE(crc)], y[ARRAY_SIZE(crc)];
> >>>> -	max = data->flags & (TEST_DPMS | TEST_SUSPEND) ? 2 : 50;
> >>>> +	max = data->flags & (TEST_DPMS | TEST_SUSPEND) ? 2 :
> >>>> +ARRAY_SIZE(crc);
> >>>>    	/* Random cursor placement */
> >>>> +
> >>>> +	/* HW test */
> >>>> +	cursor_enable(data);
> >>>> +	igt_plane_set_fb(data->primary,
> >>>> +&data->primary_fb[HWCURSORBUFFER]);
> >>>> +
> >>>>    	for (i = 0; i < max; i++) {
> >>>> -		int x = rand() % (data->screenw + data->curw * 2) - data->curw;
> >>>> -		int y = rand() % (data->screenh + data->curh * 2) - data->curh;
> >>>> -		do_single_test(data, x, y);
> >>>> +		x[i] = rand() % (data->screenw + data->curw * 2) - data->curw;
> >>>> +		y[i] = rand() % (data->screenh + data->curh * 2) - data->curh;
> >>>> +		do_single_test(data, x[i], y[i], true, &crc[i]);
> >>>>    	}
> >>>> +
> >>>> +	/* SW test */
> >>>> +	cursor_disable(data);
> >>>> +	for (i = 0; i < max; i++)
> >>>> +		do_single_test(data, x[i], y[i], false, &crc[i]);
> >>>> +
> >>>>    }
> >>>>    static void cleanup_crtc(data_t *data) @@ -362,7 +454,8 @@
> >>>> static void cleanup_crtc(data_t *data)
> >>>>    	igt_display_commit(display);
> >>>>    	igt_remove_fb(data->drm_fd, &data-
> >primary_fb[HWCURSORBUFFER]);
> >>>> -	igt_remove_fb(data->drm_fd, &data-
> >primary_fb[SWCOMPARISONBUFFER]);
> >>>> +	igt_remove_fb(data->drm_fd, &data-
> >primary_fb[SWCOMPARISONBUFFER1]);
> >>>> +	igt_remove_fb(data->drm_fd,
> >>>> +&data->primary_fb[SWCOMPARISONBUFFER2]);
> >>>>    	igt_display_reset(display);
> >>>>    }
> >>>> @@ -379,22 +472,22 @@ static void prepare_crtc(data_t *data,
> igt_output_t *output,
> >>>>    	/* create and set the primary plane fbs */
> >>>>    	mode = igt_output_get_mode(output);
> >>>> -	igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
> >>>> -			    DRM_FORMAT_XRGB8888,
> >>>> -			    DRM_FORMAT_MOD_NONE,
> >>>> -			    0.0, 0.0, 0.0,
> >>>> -			    &data->primary_fb[HWCURSORBUFFER]);
> >>>> -
> >>>> -	igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
> >>>> -			    DRM_FORMAT_XRGB8888,
> >>>> -			    DRM_FORMAT_MOD_NONE,
> >>>> -			    0.0, 0.0, 0.0,
> >>>> -			    &data->primary_fb[SWCOMPARISONBUFFER]);
> >>>> +	igt_create_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
> >>>> +		      DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE,
> >>>> +		      &data->primary_fb[HWCURSORBUFFER]);
> >>>> +
> >>>> +	igt_create_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
> >>>> +		      DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE,
> >>>> +		      &data->primary_fb[SWCOMPARISONBUFFER1]);
> >>>> +
> >>>> +	igt_create_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
> >>>> +		      DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE,
> >>>> +		      &data->primary_fb[SWCOMPARISONBUFFER2]);
> >>>>    	data->primary = igt_output_get_plane_type(output,
> DRM_PLANE_TYPE_PRIMARY);
> >>>>    	data->cursor = igt_output_get_plane_type(output,
> DRM_PLANE_TYPE_CURSOR);
> >>>> -	igt_plane_set_fb(data->primary, &data-
> >primary_fb[SWCOMPARISONBUFFER]);
> >>>> +	igt_plane_set_fb(data->primary,
> >>>> +&data->primary_fb[SWCOMPARISONBUFFER1]);
> >>>>    	igt_display_commit(display);
> >>>> @@ -427,7 +520,7 @@ static void prepare_crtc(data_t *data,
> igt_output_t *output,
> >>>>    		cairo_destroy(cr);
> >>>>    		/* Set HW cursor buffer in place */
> >>>> -			restore_image(data, HWCURSORBUFFER);
> >>>> +		restore_image(data, HWCURSORBUFFER, NULL);
> >>>>    	} else
> >>>>    		data->surface = NULL;
> >>>> @@ -469,10 +562,10 @@ static void test_cursor_alpha(data_t *data,
> double a)
> >>>>    	igt_remove_fb(data->drm_fd, &data->fb);
> >>>>    	/* Software Test - render cursor in software, drawn it directly on PF */
> >>>> -	cr = igt_get_cairo_ctx(data->drm_fd, &data-
> >primary_fb[SWCOMPARISONBUFFER]);
> >>>> +	cr = igt_get_cairo_ctx(data->drm_fd,
> >>>> +&data->primary_fb[SWCOMPARISONBUFFER1]);
> >>>>    	igt_paint_color_alpha(cr, 0, 0, curw, curh, 1.0, 1.0, 1.0, a);
> >>>>    	igt_put_cairo_ctx(cr);
> >>>> -	igt_plane_set_fb(data->primary, &data-
> >primary_fb[SWCOMPARISONBUFFER]);
> >>>> +	igt_plane_set_fb(data->primary,
> >>>> +&data->primary_fb[SWCOMPARISONBUFFER1]);
> >>>>    	igt_display_commit(display);
> >>>>    	igt_wait_for_vblank(data->drm_fd,
> >>>>    			display->pipes[data->pipe].crtc_offset);
> >>>> @@ -513,7 +606,7 @@ static void create_cursor_fb(data_t *data, int
> cur_w, int cur_h)
> >>>>    	igt_assert(fb_id);
> >>>>    	cr = igt_get_cairo_ctx(data->drm_fd, &data->fb);
> >>>> -	draw_cursor(cr, 0, 0, cur_w, cur_h, 1.0);
> >>>> +	draw_cursor(cr, &((cursorarea){0, 0, cur_w, cur_h}));
> >>>>    	igt_put_cairo_ctx(cr);
> >>>>    }
> >>>> @@ -610,7 +703,7 @@ static void test_cursor_size(data_t *data)
> >>>>    		igt_display_commit(display);
> >>>>    		/* Now render the same in software and collect crc */
> >>>> -		cr = igt_get_cairo_ctx(data->drm_fd, &data-
> >primary_fb[SWCOMPARISONBUFFER]);
> >>>> +		cr = igt_get_cairo_ctx(data->drm_fd,
> >>>> +&data->primary_fb[SWCOMPARISONBUFFER1]);
> >>>>    		/* remove previous cursor sw image */
> >>>>    		if (prevsize > 0)
> >>>> @@ -619,7 +712,7 @@ static void test_cursor_size(data_t *data)
> >>>>    		igt_paint_color_alpha(cr, 0, 0, size, size, 1.0, 1.0, 1.0, 1.0);
> >>>>    		igt_put_cairo_ctx(cr);
> >>>> -		igt_plane_set_fb(data->primary, &data-
> >primary_fb[SWCOMPARISONBUFFER]);
> >>>> +		igt_plane_set_fb(data->primary,
> >>>> +&data->primary_fb[SWCOMPARISONBUFFER1]);
> >>>>    		igt_display_commit(display);
> >>>>    		igt_pipe_crc_get_current(data->drm_fd, pipe_crc, &ref_crc);
> @@
> >>>> -657,6 +750,8 @@ static void test_rapid_movement(data_t *data)
> >>>>    	}
> >>>>    	gettimeofday(&end, NULL);
> >>>> +	cursor_disable(data);
> >>>> +
> >>>>    	/*
> >>>>    	 * We've done 400 cursor updates now.  If we're being throttled to
> >>>>    	 * vblank, then that would take roughly 400/refresh seconds.
> >>>> If the @@ -813,6 +908,9 @@ igt_main
> >>>>    		igt_require_pipe_crc(data.drm_fd);
> >>>>    		igt_display_require(&data.display, data.drm_fd);
> >>>> +		igt_display_reset(&data.display);
> >>>> +		igt_display_commit2(&data.display, data.display.is_atomic ?
> >>>> +				    COMMIT_ATOMIC : COMMIT_LEGACY);
> >>>>    	}
> >>>
> >>> igt_display_require() calls igt_display_reset at the end of it...
> >>> but after that does igt_enable_connectors. Is that why this extra
> >>> igt_display_reset is needed here?
> >>>
> >>
> >> This is something I don't yet know where exactly the problem exists,
> >> earlier failed tests may leave tail which this is able to clear out.
> >> I coined this for myself to do some debugging:
> >> https://patchwork.freedesktop.org/series/93756/
> >>
> >> Those igt_display_reset(..) followed by atomic and legacy commit and
> >> get crc of white imo should match but they don't do that for me.
> >> Situation is the same as kms_plane_alpha_blend failed and will arrive
> >> to new test, there maybe differences if test uses legacy or atomic commits.
> >
> >
> > Well if this series helps, it's
> > Acked-by: Petri Latvala <petri.latvala@intel.com>
> >
> > My concern is whether that's all tests covered that need this dancing,
> > and what kind of dancing is _actually_ required. And whether we can
> > make this cleaner without requiring all tests to call all kinds of
> > functions if they're already calling a helper that by its name is
> > claiming to do all the necessary initialization.
> >
> 
> Reason for this anomaly happening is in igt_kms.c
> igt_primary_plane_commit_legacy(..) there's missing setting all plane
> properties. It could be added there but it seems to make tests which use legacy
> commits dead slow. I'd say it's more convenient to acknowledge this issue and
> those tests which use legacy commits pad them with something like above if it
> seems they start to flip flop results in a way kms_cursor_crc has been doing.
> 
> /Juha-Pekka
> 
The patch seems to help with flip flop results of kms_cursor_crc test.

Reviewed-by: Mika Kahola <mika.kahola@intel.com>


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

* Re: [igt-dev] [PATCH i-g-t 2/2] tests/kms_plane_alpha_blend: reset display after test
  2021-08-17  9:27 ` [igt-dev] [PATCH i-g-t 2/2] tests/kms_plane_alpha_blend: reset display after test Juha-Pekka Heikkila
@ 2021-08-19 12:07   ` Kahola, Mika
  0 siblings, 0 replies; 11+ messages in thread
From: Kahola, Mika @ 2021-08-19 12:07 UTC (permalink / raw)
  To: Juha-Pekka Heikkila, igt-dev

Reviewed-by: Mika Kahola <mika.kahola@intel.com>

> -----Original Message-----
> From: igt-dev <igt-dev-bounces@lists.freedesktop.org> On Behalf Of Juha-
> Pekka Heikkila
> Sent: Tuesday, August 17, 2021 12:27 PM
> To: igt-dev@lists.freedesktop.org
> Cc: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
> Subject: [igt-dev] [PATCH i-g-t 2/2] tests/kms_plane_alpha_blend: reset display
> after test
> 
> If test would fail alpha/blend settings would be left on random setting. Clean up
> before exiting.
> 
> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
> ---
>  tests/kms_plane_alpha_blend.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/kms_plane_alpha_blend.c b/tests/kms_plane_alpha_blend.c
> index cb8f92891..cff9a9eff 100644
> --- a/tests/kms_plane_alpha_blend.c
> +++ b/tests/kms_plane_alpha_blend.c
> @@ -586,6 +586,11 @@ igt_main
>  		igt_subtest_group
>  			run_subtests(&data, pipe);
> 
> -	igt_fixture
> +	igt_fixture {
> +		igt_display_reset(&data.display);
> +		igt_display_commit2(&data.display, data.display.is_atomic ?
> +				    COMMIT_ATOMIC : COMMIT_LEGACY);
> +
>  		igt_display_fini(&data.display);
> +	}
>  }
> --
> 2.28.0


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

end of thread, other threads:[~2021-08-19 12:07 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-17  9:27 [igt-dev] [PATCH i-g-t 1/2] tests/kms_cursor_crc: Separate hw and sw runs on tests Juha-Pekka Heikkila
2021-08-17  9:27 ` [igt-dev] [PATCH i-g-t 2/2] tests/kms_plane_alpha_blend: reset display after test Juha-Pekka Heikkila
2021-08-19 12:07   ` Kahola, Mika
2021-08-17 12:47 ` [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [i-g-t,1/2] tests/kms_cursor_crc: Separate hw and sw runs on tests Patchwork
2021-08-17 14:18 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/2] tests/kms_cursor_crc: Separate hw and sw runs on tests (rev2) Patchwork
2021-08-17 15:56 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2021-08-17 15:59 ` [igt-dev] [PATCH i-g-t 1/2] tests/kms_cursor_crc: Separate hw and sw runs on tests Petri Latvala
2021-08-17 17:46   ` Juha-Pekka Heikkila
2021-08-18  9:17     ` Petri Latvala
2021-08-18 14:31       ` Juha-Pekka Heikkila
2021-08-19 12:06         ` Kahola, Mika

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.