asahi: Identify pixel stride
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Sat, 17 Sep 2022 20:53:16 +0000 (16:53 -0400)
committerAlyssa Rosenzweig <alyssa@rosenzweig.io>
Sun, 18 Sep 2022 14:34:37 +0000 (10:34 -0400)
Number of bytes in a pixel in the tilebuffer, does not depend on the
tile size.

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

src/asahi/lib/cmdbuf.xml
src/gallium/drivers/asahi/agx_state.c

index c9b2564..1791f07 100644 (file)
   <struct name="USC Shared" size="4">
     <field name="Tag" size="8" start="0" type="USC Control" default="Shared"/>
     <field name="Uses shared memory" size="1" start="8" type="bool"/>
-    <field name="Unk 1" size="16" start="8" type="hex" default="0x90"/>
+    <field name="Unk 1" size="12" start="8" type="hex" default="0x48"/>
+    <field name="Pixel stride in 8 bytes" size="4" start="20" type="uint"/>
     <field name="Shared memory per threadgroup in 256 bytes" size="8" start="24" type="uint"/>
   </struct>
 
index 7a324d8..790098f 100644 (file)
@@ -1321,7 +1321,8 @@ agx_build_pipeline(struct agx_context *ctx, struct agx_compiled_shader *cs, enum
    agx_usc_pack(&b, SHARED, cfg) {
       if (stage == PIPE_SHADER_FRAGMENT) {
          cfg.uses_shared_memory = true;
-         cfg.unk_1 = 0x10bc;
+         cfg.unk_1 = 0xbc;
+         cfg.pixel_stride_in_8_bytes = 1;
          cfg.shared_memory_per_threadgroup_in_256_bytes = 32;
       } else {
          cfg.unk_1 = 0x90;
@@ -1368,7 +1369,8 @@ agx_build_clear_pipeline(struct agx_context *ctx, uint32_t code, uint64_t clear_
 
    agx_usc_pack(&b, SHARED, cfg) {
       cfg.uses_shared_memory = true;
-      cfg.unk_1 = 0x10bc;
+      cfg.unk_1 = 0xbc;
+      cfg.pixel_stride_in_8_bytes = 1;
       cfg.shared_memory_per_threadgroup_in_256_bytes = 32;
    }
 
@@ -1448,7 +1450,8 @@ agx_build_reload_pipeline(struct agx_context *ctx, uint32_t code, struct pipe_su
 
    agx_usc_pack(&b, SHARED, cfg) {
       cfg.uses_shared_memory = true;
-      cfg.unk_1 = 0x10bc;
+      cfg.unk_1 = 0xbc;
+      cfg.pixel_stride_in_8_bytes = 1;
       cfg.shared_memory_per_threadgroup_in_256_bytes = 32;
    }
 
@@ -1486,7 +1489,8 @@ agx_build_store_pipeline(struct agx_context *ctx, uint32_t code,
 
    agx_usc_pack(&b, SHARED, cfg) {
       cfg.uses_shared_memory = true;
-      cfg.unk_1 = 0x10bc;
+      cfg.unk_1 = 0xbc;
+      cfg.pixel_stride_in_8_bytes = 1;
       cfg.shared_memory_per_threadgroup_in_256_bytes = 32;
    }