Module: Mesa Branch: main Commit: 535f1c1166bdf7e12a603cfec3f9c846e34288d2 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=535f1c1166bdf7e12a603cfec3f9c846e34288d2
Author: Alyssa Rosenzweig <[email protected]> Date: Mon Feb 21 11:41:39 2022 -0500 asahi: Identify IOGPU Clear Z/S structure Not sure on the details yet but identify and dump the data structure to start. Signed-off-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15482> --- src/asahi/lib/cmdbuf.xml | 10 ++++++++++ src/asahi/lib/decode.c | 2 ++ src/gallium/drivers/asahi/magic.c | 10 +++++----- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/asahi/lib/cmdbuf.xml b/src/asahi/lib/cmdbuf.xml index 8de70aba2f5..0eeb47ac2da 100644 --- a/src/asahi/lib/cmdbuf.xml +++ b/src/asahi/lib/cmdbuf.xml @@ -546,4 +546,14 @@ in a decimal percentage [0, 100] <field name="Percent" start="5:16" --> <field name="Percent" start="5:16" size="16" type="uint"/> </struct> + + <struct name="IOGPU Clear Z/S" size="32"> + <!-- Encoded like the depth attachment --> + <field name="Depth clear value" start="2:0" size="32" type="hex"/> + <field name="Stencil clear value" start="3:0" size="8" type="uint"/> + <field name="Unk 1" start="3:8" size="8" type="hex" default="3"/> + <field name="Unk 2" start="5:8" size="8" type="hex" default="1"/> + <field name="Z16 Unorm attachment" start="7:8" size="1" type="bool"/> + </struct> + </agxml> diff --git a/src/asahi/lib/decode.c b/src/asahi/lib/decode.c index 217aaab6b9c..fa033c54850 100644 --- a/src/asahi/lib/decode.c +++ b/src/asahi/lib/decode.c @@ -443,6 +443,8 @@ agxdecode_cmdstream(unsigned cmdbuf_handle, unsigned map_handle, bool verbose) DUMP_UNPACKED(IOGPU_HEADER, cmd, "IOGPU Header\n"); assert(cmd.attachment_offset_1 == cmd.attachment_offset_2); + DUMP_CL(IOGPU_CLEAR_Z_S, ((uint32_t *) cmdbuf->ptr.cpu) + 276, "Clear Z/S"); + uint32_t *attachments = (uint32_t *) ((uint8_t *) cmdbuf->ptr.cpu + cmd.attachment_offset_1); unsigned attachment_count = attachments[3]; for (unsigned i = 0; i < attachment_count; ++i) { diff --git a/src/gallium/drivers/asahi/magic.c b/src/gallium/drivers/asahi/magic.c index 2c48bcaafe5..0452f2db064 100644 --- a/src/gallium/drivers/asahi/magic.c +++ b/src/gallium/drivers/asahi/magic.c @@ -96,12 +96,12 @@ demo_cmdbuf(uint64_t *buf, size_t size, map[226] = unk_buffer_2 & 0xFFFFFFFF; map[227] = unk_buffer_2 >> 32; - float depth_clear = 1.0; - uint8_t stencil_clear = 0; + agx_pack(map + 276, IOGPU_CLEAR_Z_S, cfg) { + cfg.depth_clear_value = fui(1.0); // 32-bit float + cfg.stencil_clear_value = 0; + cfg.z16_unorm_attachment = false; + } - map[278] = fui(depth_clear); - map[279] = (0x3 << 8) | stencil_clear; - map[282] = 0x1000000; map[284] = 0xffffffff; map[285] = 0xffffffff; map[286] = 0xffffffff;
