asahi: Identify shared memory fields

For compute kernels, this encodes how much workgroup-local memory is
used ("shared memory" or "threadgroup memory" or "local memory"). This
memory is partitioned by the hardware.

For fragment shaders, this... encodes exactly the same thing. There is
no traditional tilebuffer in AGX, instead local memory is interpreted as
an imageblock, where each workgroup is a tile. This is a nifty design.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18623>
This commit is contained in:
Alyssa Rosenzweig 2022-09-14 22:06:56 -04:00
parent 43ed48d169
commit 09cc736c42
2 changed files with 10 additions and 4 deletions

View file

@ -502,7 +502,9 @@
<struct name="Set shader" size="24">
<field name="Tag" size="8" start="0:0" type="hex" default="0x4d"/>
<field name="Unk 1" size="24" start="0:8" type="hex" default="0x90"/>
<field name="Uses shared memory" size="1" start="0:8" type="bool"/>
<field name="Unk 1" size="16" start="0:8" type="hex" default="0x90"/>
<field name="Shared memory per threadgroup in 256 bytes" size="8" start="0:24" type="uint"/>
<field name="Unk 2" size="8" start="1:0" type="hex" default="0x0d"/> <!-- TODO differs with stage -->
<!--- Seemingly texture count related?,
or number of registers in the preshader? 8 with <4 in the preshader,
@ -535,7 +537,9 @@
<struct name="Set shader extended" size="28">
<field name="Tag" size="8" start="0:0" type="hex" default="0x4d"/>
<field name="Unk 1" size="24" start="0:8" type="hex" default="0x2010bd"/>
<field name="Uses shared memory" size="1" start="0:8" type="bool"/>
<field name="Unk 1" size="16" start="0:8" type="hex" default="0x10bd"/>
<field name="Shared memory per threadgroup in 256 bytes" size="8" start="0:24" type="uint" default="0x20"/>
<field name="Unk 2" size="8" start="1:0" type="hex" default="0x0d"/>
<field name="Loads varyings" size="1" start="1:8" type="bool"/>
<field name="Unk 1 9" size="1" start="1:9" type="bool" default="0"/>

View file

@ -1279,7 +1279,8 @@ agx_build_pipeline(struct agx_context *ctx, struct agx_compiled_shader *cs, enum
cfg.code = cs->bo->ptr.gpu;
cfg.register_quadwords = 0;
cfg.unk_3 = 0x8d;
cfg.unk_1 = 0x2010bd;
cfg.unk_1 = 0x10bd;
cfg.shared_memory_per_threadgroup_in_256_bytes = 32;
cfg.unk_2 = 0x0d;
cfg.loads_varyings = true;
cfg.fragment_parameters.early_z_testing = !writes_sample_mask;
@ -1328,7 +1329,8 @@ agx_build_clear_pipeline(struct agx_context *ctx, uint32_t code, uint64_t clear_
/* TODO: Can we prepack this? */
agx_pack(record, SET_SHADER, cfg) {
cfg.code = code;
cfg.unk_1 = 0x2010bd;
cfg.unk_1 = 0x10bd;
cfg.shared_memory_per_threadgroup_in_256_bytes = 32;
cfg.unk_2 = 0x0d;
cfg.unk_3 = 0x8d;
cfg.register_quadwords = 1;