[igt-dev] [PATCH i-g-t 3/4] lib/igt_debugfs: add function to set pipe crc source name.

Dingchen Zhang dingchen.zhang at amd.com
Mon Jun 24 14:31:43 UTC 2019


need to get CRC from different pipe crc source.

frees the existed pipe crc source and replace it with the new.

Cc: Harry Wentland <Harry.Wentland at amd.com>
Cc: Nick Kazlauskas <Nicholas.Kazlauskas at amd.com>
Change-Id: I41edae38f6c11525722295e975e77e497344ea71
Signed-off-by: Dingchen Zhang <dingchen.zhang at amd.com>
---
 lib/igt_debugfs.c | 15 +++++++++++++++
 lib/igt_debugfs.h |  1 +
 2 files changed, 16 insertions(+)

diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index 82ce1834..6dd7c537 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -994,6 +994,21 @@ 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_set_source:
+ * @pipe_crc: pipe CRC object
+ * @src: pipe CRC source name
+ *
+ * The functions frees the current existed pipe CRC source name and replace
+ * it with the new given name 'source'
+ */
+void igt_pipe_crc_set_source(igt_pipe_crc_t *pipe_crc, const char *src)
+{
+	free(pipe_crc->source);
+	pipe_crc->source = strdup(src);
+	igt_assert(pipe_crc->source);
+}
+
 /**
  * igt_reset_fifo_underrun_reporting:
  * @drm_fd: drm device file descriptor
diff --git a/lib/igt_debugfs.h b/lib/igt_debugfs.h
index b49dd2b6..640ec248 100644
--- a/lib/igt_debugfs.h
+++ b/lib/igt_debugfs.h
@@ -108,6 +108,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_set_source(igt_pipe_crc_t *pipe_crc, const char *src);
 
 void igt_hpd_storm_set_threshold(int fd, unsigned int threshold);
 void igt_hpd_storm_reset(int fd);
-- 
2.17.1



More information about the igt-dev mailing list