ir3, freedreno, tu: Plumb through SP_FS_PREFETCH_CNTL::ENDOFQUAD
authorConnor Abbott <cwabbott0@gmail.com>
Fri, 4 Aug 2023 16:41:40 +0000 (18:41 +0200)
committerMarge Bot <emma+marge@anholt.net>
Thu, 10 Aug 2023 10:09:28 +0000 (10:09 +0000)
Add a flag but don't use it yet.

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

src/freedreno/ir3/ir3_shader.h
src/freedreno/vulkan/tu_pipeline.cc
src/gallium/drivers/freedreno/a6xx/fd6_program.cc

index 8720056..f356bc6 100644 (file)
@@ -732,6 +732,12 @@ struct ir3_shader_variant {
    uint32_t num_sampler_prefetch;
    struct ir3_sampler_prefetch sampler_prefetch[IR3_MAX_SAMPLER_PREFETCH];
 
+   /* If true, the last use of helper invocations is the texture prefetch and
+    * they should be disabled for the actual shader. Equivalent to adding
+    * (eq)nop at the beginning of the shader.
+    */
+   bool prefetch_end_of_quad;
+
    uint16_t local_size[3];
    bool local_size_variable;
 
index b9ef9de..7ef21d3 100644 (file)
@@ -1477,7 +1477,9 @@ tu6_emit_fs_inputs(struct tu_cs *cs, const struct ir3_shader_variant *fs)
    tu_cs_emit_pkt4(cs, REG_A6XX_SP_FS_PREFETCH_CNTL, 1 + fs->num_sampler_prefetch);
    tu_cs_emit(cs, A6XX_SP_FS_PREFETCH_CNTL_COUNT(fs->num_sampler_prefetch) |
                      COND(!VALIDREG(ij_regid[IJ_PERSP_PIXEL]),
-                          A6XX_SP_FS_PREFETCH_CNTL_IJ_WRITE_DISABLE));
+                          A6XX_SP_FS_PREFETCH_CNTL_IJ_WRITE_DISABLE) |
+                     COND(fs->prefetch_end_of_quad,
+                          A6XX_SP_FS_PREFETCH_CNTL_ENDOFQUAD));
    for (int i = 0; i < fs->num_sampler_prefetch; i++) {
       const struct ir3_sampler_prefetch *prefetch = &fs->sampler_prefetch[i];
       tu_cs_emit(cs, A6XX_SP_FS_PREFETCH_CMD_SRC(prefetch->src) |
index 836216a..39f4188 100644 (file)
@@ -553,7 +553,9 @@ setup_stateobj(struct fd_screen *screen, struct fd_ringbuffer *ring,
    OUT_PKT4(ring, REG_A6XX_SP_FS_PREFETCH_CNTL, 1 + fs->num_sampler_prefetch);
    OUT_RING(ring, A6XX_SP_FS_PREFETCH_CNTL_COUNT(fs->num_sampler_prefetch) |
                      COND(!VALIDREG(ij_regid[IJ_PERSP_PIXEL]),
-                          A6XX_SP_FS_PREFETCH_CNTL_IJ_WRITE_DISABLE));
+                          A6XX_SP_FS_PREFETCH_CNTL_IJ_WRITE_DISABLE) |
+                     COND(fs->prefetch_end_of_quad,
+                          A6XX_SP_FS_PREFETCH_CNTL_ENDOFQUAD));
    for (int i = 0; i < fs->num_sampler_prefetch; i++) {
       const struct ir3_sampler_prefetch *prefetch = &fs->sampler_prefetch[i];
       OUT_RING(ring, SP_FS_PREFETCH_CMD(