asahi: Identify IOGPU_MISC data structure
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Mon, 21 Feb 2022 18:09:36 +0000 (13:09 -0500)
committerMarge Bot <emma+marge@anholt.net>
Tue, 22 Mar 2022 00:19:29 +0000 (00:19 +0000)
This will be elaborated upon soon.

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 92b1970..ab74bc7 100644 (file)
     <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>
index c87f5cc..562bfc6 100644 (file)
@@ -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];
index f3a7205..dde2504 100644 (file)
@@ -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);