asahi: Identify IOGPU Clear Z/S structure
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Mon, 21 Feb 2022 16:41:39 +0000 (11:41 -0500)
committerMarge Bot <emma+marge@anholt.net>
Tue, 22 Mar 2022 00:19:29 +0000 (00:19 +0000)
Not sure on the details yet but identify and dump the data structure to start.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15482>

src/asahi/lib/cmdbuf.xml
src/asahi/lib/decode.c
src/gallium/drivers/asahi/magic.c

index 8de70ab..0eeb47a 100644 (file)
          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>
index 217aaab..fa033c5 100644 (file)
@@ -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) {
index 2c48bca..0452f2d 100644 (file)
@@ -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;