}
bool
-v3d_field_iterator_next(struct v3d_field_iterator *iter)
+v3d_field_iterator_next(struct clif_dump *clif, struct v3d_field_iterator *iter)
{
if (!iter_advance_field(iter))
return false;
snprintf(iter->value, sizeof(iter->value), "%f",
__gen_unpack_float(iter->p, s, e));
break;
- case V3D_TYPE_ADDRESS:
+
+ case V3D_TYPE_ADDRESS: {
+ uint32_t addr =
+ __gen_unpack_uint(iter->p, s, e) << (31 - (e - s));
+ struct clif_bo *bo = clif_lookup_bo(clif, addr);
+ if (bo) {
+ snprintf(iter->value, sizeof(iter->value),
+ "[%s+0x%08x] /* 0x%08x */",
+ bo->name, addr - bo->offset, addr);
+ } else if (addr) {
+ snprintf(iter->value, sizeof(iter->value),
+ "/* XXX: BO unknown */ 0x%08x", addr);
+ } else {
+ snprintf(iter->value, sizeof(iter->value),
+ "[null]");
+ }
+
+ break;
+ }
+
case V3D_TYPE_OFFSET:
snprintf(iter->value, sizeof(iter->value), "0x%08"PRIx64,
__gen_unpack_uint(iter->p, s, e) << (31 - (e - s)));
struct v3d_field_iterator iter;
v3d_field_iterator_init(&iter, group, p);
- while (v3d_field_iterator_next(&iter)) {
+ while (v3d_field_iterator_next(clif, &iter)) {
fprintf(clif->out, " %s: %s\n", iter.name, iter.value);
if (iter.struct_desc) {
uint64_t struct_offset = offset + iter.offset;
ralloc_free(clif);
}
-static bool
-clif_lookup_vaddr(struct clif_dump *clif, uint32_t addr, void **vaddr)
+struct clif_bo *
+clif_lookup_bo(struct clif_dump *clif, uint32_t addr)
{
for (int i = 0; i < clif->bo_count; i++) {
struct clif_bo *bo = &clif->bo[i];
if (addr >= bo->offset &&
addr < bo->offset + bo->size) {
- *vaddr = bo->vaddr + addr - bo->offset;
- return true;
+ return bo;
}
}
- return false;
+ return NULL;
+}
+
+static bool
+clif_lookup_vaddr(struct clif_dump *clif, uint32_t addr, void **vaddr)
+{
+ struct clif_bo *bo = clif_lookup_bo(clif, addr);
+ if (!bo)
+ return false;
+
+ *vaddr = bo->vaddr + addr - bo->offset;
+ return true;
}
#define out_uint(_clif, field) out(_clif, " /* %s = */ %u\n", \