freedreno/a6xx: Move resolve blits to an IB
authorKristian H. Kristensen <hoegsberg@chromium.org>
Wed, 24 Oct 2018 07:00:50 +0000 (00:00 -0700)
committerRob Clark <robdclark@gmail.com>
Tue, 27 Nov 2018 20:44:02 +0000 (15:44 -0500)
Signed-off-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
src/gallium/drivers/freedreno/a6xx/fd6_gmem.c
src/gallium/drivers/freedreno/freedreno_batch.c
src/gallium/drivers/freedreno/freedreno_batch.h

index 6755f2ab6b4b630d9f1c4b3f40a2d55c9c110dda..e8b6d051cb65641c5d8e6b6ad9fd743f5185b3ef 100644 (file)
@@ -450,6 +450,7 @@ disable_msaa(struct fd_ringbuffer *ring)
 }
 
 static void prepare_tile_setup_ib(struct fd_batch *batch);
+static void prepare_tile_fini_ib(struct fd_batch *batch);
 
 /* before first tile */
 static void
@@ -470,6 +471,7 @@ fd6_emit_tile_init(struct fd_batch *batch)
        fd6_cache_flush(batch, ring);
 
        prepare_tile_setup_ib(batch);
+       prepare_tile_fini_ib(batch);
 
        OUT_PKT7(ring, CP_SKIP_IB2_ENABLE_GLOBAL, 1);
        OUT_RING(ring, 0x0);
@@ -740,12 +742,13 @@ fd6_emit_tile_renderprep(struct fd_batch *batch, struct fd_tile *tile)
 }
 
 static void
-emit_resolve_blit(struct fd_batch *batch, uint32_t base,
+emit_resolve_blit(struct fd_batch *batch,
+                                 struct fd_ringbuffer *ring,
+                                 uint32_t base,
                                  struct pipe_surface *psurf,
                                  struct fd_resource *rsc,
                                  unsigned buffer)
 {
-       struct fd_ringbuffer *ring = batch->gmem;
        uint32_t info = 0;
 
        if (!rsc->valid)
@@ -768,7 +771,7 @@ emit_resolve_blit(struct fd_batch *batch, uint32_t base,
        OUT_PKT4(ring, REG_A6XX_RB_BLIT_INFO, 1);
        OUT_RING(ring, info);
 
-       emit_blit(batch, batch->gmem, base, psurf, rsc);
+       emit_blit(batch, ring, base, psurf, rsc);
 }
 
 /*
@@ -776,12 +779,16 @@ emit_resolve_blit(struct fd_batch *batch, uint32_t base,
  */
 
 static void
-fd6_emit_tile_gmem2mem(struct fd_batch *batch, struct fd_tile *tile)
+prepare_tile_fini_ib(struct fd_batch *batch)
 {
        struct fd_context *ctx = batch->ctx;
        struct fd_gmem_stateobj *gmem = &ctx->gmem;
        struct pipe_framebuffer_state *pfb = &batch->framebuffer;
-       struct fd_ringbuffer *ring = batch->gmem;
+       struct fd_ringbuffer *ring;
+
+       batch->tile_fini = fd_submit_new_ringbuffer(batch->submit, 0x1000,
+                       FD_RINGBUFFER_STREAMING);
+       ring = batch->tile_fini;
 
        if (use_hw_binning(batch)) {
                OUT_PKT7(ring, CP_SET_MARKER, 1);
@@ -809,11 +816,13 @@ fd6_emit_tile_gmem2mem(struct fd_batch *batch, struct fd_tile *tile)
                struct fd_resource *rsc = fd_resource(pfb->zsbuf->texture);
 
                if (!rsc->stencil || (batch->resolve & FD_BUFFER_DEPTH)) {
-                       emit_resolve_blit(batch, gmem->zsbuf_base[0], pfb->zsbuf, rsc,
+                       emit_resolve_blit(batch, ring,
+                                                         gmem->zsbuf_base[0], pfb->zsbuf, rsc,
                                                          FD_BUFFER_DEPTH);
                }
                if (rsc->stencil && (batch->resolve & FD_BUFFER_STENCIL)) {
-                       emit_resolve_blit(batch, gmem->zsbuf_base[1], pfb->zsbuf, rsc->stencil,
+                       emit_resolve_blit(batch, ring,
+                                                         gmem->zsbuf_base[1], pfb->zsbuf, rsc->stencil,
                                                          FD_BUFFER_STENCIL);
                }
        }
@@ -825,13 +834,19 @@ fd6_emit_tile_gmem2mem(struct fd_batch *batch, struct fd_tile *tile)
                                continue;
                        if (!(batch->resolve & (PIPE_CLEAR_COLOR0 << i)))
                                continue;
-                       emit_resolve_blit(batch, gmem->cbuf_base[i], pfb->cbufs[i],
+                       emit_resolve_blit(batch, ring, gmem->cbuf_base[i], pfb->cbufs[i],
                                                          fd_resource(pfb->cbufs[i]->texture),
                                                          FD_BUFFER_COLOR);
                }
        }
 }
 
+static void
+fd6_emit_tile_gmem2mem(struct fd_batch *batch, struct fd_tile *tile)
+{
+       fd6_emit_ib(batch->gmem, batch->tile_fini);
+}
+
 static void
 fd6_emit_tile_fini(struct fd_batch *batch)
 {
index 9a35f145d19b94722de1311e9d8fc58efd6ee492..de4c8198c201478dfaba4fc362a994714ff77479 100644 (file)
@@ -155,6 +155,11 @@ batch_fini(struct fd_batch *batch)
                batch->tile_setup = NULL;
        }
 
+       if (batch->tile_fini) {
+               fd_ringbuffer_del(batch->tile_fini);
+               batch->tile_fini = NULL;
+       }
+
        fd_submit_del(batch->submit);
 
        util_dynarray_fini(&batch->draw_patches);
index 0ba6da5edc3fd127ad63d823e60173295d84ef2d..a9a7ecdaf2484c3c546af010d6dc921e1d086b6d 100644 (file)
@@ -163,6 +163,7 @@ struct fd_batch {
        // TODO maybe more generically split out clear and clear_binning rings?
        struct fd_ringbuffer *lrz_clear;
        struct fd_ringbuffer *tile_setup;
+       struct fd_ringbuffer *tile_fini;
 
        /**
         * hw query related state: