Intel GPUs have CRC values with 5 n_words, but the Chamelium's definitely
doesn't. So make igt_crc_to_string() a little smarter so it can handle this.

Signed-off-by: Lyude <ly...@redhat.com>
---
 lib/igt_debugfs.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index 9142e3f..4809b73 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -290,11 +290,18 @@ void igt_assert_crc_equal(igt_crc_t *a, igt_crc_t *b)
 char *igt_crc_to_string(igt_crc_t *crc)
 {
        char buf[128];
+       char *p;
+       int i, len;
+
+       for (i = 0, p = buf;
+            i < crc->n_words;
+            i++, p += len) {
+               snprintf(p, sizeof(buf) - (p - buf), "%08x %n",
+                        crc->crc[i], &len);
+       }
 
-       igt_assert_eq(crc->n_words, 5);
-
-       sprintf(buf, "%08x %08x %08x %08x %08x", crc->crc[0],
-               crc->crc[1], crc->crc[2], crc->crc[3], crc->crc[4]);
+       /* Strip the trailing space */
+       *strrchr(buf, ' ') = '\0';
 
        return strdup(buf);
 }
-- 
2.9.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to