asahi: Fix Indexed Draw command

Add the missing stub in the decoder for it, so we can decode indexed
draws instead of reading back garbage, and fill in some known unknowns
in the structure.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18380>
This commit is contained in:
Alyssa Rosenzweig 2022-09-01 18:20:38 -04:00 committed by Marge Bot
parent 10c9aceadf
commit 5f57fe0bc9
3 changed files with 9 additions and 6 deletions

View file

@ -540,15 +540,15 @@
<struct name="Indexed draw" size="32">
<field name="Unk 1" size="8" start="0:0" type="hex" default="0x1"/>
<field name="Command" size="24" start="0:8" type="hex" default="0x400000"/>
<field name="Command" size="8" start="0:24" type="hex" default="0x40"/>
<field name="Restart index" size="32" start="1:0" type="hex"/>
<field name="Unk 2a" size="8" start="2:0" type="hex" default="0x15"/>
<field name="Primitive" size="8" start="2:8" type="Primitive"/>
<field name="Restart enable" size="1" start="2:16" type="bool"/> <!-- Metal sets this bit for strips -->
<field name="Index size" size="3" start="2:17" type="Index size"/>
<field name="Unk 2c" size="4" start="2:20" type="hex" default="0xF"/>
<field name="Unk 2d" size="8" start="2:24" type="hex" default="0x61"/>
<field name="Index buffer offset" size="32" start="3:0" type="hex"/>
<field name="Draw Command" size="8" start="2:24" type="hex" default="0x61"/>
<field name="Index buffer lo" size="32" start="3:0" type="hex"/>
<field name="Index buffer hi" size="8" start="2:0" type="hex"/>
<field name="Index count" size="32" start="4:0" type="uint"/>
<field name="Instance count" size="32" start="5:0" type="uint"/>
<field name="Base vertex" size="32" start="6:0" type="uint"/>

View file

@ -465,6 +465,9 @@ agxdecode_cmd(const uint8_t *map, bool verbose)
agxdecode_stateful(cmd.pipeline, "Pipeline", agxdecode_pipeline, verbose);
DUMP_UNPACKED(BIND_VERTEX_PIPELINE, cmd, "Bind vertex pipeline\n");
return AGX_BIND_VERTEX_PIPELINE_LENGTH;
} else if (map[3] == 0x40) {
DUMP_CL(INDEXED_DRAW, map, "Indexed Draw");
return AGX_INDEXED_DRAW_LENGTH;
} else if (map[3] == 0x61) {
DUMP_CL(DRAW, map, "Draw");
return AGX_DRAW_LENGTH;

View file

@ -1747,11 +1747,11 @@ agx_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info,
agx_pack(out, INDEXED_DRAW, cfg) {
cfg.restart_index = info->restart_index;
cfg.unk_2a = (ib >> 32);
cfg.primitive = prim;
cfg.restart_enable = info->primitive_restart;
cfg.index_size = __builtin_ctz(idx_size);
cfg.index_buffer_offset = (ib & BITFIELD_MASK(32));
cfg.index_buffer_lo = (ib & BITFIELD_MASK(32));
cfg.index_buffer_hi = (ib >> 32);
cfg.index_buffer_size = ALIGN_POT(draws->count * idx_size, 4);
cfg.index_count = draws->count;
cfg.instance_count = info->instance_count;