2 * Copyright © 2016 Intel Corporation
3 * Copyright © 2017 Broadcom
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
34 #include <util/macros.h>
35 #include <util/ralloc.h>
37 #include "v3d_decoder.h"
38 #include "v3d_packet_helpers.h"
40 #include "broadcom/clif/clif_private.h"
46 struct v3d_group *commands[256];
48 struct v3d_group *structs[256];
50 struct v3d_group *registers[256];
52 struct v3d_enum *enums[256];
60 struct parser_context {
62 const struct v3d_device_info *devinfo;
66 struct v3d_group *group;
67 struct v3d_enum *enoom;
70 struct v3d_value *values[256];
72 struct v3d_spec *spec;
79 v3d_group_get_name(struct v3d_group *group)
85 v3d_group_get_opcode(struct v3d_group *group)
91 v3d_spec_find_struct(struct v3d_spec *spec, const char *name)
93 for (int i = 0; i < spec->nstructs; i++)
94 if (strcmp(spec->structs[i]->name, name) == 0)
95 return spec->structs[i];
101 v3d_spec_find_register(struct v3d_spec *spec, uint32_t offset)
103 for (int i = 0; i < spec->nregisters; i++)
104 if (spec->registers[i]->register_offset == offset)
105 return spec->registers[i];
111 v3d_spec_find_register_by_name(struct v3d_spec *spec, const char *name)
113 for (int i = 0; i < spec->nregisters; i++) {
114 if (strcmp(spec->registers[i]->name, name) == 0)
115 return spec->registers[i];
122 v3d_spec_find_enum(struct v3d_spec *spec, const char *name)
124 for (int i = 0; i < spec->nenums; i++)
125 if (strcmp(spec->enums[i]->name, name) == 0)
126 return spec->enums[i];
131 static void __attribute__((noreturn))
132 fail(struct location *loc, const char *msg, ...)
137 fprintf(stderr, "%s:%d: error: ",
138 loc->filename, loc->line_number);
139 vfprintf(stderr, msg, ap);
140 fprintf(stderr, "\n");
146 fail_on_null(void *p)
149 fprintf(stderr, "aubinator: out of memory\n");
157 xstrdup(const char *s)
159 return fail_on_null(strdup(s));
171 return fail_on_null(zalloc(s));
174 /* We allow fields to have either a bit index, or append "b" for a byte index.
177 is_byte_offset(const char *value)
179 return value[strlen(value) - 1] == 'b';
183 get_group_offset_count(const char **atts, uint32_t *offset, uint32_t *count,
184 uint32_t *size, bool *variable)
189 for (i = 0; atts[i]; i += 2) {
190 if (strcmp(atts[i], "count") == 0) {
191 *count = strtoul(atts[i + 1], &p, 0);
194 } else if (strcmp(atts[i], "start") == 0) {
195 *offset = strtoul(atts[i + 1], &p, 0);
196 } else if (strcmp(atts[i], "size") == 0) {
197 *size = strtoul(atts[i + 1], &p, 0);
203 static struct v3d_group *
204 create_group(struct parser_context *ctx,
207 struct v3d_group *parent)
209 struct v3d_group *group;
211 group = xzalloc(sizeof(*group));
213 group->name = xstrdup(name);
215 group->spec = ctx->spec;
216 group->group_offset = 0;
217 group->group_count = 0;
218 group->variable = false;
221 group->parent = parent;
222 get_group_offset_count(atts,
223 &group->group_offset,
232 static struct v3d_enum *
233 create_enum(struct parser_context *ctx, const char *name, const char **atts)
237 e = xzalloc(sizeof(*e));
239 e->name = xstrdup(name);
247 get_register_offset(const char **atts, uint32_t *offset)
252 for (i = 0; atts[i]; i += 2) {
253 if (strcmp(atts[i], "num") == 0)
254 *offset = strtoul(atts[i + 1], &p, 0);
260 get_start_end_pos(int *start, int *end)
262 /* start value has to be mod with 32 as we need the relative
263 * start position in the first DWord. For the end position, add
264 * the length of the field to the start position to get the
265 * relative postion in the 64 bit address.
267 if (*end - *start > 32) {
268 int len = *end - *start;
269 *start = *start % 32;
272 *start = *start % 32;
279 static inline uint64_t
280 mask(int start, int end)
284 v = ~0ULL >> (63 - end + start);
289 static inline uint64_t
290 field(uint64_t value, int start, int end)
292 get_start_end_pos(&start, &end);
293 return (value & mask(start, end)) >> (start);
296 static inline uint64_t
297 field_address(uint64_t value, int start, int end)
299 /* no need to right shift for address/offset */
300 get_start_end_pos(&start, &end);
301 return (value & mask(start, end));
304 static struct v3d_type
305 string_to_type(struct parser_context *ctx, const char *s)
311 if (strcmp(s, "int") == 0)
312 return (struct v3d_type) { .kind = V3D_TYPE_INT };
313 else if (strcmp(s, "uint") == 0)
314 return (struct v3d_type) { .kind = V3D_TYPE_UINT };
315 else if (strcmp(s, "bool") == 0)
316 return (struct v3d_type) { .kind = V3D_TYPE_BOOL };
317 else if (strcmp(s, "float") == 0)
318 return (struct v3d_type) { .kind = V3D_TYPE_FLOAT };
319 else if (strcmp(s, "address") == 0)
320 return (struct v3d_type) { .kind = V3D_TYPE_ADDRESS };
321 else if (strcmp(s, "offset") == 0)
322 return (struct v3d_type) { .kind = V3D_TYPE_OFFSET };
323 else if (sscanf(s, "u%d.%d", &i, &f) == 2)
324 return (struct v3d_type) { .kind = V3D_TYPE_UFIXED, .i = i, .f = f };
325 else if (sscanf(s, "s%d.%d", &i, &f) == 2)
326 return (struct v3d_type) { .kind = V3D_TYPE_SFIXED, .i = i, .f = f };
327 else if (g = v3d_spec_find_struct(ctx->spec, s), g != NULL)
328 return (struct v3d_type) { .kind = V3D_TYPE_STRUCT, .v3d_struct = g };
329 else if (e = v3d_spec_find_enum(ctx->spec, s), e != NULL)
330 return (struct v3d_type) { .kind = V3D_TYPE_ENUM, .v3d_enum = e };
331 else if (strcmp(s, "mbo") == 0)
332 return (struct v3d_type) { .kind = V3D_TYPE_MBO };
334 fail(&ctx->loc, "invalid type: %s", s);
337 static struct v3d_field *
338 create_field(struct parser_context *ctx, const char **atts)
340 struct v3d_field *field;
345 field = xzalloc(sizeof(*field));
347 for (i = 0; atts[i]; i += 2) {
348 if (strcmp(atts[i], "name") == 0)
349 field->name = xstrdup(atts[i + 1]);
350 else if (strcmp(atts[i], "start") == 0) {
351 field->start = strtoul(atts[i + 1], &p, 0);
352 if (is_byte_offset(atts[i + 1]))
354 } else if (strcmp(atts[i], "end") == 0) {
355 field->end = strtoul(atts[i + 1], &p, 0) - 1;
356 if (is_byte_offset(atts[i + 1]))
358 } else if (strcmp(atts[i], "size") == 0) {
359 size = strtoul(atts[i + 1], &p, 0);
360 if (is_byte_offset(atts[i + 1]))
362 } else if (strcmp(atts[i], "type") == 0)
363 field->type = string_to_type(ctx, atts[i + 1]);
364 else if (strcmp(atts[i], "default") == 0) {
365 field->has_default = true;
366 field->default_value = strtoul(atts[i + 1], &p, 0);
367 } else if (strcmp(atts[i], "minus_one") == 0) {
368 assert(strcmp(atts[i + 1], "true") == 0);
369 field->minus_one = true;
374 field->end = field->start + size - 1;
379 static struct v3d_value *
380 create_value(struct parser_context *ctx, const char **atts)
382 struct v3d_value *value = xzalloc(sizeof(*value));
384 for (int i = 0; atts[i]; i += 2) {
385 if (strcmp(atts[i], "name") == 0)
386 value->name = xstrdup(atts[i + 1]);
387 else if (strcmp(atts[i], "value") == 0)
388 value->value = strtoul(atts[i + 1], NULL, 0);
395 create_and_append_field(struct parser_context *ctx,
398 if (ctx->group->nfields == ctx->group->fields_size) {
399 ctx->group->fields_size = MAX2(ctx->group->fields_size * 2, 2);
401 (struct v3d_field **) realloc(ctx->group->fields,
402 sizeof(ctx->group->fields[0]) *
403 ctx->group->fields_size);
406 ctx->group->fields[ctx->group->nfields++] = create_field(ctx, atts);
410 set_group_opcode(struct v3d_group *group, const char **atts)
415 for (i = 0; atts[i]; i += 2) {
416 if (strcmp(atts[i], "code") == 0)
417 group->opcode = strtoul(atts[i + 1], &p, 0);
423 ver_in_range(int ver, int min_ver, int max_ver)
425 return ((min_ver == 0 || ver >= min_ver) &&
426 (max_ver == 0 || ver <= max_ver));
430 skip_if_ver_mismatch(struct parser_context *ctx, int min_ver, int max_ver)
432 if (!ctx->parse_skip_depth && !ver_in_range(ctx->devinfo->ver,
434 assert(ctx->parse_depth != 0);
435 ctx->parse_skip_depth = ctx->parse_depth;
438 return ctx->parse_skip_depth;
442 start_element(void *data, const char *element_name, const char **atts)
444 struct parser_context *ctx = data;
446 const char *name = NULL;
447 const char *ver = NULL;
451 ctx->loc.line_number = XML_GetCurrentLineNumber(ctx->parser);
453 for (i = 0; atts[i]; i += 2) {
454 if (strcmp(atts[i], "name") == 0)
456 else if (strcmp(atts[i], "gen") == 0)
458 else if (strcmp(atts[i], "min_ver") == 0)
459 min_ver = strtoul(atts[i + 1], NULL, 0);
460 else if (strcmp(atts[i], "max_ver") == 0)
461 max_ver = strtoul(atts[i + 1], NULL, 0);
464 if (skip_if_ver_mismatch(ctx, min_ver, max_ver))
467 if (strcmp(element_name, "vcxml") == 0) {
469 fail(&ctx->loc, "no ver given");
471 /* Make sure that we picked an XML that matched our version.
473 assert(ver_in_range(ctx->devinfo->ver, min_ver, max_ver));
476 int n = sscanf(ver, "%d.%d", &major, &minor);
478 fail(&ctx->loc, "invalid ver given: %s", ver);
482 ctx->spec->ver = major * 10 + minor;
483 } else if (strcmp(element_name, "packet") == 0 ||
484 strcmp(element_name, "struct") == 0) {
485 ctx->group = create_group(ctx, name, atts, NULL);
487 if (strcmp(element_name, "packet") == 0)
488 set_group_opcode(ctx->group, atts);
489 } else if (strcmp(element_name, "register") == 0) {
490 ctx->group = create_group(ctx, name, atts, NULL);
491 get_register_offset(atts, &ctx->group->register_offset);
492 } else if (strcmp(element_name, "group") == 0) {
493 struct v3d_group *previous_group = ctx->group;
494 while (previous_group->next)
495 previous_group = previous_group->next;
497 struct v3d_group *group = create_group(ctx, "", atts,
499 previous_group->next = group;
501 } else if (strcmp(element_name, "field") == 0) {
502 create_and_append_field(ctx, atts);
503 } else if (strcmp(element_name, "enum") == 0) {
504 ctx->enoom = create_enum(ctx, name, atts);
505 } else if (strcmp(element_name, "value") == 0) {
506 ctx->values[ctx->nvalues++] = create_value(ctx, atts);
507 assert(ctx->nvalues < ARRAY_SIZE(ctx->values));
515 field_offset_compare(const void *a, const void *b)
517 return ((*(const struct v3d_field **)a)->start -
518 (*(const struct v3d_field **)b)->start);
522 end_element(void *data, const char *name)
524 struct parser_context *ctx = data;
525 struct v3d_spec *spec = ctx->spec;
529 if (ctx->parse_skip_depth) {
530 if (ctx->parse_skip_depth == ctx->parse_depth)
531 ctx->parse_skip_depth = 0;
535 if (strcmp(name, "packet") == 0 ||
536 strcmp(name, "struct") == 0 ||
537 strcmp(name, "register") == 0) {
538 struct v3d_group *group = ctx->group;
540 ctx->group = ctx->group->parent;
542 if (strcmp(name, "packet") == 0) {
543 spec->commands[spec->ncommands++] = group;
545 /* V3D packet XML has the packet contents with offsets
546 * starting from the first bit after the opcode, to
547 * match the spec. Shift the fields up now.
549 for (int i = 0; i < group->nfields; i++) {
550 group->fields[i]->start += 8;
551 group->fields[i]->end += 8;
554 else if (strcmp(name, "struct") == 0)
555 spec->structs[spec->nstructs++] = group;
556 else if (strcmp(name, "register") == 0)
557 spec->registers[spec->nregisters++] = group;
559 /* Sort the fields in increasing offset order. The XML might
560 * be specified in any order, but we'll want to iterate from
563 qsort(group->fields, group->nfields, sizeof(*group->fields),
564 field_offset_compare);
566 assert(spec->ncommands < ARRAY_SIZE(spec->commands));
567 assert(spec->nstructs < ARRAY_SIZE(spec->structs));
568 assert(spec->nregisters < ARRAY_SIZE(spec->registers));
569 } else if (strcmp(name, "group") == 0) {
570 ctx->group = ctx->group->parent;
571 } else if (strcmp(name, "field") == 0) {
572 assert(ctx->group->nfields > 0);
573 struct v3d_field *field = ctx->group->fields[ctx->group->nfields - 1];
574 size_t size = ctx->nvalues * sizeof(ctx->values[0]);
575 field->inline_enum.values = xzalloc(size);
576 field->inline_enum.nvalues = ctx->nvalues;
577 memcpy(field->inline_enum.values, ctx->values, size);
579 } else if (strcmp(name, "enum") == 0) {
580 struct v3d_enum *e = ctx->enoom;
581 size_t size = ctx->nvalues * sizeof(ctx->values[0]);
582 e->values = xzalloc(size);
583 e->nvalues = ctx->nvalues;
584 memcpy(e->values, ctx->values, size);
587 spec->enums[spec->nenums++] = e;
592 character_data(void *data, const XML_Char *s, int len)
596 static uint32_t zlib_inflate(const void *compressed_data,
597 uint32_t compressed_len,
600 struct z_stream_s zstream;
603 memset(&zstream, 0, sizeof(zstream));
605 zstream.next_in = (unsigned char *)compressed_data;
606 zstream.avail_in = compressed_len;
608 if (inflateInit(&zstream) != Z_OK)
612 zstream.next_out = out;
613 zstream.avail_out = 4096;
616 switch (inflate(&zstream, Z_SYNC_FLUSH)) {
622 inflateEnd(&zstream);
626 if (zstream.avail_out)
629 out = realloc(out, 2*zstream.total_out);
631 inflateEnd(&zstream);
635 zstream.next_out = (unsigned char *)out + zstream.total_out;
636 zstream.avail_out = zstream.total_out;
639 inflateEnd(&zstream);
641 return zstream.total_out;
645 v3d_spec_load(const struct v3d_device_info *devinfo)
647 struct parser_context ctx;
649 uint8_t *text_data = NULL;
650 uint32_t text_offset = 0, text_length = 0, total_length;
652 for (int i = 0; i < ARRAY_SIZE(genxml_files_table); i++) {
654 assert(genxml_files_table[i - 1].gen_10 <
655 genxml_files_table[i].gen_10);
658 if (genxml_files_table[i].gen_10 <= devinfo->ver) {
659 text_offset = genxml_files_table[i].offset;
660 text_length = genxml_files_table[i].length;
664 if (text_length == 0) {
665 fprintf(stderr, "unable to find gen (%u) data\n", devinfo->ver);
669 memset(&ctx, 0, sizeof ctx);
670 ctx.parser = XML_ParserCreate(NULL);
671 ctx.devinfo = devinfo;
672 XML_SetUserData(ctx.parser, &ctx);
673 if (ctx.parser == NULL) {
674 fprintf(stderr, "failed to create parser\n");
678 XML_SetElementHandler(ctx.parser, start_element, end_element);
679 XML_SetCharacterDataHandler(ctx.parser, character_data);
681 ctx.spec = xzalloc(sizeof(*ctx.spec));
683 total_length = zlib_inflate(compress_genxmls,
684 sizeof(compress_genxmls),
685 (void **) &text_data);
686 assert(text_offset + text_length <= total_length);
688 buf = XML_GetBuffer(ctx.parser, text_length);
689 memcpy(buf, &text_data[text_offset], text_length);
691 if (XML_ParseBuffer(ctx.parser, text_length, true) == 0) {
693 "Error parsing XML at line %ld col %ld byte %ld/%u: %s\n",
694 XML_GetCurrentLineNumber(ctx.parser),
695 XML_GetCurrentColumnNumber(ctx.parser),
696 XML_GetCurrentByteIndex(ctx.parser), text_length,
697 XML_ErrorString(XML_GetErrorCode(ctx.parser)));
698 XML_ParserFree(ctx.parser);
703 XML_ParserFree(ctx.parser);
710 v3d_spec_find_instruction(struct v3d_spec *spec, const uint8_t *p)
714 for (int i = 0; i < spec->ncommands; i++) {
715 struct v3d_group *group = spec->commands[i];
717 if (opcode != group->opcode)
720 /* If there's a "sub-id" field, make sure that it matches the
721 * instruction being decoded.
723 struct v3d_field *subid = NULL;
724 for (int j = 0; j < group->nfields; j++) {
725 struct v3d_field *field = group->fields[j];
726 if (strcmp(field->name, "sub-id") == 0) {
732 if (subid && (__gen_unpack_uint(p, subid->start, subid->end) !=
733 subid->default_value)) {
743 /** Returns the size of a V3D packet. */
745 v3d_group_get_length(struct v3d_group *group)
748 for (int i = 0; i < group->nfields; i++) {
749 struct v3d_field *field = group->fields[i];
751 last_bit = MAX2(last_bit, field->end);
753 return last_bit / 8 + 1;
757 v3d_field_iterator_init(struct v3d_field_iterator *iter,
758 struct v3d_group *group,
761 memset(iter, 0, sizeof(*iter));
768 v3d_get_enum_name(struct v3d_enum *e, uint64_t value)
770 for (int i = 0; i < e->nvalues; i++) {
771 if (e->values[i]->value == value) {
772 return e->values[i]->name;
779 iter_more_fields(const struct v3d_field_iterator *iter)
781 return iter->field_iter < iter->group->nfields;
785 iter_group_offset_bits(const struct v3d_field_iterator *iter,
788 return iter->group->group_offset + (group_iter *
789 iter->group->group_size);
793 iter_more_groups(const struct v3d_field_iterator *iter)
795 if (iter->group->variable) {
796 return iter_group_offset_bits(iter, iter->group_iter + 1) <
797 (v3d_group_get_length(iter->group) * 8);
799 return (iter->group_iter + 1) < iter->group->group_count ||
800 iter->group->next != NULL;
805 iter_advance_group(struct v3d_field_iterator *iter)
807 if (iter->group->variable)
810 if ((iter->group_iter + 1) < iter->group->group_count) {
813 iter->group = iter->group->next;
814 iter->group_iter = 0;
818 iter->field_iter = 0;
822 iter_advance_field(struct v3d_field_iterator *iter)
824 while (!iter_more_fields(iter)) {
825 if (!iter_more_groups(iter))
828 iter_advance_group(iter);
831 iter->field = iter->group->fields[iter->field_iter++];
832 if (iter->field->name)
833 strncpy(iter->name, iter->field->name, sizeof(iter->name));
835 memset(iter->name, 0, sizeof(iter->name));
836 iter->offset = iter_group_offset_bits(iter, iter->group_iter) / 8 +
837 iter->field->start / 8;
838 iter->struct_desc = NULL;
844 v3d_field_iterator_next(struct clif_dump *clif, struct v3d_field_iterator *iter)
846 if (!iter_advance_field(iter))
849 const char *enum_name = NULL;
851 int group_member_offset =
852 iter_group_offset_bits(iter, iter->group_iter);
853 int s = group_member_offset + iter->field->start;
854 int e = group_member_offset + iter->field->end;
856 assert(!iter->field->minus_one ||
857 iter->field->type.kind == V3D_TYPE_INT ||
858 iter->field->type.kind == V3D_TYPE_UINT);
860 switch (iter->field->type.kind) {
861 case V3D_TYPE_UNKNOWN:
863 uint32_t value = __gen_unpack_sint(iter->p, s, e);
864 if (iter->field->minus_one)
866 snprintf(iter->value, sizeof(iter->value), "%d", value);
867 enum_name = v3d_get_enum_name(&iter->field->inline_enum, value);
870 case V3D_TYPE_UINT: {
871 uint32_t value = __gen_unpack_uint(iter->p, s, e);
872 if (iter->field->minus_one)
874 if (strcmp(iter->field->name, "Vec size") == 0 && value == 0)
875 value = 1 << (e - s);
876 snprintf(iter->value, sizeof(iter->value), "%u", value);
877 enum_name = v3d_get_enum_name(&iter->field->inline_enum, value);
881 snprintf(iter->value, sizeof(iter->value), "%s",
882 __gen_unpack_uint(iter->p, s, e) ?
883 "1 /* true */" : "0 /* false */");
886 snprintf(iter->value, sizeof(iter->value), "%f",
887 __gen_unpack_float(iter->p, s, e));
890 case V3D_TYPE_ADDRESS: {
892 __gen_unpack_uint(iter->p, s, e) << (31 - (e - s));
893 struct clif_bo *bo = clif_lookup_bo(clif, addr);
895 snprintf(iter->value, sizeof(iter->value),
896 "[%s+0x%08x] /* 0x%08x */",
897 bo->name, addr - bo->offset, addr);
899 snprintf(iter->value, sizeof(iter->value),
900 "/* XXX: BO unknown */ 0x%08x", addr);
902 snprintf(iter->value, sizeof(iter->value),
909 case V3D_TYPE_OFFSET:
910 snprintf(iter->value, sizeof(iter->value), "0x%08"PRIx64,
911 __gen_unpack_uint(iter->p, s, e) << (31 - (e - s)));
913 case V3D_TYPE_STRUCT:
914 snprintf(iter->value, sizeof(iter->value), "<struct %s>",
915 iter->field->type.v3d_struct->name);
917 v3d_spec_find_struct(iter->group->spec,
918 iter->field->type.v3d_struct->name);
920 case V3D_TYPE_SFIXED:
921 snprintf(iter->value, sizeof(iter->value), "%f",
922 __gen_unpack_sfixed(iter->p, s, e,
923 iter->field->type.f));
925 case V3D_TYPE_UFIXED:
926 snprintf(iter->value, sizeof(iter->value), "%f",
927 __gen_unpack_ufixed(iter->p, s, e,
928 iter->field->type.f));
932 case V3D_TYPE_ENUM: {
933 uint32_t value = __gen_unpack_uint(iter->p, s, e);
934 snprintf(iter->value, sizeof(iter->value), "%d", value);
935 enum_name = v3d_get_enum_name(iter->field->type.v3d_enum, value);
940 if (strlen(iter->group->name) == 0) {
941 int length = strlen(iter->name);
942 snprintf(iter->name + length, sizeof(iter->name) - length,
943 "[%i]", iter->group_iter);
947 int length = strlen(iter->value);
948 snprintf(iter->value + length, sizeof(iter->value) - length,
949 " /* %s */", enum_name);
956 v3d_print_group(struct clif_dump *clif, struct v3d_group *group,
957 uint64_t offset, const uint8_t *p)
959 struct v3d_field_iterator iter;
961 v3d_field_iterator_init(&iter, group, p);
962 while (v3d_field_iterator_next(clif, &iter)) {
963 fprintf(clif->out, " %s: %s\n", iter.name, iter.value);
964 if (iter.struct_desc) {
965 uint64_t struct_offset = offset + iter.offset;
966 v3d_print_group(clif, iter.struct_desc,