From e652ca4e0b4dc773e0754993a5bea4fad1a2e8a1 Mon Sep 17 00:00:00 2001 From: Jonathan Marek Date: Thu, 1 Aug 2019 15:22:47 -0400 Subject: [PATCH] freedreno: a2xx: fix HW binning for batches with >256K vertices Signed-off-by: Jonathan Marek Reviewed-by: Rob Clark --- src/gallium/drivers/freedreno/a2xx/fd2_gmem.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_gmem.c b/src/gallium/drivers/freedreno/a2xx/fd2_gmem.c index 0edc5e940c1..47cbb54d611 100644 --- a/src/gallium/drivers/freedreno/a2xx/fd2_gmem.c +++ b/src/gallium/drivers/freedreno/a2xx/fd2_gmem.c @@ -590,14 +590,14 @@ fd2_emit_tile_init(struct fd_batch *batch) for (int i = 0; i < gmem->num_vsc_pipes; i++) { struct fd_vsc_pipe *pipe = &ctx->vsc_pipe[i]; - /* XXX we know how large this needs to be.. - * should do some sort of realloc - * it should be ctx->batch->num_vertices bytes large - * with this size it will break with more than 256k vertices.. - */ - if (!pipe->bo) { - pipe->bo = fd_bo_new(ctx->dev, 0x40000, + /* allocate in 64k increments to avoid reallocs */ + uint32_t bo_size = align(batch->num_vertices, 0x10000); + if (!pipe->bo || fd_bo_size(pipe->bo) < bo_size) { + if (pipe->bo) + fd_bo_del(pipe->bo); + pipe->bo = fd_bo_new(ctx->dev, bo_size, DRM_FREEDRENO_GEM_TYPE_KMEM, "vsc_pipe[%u]", i); + assert(pipe->bo); } /* memory export address (export32): @@ -609,7 +609,7 @@ fd2_emit_tile_init(struct fd_batch *batch) OUT_RELOCW(ring, pipe->bo, 0, 0x40000000, -2); OUT_RING(ring, 0x00000000); OUT_RING(ring, 0x4B00D000); - OUT_RING(ring, 0x4B000000 | 0x40000); + OUT_RING(ring, 0x4B000000 | bo_size); } OUT_PKT3(ring, CP_SET_CONSTANT, 1 + gmem->num_vsc_pipes * 8); -- 2.11.0