All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Cc: linaro-kernel@lists.linaro.org, philippe.cornu@st.com,
	dri-devel@lists.freedesktop.org, yannick.fertre@st.com,
	airlied@redhat.com
Subject: Re: [RFC 1/1] drm: allow to use mmuless SoC
Date: Wed, 30 Nov 2016 13:35:58 +0200	[thread overview]
Message-ID: <7154886.Ud0Vdd6CQ5@avalon> (raw)
In-Reply-To: <1480504884-22638-2-git-send-email-benjamin.gaignard@linaro.org>

Hi Benjamin,

Thank you for the patch.

On Wednesday 30 Nov 2016 12:21:24 Benjamin Gaignard wrote:
> Some platforms without MMU have display drivers where a drm/kms driver
> could be implemented.
> Before doing such kind of thing drm/kms must allow to use mmuless
> devices.
> This patch proposes to remove MMU configuration flag and add some
> cma helpers functions to help implementing mmuless display driver
> 
> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
> ---
>  drivers/gpu/drm/Kconfig              |  4 +--
>  drivers/gpu/drm/drm_fb_cma_helper.c  | 20 ++++++++++++
>  drivers/gpu/drm/drm_gem_cma_helper.c | 62 +++++++++++++++++++++++++++++++++
>  drivers/gpu/drm/drm_vm.c             |  4 +++

I'll let someone more knowledgeable than me comment on these two files.

>  drivers/video/fbdev/core/fbmem.c     |  8 +++++
>  include/drm/drm_gem_cma_helper.h     |  6 ++++
>  6 files changed, 102 insertions(+), 2 deletions(-)

[snip]

> diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c
> b/drivers/gpu/drm/drm_fb_cma_helper.c index 81b3558..a3cef79 100644
> --- a/drivers/gpu/drm/drm_fb_cma_helper.c
> +++ b/drivers/gpu/drm/drm_fb_cma_helper.c
> @@ -343,10 +343,30 @@ int drm_fb_cma_debugfs_show(struct seq_file *m, void
> *arg)
> 
>  static int drm_fb_cma_mmap(struct fb_info *info, struct vm_area_struct
> *vma) {
> +#ifdef CONFIG_MMU
>  	return dma_mmap_writecombine(info->device, vma, info->screen_base,
>  				     info->fix.smem_start, info-
>fix.smem_len);
> +#else
> +	return vm_iomap_memory(vma, vma->vm_start, info->fix.smem_len);
> +#endif
>  }
> 
> +#ifdef HAVE_ARCH_FB_UNMAPPED_AREA

Shouldn't this be #ifndef ? When the symbol is defined the implementation is 
provided by the architecture.

By the way, given that you provide a generic implementation here, what's the 
reason some architecture need to implement the function in a special way ? 
Couldn't we come up with a generic implementation across all architectures ?

> +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;
> +}
> +EXPORT_SYMBOL_GPL(get_fb_unmapped_area);

Shouldn't this be defined somewhere in drivers/video/ instead, as the code is 
fbdev-specific and only used in drivers/video/fbdev/core/fbmem.c ?

> +#endif
> +
>  static struct fb_ops drm_fbdev_cma_ops = {
>  	.owner		= THIS_MODULE,
>  	DRM_FB_HELPER_DEFAULT_OPS,

[snip]

> diff --git a/drivers/video/fbdev/core/fbmem.c
> b/drivers/video/fbdev/core/fbmem.c index 76c1ad9..d6a83bd 100644
> --- a/drivers/video/fbdev/core/fbmem.c
> +++ b/drivers/video/fbdev/core/fbmem.c
> @@ -1492,6 +1492,14 @@ static long fb_compat_ioctl(struct file *file,
> unsigned int cmd, return 0;
>  }
> 
> +#ifdef HAVE_ARCH_FB_UNMAPPED_AREA
> +extern unsigned long get_fb_unmapped_area(struct file *filp,
> +					  unsigned long addr,
> +					  unsigned long len,
> +					  unsigned long pgoff,
> +					  unsigned long flags);
> +#endif

This should come from a header file.

>  static const struct file_operations fb_fops = {
>  	.owner =	THIS_MODULE,
>  	.read =		fb_read,
> diff --git a/include/drm/drm_gem_cma_helper.h
> b/include/drm/drm_gem_cma_helper.h index acd6af8..79e9dbd 100644
> --- a/include/drm/drm_gem_cma_helper.h
> +++ b/include/drm/drm_gem_cma_helper.h
> @@ -51,6 +51,12 @@ int drm_gem_cma_dumb_map_offset(struct drm_file
> *file_priv, struct drm_gem_cma_object *drm_gem_cma_create(struct drm_device
> *drm, size_t size);
> 
> +unsigned long drm_gem_cma_get_unmapped_area(struct file *filp,
> +					    unsigned long addr,
> +					    unsigned long len,
> +					    unsigned long pgoff,
> +					    unsigned long flags);
> +
>  extern const struct vm_operations_struct drm_gem_cma_vm_ops;
> 
>  #ifdef CONFIG_DEBUG_FS

-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2016-11-30 11:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-30 11:21 [RFC 0/1] DRM: allow to use mmuless devices Benjamin Gaignard
2016-11-30 11:21 ` [RFC 1/1] drm: allow to use mmuless SoC Benjamin Gaignard
2016-11-30 11:35   ` Laurent Pinchart [this message]
2016-11-30 12:35     ` Benjamin Gaignard
2016-11-30 13:52   ` Daniel Vetter
2016-11-30 15:08     ` Benjamin Gaignard
2016-11-30 15:19       ` Laurent Pinchart
2016-11-30 15:34         ` Benjamin Gaignard
2016-11-30 15:36           ` Laurent Pinchart
2016-11-30 15:56             ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7154886.Ud0Vdd6CQ5@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=airlied@redhat.com \
    --cc=benjamin.gaignard@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linaro-kernel@lists.linaro.org \
    --cc=philippe.cornu@st.com \
    --cc=yannick.fertre@st.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.