vc4: Add some dumping for STORE_TILE_BUFFER_GENERAL.
authorEric Anholt <eric@anholt.net>
Tue, 13 Jan 2015 22:23:43 +0000 (11:23 +1300)
committerEric Anholt <eric@anholt.net>
Thu, 15 Jan 2015 09:21:29 +0000 (22:21 +1300)
src/gallium/drivers/vc4/vc4_cl_dump.c

index c9044b4ab81769f906f8581f33e0bbe252e40811..14239840d321c36f0a28153efa72e6e053b6290f 100644 (file)
@@ -46,6 +46,84 @@ dump_VC4_PACKET_BRANCH_TO_SUB_LIST(void *cl, uint32_t offset, uint32_t hw_offset
                 offset, hw_offset, *addr);
 }
 
+static void
+dump_VC4_PACKET_STORE_TILE_BUFFER_GENERAL(void *cl, uint32_t offset, uint32_t hw_offset)
+{
+        uint8_t *bytes = cl + offset;
+        uint32_t *addr = cl + offset + 2;
+
+        const char *fullvg = "";
+        const char *fullzs = "";
+        const char *fullcolor = "";
+        const char *buffer = "???";
+
+        switch ((bytes[0] & 0x7)){
+        case 0:
+                buffer = "none";
+                break;
+        case 1:
+                buffer = "color";
+                break;
+        case 2:
+                buffer = "zs";
+                break;
+        case 3:
+                buffer = "z";
+                break;
+        case 4:
+                buffer = "vgmask";
+                break;
+        case 5:
+                buffer = "full";
+                if (*addr & (1 << 0))
+                        fullcolor = " !color";
+                if (*addr & (1 << 1))
+                        fullzs = " !zs";
+                if (*addr & (1 << 2))
+                        fullvg = " !vgmask";
+                break;
+        }
+
+        const char *tiling = "???";
+        switch ((bytes[0] >> 4) & 7) {
+        case 0:
+                tiling = "linear";
+                break;
+        case 1:
+                tiling = "T";
+                break;
+        case 2:
+                tiling = "LT";
+                break;
+        }
+
+        const char *format = "???";
+        switch (bytes[1] & 3) {
+        case 0:
+                format = "RGBA8888";
+                break;
+        case 1:
+                format = "BGR565_DITHER";
+                break;
+        case 2:
+                format = "BGR565";
+                break;
+        }
+
+        fprintf(stderr, "0x%08x 0x%08x: 0x%02x %s %s\n",
+                offset + 0, hw_offset + 0, bytes[0],
+                buffer, tiling);
+
+        fprintf(stderr, "0x%08x 0x%08x: 0x%02x %s\n",
+                offset + 1, hw_offset + 1, bytes[1],
+                format);
+
+        fprintf(stderr, "0x%08x 0x%08x:      addr 0x%08x %s%s%s%s\n",
+                offset + 2, hw_offset + 2, *addr & ~15,
+                fullcolor, fullzs, fullvg,
+                (*addr & (1 << 3)) ? " EOF" : "");
+}
+
 static void
 dump_VC4_PACKET_FLAT_SHADE_FLAGS(void *cl, uint32_t offset, uint32_t hw_offset)
 {
@@ -206,7 +284,7 @@ static const struct packet_info {
         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(VC4_PACKET_STORE_TILE_BUFFER_GENERAL, 7),
+        PACKET_DUMP(VC4_PACKET_STORE_TILE_BUFFER_GENERAL, 7),
         PACKET(VC4_PACKET_LOAD_TILE_BUFFER_GENERAL, 7),
 
         PACKET(VC4_PACKET_GL_INDEXED_PRIMITIVE, 14),