diff options
author | Kristian H. Kristensen <[email protected]> | 2019-10-22 20:05:47 -0700 |
---|---|---|
committer | Kristian H. Kristensen <[email protected]> | 2019-11-07 16:40:27 -0800 |
commit | 5dd51d2da75fdbabaa9cef1c9b4bf976117691b5 (patch) | |
tree | c7e79a8a353e8c02960be098dee941a4538cdccc | |
parent | f0ef3e96970e0b8388c9d7be678b70217b3a8506 (diff) |
freedreno/a6xx: Allocate and program tessellation buffer
Tessellation needs a couple of buffers that should hold the entire
output from a full VS+TCS draw call.
Signed-off-by: Kristian H. Kristensen <[email protected]>
Acked-by: Eric Anholt <[email protected]>
Reviewed-by: Rob Clark <[email protected]>
-rw-r--r-- | src/gallium/drivers/freedreno/a6xx/fd6_gmem.c | 26 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/freedreno_batch.c | 6 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/freedreno_batch.h | 12 |
3 files changed, 44 insertions, 0 deletions
diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_gmem.c b/src/gallium/drivers/freedreno/a6xx/fd6_gmem.c index 708347931ac..470e972f9e5 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_gmem.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_gmem.c @@ -650,6 +650,8 @@ emit_binning_pass(struct fd_batch *batch) uint32_t x2 = gmem->minx + gmem->width - 1; uint32_t y2 = gmem->miny + gmem->height - 1; + debug_assert(!batch->tessellation); + set_scissor(ring, x1, y1, x2, y2); emit_marker6(ring, 7); @@ -1499,6 +1501,27 @@ emit_sysmem_clears(struct fd_batch *batch, struct fd_ringbuffer *ring) } static void +setup_tess_buffers(struct fd_batch *batch, struct fd_ringbuffer *ring) +{ + struct fd_context *ctx = batch->ctx; + + batch->tessfactor_bo = fd_bo_new(ctx->screen->dev, + batch->tessfactor_size, + DRM_FREEDRENO_GEM_TYPE_KMEM, "tessfactor"); + + batch->tessparam_bo = fd_bo_new(ctx->screen->dev, + batch->tessparam_size, + DRM_FREEDRENO_GEM_TYPE_KMEM, "tessparam"); + + OUT_PKT4(ring, REG_A6XX_PC_TESSFACTOR_ADDR_LO, 2); + OUT_RELOCW(ring, batch->tessfactor_bo, 0, 0, 0); + + batch->tess_addrs_constobj->cur = batch->tess_addrs_constobj->start; + OUT_RELOCW(batch->tess_addrs_constobj, batch->tessparam_bo, 0, 0, 0); + OUT_RELOCW(batch->tess_addrs_constobj, batch->tessfactor_bo, 0, 0, 0); +} + +static void fd6_emit_sysmem_prep(struct fd_batch *batch) { struct pipe_framebuffer_state *pfb = &batch->framebuffer; @@ -1521,6 +1544,9 @@ fd6_emit_sysmem_prep(struct fd_batch *batch) OUT_RING(ring, A6XX_CP_SET_MARKER_0_MODE(RM6_BYPASS) | 0x10); /* | 0x10 ? */ emit_marker6(ring, 7); + if (batch->tessellation) + setup_tess_buffers(batch, ring); + OUT_PKT7(ring, CP_SKIP_IB2_ENABLE_GLOBAL, 1); OUT_RING(ring, 0x0); diff --git a/src/gallium/drivers/freedreno/freedreno_batch.c b/src/gallium/drivers/freedreno/freedreno_batch.c index 737a87a8dc6..f0dd8148229 100644 --- a/src/gallium/drivers/freedreno/freedreno_batch.c +++ b/src/gallium/drivers/freedreno/freedreno_batch.c @@ -166,6 +166,12 @@ batch_fini(struct fd_batch *batch) batch->tile_fini = NULL; } + if (batch->tessellation) { + fd_bo_del(batch->tessfactor_bo); + fd_bo_del(batch->tessparam_bo); + fd_ringbuffer_del(batch->tess_addrs_constobj); + } + fd_submit_del(batch->submit); util_dynarray_fini(&batch->draw_patches); diff --git a/src/gallium/drivers/freedreno/freedreno_batch.h b/src/gallium/drivers/freedreno/freedreno_batch.h index ecee0a87878..5061186f1b5 100644 --- a/src/gallium/drivers/freedreno/freedreno_batch.h +++ b/src/gallium/drivers/freedreno/freedreno_batch.h @@ -224,6 +224,18 @@ struct fd_batch { /** set of dependent batches.. holds refs to dependent batches: */ uint32_t dependents_mask; + + /* Buffer for tessellation engine input + */ + struct fd_bo *tessfactor_bo; + uint32_t tessfactor_size; + + /* Buffer for passing parameters between TCS and TES + */ + struct fd_bo *tessparam_bo; + uint32_t tessparam_size; + + struct fd_ringbuffer *tess_addrs_constobj; }; struct fd_batch * fd_batch_create(struct fd_context *ctx, bool nondraw); |