From 5f57fe0bc93c587ba6ac646670a675d61d5d107f Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 1 Sep 2022 18:20:38 -0400 Subject: [PATCH] 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 Part-of: --- src/asahi/lib/cmdbuf.xml | 8 ++++---- src/asahi/lib/decode.c | 3 +++ src/gallium/drivers/asahi/agx_state.c | 4 ++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/asahi/lib/cmdbuf.xml b/src/asahi/lib/cmdbuf.xml index 3bb7a266775..de199124fb5 100644 --- a/src/asahi/lib/cmdbuf.xml +++ b/src/asahi/lib/cmdbuf.xml @@ -540,15 +540,15 @@ - + - - - + + + diff --git a/src/asahi/lib/decode.c b/src/asahi/lib/decode.c index 3b9ead210b9..80a35e2c20e 100644 --- a/src/asahi/lib/decode.c +++ b/src/asahi/lib/decode.c @@ -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; diff --git a/src/gallium/drivers/asahi/agx_state.c b/src/gallium/drivers/asahi/agx_state.c index 02d1237540c..514346bd712 100644 --- a/src/gallium/drivers/asahi/agx_state.c +++ b/src/gallium/drivers/asahi/agx_state.c @@ -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;