From 6954103192bba9241a4b115a85cb43de779d375f Mon Sep 17 00:00:00 2001 From: Damien Lespiau Date: Thu, 6 Feb 2014 16:17:38 +0000 Subject: [PATCH] lib/crc: Add a helper to read a single CRC value In this case, we also take care of starting/stopping the CRC collection. Signed-off-by: Damien Lespiau --- lib/igt_debugfs.c | 14 ++++++++++++++ lib/igt_debugfs.h | 1 + 2 files changed, 15 insertions(+) diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c index a0d84bf..4a4a4dd 100644 --- a/lib/igt_debugfs.c +++ b/lib/igt_debugfs.c @@ -342,6 +342,20 @@ igt_pipe_crc_get_crcs(igt_pipe_crc_t *pipe_crc, int n_crcs, } /* + * Read 1 CRC from @pipe_crc. This function blocks until the CRC is retrieved. + * @out_crc must be allocated by the caller. + * + * This function takes care of the pipe_crc book-keeping, it will start/stop + * the collection of the CRC. + */ +void igt_pipe_crc_collect_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out_crc) +{ + igt_pipe_crc_start(pipe_crc); + read_one_crc(pipe_crc, out_crc); + igt_pipe_crc_stop(pipe_crc); +} + +/* * Drop caches */ diff --git a/lib/igt_debugfs.h b/lib/igt_debugfs.h index 075e446..6b7e623 100644 --- a/lib/igt_debugfs.h +++ b/lib/igt_debugfs.h @@ -79,6 +79,7 @@ void igt_pipe_crc_start(igt_pipe_crc_t *pipe_crc); void igt_pipe_crc_stop(igt_pipe_crc_t *pipe_crc); void igt_pipe_crc_get_crcs(igt_pipe_crc_t *pipe_crc, int n_crcs, igt_crc_t **out_crcs); +void igt_pipe_crc_collect_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out_crc); /* * Drop caches -- 2.7.4