[Mesa-dev] [RFC] etnaviv: native fence fd support

Philipp Zabel p.zabel at pengutronix.de
Thu Apr 6 14:22:56 UTC 2017


On Thu, 2017-04-06 at 09:54 +0200, Christian Gmeiner wrote:
> /2017-04-05 18:14 GMT+02:00 Philipp Zabel <p.zabel at pengutronix.de>:
> > 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 <p.zabel at pengutronix.de>
> > ---
> > This depends on libdrm patches [1][2] which may or may not make their
> > way into libdrm 2.4.78.
> > [1] https://patchwork.kernel.org/patch/9664401/
> > [2] https://patchwork.kernel.org/patch/9664403/
> > ---
> >  configure.ac                                  |  2 +-
> >  src/gallium/drivers/etnaviv/etnaviv_context.c | 17 ++++++++--
> >  src/gallium/drivers/etnaviv/etnaviv_context.h |  1 +
> >  src/gallium/drivers/etnaviv/etnaviv_fence.c   | 46 +++++++++++++++++++++++++--
> >  src/gallium/drivers/etnaviv/etnaviv_fence.h   | 14 +++++++-
> >  src/gallium/drivers/etnaviv/etnaviv_screen.c  | 10 +++++-
> >  src/gallium/drivers/etnaviv/etnaviv_screen.h  |  3 ++
> >  7 files changed, 86 insertions(+), 7 deletions(-)
> >
> > diff --git a/configure.ac b/configure.ac
> > index 1c60a59823..a5e1d69912 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -80,7 +80,7 @@ LIBDRM_NVVIEUX_REQUIRED=2.4.66
> >  LIBDRM_NOUVEAU_REQUIRED=2.4.66
> >  LIBDRM_FREEDRENO_REQUIRED=2.4.74
> >  LIBDRM_VC4_REQUIRED=2.4.69
> > -LIBDRM_ETNAVIV_REQUIRED=2.4.74
> > +LIBDRM_ETNAVIV_REQUIRED=2.4.78
> >
> >  dnl Versions for external dependencies
> >  DRI2PROTO_REQUIRED=2.8
> > diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.c b/src/gallium/drivers/etnaviv/etnaviv_context.c
> > index dfd9e1f73a..14170342ff 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);
> >  }
> >
> > @@ -230,11 +233,17 @@ 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);
> > +   if (ctx->in_fence_fd != -1 || (flags & PIPE_FLUSH_FENCE_FD))
> > +      etna_cmd_stream_flush_explicit(ctx->stream, ctx->in_fence_fd,
> > +                                     (flags & PIPE_FLUSH_FENCE_FD) ?
> > +                                     &out_fence_fd : NULL);
> > +   else
> > +      etna_cmd_stream_flush(ctx->stream);
> >
> 
> Can we do that without the extra if and just call
> etna_cmd_stream_flush_explicit(..) in every
> case? (Just like in freedreno?)

Yes, etna_cmd_stream_flush(stream) effectively maps to the same as
etna_cmd_stream_flush_explicit(stream, -1, NULL) anyway. I'll change
this.

regards
Philipp



More information about the mesa-dev mailing list