[PATCH i-g-t v2 24/26] lib/unigraf: Add unigraf CRC grab

Louis Chauvet louis.chauvet at bootlin.com
Thu Jul 17 18:46:44 UTC 2025


As unigraf devices are able to grab a CRC for the current video stream,
add an helper to read the CRC.
---
 lib/unigraf/unigraf.c | 15 +++++++++++++++
 lib/unigraf/unigraf.h | 10 ++++++++++
 2 files changed, 25 insertions(+)

diff --git a/lib/unigraf/unigraf.c b/lib/unigraf/unigraf.c
index add5d5b2b1379bb34ff73505ee917e51398f4b66..9ccd53e55ab5d261d236348fa8a3c7721e87698f 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"
 
@@ -499,3 +500,17 @@ void unigraf_select_stream(int stream)
 	igt_assert(unigraf_device);
 	unigraf_write(TSI_DPRX_STREAM_SELECT, &stream, sizeof(stream));
 }
+
+bool unigraf_use_crc(void)
+{
+	return unigraf_crc;
+}
+
+void unigraf_read_crc(igt_crc_t *out)
+{
+	igt_assert(unigraf_device);
+	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;
+}
diff --git a/lib/unigraf/unigraf.h b/lib/unigraf/unigraf.h
index e014ead67b57e860907bd0cd3521fb5842240594..11e483312699fd9f304586bffcc5616c10fb637d 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>
@@ -147,4 +148,13 @@ bool unigraf_set_mst_stream_count(int count);
  */
 int unigraf_get_mst_stream_max_count(void);
 
+/**
+ * unigraf_read_crc() - Read the CRC values from the Unigraf device
+ * @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(igt_crc_t *out);
+
 #endif // UNIGRAF_H

-- 
2.50.0



More information about the igt-dev mailing list