Skip to content

Commit

Permalink
tools: No C generation for initial pad
Browse files Browse the repository at this point in the history
Signed-off-by: Wladimir J. van der Laan <laanwj@gmail.com>
  • Loading branch information
laanwj committed Oct 12, 2017
1 parent 7d330dd commit 6ede0f3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 9 additions & 2 deletions tools/etnaviv/parse_command_buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
19: 0, # SNAP_PAGES
}

PLO_CMD = -1
PLO_PAD = -2
PLO_INITIAL_PAD = -3

def parse_command_buffer(buffer_words, cmdstream_info, initial_padding=CMDBUF_IGNORE_INITIAL):
'''
Parse Vivante command buffer contents, return a sequence of
Expand All @@ -45,7 +49,7 @@ def parse_command_buffer(buffer_words, cmdstream_info, initial_padding=CMDBUF_IG
for value in buffer_words:
state_info = None
if ptr >= next_cmd:
payload_ofs = -1
payload_ofs = PLO_CMD
op = value >> 27
payload_start_ptr = payload_end_ptr = ptr + 1
try:
Expand Down Expand Up @@ -87,7 +91,10 @@ def parse_command_buffer(buffer_words, cmdstream_info, initial_padding=CMDBUF_IG
desc = ' ' + opinfo[-1][0].name + ' ' + opinfo[-1][0].describe(value)
else:
desc = "PAD"
payload_ofs = -2 # padding
if ptr < initial_padding:
payload_ofs = PLO_INITIAL_PAD # initial padding
else:
payload_ofs = PLO_PAD # padding
yield CommandInfo(ptr, value, op, payload_ofs, desc, state_info)
ptr += 1

Expand Down
4 changes: 4 additions & 0 deletions tools/etnaviv/rng_describe_c.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from etnaviv.parse_rng import BitField, BaseType, Enum, BitSet, Domain
from etnaviv.parse_command_buffer import PLO_INITIAL_PAD

def format_path_c(path, only_prefix=False):
'''Format path into state space as C string'''
Expand Down Expand Up @@ -58,6 +59,9 @@ def _format_addr_default(x):
def dump_command_buffer_c(f, recs, state_map, format_addr=_format_addr_default):
'''Dump parsed command buffer as C'''
for rec in recs:
if rec.payload_ofs == PLO_INITIAL_PAD:
continue

if rec.state_info is not None:
try:
path = [(state_map,None)] + state_map.lookup_address(rec.state_info.pos)
Expand Down

0 comments on commit 6ede0f3

Please sign in to comment.