[Intel-gfx] [RFC v3 02/12] drm/file: Don't set master on in-kernel clients

Daniel Vetter daniel at ffwll.ch
Tue Mar 6 08:28:37 UTC 2018


On Thu, Feb 22, 2018 at 09:06:43PM +0100, Noralf Trønnes wrote:
> It only makes sense for userspace clients.
> 
> Signed-off-by: Noralf Trønnes <noralf at tronnes.org>

I think we might be able to reuse some of the master stuff to better
handle hand-over between in-kernel clients and userspace masters for kms.
But this definitely makes sense.

Reviewed-by: Daniel Vetter <daniel.vetter at ffwll.ch>

> ---
>  drivers/gpu/drm/drm_file.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c
> index d4588d33f91c..55505378df47 100644
> --- a/drivers/gpu/drm/drm_file.c
> +++ b/drivers/gpu/drm/drm_file.c
> @@ -155,17 +155,8 @@ struct drm_file *drm_file_alloc(struct drm_minor *minor)
>  			goto out_prime_destroy;
>  	}
>  
> -	if (drm_is_primary_client(file)) {
> -		ret = drm_master_open(file);
> -		if (ret)
> -			goto out_close;
> -	}
> -
>  	return file;
>  
> -out_close:
> -	if (dev->driver->postclose)
> -		dev->driver->postclose(dev, file);
>  out_prime_destroy:
>  	if (drm_core_check_feature(dev, DRIVER_PRIME))
>  		drm_prime_destroy_file_private(&file->prime);
> @@ -365,6 +356,7 @@ static int drm_open_helper(struct file *filp, struct drm_minor *minor)
>  {
>  	struct drm_device *dev = minor->dev;
>  	struct drm_file *priv;
> +	int ret;
>  
>  	if (filp->f_flags & O_EXCL)
>  		return -EBUSY;	/* No exclusive opens */
> @@ -379,6 +371,14 @@ static int drm_open_helper(struct file *filp, struct drm_minor *minor)
>  	if (IS_ERR(priv))
>  		return PTR_ERR(priv);
>  
> +	if (drm_is_primary_client(priv)) {
> +		ret = drm_master_open(priv);
> +		if (ret) {
> +			drm_file_free(priv);
> +			return ret;
> +		}
> +	}
> +
>  	filp->private_data = priv;
>  	priv->filp = filp;
>  
> -- 
> 2.15.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the Intel-gfx mailing list