broadcom/vc5: Add support for V3D 4.1 CLIF dumping.
authorEric Anholt <eric@anholt.net>
Tue, 9 Jan 2018 23:23:21 +0000 (15:23 -0800)
committerEric Anholt <eric@anholt.net>
Sat, 13 Jan 2018 05:55:49 +0000 (21:55 -0800)
src/broadcom/Makefile.vc5.am
src/broadcom/clif/clif_dump.c
src/broadcom/clif/clif_private.h
src/broadcom/clif/v3dx_dump.c
src/broadcom/meson.build

index 067da49f9e271506886ec2552e1f76345030cf74..d07f071346c60fc0b5a647f59f9a937bdb46b167 100644 (file)
@@ -1,5 +1,6 @@
 noinst_LTLIBRARIES += libbroadcom.la
 noinst_LTLIBRARIES += libbroadcom_v33.la
+noinst_LTLIBRARIES += libbroadcom_v41.la
 
 if USE_VC5_SIMULATOR
 AM_CFLAGS += $(VC5_SIMULATOR_CFLAGS)
@@ -9,6 +10,9 @@ endif
 libbroadcom_v33_la_SOURCES = $(BROADCOM_PER_VERSION_SOURCES)
 libbroadcom_v33_la_CFLAGS = -DV3D_VERSION=33
 
+libbroadcom_v41_la_SOURCES = $(BROADCOM_PER_VERSION_SOURCES)
+libbroadcom_v41_la_CFLAGS = -DV3D_VERSION=41
+
 libbroadcom_la_SOURCES = $(BROADCOM_FILES)
 
 check_PROGRAMS += \
index 18c20d880f765ac1701e939e1476a0dd32f6fd5f..1f57a6dbad541c9b77d5e07a67229dec48cac643 100644 (file)
@@ -81,7 +81,10 @@ static bool
 clif_dump_packet(struct clif_dump *clif, uint32_t offset, const uint8_t *cl,
                  uint32_t *size)
 {
-        return v3d33_clif_dump_packet(clif, offset, cl, size);
+        if (clif->devinfo->ver >= 41)
+                return v3d41_clif_dump_packet(clif, offset, cl, size);
+        else
+                return v3d33_clif_dump_packet(clif, offset, cl, size);
 }
 
 static void
