[PATCH i-g-t v2 26/26] lib/igt_pipe_crc: Add ungiraf crc calculation
Louis Chauvet
louis.chauvet at bootlin.com
Thu Jul 17 18:46:46 UTC 2025
Unigraf can read crc from the physical output, use this CRC instead of
internal CRC when configured. This allows to also test the hardware signal
generation.
This small addition allows to use the unigraf device for most of the
kms_* tests.
---
lib/igt_pipe_crc.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/lib/igt_pipe_crc.c b/lib/igt_pipe_crc.c
index 866bf2881cbd04df0ae0cc8fe91fe0626367144f..76244d00934ea09fd79cfd23734196f11eee1e1a 100644
--- a/lib/igt_pipe_crc.c
+++ b/lib/igt_pipe_crc.c
@@ -3,6 +3,8 @@
* Copyright © 2013 Intel Corporation
*/
+#include "igt_core.h"
+#include "unigraf/unigraf.h"
#include <inttypes.h>
#include <sys/stat.h>
#include <sys/mount.h>
@@ -348,6 +350,17 @@ static int read_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out)
return bytes_read;
}
+#if HAVE_UNIGRAF
+static int read_crc_unigraf(igt_pipe_crc_t *pipe_crc, igt_crc_t *out)
+{
+ unigraf_read_crc(out);
+
+ out->has_valid_frame = true;
+
+ return out->n_words;
+}
+#endif
+
static void read_one_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out)
{
int ret;
@@ -359,6 +372,15 @@ static void read_one_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out)
} while (ret == -EINTR);
fcntl(pipe_crc->crc_fd, F_SETFL, pipe_crc->flags);
+ printf("crc: 0x%x\n", out->crc[0]);
+
+#if HAVE_UNIGRAF
+ if (unigraf_open_device() && unigraf_use_crc()) {
+ read_crc_unigraf(pipe_crc, out);
+
+ return;
+ }
+#endif
}
/**
--
2.50.0
More information about the igt-dev
mailing list