vc4: Reuse (and extend) the packet.h sizes for dumping.
authorEric Anholt <eric@anholt.net>
Tue, 23 Jun 2015 00:31:24 +0000 (17:31 -0700)
committerEric Anholt <eric@anholt.net>
Wed, 24 Jun 2015 01:40:50 +0000 (18:40 -0700)
src/gallium/drivers/vc4/kernel/vc4_packet.h
src/gallium/drivers/vc4/vc4_cl_dump.c

index 88cfc0f..8e6f2a1 100644 (file)
@@ -88,16 +88,22 @@ enum vc4_packet {
 #define VC4_PACKET_START_TILE_BINNING_SIZE                             1
 #define VC4_PACKET_INCREMENT_SEMAPHORE_SIZE                            1
 #define VC4_PACKET_WAIT_ON_SEMAPHORE_SIZE                              1
+#define VC4_PACKET_BRANCH_SIZE                                         5
 #define VC4_PACKET_BRANCH_TO_SUB_LIST_SIZE                             5
 #define VC4_PACKET_STORE_MS_TILE_BUFFER_SIZE                           1
 #define VC4_PACKET_STORE_MS_TILE_BUFFER_AND_EOF_SIZE                   1
+#define VC4_PACKET_STORE_FULL_RES_TILE_BUFFER_SIZE                     5
+#define VC4_PACKET_LOAD_FULL_RES_TILE_BUFFER_SIZE                      5
 #define VC4_PACKET_STORE_TILE_BUFFER_GENERAL_SIZE                      7
 #define VC4_PACKET_LOAD_TILE_BUFFER_GENERAL_SIZE                       7
 #define VC4_PACKET_GL_INDEXED_PRIMITIVE_SIZE                           14
 #define VC4_PACKET_GL_ARRAY_PRIMITIVE_SIZE                             10
+#define VC4_PACKET_COMPRESSED_PRIMITIVE_SIZE                           1
+#define VC4_PACKET_CLIPPED_COMPRESSED_PRIMITIVE_SIZE                   1
 #define VC4_PACKET_PRIMITIVE_LIST_FORMAT_SIZE                          2
 #define VC4_PACKET_GL_SHADER_STATE_SIZE                                        5
 #define VC4_PACKET_NV_SHADER_STATE_SIZE                                        5
+#define VC4_PACKET_VG_SHADER_STATE_SIZE                                        5
 #define VC4_PACKET_CONFIGURATION_BITS_SIZE                             4
 #define VC4_PACKET_FLAT_SHADE_FLAGS_SIZE                               5
 #define VC4_PACKET_POINT_SIZE_SIZE                                     5
@@ -106,6 +112,7 @@ enum vc4_packet {
 #define VC4_PACKET_DEPTH_OFFSET_SIZE                                   5
 #define VC4_PACKET_CLIP_WINDOW_SIZE                                    9
 #define VC4_PACKET_VIEWPORT_OFFSET_SIZE                                        5
+#define VC4_PACKET_Z_CLIPPING_SIZE                                     9
 #define VC4_PACKET_CLIPPER_XY_SCALING_SIZE                             9
 #define VC4_PACKET_CLIPPER_Z_SCALING_SIZE                              9
 #define VC4_PACKET_TILE_BINNING_MODE_CONFIG_SIZE                       16
index 6905508..4cc197a 100644 (file)
@@ -291,63 +291,63 @@ dump_VC4_PACKET_GEM_HANDLES(void *cl, uint32_t offset, uint32_t hw_offset)
                 offset, hw_offset, handles[0], handles[1]);
 }
 
