turnip: use patchControlPoints for HS_INPUT_SIZE value
authorJonathan Marek <jonathan@marek.ca>
Tue, 14 Jul 2020 14:11:11 +0000 (10:11 -0400)
committerMarge Bot <eric+marge@anholt.net>
Mon, 27 Jul 2020 12:17:38 +0000 (12:17 +0000)
It should be calculated from patchControlPoints, not tcs_vertices_out.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5765>

src/freedreno/registers/a6xx.xml
src/freedreno/vulkan/tu_clear_blit.c
src/freedreno/vulkan/tu_cmd_buffer.c
src/freedreno/vulkan/tu_pipeline.c
src/freedreno/vulkan/tu_private.h
src/gallium/drivers/freedreno/a6xx/fd6_program.c

index 8f02c6f1296df25277fa8121897963511eabb791..1e7eefb1befd4646d4bd2a400b271a82890db2e9 100644 (file)
@@ -2765,8 +2765,8 @@ to upconvert to 32b float internally?
        <reg32 offset="0x9800" name="PC_TESS_NUM_VERTEX" low="0" high="5" type="uint"/>
 
        <!-- always 0x0 ? -->
-       <reg32 offset="0x9801" name="PC_UNKNOWN_9801">
-               <bitfield name="UNK0" low="0" high="10"/>
+       <reg32 offset="0x9801" name="PC_HS_INPUT_SIZE">
+               <bitfield name="SIZE" low="0" high="10"/>
                <bitfield name="UNK13" pos="13"/>
        </reg32>
 
index 486dc7db2847244dc9a112fd696415a4b3d99327..dc92cf43a21a46d11f0abfbe56e28d30c5926d82 100644 (file)
@@ -451,7 +451,7 @@ r3d_common(struct tu_cmd_buffer *cmd, struct tu_cs *cs, bool blit, uint32_t num_
    tu_cs_emit_regs(cs, A6XX_PC_PRIMITIVE_CNTL_0());
    tu_cs_emit_regs(cs, A6XX_VFD_CONTROL_0());
 
-   tu6_emit_vpc(cs, &vs, NULL, NULL, NULL, &fs);
+   tu6_emit_vpc(cs, &vs, NULL, NULL, NULL, &fs, 0);
 
    /* REPL_MODE for varying with RECTLIST (2 vertices only) */
    tu_cs_emit_regs(cs, A6XX_VPC_VARYING_INTERP_MODE(0, 0));
index 1c43b421b6abc50881f28e0da8469fce8e141f1f..7142ea53fb317405b1d0f3b55971bf51a39691c7 100644 (file)
@@ -816,7 +816,6 @@ tu6_init_hw(struct tu_cmd_buffer *cmd, struct tu_cs *cs)
 
    tu_cs_emit_regs(cs, A6XX_VPC_SO_DISABLE(true));
 
-   tu_cs_emit_write_reg(cs, REG_A6XX_PC_UNKNOWN_9801, 0);
    tu_cs_emit_write_reg(cs, REG_A6XX_PC_UNKNOWN_9980, 0);
 
    tu_cs_emit_write_reg(cs, REG_A6XX_PC_PRIMITIVE_CNTL_6, 0);
index 679e76fffa4b9ed52ff26167cb14192bc801a18c..20e9a4050d928c143f700fcdbfdb1afb655ffc31 100644 (file)
@@ -740,7 +740,8 @@ tu6_emit_vpc(struct tu_cs *cs,
              const struct ir3_shader_variant *hs,
              const struct ir3_shader_variant *ds,
              const struct ir3_shader_variant *gs,
-             const struct ir3_shader_variant *fs)
+             const struct ir3_shader_variant *fs,
+             uint32_t patch_control_points)
 {
    /* note: doesn't compile as static because of the array regs.. */
    const struct reg_config {
@@ -916,9 +917,8 @@ tu6_emit_vpc(struct tu_cs *cs,
       tu_cs_emit(cs, hs_info->tess.tcs_vertices_out);
 
       /* Total attribute slots in HS incoming patch. */
-      tu_cs_emit_pkt4(cs, REG_A6XX_PC_UNKNOWN_9801, 1);
-      tu_cs_emit(cs,
-            hs_info->tess.tcs_vertices_out * vs->output_size / 4);
+      tu_cs_emit_pkt4(cs, REG_A6XX_PC_HS_INPUT_SIZE, 1);
+      tu_cs_emit(cs, patch_control_points * vs->output_size / 4);
 
       tu_cs_emit_pkt4(cs, REG_A6XX_SP_HS_UNKNOWN_A831, 1);
       tu_cs_emit(cs, vs->output_size);
@@ -1371,6 +1371,8 @@ tu6_emit_program(struct tu_cs *cs,
    const struct ir3_shader_variant *gs = builder->variants[MESA_SHADER_GEOMETRY];
    const struct ir3_shader_variant *fs = builder->variants[MESA_SHADER_FRAGMENT];
    gl_shader_stage stage = MESA_SHADER_VERTEX;
+   uint32_t cps_per_patch = builder->create_info->pTessellationState ?
+      builder->create_info->pTessellationState->patchControlPoints : 0;
 
    STATIC_ASSERT(MESA_SHADER_VERTEX == 0);
 
@@ -1403,7 +1405,7 @@ tu6_emit_program(struct tu_cs *cs,
    tu_cs_emit_pkt4(cs, REG_A6XX_SP_HS_UNKNOWN_A831, 1);
    tu_cs_emit(cs, 0);
 
-   tu6_emit_vpc(cs, vs, hs, ds, gs, fs);
+   tu6_emit_vpc(cs, vs, hs, ds, gs, fs, cps_per_patch);
    tu6_emit_vpc_varying_modes(cs, fs);
 
    if (fs) {
@@ -1423,8 +1425,6 @@ tu6_emit_program(struct tu_cs *cs,
    }
 
    if (gs || hs) {
-      uint32_t cps_per_patch = builder->create_info->pTessellationState ?
-            builder->create_info->pTessellationState->patchControlPoints : 0;
       tu6_emit_geom_tess_consts(cs, vs, hs, ds, gs, cps_per_patch);
    }
 }
index ff55e379a02afe68d873e03acbc0b5902b3ea3cb..a387afb5a474ed49acda57f846d04c1b72d4fc33 100644 (file)
@@ -1188,7 +1188,8 @@ tu6_emit_vpc(struct tu_cs *cs,
              const struct ir3_shader_variant *hs,
              const struct ir3_shader_variant *ds,
              const struct ir3_shader_variant *gs,
-             const struct ir3_shader_variant *fs);
+             const struct ir3_shader_variant *fs,
+             uint32_t patch_control_points);
 
 void
 tu6_emit_fs_inputs(struct tu_cs *cs, const struct ir3_shader_variant *fs);
index fb547560c44348898b6a851b456e92b0bc81087a..973086ddd00cd8436ef7fdf171910e59bbb62cac 100644 (file)
@@ -565,7 +565,7 @@ setup_stateobj(struct fd_ringbuffer *ring, struct fd_screen *screen,
                OUT_RING(ring, hs_info->tess.tcs_vertices_out);
 
                /* Total attribute slots in HS incoming patch. */
-               OUT_PKT4(ring, REG_A6XX_PC_UNKNOWN_9801, 1);
+               OUT_PKT4(ring, REG_A6XX_PC_HS_INPUT_SIZE, 1);
                OUT_RING(ring, hs_info->tess.tcs_vertices_out * vs->output_size / 4);
 
                OUT_PKT4(ring, REG_A6XX_SP_HS_UNKNOWN_A831, 1);