[PATCH 3/3] drm/etnaviv: submit support for out-fences

Gustavo Padovan gustavo at padovan.org
Wed Mar 8 14:48:45 UTC 2017


Hi Philipp,

2017-03-08 Philipp Zabel <p.zabel at pengutronix.de>:

> Based on commit 4cd0945901a6 ("drm/msm: submit support for out-fences").
> We increment the minor driver version so userspace can detect explicit
> fence support.
> 
> Signed-off-by: Philipp Zabel <p.zabel at pengutronix.de>
> ---
>  drivers/gpu/drm/etnaviv/etnaviv_drv.c        |  2 +-
>  drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 27 +++++++++++++++++++++++++++
>  include/uapi/drm/etnaviv_drm.h               |  6 ++++--
>  3 files changed, 32 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> index 587e45043542b..00f7e9acf68ad 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> @@ -512,7 +512,7 @@ static struct drm_driver etnaviv_drm_driver = {
>  	.desc               = "etnaviv DRM",
>  	.date               = "20151214",
>  	.major              = 1,
> -	.minor              = 0,
> +	.minor              = 1,
>  };
>  
>  /*
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
> index 022fcc7d57f48..7d4dc946104b9 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
> @@ -307,6 +307,8 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data,
>  	struct etnaviv_cmdbuf *cmdbuf;
>  	struct etnaviv_gpu *gpu;
>  	struct dma_fence *in_fence = NULL;
> +	struct sync_file *sync_file = NULL;
> +	int out_fence_fd = -1;
>  	void *stream;
>  	int ret;
>  
> @@ -374,6 +376,14 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data,
>  		goto err_submit_cmds;
>  	}
>  
> +	if (args->flags & ETNA_SUBMIT_FENCE_FD_OUT) {
> +		out_fence_fd = get_unused_fd_flags(O_CLOEXEC);
> +		if (out_fence_fd < 0) {
> +			ret = out_fence_fd;
> +			goto err_submit_cmds;
> +		}
> +	}
> +
>  	submit = submit_create(dev, gpu, args->nr_bos);
>  	if (!submit) {
>  		ret = -ENOMEM;
> @@ -437,10 +447,25 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data,
>  		goto out;
>  	}
>  
> +	if (args->flags & ETNA_SUBMIT_FENCE_FD_OUT) {
> +		sync_file = sync_file_create(submit->fence);
> +		if (!sync_file) {
> +			dma_fence_put(submit->fence);
> +			submit->fence = NULL;
> +			ret = -ENOMEM;
> +			goto out;
> +		}
> +	}
> +
>  	ret = etnaviv_gpu_submit(gpu, submit, cmdbuf);
>  	if (ret == 0)
>  		cmdbuf = NULL;
>  
> +	if (args->flags & ETNA_SUBMIT_FENCE_FD_OUT) {
> +		fd_install(out_fence_fd, sync_file->file);
> +	}

Extra braces here.

Otherwise looks good to me.

Reviewed-by: Gustavo Padovan <gustavo.padovan at collabora.com>

Gustavo



More information about the etnaviv mailing list