asahi: Correct alignment for USC Uniform packets

We only need 4 byte alignment, not 8 bytes. This isn't a big difference in
practice, but it probably reduces padding in some cases. More importantly, it
corrects our XML to match what the hardware actually does, which is great.
(There is exactly enough room for a 40-bit address with 4 byte alignment.)

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21118>
This commit is contained in:
Alyssa Rosenzweig 2023-02-03 22:02:34 -05:00 committed by Marge Bot
parent e4cb64c0e2
commit 231561d53a
2 changed files with 4 additions and 6 deletions

View file

@ -560,17 +560,15 @@
<struct name="USC Uniform" size="8">
<field name="Tag" size="8" start="0:0" type="USC Control" default="Uniform"/>
<field name="Start (halfs)" size="8" start="0:8" type="uint"/>
<!-- Exact split is unknown. -->
<field name="Size (halfs)" size="6" start="0:20" type="uint" modifier="groups(1)"/>
<field name="Buffer" size="36" start="0:27" type="address" modifier="shr(3)"/>
<field name="Buffer" size="38" start="0:26" type="address" modifier="shr(2)"/>
</struct>
<struct name="USC Uniform High" size="8">
<field name="Tag" size="8" start="0:0" type="USC Control" default="Uniform High"/>
<field name="Start (halfs)" size="8" start="0:8" type="uint"/>
<!-- Exact split is unknown. -->
<field name="Size (halfs)" size="6" start="0:20" type="uint" modifier="groups(1)"/>
<field name="Buffer" size="36" start="0:27" type="address" modifier="shr(3)"/>
<field name="Buffer" size="38" start="0:26" type="address" modifier="shr(2)"/>
</struct>
<struct name="USC Texture" size="8">

View file

@ -141,10 +141,10 @@ lay_out_uniforms(struct agx_compiled_shader *shader, struct state *state)
assert((shader->push_range_count < ARRAY_SIZE(shader->push)) &&
"AGX_MAX_PUSH_RANGES must be an upper bound");
/* Offsets must be aligned to 8 bytes, this may require pushing a
/* Offsets must be aligned to 4 bytes, this may require pushing a
* little more than intended (otherwise we would need extra copies)
*/
range_start = ROUND_DOWN_TO(range_start, 8 / 2);
range_start = ROUND_DOWN_TO(range_start, 4 / 2);
shader->push[shader->push_range_count++] = (struct agx_push_range){
.uniform = uniform,