freedreno/a6xx: Add some documentation for shared consts
authorConnor Abbott <cwabbott0@gmail.com>
Mon, 13 Jul 2020 10:51:43 +0000 (12:51 +0200)
committerConnor Abbott <cwabbott0@gmail.com>
Tue, 14 Jul 2020 08:23:58 +0000 (10:23 +0200)
I'm not convinced we'll actually want to use this, and there may be
another enable bit in SP_UNKNOWN_AB00, but it's nice to at least write
this down in case we want to try using it in the future.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5877>

src/freedreno/registers/a6xx.xml
src/freedreno/vulkan/tu_cmd_buffer.c
src/gallium/drivers/freedreno/a6xx/fd6_emit.c

index f821832ba0697bf1f2ee4a3cdbe2db4c1fa48a8e..96415c17f6df7023da9cfdb55e3fe7d8f80fda89 100644 (file)
@@ -3426,6 +3426,7 @@ to upconvert to 32b float internally?
                <bitfield name="CS_IBO" pos="6" type="boolean"/>
                <bitfield name="GFX_IBO" pos="7" type="boolean"/>
 
+               <!-- Note: these only do something when HLSQ_SHARED_CONSTS is set to 1 -->
                <bitfield name="CS_SHARED_CONST" pos="19" type="boolean"/>
                <bitfield name="GFX_SHARED_CONST" pos="8" type="boolean"/>
 
@@ -3436,8 +3437,27 @@ to upconvert to 32b float internally?
 
        <reg32 offset="0xbb10" name="HLSQ_FS_CNTL" type="a6xx_hlsq_xs_cntl"/>
 
-       <!-- always 0x0 ? -->
-       <reg32 offset="0xbb11" name="HLSQ_UNKNOWN_BB11"/>
+       <reg32 offset="0xbb11" name="HLSQ_SHARED_CONSTS">
+               <doc>
+                       Shared constants are intended to be used for Vulkan push
+                       constants. When enabled, 8 vec4's are reserved in the FS
+                       const pool and 16 in the geometry const pool although
+                       only 8 are actually used (why?) and they are mapped to
+                       c504-c511 in each stage. Both VS and FS shared consts
+                       are written using ST6_CONSTANTS/SB6_IBO, so that both
+                       the geometry and FS shared consts can be written at once
+                       by using CP_LOAD_STATE6 rather than
+                       CP_LOAD_STATE6_FRAG/CP_LOAD_STATE6_GEOM. In addition
+                       DST_OFF and NUM_UNIT are in units of dwords instead of
+                       vec4's.
+
+                       There is also a separate shared constant pool for CS,
+                       which is loaded through CP_LOAD_STATE6_FRAG with
+                       ST6_UBO/ST6_IBO. However the only real difference for CS
+                       is the dword units.
+               </doc>
+               <bitfield name="ENABLE" pos="0" type="boolean"/>
+       </reg32>
 
        <!-- mirror of SP_BINDLESS_BASE -->
        <array offset="0xbb20" name="HLSQ_BINDLESS_BASE" stride="2" length="5">
index d1145bfb13e1953dcbc33122b17f60559d609e68..8fe404b5e5ce66ee1f32a3feb55b37e63d726b00 100644 (file)
@@ -751,7 +751,7 @@ tu6_init_hw(struct tu_cmd_buffer *cmd, struct tu_cs *cs)
    tu_cs_emit_write_reg(cs, REG_A6XX_SP_UNKNOWN_AE03, 0x00000410);
    tu_cs_emit_write_reg(cs, REG_A6XX_SP_IBO_COUNT, 0);
    tu_cs_emit_write_reg(cs, REG_A6XX_SP_UNKNOWN_B182, 0);
-   tu_cs_emit_write_reg(cs, REG_A6XX_HLSQ_UNKNOWN_BB11, 0);
+   tu_cs_emit_write_reg(cs, REG_A6XX_HLSQ_SHARED_CONSTS, 0);
    tu_cs_emit_write_reg(cs, REG_A6XX_UCHE_UNKNOWN_0E12, 0x3200000);
    tu_cs_emit_write_reg(cs, REG_A6XX_UCHE_CLIENT_PF, 4);
    tu_cs_emit_write_reg(cs, REG_A6XX_RB_UNKNOWN_8E01, 0x0);
index 4740f60ab45a409d010103eae811cccfb58a329a..cf224178ca8c47eae52c373c3d756c86a4be1fc7 100644 (file)
@@ -1162,7 +1162,7 @@ fd6_emit_restore(struct fd_batch *batch, struct fd_ringbuffer *ring)
        WRITE(REG_A6XX_SP_UNKNOWN_AE03, 0x1430);
        WRITE(REG_A6XX_SP_IBO_COUNT, 0);
        WRITE(REG_A6XX_SP_UNKNOWN_B182, 0);
-       WRITE(REG_A6XX_HLSQ_UNKNOWN_BB11, 0);
+       WRITE(REG_A6XX_HLSQ_SHARED_CONSTS, 0);
        WRITE(REG_A6XX_UCHE_UNKNOWN_0E12, 0x3200000);
        WRITE(REG_A6XX_UCHE_CLIENT_PF, 4);
        WRITE(REG_A6XX_RB_UNKNOWN_8E01, 0x1);