[igt-dev] [PATCH i-g-t 1/2] HACK lib/igt_debugfs: add igt_pipe_crc_get_current_with_reference

Juha-Pekka Heikkila juhapekka.heikkila at gmail.com
Thu Feb 14 13:57:12 UTC 2019


igt_pipe_crc_get_current_with_reference will get current crc
and compare it to reference crc. 'current' is returned out
from function but if current didn't match to reference
five following crc's are checked if they'd match and printed
as info.

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
---
 lib/igt_debugfs.c | 28 ++++++++++++++++++++++++++++
 lib/igt_debugfs.h |  1 +
 2 files changed, 29 insertions(+)

diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index 6cfaa97..1245274 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -1002,6 +1002,34 @@ void igt_pipe_crc_collect_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out_crc)
 	igt_pipe_crc_stop(pipe_crc);
 }
 
+/**
+ * igt_pipe_crc_get_current_with_reference:
+ * @drm_fd: Pointer to drm fd for vblank counter
+ * @pipe_crc: pipe CRC object
+ * @crc: buffer pointer for the captured CRC value
+ *
+ * Same as igt_pipe_crc_get_current(), but if current crc doesn't
+ * match to reference see if within 5 next crc there will come match.
+ */
+void
+igt_pipe_crc_get_current_with_reference(int drm_fd, igt_pipe_crc_t *pipe_crc,
+					igt_crc_t *crc, igt_crc_t *reference)
+{
+	igt_crc_t following_crc;
+	int i;
+
+	igt_pipe_crc_get_current(drm_fd, pipe_crc, crc);
+	if (reference != NULL && !igt_check_crc_equal(crc, reference)) {
+		for (i = 0; i < 5; i++) {
+			igt_pipe_crc_get_single(pipe_crc, &following_crc);
+			if (igt_check_crc_equal(crc, reference)) {
+				igt_info("current crc didn't match to reference but %d frame after crc did match!", i+1);
+				break;
+			}
+		}
+	}
+}
+
 /*
  * Drop caches
  */
diff --git a/lib/igt_debugfs.h b/lib/igt_debugfs.h
index 1233cd8..b293f51 100644
--- a/lib/igt_debugfs.h
+++ b/lib/igt_debugfs.h
@@ -137,6 +137,7 @@ void igt_pipe_crc_get_single(igt_pipe_crc_t *pipe_crc, igt_crc_t *out_crc);
 void igt_pipe_crc_get_current(int drm_fd, igt_pipe_crc_t *pipe_crc, igt_crc_t *crc);
 
 void igt_pipe_crc_collect_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out_crc);
+void igt_pipe_crc_get_current_with_reference(int drm_fd, igt_pipe_crc_t *pipe_crc, igt_crc_t *crc, igt_crc_t *reference);
 
 void igt_hpd_storm_set_threshold(int fd, unsigned int threshold);
 void igt_hpd_storm_reset(int fd);
-- 
2.7.4



More information about the igt-dev mailing list