From c6449e33e3b3ec9ea0509aa7c91d1127c81ef1e5 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 27 Jun 2018 15:00:32 -0700 Subject: [PATCH] v3d: Use a short, underscored name for packets in CLIF/CL dumping. These will match the names that the CLIF parser expects to see. I may in the future decide to change more of the other names so that I match the names the HW/closed SW team uses for their packets, rather than the names in the spec (which only they and I can read anyway). --- src/broadcom/cle/v3d_decoder.c | 4 +- src/broadcom/cle/v3d_packet_v33.xml | 86 ++++++++++++++--------------- src/broadcom/clif/v3dx_dump.c | 27 ++++++++- 3 files changed, 72 insertions(+), 45 deletions(-) diff --git a/src/broadcom/cle/v3d_decoder.c b/src/broadcom/cle/v3d_decoder.c index c1e9e50a247..00d67b2a2e6 100644 --- a/src/broadcom/cle/v3d_decoder.c +++ b/src/broadcom/cle/v3d_decoder.c @@ -453,7 +453,9 @@ start_element(void *data, const char *element_name, const char **atts) ctx->loc.line_number = XML_GetCurrentLineNumber(ctx->parser); for (i = 0; atts[i]; i += 2) { - if (strcmp(atts[i], "name") == 0) + if (strcmp(atts[i], "shortname") == 0) + name = atts[i + 1]; + else if (strcmp(atts[i], "name") == 0 && !name) name = atts[i + 1]; else if (strcmp(atts[i], "gen") == 0) ver = atts[i + 1]; diff --git a/src/broadcom/cle/v3d_packet_v33.xml b/src/broadcom/cle/v3d_packet_v33.xml index 5b9be0fcab9..6ce8299e26b 100644 --- a/src/broadcom/cle/v3d_packet_v33.xml +++ b/src/broadcom/cle/v3d_packet_v33.xml @@ -245,19 +245,19 @@ - - - - - - - - - + + + + + + + + + - + @@ -265,37 +265,37 @@ - + - - + + - + - + - + - + - + - + @@ -307,22 +307,22 @@ - + - + - + - + - + @@ -343,7 +343,7 @@ - + @@ -376,7 +376,7 @@ - + @@ -393,7 +393,7 @@ - + @@ -424,7 +424,7 @@ - + @@ -523,7 +523,7 @@ - + @@ -598,14 +598,14 @@ - + - + @@ -623,7 +623,7 @@ - + @@ -645,18 +645,18 @@ - + - + - + - + @@ -682,7 +682,7 @@ - + @@ -701,17 +701,17 @@ - + - + - + @@ -973,7 +973,7 @@ - + @@ -993,13 +993,13 @@ - + - + diff --git a/src/broadcom/clif/v3dx_dump.c b/src/broadcom/clif/v3dx_dump.c index 2705e2bc79f..b10b1c92a5a 100644 --- a/src/broadcom/clif/v3dx_dump.c +++ b/src/broadcom/clif/v3dx_dump.c @@ -21,7 +21,10 @@ * IN THE SOFTWARE. */ +#include +#include #include +#include "util/macros.h" #include "broadcom/cle/v3d_decoder.h" #include "clif_dump.h" #include "clif_private.h" @@ -34,6 +37,26 @@ #include "broadcom/cle/v3dx_pack.h" #include "broadcom/common/v3d_macros.h" +static char * +clif_name(const char *xml_name) +{ + char *name = malloc(strlen(xml_name) + 1); + + int j = 0; + for (int i = 0; i < strlen(xml_name); i++) { + if (xml_name[i] == ' ') { + name[j++] = '_'; + } else if (xml_name[i] == '(' || xml_name[i] == ')') { + /* skip */ + } else { + name[j++] = toupper(xml_name[i]); + } + } + name[j++] = 0; + + return name; +} + bool v3dX(clif_dump_packet)(struct clif_dump *clif, uint32_t offset, const uint8_t *cl, uint32_t *size) @@ -46,7 +69,9 @@ v3dX(clif_dump_packet)(struct clif_dump *clif, uint32_t offset, *size = v3d_group_get_length(inst); - out(clif, "%s\n", v3d_group_get_name(inst)); + 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) { -- 2.30.2