[PATCH i-g-t v2 25/26] lib/unigraf: Add configuration for CRC usage
Louis Chauvet
louis.chauvet at bootlin.com
Thu Jul 17 18:46:45 UTC 2025
As Unigraf devices are able to compute a CRC for the input image, add a
configuration file option to use them.
---
lib/unigraf/unigraf.c | 14 ++++++++++++++
lib/unigraf/unigraf.h | 8 ++++++++
2 files changed, 22 insertions(+)
diff --git a/lib/unigraf/unigraf.c b/lib/unigraf/unigraf.c
index 9ccd53e55ab5d261d236348fa8a3c7721e87698f..caff77293b6820c8dd179c8abd3def894c3bb879 100644
--- a/lib/unigraf/unigraf.c
+++ b/lib/unigraf/unigraf.c
@@ -22,6 +22,7 @@ static int unigraf_open_count;
static TSI_HANDLE unigraf_device;
static char *unigraf_default_edid;
static char *unigraf_connector_name;
+static bool unigraf_crc;
/**
* UNIGRAF_NAME_MAX - Maximum name length to be used for TSI functions
@@ -58,6 +59,11 @@ static char *unigraf_connector_name;
*/
#define UNIGRAF_CONFIG_EDID_NAME "EDID"
+/**
+ * UNIGRAF_CONFIG_USE_CRC_NAME - Key of the CRC selection in the configuration file
+ */
+#define UNIGRAF_CONFIG_USE_CRC_NAME "UseCRC"
+
/**
* UNIGRAF_DEFAULT_ROLE_NAME - Default role name to search on the unigraf device
*/
@@ -276,6 +282,7 @@ bool unigraf_open_device(void)
cfg_role = NULL;
cfg_input = NULL;
unigraf_connector_name = NULL;
+ unigraf_crc = true;
} else {
cfg_device = g_key_file_get_string(igt_key_file, cfg_group, UNIGRAF_CONFIG_DEVICE_NAME, &cfg_error);
if (cfg_error) {
@@ -310,6 +317,13 @@ bool unigraf_open_device(void)
unigraf_debug("No default EDID set, use IGT default.\n");
unigraf_connector_name = NULL;
}
+
+ cfg_error = NULL;
+ unigraf_crc = g_key_file_get_boolean(igt_key_file, cfg_group, UNIGRAF_CONFIG_USE_CRC_NAME, &cfg_error);
+ if (cfg_error) {
+ unigraf_debug("CRC usage not configured, using unigraf CRC.\n");
+ unigraf_crc = true;
+ }
}
unigraf_assert(TSIX_DEV_RescanDevices(0, TSI_DEVCAP_VIDEO_CAPTURE, 0));
diff --git a/lib/unigraf/unigraf.h b/lib/unigraf/unigraf.h
index 11e483312699fd9f304586bffcc5616c10fb637d..2ff3dc5f3b8b06d2df7d1fd9b58e2b3a9b8b6729 100644
--- a/lib/unigraf/unigraf.h
+++ b/lib/unigraf/unigraf.h
@@ -157,4 +157,12 @@ int unigraf_get_mst_stream_max_count(void);
*/
void unigraf_read_crc(igt_crc_t *out);
+/**
+ * unigraf_use_crc() - Check if Unigraf device should be used for CRC computation
+ *
+ * Returns: true if the Unigraf device should be used for CRC computation,
+ * false otherwise.
+ */
+bool unigraf_use_crc(void);
+
#endif // UNIGRAF_H
--
2.50.0
More information about the igt-dev
mailing list