[igt-dev] [PATCH i-g-t] tests/kms_frontbuffer_tracking: optimize test execution time

Juha-Pekka Heikkila juhapekka.heikkila at gmail.com
Wed Nov 27 19:57:56 UTC 2019


Don't continuously start and stop crc calculation because it
take lot of time. Just start crc in beginning of test and
stop it in the end.

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
---
 tests/kms_frontbuffer_tracking.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/tests/kms_frontbuffer_tracking.c b/tests/kms_frontbuffer_tracking.c
index c788b59..c4847f7 100644
--- a/tests/kms_frontbuffer_tracking.c
+++ b/tests/kms_frontbuffer_tracking.c
@@ -1172,7 +1172,8 @@ static void print_crc(const char *str, igt_crc_t *crc)
 
 static void collect_crc(igt_crc_t *crc)
 {
-	igt_pipe_crc_collect_crc(pipe_crc, crc);
+	igt_wait_for_vblank(drm.fd, prim_mode_params.pipe);
+	igt_pipe_crc_get_current(drm.fd, pipe_crc, crc);
 }
 
 static void init_blue_crc(enum pixel_format format)
@@ -1196,6 +1197,7 @@ static void init_blue_crc(enum pixel_format format)
 	if (!pipe_crc) {
 		pipe_crc = igt_pipe_crc_new(drm.fd, prim_mode_params.pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
 		igt_assert(pipe_crc);
+		igt_pipe_crc_start(pipe_crc);
 	}
 
 	collect_crc(&blue_crcs[format].crc);
@@ -1354,6 +1356,9 @@ static void teardown_crcs(void)
 			free(pattern4.crcs[f]);
 	}
 
+	if (pipe_crc != NULL)
+		igt_pipe_crc_stop(pipe_crc);
+
 	igt_pipe_crc_free(pipe_crc);
 }
 
@@ -1556,8 +1561,10 @@ static void do_crc_assertions(int flags)
 {
 	igt_crc_t crc;
 
-	if (!opt.check_crc || (flags & DONT_ASSERT_CRC))
+	if (!opt.check_crc || (flags & DONT_ASSERT_CRC)) {
+		igt_pipe_crc_drain(pipe_crc);
 		return;
+	}
 
 	collect_crc(&crc);
 	print_crc("Calculated CRC:", &crc);
@@ -2168,16 +2175,22 @@ static void slow_draw_subtest(const struct test_mode *t)
 	struct fb_region *target;
 
 	prepare_subtest(t, pattern);
+	igt_pipe_crc_stop(pipe_crc);
 	sleep(2);
 	target = pick_target(t, params);
+	igt_pipe_crc_start(pipe_crc);
 
 	for (r = 0; r < pattern->n_rects; r++) {
+		igt_pipe_crc_stop(pipe_crc);
+
 		sleep(2);
 		draw_rect(pattern, target, t->method, r);
 		sleep(2);
 
 		update_wanted_crc(t, &pattern->crcs[t->format][r]);
 
+		igt_pipe_crc_start(pipe_crc);
+
 		if (t->feature & FEATURE_DRRS)
 			do_assertions(ASSERT_DRRS_LOW);
 		else
-- 
2.7.4



More information about the igt-dev mailing list