etnaviv: sync uapi header
PATCH 1/2 etnaviv: sync uapi header
Import the etnaviv header changes from kernel commits 9ad59fea162c ("drm/etnaviv: submit support for in-fences") and 78ec187f64fa ("drm/etnaviv: submit support for out-fences") for fence fd support.
--- etnaviv/etnaviv_drm.h | 8 ++++++++ 1 file changed, 8 insertions(+)
etnaviv/etnaviv_drm.h +8 -0
@@ -154,6 +154,12 @@ struct drm_etnaviv_gem_submit_bo {* one or more cmdstream buffers. This allows for conditional execution * (context-restore), and IB buffers needed for per tile/bin draw cmds. */ +#define ETNA_SUBMIT_NO_IMPLICIT 0x0001 +#define ETNA_SUBMIT_FENCE_FD_IN 0x0002 +#define ETNA_SUBMIT_FENCE_FD_OUT 0x0004 +#define ETNA_SUBMIT_FLAGS (ETNA_SUBMIT_NO_IMPLICIT | \ + ETNA_SUBMIT_FENCE_FD_IN | \ + ETNA_SUBMIT_FENCE_FD_OUT)#define ETNA_PIPE_3D 0x00#define ETNA_PIPE_2D 0x01#define ETNA_PIPE_VG 0x02
@@ -167,6 +173,8 @@ struct drm_etnaviv_gem_submit {__u64 bos;/* in, ptr to array of submit_bo's */ __u64 relocs;/* in, ptr to array of submit_reloc's */ __u64 stream;/* in, ptr to cmdstream */ +__u32 flags;/* in, mask of ETNA_SUBMIT_x */ +__s32 fence_fd;/* in/out, fence fd (see ETNA_SUBMIT_FENCE_FD_x) */ };/* The normal way to synchronize with the GPU is just to CPU_PREP on
Signature · 6 lines
2.11.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/2 etnaviv: add fence fd support
Add etna_cmd_stream_flush_explicit with in-fence fd and out-fence fd support for explicit fencing.
--- etnaviv/etnaviv_cmd_stream.c | 33 +++++++++++++++++++++++++++++---- etnaviv/etnaviv_drmif.h | 2 ++ 2 files changed, 31 insertions(+), 4 deletions(-)
etnaviv/etnaviv_cmd_stream.c +29 -4
@@ -177,7 +177,8 @@ static uint32_t bo2idx(struct etna_cmd_stream *stream, struct etna_bo *bo,return idx; } -static void flush (struct etna_cmd_stream *stream) +static void flush (struct etna_cmd_stream *stream,int in_fence_fd, +int *out_fence_fd) {struct etna_cmd_stream_priv *priv =etna_cmd_stream_priv (stream);int ret, id = priv->pipe->id;
@@ -194,8 +195,22 @@ static void flush(struct etna_cmd_stream *stream) .stream_size = stream->offset * 4, /* in bytes */ }; +if (in_fence_fd !=-1 ) { + req.flags |=ETNA_SUBMIT_FENCE_FD_IN |ETNA_SUBMIT_NO_IMPLICIT ; + req.fence_fd = in_fence_fd; + } + +if (out_fence_fd) + req.flags |=ETNA_SUBMIT_FENCE_FD_OUT ; + +/* +* Pass the complete submit structure only if flags are set. Otherwise, +* only pass the fields up to, but not including the flags field for +* backwards compatiblity with older kernels. +*/ ret =drmCommandWriteRead (gpu->dev->fd,DRM_ETNAVIV_GEM_SUBMIT , - &req,sizeof (req)); + &req, req.flags ?sizeof (req) : + offsetof(struct drm_etnaviv_gem_submit , flags));if (ret)ERROR_MSG ("submit failed: %d (%s)" , ret,strerror (errno));
@@ -208,11 +223,21 @@ static void flush(struct etna_cmd_stream *stream) bo->current_stream =NULL ;etna_bo_del (bo); } + +if (out_fence_fd) + *out_fence_fd = req.fence_fd; }void etna_cmd_stream_flush (struct etna_cmd_stream *stream) { -flush (stream); +flush (stream,-1 ,NULL ); +reset_buffer (stream); +} + +void etna_cmd_stream_flush_explicit (struct etna_cmd_stream *stream, +int in_fence_fd,int *out_fence_fd) +{ +flush (stream, in_fence_fd, out_fence_fd);reset_buffer (stream); }
@@ -220,7 +245,7 @@ void etna_cmd_stream_finish(struct etna_cmd_stream *stream) {struct etna_cmd_stream_priv *priv =etna_cmd_stream_priv (stream); -flush (stream); +flush (stream,-1 ,NULL );etna_pipe_wait (priv->pipe, priv->last_timestamp,5000 );reset_buffer (stream); }
etnaviv/etnaviv_drmif.h +2 -0
@@ -142,6 +142,8 @@ struct etna_cmd_stream *etna_cmd_stream_new(struct etna_pipe *pipe, uint32_t sizvoid etna_cmd_stream_del (struct etna_cmd_stream *stream);uint32_t etna_cmd_stream_timestamp (struct etna_cmd_stream *stream);void etna_cmd_stream_flush (struct etna_cmd_stream *stream); +void etna_cmd_stream_flush_explicit (struct etna_cmd_stream *stream, +int in_fence_fd,int *out_fence_fd);void etna_cmd_stream_finish (struct etna_cmd_stream *stream);static inline uint32_t etna_cmd_stream_avail (struct etna_cmd_stream *stream)
Signature · 6 lines
2.11.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH libdrm 2/2] etnaviv: add fence fd support
Quoted 4 lines · Philipp Zabel
Add
etna_cmd_stream_flush_explicitwith in-fence fd and out-fence fd support for explicit fencing.Signed-off-by Philipp Zabel <[email protected]>
Series is:
Do you have push access?
Quoted 91 lines
--- etnaviv/etnaviv_cmd_stream.c | 33 +++++++++++++++++++++++++++++---- etnaviv/etnaviv_drmif.h | 2 ++ 2 files changed, 31 insertions(+), 4 deletions(-)etnaviv/etnaviv_cmd_stream.c +29
-4@@ -177,7 +177,8 @@ static uint32_t bo2idx(struct etna_cmd_stream *stream, struct etna_bo *bo,return idx; } -static void flush (struct etna_cmd_stream *stream) +static void flush (struct etna_cmd_stream *stream,int in_fence_fd, +int *out_fence_fd) {struct etna_cmd_stream_priv *priv =etna_cmd_stream_priv (stream);int ret, id = priv->pipe->id;@@ -194,8 +195,22 @@ static void flush(struct etna_cmd_stream *stream) .stream_size = stream->offset * 4, /* in bytes */ }; +if (in_fence_fd !=-1 ) { + req.flags |=ETNA_SUBMIT_FENCE_FD_IN |ETNA_SUBMIT_NO_IMPLICIT ; + req.fence_fd = in_fence_fd; + } + +if (out_fence_fd) + req.flags |=ETNA_SUBMIT_FENCE_FD_OUT ; + +/* +* Pass the complete submit structure only if flags are set. Otherwise, +* only pass the fields up to, but not including the flags field for +* backwards compatiblity with older kernels. +*/ ret =drmCommandWriteRead (gpu->dev->fd,DRM_ETNAVIV_GEM_SUBMIT , - &req,sizeof (req)); + &req, req.flags ?sizeof (req) : + offsetof(struct drm_etnaviv_gem_submit , flags));if (ret)ERROR_MSG ("submit failed: %d (%s)" , ret,strerror (errno));@@ -208,11 +223,21 @@ static void flush(struct etna_cmd_stream *stream) bo->current_stream =NULL ;etna_bo_del (bo); } + +if (out_fence_fd) + *out_fence_fd = req.fence_fd; }void etna_cmd_stream_flush (struct etna_cmd_stream *stream) { -flush (stream); +flush (stream,-1 ,NULL ); +reset_buffer (stream); +} + +void etna_cmd_stream_flush_explicit (struct etna_cmd_stream *stream, +int in_fence_fd,int *out_fence_fd) +{ +flush (stream, in_fence_fd, out_fence_fd);reset_buffer (stream); }@@ -220,7 +245,7 @@ void etna_cmd_stream_finish(struct etna_cmd_stream *stream) {struct etna_cmd_stream_priv *priv =etna_cmd_stream_priv (stream); -flush (stream); +flush (stream,-1 ,NULL );etna_pipe_wait (priv->pipe, priv->last_timestamp,5000 );reset_buffer (stream); }etnaviv/etnaviv_drmif.h +2
-0@@ -142,6 +142,8 @@ struct etna_cmd_stream *etna_cmd_stream_new(struct etna_pipe *pipe, uint32_t sizvoid etna_cmd_stream_del (struct etna_cmd_stream *stream);uint32_t etna_cmd_stream_timestamp (struct etna_cmd_stream *stream);void etna_cmd_stream_flush (struct etna_cmd_stream *stream); +void etna_cmd_stream_flush_explicit (struct etna_cmd_stream *stream, +int in_fence_fd,int *out_fence_fd);void etna_cmd_stream_finish (struct etna_cmd_stream *stream);static inline uint32_t etna_cmd_stream_avail (struct etna_cmd_stream *stream)Signature · 1 line
2.11.0
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH libdrm 2/2] etnaviv: add fence fd support
Quoted 8 lines · Eric Engestrom
Quoted 4 lines · Philipp Zabel
Add
etna_cmd_stream_flush_explicitwith in-fence fd and out-fence fd support for explicit fencing.Signed-off-by Philipp Zabel <[email protected]>Series is:
Reviewed-by Eric Engestrom <[email protected]>
Thank you.
Quoted 1 line
Do you have push access?
I do not.
regards
Philipp
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Christian Gmeiner
Reviewed-byRe: [PATCH libdrm 2/2] etnaviv: add fence fd support
2017-04-05 18:25 GMT+02:00 Philipp Zabel <[email protected]>:
Quoted 7 lines · Eric Engestrom
Quoted 6 lines · Philipp Zabel
Quoted 4 lines
Add
etna_cmd_stream_flush_explicitwith in-fence fd and out-fence fd support for explicit fencing.Signed-off-by Philipp Zabel <[email protected]>
Quoted 9 lines
Quoted 2 lines
Series is:
Reviewed-by Eric Engestrom <[email protected]>Thank you.
Quoted 1 line
Do you have push access?
I do not.
I will push those patches after the kernel bits landed.
Oh..
Series is:
greets
--
Christian Gmeiner, MSc
https://www.youtube.com/user/AloryOFFICIAL
https://soundcloud.com/christian-gmeiner
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH libdrm 2/2] etnaviv: add fence fd support
Quoted 18 lines · Christian Gmeiner
2017-04-05 18:25 GMT+02:00 Philipp Zabel <[email protected]>:
Quoted 7 lines · Eric Engestrom
Quoted 6 lines · Philipp Zabel
Quoted 4 lines
Add
etna_cmd_stream_flush_explicitwith in-fence fd and out-fence fd support for explicit fencing.Signed-off-by Philipp Zabel <[email protected]>Quoted 9 lines
Quoted 2 lines
Series is:
Reviewed-by Eric Engestrom <[email protected]>Thank you.
Quoted 1 line
Do you have push access?
I do not.
Quoted 6 lines
I will push those patches after the kernel bits landed.
Oh..
Series is:
Reviewed-by Christian Gmeiner <[email protected]>
Thanks, I'll resend them once more when the kernel patches are merged.
regards
Philipp
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH libdrm 2/2] etnaviv: add fence fd support
In reply to Philipp Zabel2017-04-05 14:34 GMT+02:00 Philipp Zabel <[email protected]>:
Quoted 59 lines
Add
etna_cmd_stream_flush_explicitwith in-fence fd and out-fence fd support for explicit fencing.Signed-off-by Philipp Zabel <[email protected]>--- etnaviv/etnaviv_cmd_stream.c | 33 +++++++++++++++++++++++++++++---- etnaviv/etnaviv_drmif.h | 2 ++ 2 files changed, 31 insertions(+), 4 deletions(-)etnaviv/etnaviv_cmd_stream.c +20
-3@@ -177,7 +177,8 @@ static uint32_t bo2idx(struct etna_cmd_stream *stream, struct etna_bo *bo,return idx; } -static void flush (struct etna_cmd_stream *stream) +static void flush (struct etna_cmd_stream *stream,int in_fence_fd, +int *out_fence_fd) {struct etna_cmd_stream_priv *priv =etna_cmd_stream_priv (stream);int ret, id = priv->pipe->id;@@ -194,8 +195,22 @@ static void flush(struct etna_cmd_stream *stream) .stream_size = stream->offset * 4, /* in bytes */ }; +if (in_fence_fd !=-1 ) { + req.flags |=ETNA_SUBMIT_FENCE_FD_IN |ETNA_SUBMIT_NO_IMPLICIT ; + req.fence_fd = in_fence_fd; + } + +if (out_fence_fd) + req.flags |=ETNA_SUBMIT_FENCE_FD_OUT ; + +/* +* Pass the complete submit structure only if flags are set. Otherwise, +* only pass the fields up to, but not including the flags field for +* backwards compatiblity with older kernels. +*/ ret =drmCommandWriteRead (gpu->dev->fd,DRM_ETNAVIV_GEM_SUBMIT , - &req,sizeof (req)); + &req, req.flags ?sizeof (req) : + offsetof(struct drm_etnaviv_gem_submit , flags));if (ret)ERROR_MSG ("submit failed: %d (%s)" , ret,strerror (errno));@@ -208,11 +223,21 @@ static void flush(struct etna_cmd_stream *stream) bo->current_stream =NULL ;etna_bo_del (bo); } + +if (out_fence_fd) + *out_fence_fd = req.fence_fd; }void etna_cmd_stream_flush (struct etna_cmd_stream *stream) { -flush (stream);
etnaviv/etnaviv_cmd_stream.c static void flush(struct etna_cmd_stream *stream) · line 242
Quoted 10 lines
etnaviv/etnaviv_cmd_stream.c +8
-0+flush (stream,-1 ,NULL ); +reset_buffer (stream); +} + +void etna_cmd_stream_flush_explicit (struct etna_cmd_stream *stream, +int in_fence_fd,int *out_fence_fd) +{ +flush (stream, in_fence_fd, out_fence_fd);reset_buffer (stream); }
Just a little nitpick:
I am not sure about the function name maybe etna_cmd_stream_flush2(..). The _explicit postfix does not give that much more information about what it does (without
looking at the new function arguments).
greets
--
Christian Gmeiner, MSc
https://www.youtube.com/user/AloryOFFICIAL
https://soundcloud.com/christian-gmeiner
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi Philipp
Quoted 4 lines · Philipp Zabel
Import the etnaviv header changes from kernel commits
9ad59fea162c("drm/etnaviv: submit support for in-fences") and78ec187f64fa("drm/etnaviv: submit support for out-fences") for fence fd support.
Looking for 9ad59fea162c in airlied/drm-next and drm/drm-misc/{drm-misc-next,for-linux-next} shows no references.
Can I suggest updating the header as described in include/drm/README "When and how to update these files" ?
Thanks
Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi Emil,
Quoted 9 lines · Emil Velikov
Hi Philipp
Quoted 4 lines · Philipp Zabel
Import the etnaviv header changes from kernel commits
9ad59fea162c("drm/etnaviv: submit support for in-fences") and78ec187f64fa("drm/etnaviv: submit support for out-fences") for fence fd support.Looking for
9ad59fea162cin airlied/drm-next and drm/drm-misc/{drm-misc-next,for-linux-next} shows no references.
They are still pending in the "etnaviv-next for 4.12" pull request at
https://git.pengutronix.de/git/lst/linux etnaviv/next
Quoted 2 lines
Can I suggest updating the header as described in
include/drm/README"When and how to update these files" ?
Thanks for pointing this out, I wasn't aware of that README file. I'll respin this with the appropriate comments once the kernel patches are merged.
regards
Philipp
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel