[PATCH i-g-t] tests/kms_async_flips: Fix test to pass crc tests on mtl and discrete

Juha-Pekka Heikkila juhapekka.heikkila at gmail.com
Thu Dec 7 16:33:05 UTC 2023


Instead of copying framebuffers back'n'forth just use blitter to
paint framebuffers. For now this is Intel only solution, need to
fix test properly not breaking anything.

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
---
 tests/kms_async_flips.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/tests/kms_async_flips.c b/tests/kms_async_flips.c
index 6fddad093..de524e660 100644
--- a/tests/kms_async_flips.c
+++ b/tests/kms_async_flips.c
@@ -531,6 +531,7 @@ static void test_crc(data_t *data)
 	unsigned int start;
 	cairo_t *cr;
 	int ret;
+	struct buf_ops *bops;
 
 	data->flip_count = 0;
 	data->frame_count = 0;
@@ -549,6 +550,8 @@ static void test_crc(data_t *data)
 			     &data->output->config.connector->modes[0]);
 	igt_assert_eq(ret, 0);
 
+	bops = buf_ops_create(data->drm_fd);
+
 	data->pipe_crc = igt_pipe_crc_new(data->drm_fd,
 					  kmstest_get_pipe_from_crtc_id(data->drm_fd, data->crtc_id),
 					  IGT_PIPE_CRC_SOURCE_AUTO);
@@ -562,9 +565,8 @@ static void test_crc(data_t *data)
 
 	while (clock_ms() - start < 2000) {
 		/* fill the next fb with the expected color */
-		cr = igt_get_cairo_ctx(data->drm_fd, &data->bufs[frame]);
-		igt_paint_color(cr, 0, 0, 1, data->bufs[frame].height, 1.0, 0.0, 0.0);
-		igt_put_cairo_ctx(cr);
+		igt_draw_rect_fb(data->drm_fd, bops, 0, &data->bufs[frame],IGT_DRAW_BLT,
+				 0,0, 1, data->bufs[frame].height, 0xffff0000);
 
 		data->flip_pending = true;
 		ret = drmModePageFlip(data->drm_fd, data->crtc_id, data->bufs[frame].fb_id,
@@ -575,11 +577,11 @@ static void test_crc(data_t *data)
 
 		/* clobber the previous fb which should no longer be scanned out */
 		frame = !frame;
-		cr = igt_get_cairo_ctx(data->drm_fd, &data->bufs[frame]);
-		igt_paint_color_rand(cr, 0, 0, 1, data->bufs[frame].height);
-		igt_put_cairo_ctx(cr);
+		igt_draw_rect_fb(data->drm_fd, bops, 0, &data->bufs[frame],IGT_DRAW_BLT,
+				 0,0, 1, data->bufs[frame].height, 0xff0000ff);
 	}
 
+	buf_ops_destroy(bops);
 	igt_pipe_crc_stop(data->pipe_crc);
 	igt_pipe_crc_free(data->pipe_crc);
 
-- 
2.25.1



More information about the Intel-gfx-trybot mailing list