-#define PACKET_DUMP(name, size) [name] = { #name, size, dump_##name }
-#define PACKET(name, size) [name] = { #name, size, NULL }
+#define PACKET_DUMP(name) [name] = { #name, name ## _SIZE, dump_##name }
+#define PACKET(name) [name] = { #name, name ## _SIZE, NULL }
 
 static const struct packet_info {
         const char *name;
         uint8_t size;
         void (*dump_func)(void *cl, uint32_t offset, uint32_t hw_offset);
 } packet_info[] = {
-        PACKET(VC4_PACKET_HALT, 1),
-        PACKET(VC4_PACKET_NOP, 1),
-
-        PACKET(VC4_PACKET_FLUSH, 1),
-        PACKET(VC4_PACKET_FLUSH_ALL, 1),
-        PACKET(VC4_PACKET_START_TILE_BINNING, 1),
-        PACKET(VC4_PACKET_INCREMENT_SEMAPHORE, 1),
-        PACKET(VC4_PACKET_WAIT_ON_SEMAPHORE, 1),
-
-        PACKET(VC4_PACKET_BRANCH, 5),
-        PACKET_DUMP(VC4_PACKET_BRANCH_TO_SUB_LIST, 5),
-
-        PACKET(VC4_PACKET_STORE_MS_TILE_BUFFER, 1),
-        PACKET(VC4_PACKET_STORE_MS_TILE_BUFFER_AND_EOF, 1),
-        PACKET(VC4_PACKET_STORE_FULL_RES_TILE_BUFFER, 5),
-        PACKET(VC4_PACKET_LOAD_FULL_RES_TILE_BUFFER, 5),
-        PACKET_DUMP(VC4_PACKET_STORE_TILE_BUFFER_GENERAL, 7),
-        PACKET(VC4_PACKET_LOAD_TILE_BUFFER_GENERAL, 7),
-
-        PACKET(VC4_PACKET_GL_INDEXED_PRIMITIVE, 14),
-        PACKET(VC4_PACKET_GL_ARRAY_PRIMITIVE, 10),
-
-        PACKET(VC4_PACKET_COMPRESSED_PRIMITIVE, 48),
-        PACKET(VC4_PACKET_CLIPPED_COMPRESSED_PRIMITIVE, 49),
-
-        PACKET(VC4_PACKET_PRIMITIVE_LIST_FORMAT, 2),
-
-        PACKET(VC4_PACKET_GL_SHADER_STATE, 5),
-        PACKET(VC4_PACKET_NV_SHADER_STATE, 5),
-        PACKET(VC4_PACKET_VG_SHADER_STATE, 5),
-
-        PACKET(VC4_PACKET_CONFIGURATION_BITS, 4),
-        PACKET_DUMP(VC4_PACKET_FLAT_SHADE_FLAGS, 5),
-        PACKET_DUMP(VC4_PACKET_POINT_SIZE, 5),
-        PACKET_DUMP(VC4_PACKET_LINE_WIDTH, 5),
-        PACKET(VC4_PACKET_RHT_X_BOUNDARY, 3),
-        PACKET(VC4_PACKET_DEPTH_OFFSET, 5),
-        PACKET(VC4_PACKET_CLIP_WINDOW, 9),
-        PACKET_DUMP(VC4_PACKET_VIEWPORT_OFFSET, 5),
-        PACKET(VC4_PACKET_Z_CLIPPING, 9),
-        PACKET_DUMP(VC4_PACKET_CLIPPER_XY_SCALING, 9),
-        PACKET_DUMP(VC4_PACKET_CLIPPER_Z_SCALING, 9),
-
-        PACKET_DUMP(VC4_PACKET_TILE_BINNING_MODE_CONFIG, 16),
-        PACKET_DUMP(VC4_PACKET_TILE_RENDERING_MODE_CONFIG, 11),
-        PACKET(VC4_PACKET_CLEAR_COLORS, 14),
-        PACKET_DUMP(VC4_PACKET_TILE_COORDINATES, 3),
-
-        PACKET_DUMP(VC4_PACKET_GEM_HANDLES, 9),
+        PACKET(VC4_PACKET_HALT),
+        PACKET(VC4_PACKET_NOP),
+
+        PACKET(VC4_PACKET_FLUSH),
+        PACKET(VC4_PACKET_FLUSH_ALL),
+        PACKET(VC4_PACKET_START_TILE_BINNING),
+        PACKET(VC4_PACKET_INCREMENT_SEMAPHORE),
+        PACKET(VC4_PACKET_WAIT_ON_SEMAPHORE),
+
+        PACKET(VC4_PACKET_BRANCH),
+        PACKET_DUMP(VC4_PACKET_BRANCH_TO_SUB_LIST),
+
+        PACKET(VC4_PACKET_STORE_MS_TILE_BUFFER),
+        PACKET(VC4_PACKET_STORE_MS_TILE_BUFFER_AND_EOF),
+        PACKET(VC4_PACKET_STORE_FULL_RES_TILE_BUFFER),
+        PACKET(VC4_PACKET_LOAD_FULL_RES_TILE_BUFFER),
+        PACKET_DUMP(VC4_PACKET_STORE_TILE_BUFFER_GENERAL),
+        PACKET(VC4_PACKET_LOAD_TILE_BUFFER_GENERAL),
+
+        PACKET(VC4_PACKET_GL_INDEXED_PRIMITIVE),
+        PACKET(VC4_PACKET_GL_ARRAY_PRIMITIVE),
+
+        PACKET(VC4_PACKET_COMPRESSED_PRIMITIVE),
+        PACKET(VC4_PACKET_CLIPPED_COMPRESSED_PRIMITIVE),
+
+        PACKET(VC4_PACKET_PRIMITIVE_LIST_FORMAT),
+
+        PACKET(VC4_PACKET_GL_SHADER_STATE),
+        PACKET(VC4_PACKET_NV_SHADER_STATE),
+        PACKET(VC4_PACKET_VG_SHADER_STATE),
+
+        PACKET(VC4_PACKET_CONFIGURATION_BITS),
+        PACKET_DUMP(VC4_PACKET_FLAT_SHADE_FLAGS),
+        PACKET_DUMP(VC4_PACKET_POINT_SIZE),
+        PACKET_DUMP(VC4_PACKET_LINE_WIDTH),
+        PACKET(VC4_PACKET_RHT_X_BOUNDARY),
+        PACKET(VC4_PACKET_DEPTH_OFFSET),
+        PACKET(VC4_PACKET_CLIP_WINDOW),
+        PACKET_DUMP(VC4_PACKET_VIEWPORT_OFFSET),
+        PACKET(VC4_PACKET_Z_CLIPPING),
+        PACKET_DUMP(VC4_PACKET_CLIPPER_XY_SCALING),
+        PACKET_DUMP(VC4_PACKET_CLIPPER_Z_SCALING),
+
+        PACKET_DUMP(VC4_PACKET_TILE_BINNING_MODE_CONFIG),
+        PACKET_DUMP(VC4_PACKET_TILE_RENDERING_MODE_CONFIG),
+        PACKET(VC4_PACKET_CLEAR_COLORS),
+        PACKET_DUMP(VC4_PACKET_TILE_COORDINATES),
+
+        PACKET_DUMP(VC4_PACKET_GEM_HANDLES),
 };
 
 void