[Mesa-dev] [libdrm 1/4] etnaviv: submit full struct drm_etnaviv_gem_submit

Philipp Zabel p.zabel at pengutronix.de
Fri Jun 9 11:13:54 UTC 2017


Hi Christian,

On Fri, 2017-06-09 at 12:27 +0200, Christian Gmeiner wrote:
> It is safe to submit the full struct even on older kernels as such
> kernels do not process the full struct. Without this change it
> becomes quite challenging to extned the submit struct.
> 
> Freedreno has no special treatment too. See git commits
> - freedreno: sync uapi header
> - freedreno: add fence fd support

Reading drm_ioctl() closely, I can see that it is safe to submit a
struct larger than what the kernel expects. I have applied this patch
and reverted kernel commits 78ec187f64fa ("drm/etnaviv: submit support
for out-fences") and 9ad59fea162c ("drm/etnaviv: submit support for
in-fences") to test, without ill effects.

> Signed-off-by: Christian Gmeiner <christian.gmeiner at gmail.com>

Reviewed-by: Philipp Zabel <p.zabel at pengutronix.de>
Tested-by: Philipp Zabel <p.zabel at pengutronix.de>

regards
Philipp

> ---
>  etnaviv/etnaviv_cmd_stream.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/etnaviv/etnaviv_cmd_stream.c b/etnaviv/etnaviv_cmd_stream.c
> index 3c7b0ed..8d0e813 100644
> --- a/etnaviv/etnaviv_cmd_stream.c
> +++ b/etnaviv/etnaviv_cmd_stream.c
> @@ -203,14 +203,8 @@ static void flush(struct etna_cmd_stream *stream, int 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, req.flags ? sizeof(req) :
> -			offsetof(struct drm_etnaviv_gem_submit, flags));
> +			&req, sizeof(req));
>  
>  	if (ret)
>  		ERROR_MSG("submit failed: %d (%s)", ret, strerror(errno));




More information about the mesa-dev mailing list