From 36f21017237ab536db74c84e0f778d3a58271c75 Mon Sep 17 00:00:00 2001 From: Philipp Zabel Date: Wed, 12 Apr 2017 12:31:01 +0200 Subject: etnaviv: native fence fd support This adds native fence fd support to etnaviv, similarly to commit 0b98e84e9ba0 ("freedreno: native fence fd"), enabled for kernel driver version 1.1 or later. Signed-off-by: Philipp Zabel Reviewed-By: Wladimir J. van der Laan Reviewed-by: Christian Gmeiner --- src/gallium/drivers/etnaviv/etnaviv_context.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/gallium/drivers/etnaviv/etnaviv_context.c') diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.c b/src/gallium/drivers/etnaviv/etnaviv_context.c index f2f709cbf24..cfbc9065426 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_context.c +++ b/src/gallium/drivers/etnaviv/etnaviv_context.c @@ -73,6 +73,9 @@ etna_context_destroy(struct pipe_context *pctx) slab_destroy_child(&ctx->transfer_pool); + if (ctx->in_fence_fd != -1) + close(ctx->in_fence_fd); + FREE(pctx); } @@ -275,11 +278,14 @@ etna_flush(struct pipe_context *pctx, struct pipe_fence_handle **fence, enum pipe_flush_flags flags) { struct etna_context *ctx = etna_context(pctx); + int out_fence_fd = -1; - etna_cmd_stream_flush(ctx->stream); + etna_cmd_stream_flush2(ctx->stream, ctx->in_fence_fd, + (flags & PIPE_FLUSH_FENCE_FD) ? &out_fence_fd : + NULL); if (fence) - *fence = etna_fence_create(pctx); + *fence = etna_fence_create(pctx, out_fence_fd); } static void @@ -356,10 +362,14 @@ etna_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags) /* Set sensible defaults for state */ etna_cmd_stream_reset_notify(ctx->stream, ctx); + ctx->in_fence_fd = -1; + pctx->destroy = etna_context_destroy; pctx->draw_vbo = etna_draw_vbo; pctx->flush = etna_flush; pctx->set_debug_callback = etna_set_debug_callback; + pctx->create_fence_fd = etna_create_fence_fd; + pctx->fence_server_sync = etna_fence_server_sync; /* creation of compile states */ pctx->create_blend_state = etna_blend_state_create; -- cgit v1.2.3