[igt-dev] [PATCH i-g-t] tests/kms_cursor_crc: Skip vblank waits for virtual_hw mode

Sumera Priyadarsini sylphrenadin at gmail.com
Tue Feb 23 11:53:39 UTC 2021


Call igt_wait_for_vblank() only when vblank interrupts are supported.
For cases involving virtual hardware, use igt_pipe_crc_drain()
and igt_pipe_crc_get_single() to flush and read the crc pipe instead
of igt_pipe_crc_get_current() which depends on the vblank interval.

Co-developed-by: Melissa Wen <melissa.srw at gmail.com>
Signed-off-by: Melissa Wen <melissa.srw at gmail.com>
Signed-off-by: Sumera Priyadarsini <sylphrenadin at gmail.com>
---
 tests/kms_cursor_crc.c | 53 +++++++++++++++++++++++++++++++++---------
 1 file changed, 42 insertions(+), 11 deletions(-)

diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c
index 0be8f7f8..22830601 100644
--- a/tests/kms_cursor_crc.c
+++ b/tests/kms_cursor_crc.c
@@ -186,9 +186,14 @@ static void do_single_test(data_t *data, int x, int y)
 	igt_display_commit(display);
 
 	/* Extra vblank wait is because nonblocking cursor ioctl */
-	igt_wait_for_vblank(data->drm_fd,
+	if (kms_has_vblank(data->drm_fd)) {
+		igt_wait_for_vblank(data->drm_fd,
 			display->pipes[data->pipe].crtc_offset);
-	igt_pipe_crc_get_current(data->drm_fd, pipe_crc, &crc);
+		igt_pipe_crc_get_current(data->drm_fd, pipe_crc, &crc);
+	} else {
+		igt_pipe_crc_drain(pipe_crc);
+		igt_pipe_crc_get_single(pipe_crc, &crc);
+	}
 
 	if (data->flags & (TEST_DPMS | TEST_SUSPEND)) {
 		igt_crc_t crc_after;
@@ -213,7 +218,13 @@ static void do_single_test(data_t *data, int x, int y)
 						      SUSPEND_TEST_NONE);
 
 		igt_pipe_crc_start(pipe_crc);
-		igt_pipe_crc_get_current(data->drm_fd, pipe_crc, &crc_after);
+		if (kms_has_vblank(data->drm_fd)) {
+			igt_pipe_crc_get_current(data->drm_fd, pipe_crc, &crc_after);
+		} else {
+			igt_pipe_crc_drain(pipe_crc);
+			igt_pipe_crc_get_single(pipe_crc, &crc_after);
+		}
+
 		igt_assert_crc_equal(&crc, &crc_after);
 	}
 
@@ -451,9 +462,14 @@ static void test_cursor_alpha(data_t *data, double a)
 	/* Hardware Test - enable cursor and get PF CRC */
 	cursor_enable(data);
 	igt_display_commit(display);
-	igt_wait_for_vblank(data->drm_fd,
+	if (kms_has_vblank(data->drm_fd)) {
+		igt_wait_for_vblank(data->drm_fd,
 			display->pipes[data->pipe].crtc_offset);
-	igt_pipe_crc_get_current(data->drm_fd, pipe_crc, &crc);
+		igt_pipe_crc_get_current(data->drm_fd, pipe_crc, &crc);
+	} else {
+		igt_pipe_crc_drain(pipe_crc);
+		igt_pipe_crc_get_single(pipe_crc, &crc);
+	}
 
 	cursor_disable(data);
 	igt_remove_fb(data->drm_fd, &data->fb);
@@ -464,9 +480,14 @@ static void test_cursor_alpha(data_t *data, double a)
 	igt_put_cairo_ctx(cr);
 
 	igt_display_commit(display);
-	igt_wait_for_vblank(data->drm_fd,
+	if (kms_has_vblank(data->drm_fd)) {
+		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_pipe_crc_get_current(data->drm_fd, pipe_crc, &ref_crc);
+	} else {
+		igt_pipe_crc_drain(pipe_crc);
+		igt_pipe_crc_get_single(pipe_crc, &ref_crc);
+	}
 
 	/* Compare CRC from Hardware/Software tests */
 	igt_assert_crc_equal(&crc, &ref_crc);
@@ -572,9 +593,14 @@ static void test_cursor_size(data_t *data)
 		igt_plane_set_size(data->cursor, size, size);
 		igt_fb_set_size(&data->fb, data->cursor, size, size);
 		igt_display_commit(display);
-		igt_wait_for_vblank(data->drm_fd,
+		if (kms_has_vblank(data->drm_fd)) {
+			igt_wait_for_vblank(data->drm_fd,
 				display->pipes[data->pipe].crtc_offset);
-		igt_pipe_crc_get_current(data->drm_fd, pipe_crc, &crc[i]);
+			igt_pipe_crc_get_current(data->drm_fd, pipe_crc, &crc[i]);
+		} else {
+			igt_pipe_crc_drain(pipe_crc);
+			igt_pipe_crc_get_single(pipe_crc, &crc[i]);
+		}
 	}
 	cursor_disable(data);
 	igt_display_commit(display);
@@ -587,9 +613,14 @@ static void test_cursor_size(data_t *data)
 		igt_put_cairo_ctx(cr);
 
 		igt_display_commit(display);
-		igt_wait_for_vblank(data->drm_fd,
+		if (kms_has_vblank(data->drm_fd)) {
+			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_pipe_crc_get_current(data->drm_fd, pipe_crc, &ref_crc);
+		} else {
+			igt_pipe_crc_drain(pipe_crc);
+			igt_pipe_crc_get_single(pipe_crc, &ref_crc);
+		}
 		/* Clear screen afterwards */
 		cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb[FRONTBUFFER]);
 		igt_paint_color(cr, 0, 0, data->screenw, data->screenh,
-- 
2.25.1



More information about the igt-dev mailing list