diff options
author | Rob Clark <[email protected]> | 2017-11-19 10:36:19 -0500 |
---|---|---|
committer | Rob Clark <[email protected]> | 2017-12-03 14:17:40 -0500 |
commit | 15ebf387fc43632be0e68365cf92ac8fb1b64a9c (patch) | |
tree | c38457eb447df994c138d01a155122406accda3c /src/gallium/drivers/freedreno/freedreno_context.c | |
parent | deb57fb237c3be9629a39ef1978dfac4563d6bda (diff) |
freedreno: rework fence tracking
ctx->last_fence isn't such a terribly clever idea, if batches can be
flushed out of order. Instead, each batch now holds a fence, which is
created before the batch is flushed (useful for next patch), that later
gets populated after the batch is actually flushed.
Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno/freedreno_context.c')
-rw-r--r-- | src/gallium/drivers/freedreno/freedreno_context.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/src/gallium/drivers/freedreno/freedreno_context.c b/src/gallium/drivers/freedreno/freedreno_context.c index 60b50b26acf..e138ac94ae3 100644 --- a/src/gallium/drivers/freedreno/freedreno_context.c +++ b/src/gallium/drivers/freedreno/freedreno_context.c @@ -40,31 +40,28 @@ #include "util/u_upload_mgr.h" static void -fd_context_flush(struct pipe_context *pctx, struct pipe_fence_handle **fence, +fd_context_flush(struct pipe_context *pctx, struct pipe_fence_handle **fencep, unsigned flags) { struct fd_context *ctx = fd_context(pctx); + struct pipe_fence_handle *fence = NULL; + + /* Take a ref to the batch's fence (batch can be unref'd when flushed: */ + fd_fence_ref(pctx->screen, &fence, ctx->batch->fence); if (flags & PIPE_FLUSH_FENCE_FD) ctx->batch->needs_out_fence_fd = true; if (!ctx->screen->reorder) { - fd_batch_flush(ctx->batch, true); + fd_batch_flush(ctx->batch, true, false); } else { fd_bc_flush(&ctx->screen->batch_cache, ctx); } - if (fence) { - /* if there hasn't been any rendering submitted yet, we might not - * have actually created a fence - */ - if (!ctx->last_fence || ctx->batch->needs_out_fence_fd) { - ctx->batch->needs_flush = true; - fd_gmem_render_noop(ctx->batch); - fd_batch_reset(ctx->batch); - } - fd_fence_ref(pctx->screen, fence, ctx->last_fence); - } + if (fencep) + fd_fence_ref(pctx->screen, fencep, fence); + + fd_fence_ref(pctx->screen, &fence, NULL); } static void @@ -129,8 +126,6 @@ fd_context_destroy(struct pipe_context *pctx) fd_batch_reference(&ctx->batch, NULL); /* unref current batch */ fd_bc_invalidate_context(ctx); - fd_fence_ref(pctx->screen, &ctx->last_fence, NULL); - fd_prog_fini(pctx); if (ctx->blitter) |