diff options
author | Eric Anholt <[email protected]> | 2018-06-27 15:00:32 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2018-07-30 14:29:01 -0700 |
commit | c6449e33e3b3ec9ea0509aa7c91d1127c81ef1e5 (patch) | |
tree | 37fd2598e326da096084a0a9791136e0778a7dc6 /src/broadcom/clif | |
parent | b56f8c475e5bf6a3b77c597723631ebde4f31358 (diff) |
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).
Diffstat (limited to 'src/broadcom/clif')
-rw-r--r-- | src/broadcom/clif/v3dx_dump.c | 27 |
1 files changed, 26 insertions, 1 deletions
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 <ctype.h> +#include <stdlib.h> #include <string.h> +#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) { |