Skip to content
Snippets Groups Projects
Commit 141b2953 authored by Rob Clark's avatar Rob Clark :speech_balloon: Committed by Marge Bot
Browse files

freedreno: allow fence_fd fences to be recycled


This allows us to avoid a no-op flush if there has been no rendering,
but we hit pctx->flush(PIPE_FLUSH_FENCE_FD).

Signed-off-by: default avatarRob Clark <robdclark@chromium.org>
Part-of: <mesa/mesa!6177>
parent 07a49bf5
No related branches found
No related tags found
No related merge requests found
......@@ -60,7 +60,8 @@ fd_context_flush(struct pipe_context *pctx, struct pipe_fence_handle **fencep,
* not an "fd" fence, which results in eglDupNativeFenceFDANDROID()
* errors.
*/
if (flags & PIPE_FLUSH_FENCE_FD)
if ((flags & PIPE_FLUSH_FENCE_FD) && ctx->last_fence &&
!fd_fence_is_fd(ctx->last_fence))
fd_fence_ref(&ctx->last_fence, NULL);
/* if no rendering since last flush, ie. app just decided it needed
......
......@@ -150,6 +150,11 @@ int fd_fence_get_fd(struct pipe_screen *pscreen,
return os_dupfd_cloexec(fence->fence_fd);
}
bool fd_fence_is_fd(struct pipe_fence_handle *fence)
{
return fence->fence_fd != -1;
}
struct pipe_fence_handle * fd_fence_create(struct fd_batch *batch)
{
return fence_create(batch->ctx, batch, 0, -1);
......
......@@ -44,6 +44,7 @@ void fd_fence_server_sync(struct pipe_context *pctx,
struct pipe_fence_handle *fence);
int fd_fence_get_fd(struct pipe_screen *pscreen,
struct pipe_fence_handle *pfence);
bool fd_fence_is_fd(struct pipe_fence_handle *fence);
struct fd_batch;
struct pipe_fence_handle * fd_fence_create(struct fd_batch *batch);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment