intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Lyude <lyude@redhat.com>
To: intel-gfx@lists.freedesktop.org
Cc: Lyude <lyude@redhat.com>
Subject: [RFC i-g-t v3 4/5] igt_debugfs: Make igt_crc_to_string() work with other CRC types
Date: Wed, 30 Nov 2016 20:24:47 -0500	[thread overview]
Message-ID: <20161201012448.16334-5-lyude@redhat.com> (raw)
In-Reply-To: <20161201012448.16334-1-lyude@redhat.com>

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 <lyude@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

  parent reply	other threads:[~2016-12-01  1:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-01  1:24 [RFC i-g-t v3 0/5] Add support for the Chamelium Lyude
2016-12-01  1:24 ` [RFC i-g-t v3 1/5] igt_aux: Add igt_skip_without_suspend_support() Lyude
2016-12-01  1:24 ` [RFC i-g-t v3 2/5] igt_aux: Add igt_set_autoresume_delay() Lyude
2016-12-01  1:24 ` [RFC i-g-t v3 3/5] igt_kms: Add helpers for watching for sysfs hotplug events Lyude
2016-12-01  1:24 ` Lyude [this message]
2016-12-01  1:24 ` [RFC i-g-t v3 5/5] Add support for hotplug testing with the Chamelium Lyude
2016-12-07 11:27   ` Tomeu Vizoso
2016-12-07 19:56     ` Lyude Paul
2016-12-08  7:51       ` Tomeu Vizoso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161201012448.16334-5-lyude@redhat.com \
    --to=lyude@redhat.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).