Mesa (main): asahi: Move IOGPU header to XML

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jul 6 13:55:47 UTC 2021


Module: Mesa
Branch: main
Commit: c1d8ed1bc213bac4db9bf77c880c648f1e074a4a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c1d8ed1bc213bac4db9bf77c880c648f1e074a4a

Author: Alyssa Rosenzweig <alyssa at rosenzweig.io>
Date:   Mon Jul  5 19:45:41 2021 -0400

asahi: Move IOGPU header to XML

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

---

 src/asahi/lib/cmdbuf.xml          | 10 ++++++++++
 src/gallium/drivers/asahi/magic.c | 13 ++++++-------
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/src/asahi/lib/cmdbuf.xml b/src/asahi/lib/cmdbuf.xml
index 8ffae47b2d3..8398cf29181 100644
--- a/src/asahi/lib/cmdbuf.xml
+++ b/src/asahi/lib/cmdbuf.xml
@@ -465,6 +465,16 @@
     <value name="Depth" value="0xC"/>
   </enum>
 
+  <struct name="IOGPU Header" size="48">
+    <field name="Unk 0" start="0:0" size="32" default="0x10000" type="hex"/>
+    <field name="Total size" start="1:0" size="32" type="uint"/>
+    <field name="Unk 2" start="2:0" size="32" default="0x7" type="hex"/>
+    <field name="Attachment offset 1" start="8:0" size="32" type="uint"/>
+    <field name="Unk 3" start="9:0" size="32" default="0x18" type="hex"/>
+    <field name="Attachment offset 2" start="10:0" size="32" type="uint"/>
+    <field name="Unknown offset" start="11:0" size="32" type="uint"/>
+  </struct>
+
   <struct name="IOGPU Attachment" size="24">
     <field name="Unk 0" start="0:0" size="16" default="0x100" type="hex"/>
     <field name="Address" start="0:16" size="48" type="address"/>
diff --git a/src/gallium/drivers/asahi/magic.c b/src/gallium/drivers/asahi/magic.c
index e81c400cc17..fc575144298 100644
--- a/src/gallium/drivers/asahi/magic.c
+++ b/src/gallium/drivers/asahi/magic.c
@@ -242,13 +242,12 @@ demo_cmdbuf(uint64_t *buf, size_t size,
 
    unsigned total_size = (cmdbuf->offset * 4);
 
-   cmdbuf->map[0] = 0x10000;
-   cmdbuf->map[1] = total_size;
-   cmdbuf->map[2] = 7;
-   cmdbuf->map[8] = offset_attachments;
-   cmdbuf->map[9] = 0x18;
-   cmdbuf->map[10] = offset_attachments;
-   cmdbuf->map[11] = offset_unk;
+   agx_pack(cmdbuf->map, IOGPU_HEADER, cfg) {
+      cfg.total_size = total_size;
+      cfg.attachment_offset_1 = offset_attachments;
+      cfg.attachment_offset_2 = offset_attachments;
+      cfg.unknown_offset = offset_unk;
+   }
 
    return total_size;
 }



More information about the mesa-commit mailing list