intel: improve blob decoding
The last few dwords were skipped if the total number of dwords was not a
multiple of 4. Change the formatting for better readability.
diff --git a/icd/intel/cmd_decode.c b/icd/intel/cmd_decode.c
index bc8904c..08ce48f 100644
--- a/icd/intel/cmd_decode.c
+++ b/icd/intel/cmd_decode.c
@@ -80,22 +80,44 @@
enum intel_cmd_writer_type which,
const struct intel_cmd_item *item)
{
- const unsigned state_size = sizeof(uint32_t) * 4;
+ const unsigned state_size = sizeof(uint32_t);
const unsigned count = item->size / state_size;
unsigned offset = item->offset;
unsigned i;
- for (i = 0; i < count; i++) {
+ for (i = 0; i < count; i += 4) {
const uint32_t *dw = writer_pointer(cmd, which, offset);
- writer_dw(cmd, which, offset, 0, "BLOB%d", i);
- /* output a single line for all four DWords */
- fprintf(stderr, "(% f, % f, % f, % f) "
- "(0x%08x, 0x%08x, 0x%08x, 0x%08x)\n",
- u_uif(dw[0]), u_uif(dw[1]), u_uif(dw[2]), u_uif(dw[3]),
- dw[0], dw[1], dw[2], dw[3]);
+ writer_dw(cmd, which, offset, 0, "BLOB%d", i / 4);
- offset += state_size;
+ switch (count - i) {
+ case 1:
+ fprintf(stderr, "(%10.4f, %10c, %10c, %10c) "
+ "(0x%08x, %10c, %10c, %10c)\n",
+ u_uif(dw[0]), 'X', 'X', 'X',
+ dw[0], 'X', 'X', 'X');
+ break;
+ case 2:
+ fprintf(stderr, "(%10.4f, %10.4f, %10c, %10c) "
+ "(0x%08x, 0x%08x, %10c, %10c)\n",
+ u_uif(dw[0]), u_uif(dw[1]), 'X', 'X',
+ dw[0], dw[1], 'X', 'X');
+ break;
+ case 3:
+ fprintf(stderr, "(%10.4f, %10.4f, %10.4f, %10c) "
+ "(0x%08x, 0x%08x, 0x%08x, %10c)\n",
+ u_uif(dw[0]), u_uif(dw[1]), u_uif(dw[2]), 'X',
+ dw[0], dw[1], dw[2], 'X');
+ break;
+ default:
+ fprintf(stderr, "(%10.4f, %10.4f, %10.4f, %10.4f) "
+ "(0x%08x, 0x%08x, 0x%08x, 0x%08x)\n",
+ u_uif(dw[0]), u_uif(dw[1]), u_uif(dw[2]), u_uif(dw[3]),
+ dw[0], dw[1], dw[2], dw[3]);
+ break;
+ }
+
+ offset += state_size * 4;
}
}