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).
This commit is contained in:
Eric Anholt 2018-06-27 15:00:32 -07:00
parent b56f8c475e
commit c6449e33e3
3 changed files with 71 additions and 44 deletions

View File

@ -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];

View File

@ -245,19 +245,19 @@
<packet code="4" name="Flush"/>
<packet code="5" name="Flush All State"/>
<packet code="6" name="Start Tile Binning"/>
<packet code="7" name="Increment Semaphore"/>
<packet code="8" name="Wait on Semaphore"/>
<packet code="9" name="Wait for previous frame"/>
<packet code="10" name="Enable Z-only rendering" cl="R"/>
<packet code="11" name="Disable Z-only rendering" cl="R"/>
<packet code="12" name="End of Z-only rendering in frame"/>
<packet code="13" name="End of rendering"/>
<packet code="7" shortname="incr_semaphore" name="Increment Semaphore"/>
<packet code="8" shortname="wait_semaphore" name="Wait on Semaphore"/>
<packet code="9" shortname="wait_prev_frame" name="Wait for previous frame"/>
<packet code="10" shortname="enable_z_only" name="Enable Z-only rendering" cl="R"/>
<packet code="11" shortname="disable_z_only" name="Disable Z-only rendering" cl="R"/>
<packet code="12" shortname="end_z_only" name="End of Z-only rendering in frame"/>
<packet code="13" shortname="end_render" name="End of rendering"/>
<packet code="14" name="Wait for transform feedback" cl="B">
<packet code="14" shortname="wait_transform_feedback" name="Wait for transform feedback" cl="B">
<field name="Block count" size="8" start="0" type="uint"/>
</packet>
<packet code="15" name="Branch to auto-chained sub-list">
<packet code="15" shortname="branch_sub_autochain" name="Branch to auto-chained sub-list">
<field name="address" size="32" start="0" type="address"/>
</packet>
@ -265,37 +265,37 @@
<field name="address" size="32" start="0" type="address"/>
</packet>
<packet code="17" name="Branch to Sub-list">
<packet code="17" shortname="branch_sub" name="Branch to Sub-list">
<field name="address" size="32" start="0" type="address"/>
</packet>
<packet code="18" name="Return from sub-list"/>
<packet code="19" name="Flush VCD cache"/>
<packet code="18" shortname="return" name="Return from sub-list"/>
<packet code="19" shortname="clear_vcd_cache" name="Flush VCD cache"/>
<packet code="20" name="Start Address of Generic Tile List">
<packet code="20" shortname="generic_tile_list" name="Start Address of Generic Tile List">
<field name="start" size="32" start="0" type="address"/>
<field name="end" size="32" start="32" type="address"/>
</packet>
<packet code="21" name="Branch to Implicit Tile List">
<packet code="21" shortname="branch_implicit_tile" name="Branch to Implicit Tile List">
<field name="tile list set number" size="8" start="0" type="uint"/>
</packet>
<packet code="22" name="Branch to Explicit Supertile">
<packet code="22" shortname="branch_explicit_supertile" name="Branch to Explicit Supertile">
<field name="Absolute address of explicit supertile render list" size="32" start="24" type="address"/>
<field name="explicit supertile number" size="8" start="16" type="uint"/>
<field name="row number" size="8" start="8" type="uint"/>
<field name="column number" size="8" start="0" type="uint"/>
</packet>
<packet code="23" name="Supertile Coordinates">
<packet code="23" shortname="supertile_coords" name="Supertile Coordinates">
<field name="row number in supertiles" size="8" start="8" type="uint"/>
<field name="column number in supertiles" size="8" start="0" type="uint"/>
</packet>
<packet code="24" name="Store Multi-Sample Resolved Tile Color Buffer" cl="R" max_ver="33"/>
<packet code="24" shortname="store_subsample" name="Store Multi-Sample Resolved Tile Color Buffer" cl="R" max_ver="33"/>
<packet code="25" name="Store Multi-Sample Resolved Tile Color Buffer (extended)" cl="R" max_ver="33">
<packet code="25" shortname="store_subsample_ex" name="Store Multi-Sample Resolved Tile Color Buffer (extended)" cl="R" max_ver="33">
<field name="Disable Color Buffer write" size="8" start="8" type="uint"/>
<field name="Enable Z write" size="1" start="7" type="bool"/>
<field name="Enable Stencil write" size="1" start="6" type="bool"/>
@ -307,22 +307,22 @@
<field name="Last Tile of Frame" size="1" start="0" type="bool"/>
</packet>
<packet code="25" name="Clear Tile Buffers" cl="R" min_ver="41">
<packet code="25" shortname="clear" name="Clear Tile Buffers" cl="R" min_ver="41">
<field name="Clear Z/Stencil Buffer" size="1" start="1" type="bool"/>
<field name="Clear all Render Targets" size="1" start="0" type="bool"/>
</packet>
<packet code="26" name="Reload Tile Color Buffer" cl="R" max_ver="33">
<packet code="26" shortname="load" name="Reload Tile Color Buffer" cl="R" max_ver="33">
<field name="Disable Color Buffer load" size="8" start="8" type="uint"/>
<field name="Enable Z load" size="1" start="7" type="bool"/>
<field name="Enable Stencil load" size="1" start="6" type="bool"/>
</packet>
<packet code="26" name="End of Loads" cl="R" min_ver="41"/>
<packet code="26" shortname="end_loads" name="End of Loads" cl="R" min_ver="41"/>
<packet code="27" name="End of Tile Marker" cl="R"/>
<packet code="27" shortname="end_tile" name="End of Tile Marker" cl="R"/>
<packet code="29" name="Store Tile Buffer General" cl="R" max_ver="33">
<packet code="29" shortname="store_general" name="Store Tile Buffer General" cl="R" max_ver="33">
<field name="Address" size="24" start="24" type="address"/>
<field name="Padded height of output image in UIF blocks" size="13" start="11" type="uint"/>
<field name="XOR UIF" size="1" start="10" type="bool"/>
@ -343,7 +343,7 @@
</field>
</packet>
<packet code="29" name="Store Tile Buffer General" cl="R" min_ver="41">
<packet code="29" shortname="store" name="Store Tile Buffer General" cl="R" min_ver="41">
<field name="Address" size="32" start="64" type="address"/>
<!-- used for y flip -->
@ -376,7 +376,7 @@
</field>
</packet>
<packet code="30" name="Load Tile Buffer General" cl="R" max_ver="33">
<packet code="30" shortname="load_general" name="Load Tile Buffer General" cl="R" max_ver="33">
<field name="Address" size="24" start="24" type="address"/>
<field name="Padded height of output image in UIF blocks" size="13" start="11" type="uint"/>
<field name="XOR UIF" size="1" start="10" type="bool"/>
@ -393,7 +393,7 @@
</field>
</packet>
<packet code="30" name="Load Tile Buffer General" cl="R" min_ver="41">
<packet code="30" shortname="load" name="Load Tile Buffer General" cl="R" min_ver="41">
<field name="Address" size="32" start="64" type="address"/>
<!-- used for y flip -->
@ -424,7 +424,7 @@
</field>
</packet>
<packet code="31" name="Transform Feedback Flush and Count"/>
<packet code="31" shortname="tf_draw_flush_and_count" name="Transform Feedback Flush and Count"/>
<packet code="32" name="Indexed Prim List" cl="B" max_ver="33">
<field name="Minimum index" size="32" start="104" type="uint"/>
@ -523,7 +523,7 @@
</field>
</packet>
<packet code="64" name="GL Shader State">
<packet code="64" shortname="gl_shader" name="GL Shader State">
<field name="address" size="27" start="5" type="address"/>
<field name="number of attribute arrays" size="5" start="0" type="uint"/>
</packet>
@ -598,14 +598,14 @@
<field name="Alpha blend mode" size="4" start="0" type="Blend Mode"/>
</packet>
<packet code="86" name="Blend Constant Color">
<packet code="86" shortname="blend_ccolor" name="Blend Constant Color">
<field name="Alpha (F16)" size="16" start="48" type="uint"/>
<field name="Blue (F16)" size="16" start="32" type="uint"/>
<field name="Green (F16)" size="16" start="16" type="uint"/>
<field name="Red (F16)" size="16" start="0" type="uint"/>
</packet>
<packet code="87" name="Color Write Masks">
<packet code="87" shortname="color_wmasks" name="Color Write Masks">
<field name="Mask" size="32" start="0" type="uint"/>
</packet>
@ -623,7 +623,7 @@
<field name="Mask" size="4" start="0" type="uint"/>
</packet>
<packet code="92" name="Occlusion Query Counter">
<packet code="92" shortname="occlusion_query_counter_enable" name="Occlusion Query Counter">
<field name="address" size="32" start="0" type="address"/>
</packet>
@ -645,18 +645,18 @@
<field name="Enable Forward Facing Primitive" size="1" start="0" type="bool"/>
</packet>
<packet code="97" name="Zero All Flat Shade Flags"/>
<packet code="97" shortname="zero_all_flatshade_flags" name="Zero All Flat Shade Flags"/>
<packet code="98" name="Flat Shade Flags">
<packet code="98" shortname="flatshade_flags" name="Flat Shade Flags">
<field name="Flat Shade Flags for varyings V0*24" size="24" start="8" type="uint"/>
<field name="Action for Flat Shade Flags of higher numbered varyings" size="2" start="6" type="Varying Flags Action"/>
<field name="Action for Flat Shade Flags of lower numbered varyings" size="2" start="4" type="Varying Flags Action"/>
<field name="Varying offset V0" size="4" start="0" type="uint"/>
</packet>
<packet code="99" name="Zero All Non-perspective Flags" min_ver="41"/>
<packet code="99" shortname="zero_all_noperspective_flags" name="Zero All Non-perspective Flags" min_ver="41"/>
<packet code="100" name="Non-perspective Flags" min_ver="41">
<packet code="100" shortname="noperspective_flags" name="Non-perspective Flags" min_ver="41">
<field name="Non-perspective Flags for varyings V0*24" size="24" start="8" type="uint"/>
<field name="Action for Non-perspective Flags of higher numbered varyings" size="2" start="6" type="Varying Flags Action"/>
<field name="Action for Non-perspective Flags of lower numbered varyings" size="2" start="4" type="Varying Flags Action"/>
@ -682,7 +682,7 @@
<field name="Depth Offset Factor" size="16" start="0" type="f187"/>
</packet>
<packet name="Clip Window" code="107">
<packet shortname="clip" name="clip_window" code="107">
<field name="Clip Window Height in pixels" size="16" start="48" type="uint"/>
<field name="Clip Window Width in pixels" size="16" start="32" type="uint"/>
<field name="Clip Window Bottom Pixel Coordinate" size="16" start="16" type="uint"/>
@ -701,17 +701,17 @@
<field name="Viewport Centre X-coordinate" size="22" start="0" type="s14.8"/>
</packet>
<packet name="Clipper Z min/max clipping planes" code="109">
<packet shortname="clipz" name="Clipper Z min/max clipping planes" code="109">
<field name="Maximum Zw" size="32" start="32" type="float"/>
<field name="Minimum Zw" size="32" start="0" type="float"/>
</packet>
<packet name="Clipper XY Scaling" code="110" cl="B">
<packet shortname="clipper_xy" name="Clipper XY Scaling" code="110" cl="B">
<field name="Viewport Half-Height in 1/256th of pixel" size="32" start="32" type="float"/>
<field name="Viewport Half-Width in 1/256th of pixel" size="32" start="0" type="float"/>
</packet>
<packet name="Clipper Z Scale and Offset" code="111" cl="B">
<packet shortname="clipper_z" name="Clipper Z Scale and Offset" code="111" cl="B">
<field name="Viewport Z Offset (Zc to Zs)" size="32" start="32" type="float"/>
<field name="Viewport Z Scale (Zc to Zs)" size="32" start="0" type="float"/>
</packet>
@ -973,7 +973,7 @@
<field name="sub-id" size="4" start="0" type="uint" default="5"/>
</packet>
<packet code="124" name="Tile Coordinates">
<packet code="124" shortname="tile_coords" name="Tile Coordinates">
<field name="tile row number" size="12" start="12" type="uint"/>
<field name="tile column number" size="12" start="0" type="uint"/>
</packet>
@ -993,13 +993,13 @@
<field name="Supertile Width in Tiles" size="8" start="0" type="uint" minus_one="true"/>
</packet>
<packet code="123" name="Multicore Rendering Tile List Set Base" cl="R">
<packet code="123" shortname="multicore_rendering_tile_list_base" name="Multicore Rendering Tile List Set Base" cl="R">
<field name="address" size="26" start="6" type="address"/>
<field name="Tile List Set Number" size="4" start="0" type="uint"/>
</packet>
<!-- add fields -->
<packet code="125" name="Tile Coordinates Implicit"/>
<packet code="125" shortname="implicit_tile_coords" name="Tile Coordinates Implicit"/>
<packet code="126" name="Tile List Initial Block Size">
<field name="Use auto-chained tile lists" size="1" start="2" type="bool"/>

View File

@ -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) {