Module: Mesa Branch: main Commit: f5ae88d36f8fe6a7e105624d773c536e2cefa35f URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f5ae88d36f8fe6a7e105624d773c536e2cefa35f
Author: Alyssa Rosenzweig <[email protected]> Date: Mon Feb 21 13:09:36 2022 -0500 asahi: Identify IOGPU_MISC data structure This will be elaborated upon soon. Signed-off-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15482> --- src/asahi/lib/cmdbuf.xml | 22 ++++++++++++++++++++++ src/asahi/lib/decode.c | 1 + src/gallium/drivers/asahi/magic.c | 27 +++++++-------------------- 3 files changed, 30 insertions(+), 20 deletions(-) diff --git a/src/asahi/lib/cmdbuf.xml b/src/asahi/lib/cmdbuf.xml index 92b1970131c..ab74bc79162 100644 --- a/src/asahi/lib/cmdbuf.xml +++ b/src/asahi/lib/cmdbuf.xml @@ -597,4 +597,26 @@ <field name="Z16 Unorm attachment" start="7:8" size="1" type="bool"/> </struct> + <struct name="IOGPU Misc" size="256"> + <field name="Stencil buffer" start="0:0" size="64" type="address"/> + <field name="Stencil acceleration buffer" start="2:0" size="64" type="address"/> + <!-- maybe only set when doing a depth clear? --> + <field name="Unk 8:0" start="8:0" size="32" default="0x1" type="hex"/> + <field name="Unk 16:0" start="16:0" size="32" default="0x1c" type="hex"/> + <field name="Encoder ID" start="18:0" size="32" type="hex"/> + <!-- top bit maybe only set with a depth clear? --> + <field name="Unk 21:0" start="21:0" size="64" default="0x1ffffffff" type="hex"/> + <field name="Unknown buffer" start="26:0" size="64" type="address"/> + <field name="Width" start="30:0" size="32" type="uint"/> + <field name="Height" start="31:0" size="32" type="uint"/> + <field name="Unk 32:0" start="32:0" size="32" default="1" type="uint"/> + <field name="Unk 33:0" start="33:0" size="32" default="8" type="uint"/> + <field name="Unk 34:0" start="34:0" size="32" default="8" type="uint"/> + <field name="Unk 49:0" start="49:0" size="32" default="8" type="uint"/> + <field name="Unk 50:0" start="50:0" size="32" default="32" type="uint"/> + <field name="Unk 51:0" start="51:0" size="32" default="32" type="uint"/> + <field name="Unk 52:0" start="52:0" size="32" default="1" type="uint"/> + <field name="Unk 56:0" start="56:0" size="32" default="1" type="uint"/> + </struct> + </agxml> diff --git a/src/asahi/lib/decode.c b/src/asahi/lib/decode.c index c87f5cc2d19..562bfc6b634 100644 --- a/src/asahi/lib/decode.c +++ b/src/asahi/lib/decode.c @@ -446,6 +446,7 @@ agxdecode_cmdstream(unsigned cmdbuf_handle, unsigned map_handle, bool verbose) DUMP_CL(IOGPU_INTERNAL_PIPELINES, ((uint32_t *) cmdbuf->ptr.cpu) + 156, "Internal pipelines"); DUMP_CL(IOGPU_AUX_FRAMEBUFFER, ((uint32_t *) cmdbuf->ptr.cpu) + 220, "Aux Framebuffer"); DUMP_CL(IOGPU_CLEAR_Z_S, ((uint32_t *) cmdbuf->ptr.cpu) + 276, "Clear Z/S"); + DUMP_CL(IOGPU_MISC, ((uint32_t *) cmdbuf->ptr.cpu) + 344, "Misc"); uint32_t *attachments = (uint32_t *) ((uint8_t *) cmdbuf->ptr.cpu + cmd.attachment_offset_1); unsigned attachment_count = attachments[3]; diff --git a/src/gallium/drivers/asahi/magic.c b/src/gallium/drivers/asahi/magic.c index f3a72051423..dde2504932f 100644 --- a/src/gallium/drivers/asahi/magic.c +++ b/src/gallium/drivers/asahi/magic.c @@ -109,26 +109,13 @@ demo_cmdbuf(uint64_t *buf, size_t size, map[300] = pipeline_null | 0x4; map[305] = 0x12; map[306] = pipeline_store | 0x4; - map[352] = 1; - map[360] = 0x1c; - map[362] = encoder_id; - map[365] = 0xffffffff; - map[366] = 1; - - uint64_t unk6 = demo_unk6(pool); - map[370] = unk6 & 0xFFFFFFFF; - map[371] = unk6 >> 32; - - map[374] = width; - map[375] = height; - map[376] = 1; - map[377] = 8; - map[378] = 8; - - map[393] = 8; - map[394] = 32; - map[395] = 32; - map[396] = 1; + + agx_pack(map + 344, IOGPU_MISC, cfg) { + cfg.encoder_id = encoder_id; + cfg.unknown_buffer = demo_unk6(pool); + cfg.width = width; + cfg.height = height; + } unsigned offset_unk = (458 * 4); unsigned offset_attachments = (470 * 4);
