Re: [PATCH v2] drm: Allow CAP_DUMB_BUFFERS on !MODESET

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 08, 2018 at 01:52:01AM -0300, Ezequiel Garcia wrote:
> It's perfectly possible to get dumb buffers out of drivers
> that don't support modeset. This is the case of vgem,
> which can be used to export dmabuf to run various tests.
> 
> Inspired by commit f3f4c4d68a28 ("drm: Allow CAP_PRIME on !MODESET").

Prime makes sense, because render-only drivers _really_ want to be able to
share buffers.

But dumb buffers are really meant for dumb userspace running on kms
drivers only, there's no need ever to tell userspace that dumb buffers are
supported on non-kms drivers. It's kinda abuse of ioctls, but oh well,
uapi is fixed forever. And you can still call the ioctls if you know
they're there (which is always the case for the render-side of drm,
there's no generic alloc ioctl for those).
-Daniel

> Fixes: d5264ed3823a ("drm: Return -ENOTSUPP when called for KMS cap with a non-KMS driver")
> Signed-off-by: Ezequiel Garcia <ezequiel@xxxxxxxxxxxxx>
> ---
> Changes from v1:
>  * Drop the bitwise-OR assignment op
> 
>  drivers/gpu/drm/drm_ioctl.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
> index af782911c505..a5b879ce8f2c 100644
> --- a/drivers/gpu/drm/drm_ioctl.c
> +++ b/drivers/gpu/drm/drm_ioctl.c
> @@ -244,6 +244,9 @@ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_
>  	case DRM_CAP_SYNCOBJ:
>  		req->value = drm_core_check_feature(dev, DRIVER_SYNCOBJ);
>  		return 0;
> +	case DRM_CAP_DUMB_BUFFER:
> +		req->value = dev->driver->dumb_create ? 1 : 0;
> +		return 0;
>  	}
>  
>  	/* Other caps only work with KMS drivers */
> @@ -251,10 +254,6 @@ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_
>  		return -ENOTSUPP;
>  
>  	switch (req->capability) {
> -	case DRM_CAP_DUMB_BUFFER:
> -		if (dev->driver->dumb_create)
> -			req->value = 1;
> -		break;
>  	case DRM_CAP_VBLANK_HIGH_CRTC:
>  		req->value = 1;
>  		break;
> -- 
> 2.16.3
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux