v3d: Split walking the CLs to generate relocs from walking CLs to dump.
[mesa.git] / src / broadcom / clif / v3dx_dump.c
index b10b1c92a5ac8945c61ecf3d9590c8efc1fedf4f..9cf59f8892069b41248d22b00e8a9aa4951ff9c5 100644 (file)
@@ -59,7 +59,7 @@ clif_name(const char *xml_name)
 
 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) {
@@ -69,23 +69,27 @@ v3dX(clif_dump_packet)(struct clif_dump *clif, uint32_t offset,
 
         *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;
         }
@@ -112,11 +116,13 @@ v3dX(clif_dump_packet)(struct clif_dump *clif, uint32_t offset,
                 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 */
@@ -133,13 +139,15 @@ v3dX(clif_dump_packet)(struct clif_dump *clif, uint32_t offset,
                 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);
                 }