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

Juha-Pekka Heikkila juhapekka.heikkila at gmail.com
Fri Dec 13 15:41:46 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 | 26 +++++++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/tests/kms_frontbuffer_tracking.c b/tests/kms_frontbuffer_tracking.c
index c788b59..e34580a 100644
--- a/tests/kms_frontbuffer_tracking.c
+++ b/tests/kms_frontbuffer_tracking.c
@@ -1172,15 +1172,19 @@ 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)
 {
 	struct igt_fb blue;
 
-	if (blue_crcs[format].initialized)
+	if (blue_crcs[format].initialized) {
+		if (pipe_crc)
+			igt_pipe_crc_drain(pipe_crc);
 		return;
+	}
 
 	create_fb(format, prim_mode_params.mode->hdisplay,
 		  prim_mode_params.mode->vdisplay, opt.tiling, PLANE_PRI,
@@ -1196,6 +1200,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 +1359,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 +1564,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 +2178,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
@@ -2699,15 +2715,19 @@ static void suspend_subtest(const struct test_mode *t)
 	struct modeset_params *params = pick_params(t);
 
 	prepare_subtest(t, NULL);
+	igt_pipe_crc_stop(pipe_crc);
 	igt_system_suspend_autoresume(SUSPEND_STATE_MEM, SUSPEND_TEST_NONE);
+	igt_pipe_crc_start(pipe_crc);
 	do_assertions(ASSERT_DRRS_LOW);
 
 	unset_all_crtcs();
+	igt_pipe_crc_stop(pipe_crc);
 	igt_system_suspend_autoresume(SUSPEND_STATE_MEM, SUSPEND_TEST_NONE);
 	do_assertions(ASSERT_FBC_DISABLED | ASSERT_PSR_DISABLED |
 		      DONT_ASSERT_CRC | ASSERT_DRRS_INACTIVE);
 
 	set_mode_for_params(params);
+	igt_pipe_crc_start(pipe_crc);
 	do_assertions(0);
 }
 
-- 
2.7.4



More information about the igt-dev mailing list