[RFC v2 1/1] drm: allow to use mmuless SoC

Laurent Pinchart laurent.pinchart at ideasonboard.com
Wed Nov 30 13:27:50 UTC 2016


Hi Benjamin,

Thank you for the patch.

On Wednesday 30 Nov 2016 14:19:18 Benjamin Gaignard wrote:
> Some SoC without MMU have display driver where a drm/kms driver
> could be implemented.
> Before doing such kind of thing drm/kms must allow to use mmuless
> devices.
> This patch propose to remove MMU configuration flag and add some
> cma helpers functions to help implementing mmuless display driver
> 
> version 2:
> - define get_fb_unmapped_area() in drivers/video/fbdev/core/fbmem.c
>   if HAVE_ARCH_FB_UNMAPPED_AREA is set and get_fb_unmapped_area not
>   already defined in the architecture
> 
> Signed-off-by: Benjamin Gaignard <benjamin.gaignard at linaro.org>
> ---
>  drivers/gpu/drm/Kconfig              |  4 +--
>  drivers/gpu/drm/drm_fb_cma_helper.c  |  4 +++
>  drivers/gpu/drm/drm_gem_cma_helper.c | 62 +++++++++++++++++++++++++++++++++
>  drivers/gpu/drm/drm_vm.c             |  4 +++
>  drivers/video/fbdev/core/fbmem.c     | 15 +++++++++
>  include/drm/drm_gem_cma_helper.h     |  6 ++++
>  6 files changed, 93 insertions(+), 2 deletions(-)

[snip]

> diff --git a/drivers/video/fbdev/core/fbmem.c
> b/drivers/video/fbdev/core/fbmem.c index 76c1ad9..54488ee 100644
> --- a/drivers/video/fbdev/core/fbmem.c
> +++ b/drivers/video/fbdev/core/fbmem.c
> @@ -1492,6 +1492,21 @@ static long fb_compat_ioctl(struct file *file,
> unsigned int cmd, return 0;
>  }
> 
> +#if defined(HAVE_ARCH_FB_UNMAPPED_AREA) && !defined(get_fb_unmapped_area)

Only blackfin and sparc define HAVE_ARCH_FB_UNMAPPED_AREA, and both of them 
provide an implementation of get_fb_unmapped_area().

> +unsigned long get_fb_unmapped_area(struct file *filp,
> +				    unsigned long addr, unsigned long len,
> +				    unsigned long pgoff, unsigned long flags)
> +{
> +	struct fb_info * const info = filp->private_data;
> +	unsigned long fb_size = PAGE_ALIGN(info->fix.smem_len);
> +
> +	if (pgoff > fb_size || len > fb_size - pgoff)
> +		return -EINVAL;
> +
> +	return (unsigned long)info->screen_base + pgoff;
> +}
> +#endif
> +
>  static const struct file_operations fb_fops = {
>  	.owner =	THIS_MODULE,
>  	.read =		fb_read,

[snip]

-- 
Regards,

Laurent Pinchart



More information about the dri-devel mailing list