コード例 #1
0
static void
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;

	DBG("%p: flush: flags=%x\n", ctx->batch, flags);

	/* 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, false);
	} else if (flags & PIPE_FLUSH_DEFERRED) {
		fd_bc_flush_deferred(&ctx->screen->batch_cache, ctx);
	} else {
		fd_bc_flush(&ctx->screen->batch_cache, ctx);
	}

	if (fencep)
		fd_fence_ref(pctx->screen, fencep, fence);

	fd_fence_ref(pctx->screen, &fence, NULL);
}
コード例 #2
0
ファイル: freedreno_context.c プロジェクト: jvesely/mesa
static void
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;
	// TODO we want to lookup batch if it exists, but not create one if not.
	struct fd_batch *batch = fd_context_batch(ctx);

	DBG("%p: flush: flags=%x\n", ctx->batch, flags);

	/* if no rendering since last flush, ie. app just decided it needed
	 * a fence, re-use the last one:
	 */
	if (ctx->last_fence) {
		fd_fence_ref(pctx->screen, &fence, ctx->last_fence);
		goto out;
	}

	if (!batch)
		return;

	/* Take a ref to the batch's fence (batch can be unref'd when flushed: */
	fd_fence_ref(pctx->screen, &fence, batch->fence);

	/* TODO is it worth trying to figure out if app is using fence-fd's, to
	 * avoid requesting one every batch?
	 */
	batch->needs_out_fence_fd = true;

	if (!ctx->screen->reorder) {
		fd_batch_flush(batch, true, false);
	} else if (flags & PIPE_FLUSH_DEFERRED) {
		fd_bc_flush_deferred(&ctx->screen->batch_cache, ctx);
	} else {
		fd_bc_flush(&ctx->screen->batch_cache, ctx);
	}

out:
	if (fencep)
		fd_fence_ref(pctx->screen, fencep, fence);

	fd_fence_ref(pctx->screen, &ctx->last_fence, fence);

	fd_fence_ref(pctx->screen, &fence, NULL);
}