static bool
clif_dump_packet(struct clif_dump *clif, uint32_t offset, const uint8_t *cl,
- uint32_t *size)
+ uint32_t *size, bool reloc_mode)
{
if (clif->devinfo->ver >= 41)
- return v3d41_clif_dump_packet(clif, offset, cl, size);
+ return v3d41_clif_dump_packet(clif, offset, cl, size, reloc_mode);
else
- return v3d33_clif_dump_packet(clif, offset, cl, size);
+ return v3d33_clif_dump_packet(clif, offset, cl, size, reloc_mode);
}
static void
-clif_dump_cl(struct clif_dump *clif, uint32_t start, uint32_t end)
+clif_dump_cl(struct clif_dump *clif, uint32_t start, uint32_t end,
+ bool reloc_mode)
{
void *start_vaddr;
if (!clif_lookup_vaddr(clif, start, &start_vaddr)) {
return;
}
- out(clif, "@format ctrllist\n");
+ if (!reloc_mode)
+ out(clif, "@format ctrllist\n");
uint32_t size;
uint8_t *cl = start_vaddr;
- while (clif_dump_packet(clif, start, cl, &size)) {
+ while (clif_dump_packet(clif, start, cl, &size, reloc_mode)) {
cl += size;
start += size;
}
static void
-clif_process_worklist(struct clif_dump *clif)
+clif_process_worklist(struct clif_dump *clif, bool reloc_mode)
{
- while (!list_empty(&clif->worklist)) {
- struct reloc_worklist_entry *reloc =
- list_first_entry(&clif->worklist,
- struct reloc_worklist_entry, link);
- list_del(&reloc->link);
-
+ list_for_each_entry_safe(struct reloc_worklist_entry, reloc,
+ &clif->worklist, link) {
void *vaddr;
if (!clif_lookup_vaddr(clif, reloc->addr, &vaddr)) {
out(clif, "Failed to look up address 0x%08x\n",
switch (reloc->type) {
case reloc_cl:
- clif_dump_cl(clif, reloc->addr, reloc->cl.end);
- out(clif, "\n");
+ clif_dump_cl(clif, reloc->addr, reloc->cl.end,
+ reloc_mode);
+ if (!reloc_mode)
+ out(clif, "\n");
break;
case reloc_gl_shader_state:
+ if (reloc_mode)
+ continue;
clif_dump_gl_shader_state_record(clif,
reloc,
vaddr);
break;
case reloc_generic_tile_list:
clif_dump_cl(clif, reloc->addr,
- reloc->generic_tile_list.end);
+ reloc->generic_tile_list.end, reloc_mode);
break;
}
- out(clif, "\n");
+ if (!reloc_mode)
+ out(clif, "\n");
}
}
clif_dump_add_cl(clif, submit->bcl_start, submit->bcl_end);
clif_dump_add_cl(clif, submit->rcl_start, submit->rcl_end);
- clif_process_worklist(clif);
+ clif_process_worklist(clif, true);
+ clif_process_worklist(clif, false);
out(clif, "@add_bin 0\n ");
out_address(clif, submit->bcl_start);
uint32_t addr);
bool v3d33_clif_dump_packet(struct clif_dump *clif, uint32_t offset,
- const uint8_t *cl, uint32_t *size);
+ const uint8_t *cl, uint32_t *size, bool reloc_mode);
bool v3d41_clif_dump_packet(struct clif_dump *clif, uint32_t offset,
- const uint8_t *cl, uint32_t *size);
+ const uint8_t *cl, uint32_t *size, bool reloc_mode);
bool v3d42_clif_dump_packet(struct clif_dump *clif, uint32_t offset,
- const uint8_t *cl, uint32_t *size);
+ const uint8_t *cl, uint32_t *size, bool reloc_mode);
static inline void
out(struct clif_dump *clif, const char *fmt, ...)
bool
v3dX(clif_dump_packet)(struct clif_dump *clif, uint32_t offset,
- const uint8_t *cl, uint32_t *size)
+ const uint8_t *cl, uint32_t *size, bool reloc_mode)
{
struct v3d_group *inst = v3d_spec_find_instruction(clif->spec, cl);
if (!inst) {
*size = v3d_group_get_length(inst);
- char *name = clif_name(v3d_group_get_name(inst));
- out(clif, "%s\n", name);
- free(name);
- v3d_print_group(clif, inst, 0, cl);
+ if (!reloc_mode) {
+ char *name = clif_name(v3d_group_get_name(inst));
+ out(clif, "%s\n", name);
+ free(name);
+ v3d_print_group(clif, inst, 0, cl);
+ }
switch (*cl) {
case V3DX(GL_SHADER_STATE_opcode): {
struct V3DX(GL_SHADER_STATE) values;
V3DX(GL_SHADER_STATE_unpack)(cl, &values);
- struct reloc_worklist_entry *reloc =
- clif_dump_add_address_to_worklist(clif,
- reloc_gl_shader_state,
- values.address);
- if (reloc) {
- reloc->shader_state.num_attrs =
- values.number_of_attribute_arrays;
+ if (reloc_mode) {
+ struct reloc_worklist_entry *reloc =
+ clif_dump_add_address_to_worklist(clif,
+ reloc_gl_shader_state,
+ values.address);
+ if (reloc) {
+ reloc->shader_state.num_attrs =
+ values.number_of_attribute_arrays;
+ }
}
return true;
}
cl += *size;
for (int i = 0; i < values.number_of_16_bit_output_data_specs_following; i++) {
- v3d_print_group(clif, spec, 0, cl);
+ if (!reloc_mode)
+ v3d_print_group(clif, spec, 0, cl);
cl += v3d_group_get_length(spec);
*size += v3d_group_get_length(spec);
}
- out(clif, "@format ctrllist\n");
+ if (!reloc_mode)
+ out(clif, "@format ctrllist\n");
break;
}
#else /* V3D_VERSION < 40 */
cl += *size;
for (int i = 0; i < values.number_of_16_bit_output_data_specs_following; i++) {
- v3d_print_group(clif, spec, 0, cl);
+ if (!reloc_mode)
+ v3d_print_group(clif, spec, 0, cl);
cl += v3d_group_get_length(spec);
*size += v3d_group_get_length(spec);
}
for (int i = 0; i < values.number_of_32_bit_output_buffer_address_following; i++) {
- v3d_print_group(clif, addr, 0, cl);
+ if (!reloc_mode)
+ v3d_print_group(clif, addr, 0, cl);
cl += v3d_group_get_length(addr);
*size += v3d_group_get_length(addr);
}