freedreno: a2xx: fix VERTEX_REUSE/DEALLOC on a20x
authorJonathan Marek <jonathan@marek.ca>
Tue, 18 Dec 2018 23:11:04 +0000 (18:11 -0500)
committerRob Clark <robdclark@gmail.com>
Mon, 21 Jan 2019 14:22:22 +0000 (09:22 -0500)
On a20x, set VGT_VERTEX_REUSE_BLOCK_CNTL to 2 and don't change it. Small
rearrangement on a220 to reduce the size of draw commands.

Only set DEALLOC_CNTL on a20x because the correct a220 value is not known.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Rob Clark <robdclark@gmail.com>
src/gallium/drivers/freedreno/a2xx/fd2_draw.c
src/gallium/drivers/freedreno/a2xx/fd2_emit.c
src/gallium/drivers/freedreno/a2xx/fd2_gmem.c

index 81137705180ff8390276c072c3f1597a1c1a036b..00381df503487fb1383600a0ba8c31d3125e0640 100644 (file)
@@ -85,10 +85,6 @@ draw_impl(struct fd_context *ctx, const struct pipe_draw_info *info,
        OUT_RING(ring, CP_REG(REG_A2XX_VGT_INDX_OFFSET));
        OUT_RING(ring, info->index_size ? 0 : info->start);
 
-       OUT_PKT3(ring, CP_SET_CONSTANT, 2);
-       OUT_RING(ring, CP_REG(REG_A2XX_VGT_VERTEX_REUSE_BLOCK_CNTL));
-       OUT_RING(ring, is_a20x(ctx->screen) ? 0x00000002 : 0x0000003b);
-
        OUT_PKT0(ring, REG_A2XX_TC_CNTL_STATUS, 1);
        OUT_RING(ring, A2XX_TC_CNTL_STATUS_L2_INVALIDATE);
 
@@ -214,9 +210,11 @@ fd2_clear(struct fd_context *ctx, unsigned buffers,
        OUT_RING(ring, CP_REG(REG_A2XX_VGT_INDX_OFFSET));
        OUT_RING(ring, 0);
 
-       OUT_PKT3(ring, CP_SET_CONSTANT, 2);
-       OUT_RING(ring, CP_REG(REG_A2XX_VGT_VERTEX_REUSE_BLOCK_CNTL));
-       OUT_RING(ring, 0x0000028f);
+       if (!is_a20x(ctx->screen)) {
+               OUT_PKT3(ring, CP_SET_CONSTANT, 2);
+               OUT_RING(ring, CP_REG(REG_A2XX_VGT_VERTEX_REUSE_BLOCK_CNTL));
+               OUT_RING(ring, 0x0000028f);
+       }
 
        fd2_program_emit(ring, &ctx->solid_prog);
 
@@ -357,6 +355,12 @@ fd2_clear(struct fd_context *ctx, unsigned buffers,
        OUT_RING(ring, CP_REG(REG_A2XX_RB_COPY_CONTROL));
        OUT_RING(ring, 0x00000000);
 
+       if (!is_a20x(ctx->screen)) {
+               OUT_PKT3(ring, CP_SET_CONSTANT, 2);
+               OUT_RING(ring, CP_REG(REG_A2XX_VGT_VERTEX_REUSE_BLOCK_CNTL));
+               OUT_RING(ring, 0x0000003b);
+       }
+
        ctx->dirty |= FD_DIRTY_ZSA |
                        FD_DIRTY_VIEWPORT |
                        FD_DIRTY_RASTERIZER |
index 7dcd31cbcbd2cbc18134d191907f09973cfdffd9..ce275a78a6147abca10cb6198476fbf7d934a05b 100644 (file)
@@ -341,6 +341,18 @@ fd2_emit_restore(struct fd_context *ctx, struct fd_ringbuffer *ring)
                OUT_PKT3(ring, CP_SET_CONSTANT, 2);
                OUT_RING(ring, CP_REG(REG_A2XX_PA_SC_VIZ_QUERY));
                OUT_RING(ring, A2XX_PA_SC_VIZ_QUERY_VIZ_QUERY_ID(16));
+
+               OUT_PKT3(ring, CP_SET_CONSTANT, 2);
+               OUT_RING(ring, CP_REG(REG_A2XX_VGT_VERTEX_REUSE_BLOCK_CNTL));
+               OUT_RING(ring, 0x00000002);
+
+               OUT_PKT3(ring, CP_SET_CONSTANT, 2);
+               OUT_RING(ring, CP_REG(REG_A2XX_VGT_OUT_DEALLOC_CNTL));
+               OUT_RING(ring, 0x00000002);
+       } else {
+               OUT_PKT3(ring, CP_SET_CONSTANT, 2);
+               OUT_RING(ring, CP_REG(REG_A2XX_VGT_VERTEX_REUSE_BLOCK_CNTL));
+               OUT_RING(ring, 0x0000003b);
        }
 
        OUT_PKT0(ring, REG_A2XX_TP0_CHICKEN, 1);
@@ -368,10 +380,6 @@ fd2_emit_restore(struct fd_context *ctx, struct fd_ringbuffer *ring)
        OUT_RING(ring, CP_REG(REG_A2XX_VGT_INDX_OFFSET));
        OUT_RING(ring, 0x00000000);
 
-       OUT_PKT3(ring, CP_SET_CONSTANT, 2);
-       OUT_RING(ring, CP_REG(REG_A2XX_VGT_VERTEX_REUSE_BLOCK_CNTL));
-       OUT_RING(ring, 0x0000003b);
-
        OUT_PKT3(ring, CP_SET_CONSTANT, 2);
        OUT_RING(ring, CP_REG(REG_A2XX_SQ_CONTEXT_MISC));
        OUT_RING(ring, A2XX_SQ_CONTEXT_MISC_SC_SAMPLE_CNTL(CENTERS_ONLY));
index 6ffeefb3784534bf7cb8de41c78290b06af4598b..f9ff7bf0aed683d4c088ffdb815f8ddf67c3ceab 100644 (file)
@@ -131,9 +131,11 @@ fd2_emit_tile_gmem2mem(struct fd_batch *batch, struct fd_tile *tile)
        OUT_RING(ring, CP_REG(REG_A2XX_VGT_INDX_OFFSET));
        OUT_RING(ring, 0);
 
-       OUT_PKT3(ring, CP_SET_CONSTANT, 2);
-       OUT_RING(ring, CP_REG(REG_A2XX_VGT_VERTEX_REUSE_BLOCK_CNTL));
-       OUT_RING(ring, 0x0000028f);
+       if (!is_a20x(ctx->screen)) {
+               OUT_PKT3(ring, CP_SET_CONSTANT, 2);
+               OUT_RING(ring, CP_REG(REG_A2XX_VGT_VERTEX_REUSE_BLOCK_CNTL));
+               OUT_RING(ring, 0x0000028f);
+       }
 
        fd2_program_emit(ring, &ctx->solid_prog);
 
@@ -185,6 +187,12 @@ fd2_emit_tile_gmem2mem(struct fd_batch *batch, struct fd_tile *tile)
        OUT_PKT3(ring, CP_SET_CONSTANT, 2);
        OUT_RING(ring, CP_REG(REG_A2XX_RB_MODECONTROL));
        OUT_RING(ring, A2XX_RB_MODECONTROL_EDRAM_MODE(COLOR_DEPTH));
+
+       if (!is_a20x(ctx->screen)) {
+               OUT_PKT3(ring, CP_SET_CONSTANT, 2);
+               OUT_RING(ring, CP_REG(REG_A2XX_VGT_VERTEX_REUSE_BLOCK_CNTL));
+               OUT_RING(ring, 0x0000003b);
+       }
 }
 
 /* transfer from system memory to gmem */
@@ -277,10 +285,6 @@ fd2_emit_tile_mem2gmem(struct fd_batch *batch, struct fd_tile *tile)
        OUT_RING(ring, CP_REG(REG_A2XX_VGT_INDX_OFFSET));
        OUT_RING(ring, 0);
 
-       OUT_PKT3(ring, CP_SET_CONSTANT, 2);
-       OUT_RING(ring, CP_REG(REG_A2XX_VGT_VERTEX_REUSE_BLOCK_CNTL));
-       OUT_RING(ring, 0x0000003b);
-
        fd2_program_emit(ring, &ctx->blit_prog[0]);
 
        OUT_PKT0(ring, REG_A2XX_TC_CNTL_STATUS, 1);