diff options
author | Philipp Zabel <[email protected]> | 2017-04-12 12:31:01 +0200 |
---|---|---|
committer | Christian Gmeiner <[email protected]> | 2017-04-15 01:47:18 +0200 |
commit | 36f21017237ab536db74c84e0f778d3a58271c75 (patch) | |
tree | 399a8b2a5831dc764be6a80f4eafb76db62a8d78 /src/gallium/drivers/etnaviv/etnaviv_context.c | |
parent | 96dfc014fd33a4f38e31fa1d4c9c4ea52d85a0b8 (diff) |
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 <[email protected]>
Reviewed-By: Wladimir J. van der Laan <[email protected]>
Reviewed-by: Christian Gmeiner <[email protected]>
Diffstat (limited to 'src/gallium/drivers/etnaviv/etnaviv_context.c')
-rw-r--r-- | src/gallium/drivers/etnaviv/etnaviv_context.c | 14 |
1 files changed, 12 insertions, 2 deletions
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; |