[PATCH i-g-t v3 25/29] lib/unigraf: Add unigraf CRC capture

Louis Chauvet louis.chauvet at bootlin.com
Sat Aug 23 02:11:45 UTC 2025


As unigraf devices are able to grab a CRC for the current video stream,
add an helper to read the CRC.

Signed-off-by: Louis Chauvet <louis.chauvet at bootlin.com>
---
 lib/unigraf/unigraf.c | 15 +++++++++++++++
 lib/unigraf/unigraf.h | 11 +++++++++++
 2 files changed, 26 insertions(+)

diff --git a/lib/unigraf/unigraf.c b/lib/unigraf/unigraf.c
index 5aa5d94660255d9740db7b74c3e1eea0575fa5f2..e63182ccc61ca23c9333d1c36950a5d73f94b3ea 100644
--- a/lib/unigraf/unigraf.c
+++ b/lib/unigraf/unigraf.c
@@ -12,6 +12,7 @@
 #include "TSI.h"
 #include "igt_edid.h"
 #include "igt_kms.h"
+#include "igt_pipe_crc.h"
 #include "igt_rc.h"
 #include "monitor_edids/monitor_edids_helper.h"
 
@@ -556,3 +557,17 @@ void unigraf_select_stream(int stream)
 	igt_assert(unigraf_device);
 	unigraf_write(TSI_DPRX_STREAM_SELECT, &stream, sizeof(stream));
 }
+
+void unigraf_read_crc(int stream, igt_crc_t *out)
+{
+	igt_assert(unigraf_device);
+	unigraf_select_stream(stream);
+	unigraf_assert(TSIX_TS_GetConfigItem(unigraf_device, TSI_DPRX_CRC_R_R,
+					     &out->crc[0], sizeof(out->crc[0])));
+	unigraf_assert(TSIX_TS_GetConfigItem(unigraf_device, TSI_DPRX_CRC_G_R,
+					     &out->crc[1], sizeof(out->crc[1])));
+	unigraf_assert(TSIX_TS_GetConfigItem(unigraf_device, TSI_DPRX_CRC_B_R,
+					     &out->crc[2], sizeof(out->crc[2])));
+	out->n_words = 3;
+	out->has_valid_frame = false;
+}
diff --git a/lib/unigraf/unigraf.h b/lib/unigraf/unigraf.h
index 553a732d746e5465472a81405f885add6a3a7c47..cf37054baf4dd9d8115cd6b2abce70400254c301 100644
--- a/lib/unigraf/unigraf.h
+++ b/lib/unigraf/unigraf.h
@@ -3,6 +3,7 @@
 #ifndef UNIGRAF_H
 #define UNIGRAF_H
 
+#include "igt_fb.h"
 #include <stdbool.h>
 #include <stdint.h>
 #include <xf86drmMode.h>
@@ -153,4 +154,14 @@ bool unigraf_set_mst_stream_count(int count);
 int unigraf_get_mst_stream_max_count(void);
 void unigraf_select_stream(int stream);
 
+/**
+ * unigraf_read_crc() - Read the CRC values from the Unigraf device
+ * @stream: Stream to grab the CRC from
+ * @out: Pointer to an igt_crc_t structure where the CRC values will be stored
+ *
+ * This function reads the CRC values from the Unigraf device and stores them in the
+ * provided igt_crc_t structure.
+ */
+void unigraf_read_crc(int stream, igt_crc_t *out);
+
 #endif // UNIGRAF_H

-- 
2.50.1



More information about the igt-dev mailing list