freedreno/a5xx: refactor out helper for LRZ flush
authorRob Clark <robdclark@gmail.com>
Sat, 3 Jun 2017 16:42:35 +0000 (12:42 -0400)
committerRob Clark <robdclark@gmail.com>
Wed, 7 Jun 2017 16:32:00 +0000 (12:32 -0400)
Signed-off-by: Rob Clark <robdclark@gmail.com>
src/gallium/drivers/freedreno/a5xx/fd5_emit.c
src/gallium/drivers/freedreno/a5xx/fd5_emit.h
src/gallium/drivers/freedreno/a5xx/fd5_gmem.c

index 73684c9f900befc6e53b5ece8fcf47cc3ae8d12b..2c31831c976b75676561da7fccd79dd2f125fe78 100644 (file)
@@ -795,9 +795,6 @@ t7              opcode: CP_WAIT_FOR_IDLE (26) (1 dwords)
        OUT_PKT4(ring, REG_A5XX_PC_RASTER_CNTL, 1);
        OUT_RING(ring, 0x00000012);
 
-       OUT_PKT4(ring, REG_A5XX_GRAS_LRZ_CNTL, 1);
-       OUT_RING(ring, 0x00000000);
-
        OUT_PKT4(ring, REG_A5XX_GRAS_SU_POINT_MINMAX, 2);
        OUT_RING(ring, A5XX_GRAS_SU_POINT_MINMAX_MIN(1.0) |
                        A5XX_GRAS_SU_POINT_MINMAX_MAX(4092.0));
index ca8808306888c4d5d65c31852ca25e4278692481..7df7eb7123244a4048a72a2ca19d51c569471331 100644 (file)
@@ -160,7 +160,22 @@ fd5_emit_render_cntl(struct fd_context *ctx, bool blit, bool binning)
        OUT_RING(ring, 0x00000008 |   /* GRAS_SC_CNTL */
                        COND(binning, A5XX_GRAS_SC_CNTL_BINNING_PASS) |
                        COND(samples_passed, A5XX_GRAS_SC_CNTL_SAMPLES_PASSED));
+}
+
+static inline void
+fd5_emit_lrz_flush(struct fd_ringbuffer *ring)
+{
+       /* TODO I think the extra writes to GRAS_LRZ_CNTL are probably
+        * a workaround and not needed on all a5xx.
+        */
+       OUT_PKT4(ring, REG_A5XX_GRAS_LRZ_CNTL, 1);
+       OUT_RING(ring, A5XX_GRAS_LRZ_CNTL_ENABLE);
+
+       OUT_PKT7(ring, CP_EVENT_WRITE, 1);
+       OUT_RING(ring, LRZ_FLUSH);
 
+       OUT_PKT4(ring, REG_A5XX_GRAS_LRZ_CNTL, 1);
+       OUT_RING(ring, 0x0);
 }
 
 void fd5_emit_vertex_bufs(struct fd_ringbuffer *ring, struct fd5_emit *emit);
index b403dad5e699fe039c029132f4830be641078939..6669885959ed40cff899586268e54c3664602141 100644 (file)
@@ -348,8 +348,7 @@ fd5_emit_tile_init(struct fd_batch *batch)
 
        fd5_emit_restore(batch, ring);
 
-       OUT_PKT7(ring, CP_EVENT_WRITE, 1);
-       OUT_RING(ring, LRZ_FLUSH);
+       fd5_emit_lrz_flush(ring);
 
        OUT_PKT7(ring, CP_SKIP_IB2_ENABLE_GLOBAL, 1);
        OUT_RING(ring, 0x0);
@@ -629,8 +628,7 @@ fd5_emit_tile_fini(struct fd_batch *batch)
        OUT_PKT7(ring, CP_SKIP_IB2_ENABLE_GLOBAL, 1);
        OUT_RING(ring, 0x0);
 
-       OUT_PKT7(ring, CP_EVENT_WRITE, 1);
-       OUT_RING(ring, LRZ_FLUSH);
+       fd5_emit_lrz_flush(ring);
 
        fd5_cache_flush(batch, ring);
        fd5_set_render_mode(batch->ctx, ring, BYPASS);
@@ -644,8 +642,7 @@ fd5_emit_sysmem_prep(struct fd_batch *batch)
 
        fd5_emit_restore(batch, ring);
 
-       OUT_PKT7(ring, CP_EVENT_WRITE, 1);
-       OUT_RING(ring, LRZ_FLUSH);
+       fd5_emit_lrz_flush(ring);
 
        OUT_PKT7(ring, CP_SKIP_IB2_ENABLE_GLOBAL, 1);
        OUT_RING(ring, 0x0);
@@ -719,8 +716,7 @@ fd5_emit_sysmem_fini(struct fd_batch *batch)
        OUT_PKT7(ring, CP_SKIP_IB2_ENABLE_GLOBAL, 1);
        OUT_RING(ring, 0x0);
 
-       OUT_PKT7(ring, CP_EVENT_WRITE, 1);
-       OUT_RING(ring, LRZ_FLUSH);
+       fd5_emit_lrz_flush(ring);
 
        OUT_PKT7(ring, CP_EVENT_WRITE, 4);
        OUT_RING(ring, UNK_1D);