@@ -133,8 +136,15 @@ clif_process_worklist(struct clif_dump *clif)
 
                 switch (reloc->type) {
                 case reloc_gl_shader_state:
-                        v3d33_clif_dump_gl_shader_state_record(clif, reloc,
-                                                               vaddr);
+                        if (clif->devinfo->ver >= 41) {
+                                v3d41_clif_dump_gl_shader_state_record(clif,
+                                                                       reloc,
+                                                                       vaddr);
+                        } else {
+                                v3d33_clif_dump_gl_shader_state_record(clif,
+                                                                       reloc,
+                                                                       vaddr);
+                        }
                         break;
                 case reloc_generic_tile_list:
                         clif_dump_cl(clif, reloc->addr,
index d8453d51c4163d7305566f5c329817486f09d946..eac61eaa95bea2d4eb9947348ba4a747efc7c2b1 100644 (file)
@@ -72,6 +72,11 @@ bool v3d33_clif_dump_packet(struct clif_dump *clif, uint32_t offset,
 void v3d33_clif_dump_gl_shader_state_record(struct clif_dump *clif,
                                             struct reloc_worklist_entry *reloc,
                                             void *vaddr);
+bool v3d41_clif_dump_packet(struct clif_dump *clif, uint32_t offset,
+                            const uint8_t *cl, uint32_t *size);
+void v3d41_clif_dump_gl_shader_state_record(struct clif_dump *clif,
+                                            struct reloc_worklist_entry *reloc,
+                                            void *vaddr);
 
 static inline void
 out(struct clif_dump *clif, const char *fmt, ...)
index 506d3bb7b50286bc980b3fc5056b75fd7b02166e..b1d16551d7144fbca3dc414f6874edbd9cb2dfbe 100644 (file)
@@ -50,9 +50,9 @@ v3dX(clif_dump_packet)(struct clif_dump *clif, uint32_t offset,
         v3d_print_group(clif->out, inst, 0, cl, "");
 
         switch (*cl) {
-        case V3D33_GL_SHADER_STATE_opcode: {
-                struct V3D33_GL_SHADER_STATE values;
-                V3D33_GL_SHADER_STATE_unpack(cl, &values);
+        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,
@@ -65,18 +65,38 @@ v3dX(clif_dump_packet)(struct clif_dump *clif, uint32_t offset,
                 return true;
         }
 
-        case V3D33_STORE_MULTI_SAMPLE_RESOLVED_TILE_COLOR_BUFFER_EXTENDED_opcode: {
-                struct V3D33_STORE_MULTI_SAMPLE_RESOLVED_TILE_COLOR_BUFFER_EXTENDED values;
-                V3D33_STORE_MULTI_SAMPLE_RESOLVED_TILE_COLOR_BUFFER_EXTENDED_unpack(cl, &values);
+#if V3D_VERSION < 40
+        case V3DX(STORE_MULTI_SAMPLE_RESOLVED_TILE_COLOR_BUFFER_EXTENDED_opcode): {
+                struct V3DX(STORE_MULTI_SAMPLE_RESOLVED_TILE_COLOR_BUFFER_EXTENDED) values;
+                V3DX(STORE_MULTI_SAMPLE_RESOLVED_TILE_COLOR_BUFFER_EXTENDED_unpack)(cl, &values);
 
                 if (values.last_tile_of_frame)
                         return false;
                 break;
         }
+#endif /* V3D_VERSION < 40 */
 
-        case V3D33_TRANSFORM_FEEDBACK_ENABLE_opcode: {
-                struct V3D33_TRANSFORM_FEEDBACK_ENABLE values;
-                V3D33_TRANSFORM_FEEDBACK_ENABLE_unpack(cl, &values);
+#if V3D_VERSION > 40
+        case V3DX(TRANSFORM_FEEDBACK_SPECS_opcode): {
+                struct V3DX(TRANSFORM_FEEDBACK_SPECS) values;
+                V3DX(TRANSFORM_FEEDBACK_SPECS_unpack)(cl, &values);
+                struct v3d_group *spec = v3d_spec_find_struct(clif->spec,
+                                                              "Transform Feedback Output Data Spec");
+                assert(spec);
+
+                cl += *size;
+
+                for (int i = 0; i < values.number_of_16_bit_output_data_specs_following; i++) {
+                        v3d_print_group(clif->out, spec, 0, cl, "");
+                        cl += v3d_group_get_length(spec);
+                        *size += v3d_group_get_length(spec);
+                }
+                break;
+        }
+#else /* V3D_VERSION < 40 */
+        case V3DX(TRANSFORM_FEEDBACK_ENABLE_opcode): {
+                struct V3DX(TRANSFORM_FEEDBACK_ENABLE) values;
+                V3DX(TRANSFORM_FEEDBACK_ENABLE_unpack)(cl, &values);
                 struct v3d_group *spec = v3d_spec_find_struct(clif->spec,
                                                               "Transform Feedback Output Data Spec");
                 struct v3d_group *addr = v3d_spec_find_struct(clif->spec,
@@ -99,10 +119,11 @@ v3dX(clif_dump_packet)(struct clif_dump *clif, uint32_t offset,
                 }
                 break;
         }
+#endif /* V3D_VERSION < 40 */
 
-        case V3D33_START_ADDRESS_OF_GENERIC_TILE_LIST_opcode: {
-                struct V3D33_START_ADDRESS_OF_GENERIC_TILE_LIST values;
-                V3D33_START_ADDRESS_OF_GENERIC_TILE_LIST_unpack(cl, &values);
+        case V3DX(START_ADDRESS_OF_GENERIC_TILE_LIST_opcode): {
+                struct V3DX(START_ADDRESS_OF_GENERIC_TILE_LIST) values;
+                V3DX(START_ADDRESS_OF_GENERIC_TILE_LIST_unpack)(cl, &values);
                 struct reloc_worklist_entry *reloc =
                         clif_dump_add_address_to_worklist(clif,
                                                           reloc_generic_tile_list,
@@ -111,7 +132,7 @@ v3dX(clif_dump_packet)(struct clif_dump *clif, uint32_t offset,
                 break;
         }
 
-        case V3D33_HALT_opcode:
+        case V3DX(HALT_opcode):
                 return false;
         }
 
index 839fa4a192ea750564870de5052b729a0f23cfcc..6721966c7cf11428457a76475096c87d0231a299 100644 (file)
@@ -22,7 +22,7 @@ inc_broadcom = include_directories('.', 'cle')
 
 subdir('cle')
 
-vc5_versions = ['33']
+vc5_versions = ['33', '41']
 
 if with_gallium_vc5
   subdir('compiler')