Skip to contentSkip to conversation

Hello,

RFC In review Benjamin Gaignard 3 participants 13 messages Nov 30, 2016 – Dec 1, 2016

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

v3 cover Hello,

version 3:
- split the original patch in 3 parts, it should be more easy to review like this.
- duplicate drm_fb_cma_helper.c and drm_gem_cma_helper.c into nommu version
- add a configuration flag for drm_vm.c

The purpose of this RFC is to understand what is needed to allow to write drm/kms drivers for devices without MMU.

There are some MCU platforms, like stm32f4, which don't have MMU but have hardware display IP where is it possible to implement a drm/kms driver.

Obviously that start by removing MMU configuration flag from Kconfig. But while coding the driver for stm32f4 (on discovery board to have enough memory) we have already identify few other pieces of code that need to be change. We have been inspired by what already exist in v4l2 where using mmuless devices is possible.

Since we have only use cma helpers we only have partial view of what could be needed for other part of drm/kms framework.

Benjamin Gaignard (3):
fbmem: add default get_fb_unmapped_area function
drm: compile drm_vm.c only when needed
drm: allow to use mmuless SoC

 drivers/gpu/drm/Kconfig                    |  28 +-
 drivers/gpu/drm/Makefile                   |   5 +-
 drivers/gpu/drm/drm_fb_cma_helper_nommu.c  | 648 +++++++++++++++++++++++++++++
 drivers/gpu/drm/drm_gem_cma_helper_nommu.c | 574 +++++++++++++++++++++++++
 drivers/gpu/drm/drm_legacy.h               |   7 +
 drivers/gpu/drm/nouveau/Kconfig            |   1 +
 drivers/video/fbdev/core/fbmem.c           |  15 +
 include/drm/drm_gem_cma_helper.h           |   8 +
 8 files changed, 1281 insertions(+), 5 deletions(-)
 create mode 100644 drivers/gpu/drm/drm_fb_cma_helper_nommu.c
 create mode 100644 drivers/gpu/drm/drm_gem_cma_helper_nommu.c
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

RFC v3 1/3 fbmem: add default get_fb_unmapped_area function

If HAVE_ARCH_FB_UNMAPPED_AREA is set and get_fb_unmapped_area function not defined in platform architecture let use a default function.

---
 drivers/video/fbdev/core/fbmem.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/video/fbdev/core/fbmem.c +15 -0
index 76c1ad9..54488ee 100644
@@ -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)
+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,
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw

Re: [RFC v3 1/3] fbmem: add default get_fb_unmapped_area function

Quoted 13 lines · On Wednesday 30 Nov 2016 20:34:17 Benjamin Gaignard wrote:

If HAVE_ARCH_FB_UNMAPPED_AREA is set and get_fb_unmapped_area function not defined in platform architecture let use a default function.

---
 drivers/video/fbdev/core/fbmem.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
(quoted diff) +0 -0

b/drivers/video/fbdev/core/fbmem.c index 76c1ad9..54488ee 100644

drivers/video/fbdev/core/fbmem.c static long fb_compat_ioctl(struct file *file, · line 1495

Quoted 4 lines
drivers/video/fbdev/core/fbmem.c +1 -0
@@ -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)

I think I've asked this twice already, how is that possible ?

Quoted 17 lines
drivers/video/fbdev/core/fbmem.c +14 -0
+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,
Signature · 8 lines
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw

Re: [RFC v3 1/3] fbmem: add default get_fb_unmapped_area function

2016-11-30 20:39 GMT+01:00 Laurent Pinchart <[email protected]>:

Quoted 17 lines · On Wednesday 30 Nov 2016 20:34:17 Benjamin Gaignard wrote:
Quoted 16 lines

If HAVE_ARCH_FB_UNMAPPED_AREA is set and get_fb_unmapped_area function not defined in platform architecture let use a default function.

---
 drivers/video/fbdev/core/fbmem.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
(quoted diff) +0 -0

b/drivers/video/fbdev/core/fbmem.c index 76c1ad9..54488ee 100644

drivers/video/fbdev/core/fbmem.c +0 -0
@@ -1492,6 +1492,21 @@ static long fb_compat_ioctl(struct file *file,
 unsigned int cmd, return 0;
 }
 
Quoted 3 lines

drivers/video/fbdev/core/fbmem.c static long fb_compat_ioctl(struct file *file, unsigned int cmd, · line 1495

Quoted 1 line
drivers/video/fbdev/core/fbmem.c +1 -0
+#if defined(HAVE_ARCH_FB_UNMAPPED_AREA) && !defined(get_fb_unmapped_area)

I think I've asked this twice already, how is that possible ?

As you said before only sparc and blackfin architectures have define HAVE_ARCH_FB_UNMAPPED_AREA
and get_fb_unmapped_area().
For stm32f4 (ARMv7m) I plan to only add HAVE_ARCH_FB_UNMAPPED_AREA and use this default function

By testing those two flags I avoid to define twince get_fb_unmapped_area() if the architecture already provide it.

Quoted 25 lines
Quoted 9 lines
drivers/video/fbdev/core/fbmem.c +7 -0
+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);
+

drivers/video/fbdev/core/fbmem.c static long fb_compat_ioctl(struct file *file, unsigned int cmd, · line 1512

Quoted 10 lines
drivers/video/fbdev/core/fbmem.c +7 -0
+     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,

--
Regards,

Laurent Pinchart

Signature · 11 lines
Benjamin Gaignard

Graphic Study Group

Linaro.org │ Open source software for ARM SoCs

Follow Linaro: Facebook | Twitter | Blog
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#4 lore raw

Re: [RFC v3 1/3] fbmem: add default get_fb_unmapped_area function

Hi Benjamin,

Quoted 25 lines · On Wednesday 30 Nov 2016 20:46:23 Benjamin Gaignard wrote:

2016-11-30 20:39 GMT+01:00 Laurent Pinchart:

Quoted 19 lines · On Wednesday 30 Nov 2016 20:34:17 Benjamin Gaignard wrote:
Quoted 18 lines

If HAVE_ARCH_FB_UNMAPPED_AREA is set and get_fb_unmapped_area function not defined in platform architecture let use a default function.

---

 drivers/video/fbdev/core/fbmem.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
(quoted diff) +0 -0

b/drivers/video/fbdev/core/fbmem.c index 76c1ad9..54488ee 100644

drivers/video/fbdev/core/fbmem.c +0 -0
@@ -1492,6 +1492,21 @@ static long fb_compat_ioctl(struct file *file,
 unsigned int cmd,
 	return 0;
 }
 
Quoted 4 lines

drivers/video/fbdev/core/fbmem.c static long fb_compat_ioctl(struct file *file, · line 1497

Quoted 2 lines
drivers/video/fbdev/core/fbmem.c +1 -0
+#if defined(HAVE_ARCH_FB_UNMAPPED_AREA) &&
 !defined(get_fb_unmapped_area)

I think I've asked this twice already, how is that possible ?

Quoted 4 lines

As you said before only sparc and blackfin architectures have define HAVE_ARCH_FB_UNMAPPED_AREA and get_fb_unmapped_area().
For stm32f4 (ARMv7m) I plan to only add HAVE_ARCH_FB_UNMAPPED_AREA and use this default function

Ah, so it's for support of a future patch. You should explain that in the commit message.

The other question I asked was whether it would be possible to come up with a generic implementation of this function that would work on all architectures. At first sight the blackfin implementation is similar, but the sparc one is quite different. Why does it have to be arch-specific ?

Quoted 22 lines

By testing those two flags I avoid to define twince get_fb_unmapped_area() if the architecture already provide it.

Quoted 18 lines
Quoted 18 lines
drivers/video/fbdev/core/fbmem.c +14 -0
+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,

Signature · 8 lines
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#5 lore raw

Re: [RFC v3 1/3] fbmem: add default get_fb_unmapped_area function

2016-12-01 2:13 GMT+01:00 Laurent Pinchart <[email protected]>:

Quoted 28 lines

Hi Benjamin,

Quoted 25 lines · On Wednesday 30 Nov 2016 20:46:23 Benjamin Gaignard wrote:

2016-11-30 20:39 GMT+01:00 Laurent Pinchart:

Quoted 23 lines · On Wednesday 30 Nov 2016 20:34:17 Benjamin Gaignard wrote:
Quoted 14 lines

If HAVE_ARCH_FB_UNMAPPED_AREA is set and get_fb_unmapped_area function not defined in platform architecture let use a default function.

---

 drivers/video/fbdev/core/fbmem.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
(quoted diff) +0 -0

b/drivers/video/fbdev/core/fbmem.c index 76c1ad9..54488ee 100644

drivers/video/fbdev/core/fbmem.c static long fb_compat_ioctl(struct file *file, · line 1497

Quoted 6 lines
drivers/video/fbdev/core/fbmem.c +1 -0
@@ -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)

I think I've asked this twice already, how is that possible ?

Quoted 7 lines
Quoted 4 lines

As you said before only sparc and blackfin architectures have define HAVE_ARCH_FB_UNMAPPED_AREA and get_fb_unmapped_area().
For stm32f4 (ARMv7m) I plan to only add HAVE_ARCH_FB_UNMAPPED_AREA and use this default function

Ah, so it's for support of a future patch. You should explain that in the commit message.

OK

Quoted 4 lines

The other question I asked was whether it would be possible to come up with a generic implementation of this function that would work on all architectures. At first sight the blackfin implementation is similar, but the sparc one is quite different. Why does it have to be arch-specific ?

I don't know but I guess it is link to how memory is mmapped by the architecture

Quoted 28 lines
Quoted 14 lines

By testing those two flags I avoid to define twince get_fb_unmapped_area() if the architecture already provide it.

Quoted 10 lines
Quoted 10 lines
drivers/video/fbdev/core/fbmem.c +9 -0
+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;
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/video/fbdev/core/fbmem.c +5 -0
+
+     return (unsigned long)info->screen_base + pgoff;
+}
+#endif
+

static const struct file_operations fb_fops = {
.owner = THIS_MODULE,
.read = fb_read,

--
Regards,

Laurent Pinchart

Signature · 11 lines
Benjamin Gaignard

Graphic Study Group

Linaro.org │ Open source software for ARM SoCs

Follow Linaro: Facebook | Twitter | Blog
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#6 lore raw

Re: [RFC v3 1/3] fbmem: add default get_fb_unmapped_area function

Hi Benjamin,

Quoted 38 lines · On Thursday 01 Dec 2016 08:24:50 Benjamin Gaignard wrote:

2016-12-01 2:13 GMT+01:00 Laurent Pinchart:

Quoted 27 lines · On Wednesday 30 Nov 2016 20:46:23 Benjamin Gaignard wrote:
Quoted 26 lines

2016-11-30 20:39 GMT+01:00 Laurent Pinchart:

Quoted 24 lines · On Wednesday 30 Nov 2016 20:34:17 Benjamin Gaignard wrote:
Quoted 15 lines

If HAVE_ARCH_FB_UNMAPPED_AREA is set and get_fb_unmapped_area function not defined in platform architecture let use a default function.

---

 drivers/video/fbdev/core/fbmem.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
(quoted diff) +0 -0

b/drivers/video/fbdev/core/fbmem.c index 76c1ad9..54488ee 100644

drivers/video/fbdev/core/fbmem.c static long fb_compat_ioctl(struct file *file, · line 1497

Quoted 6 lines
drivers/video/fbdev/core/fbmem.c +1 -0
@@ -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)

I think I've asked this twice already, how is that possible ?

Quoted 7 lines
Quoted 4 lines

As you said before only sparc and blackfin architectures have define HAVE_ARCH_FB_UNMAPPED_AREA and get_fb_unmapped_area().
For stm32f4 (ARMv7m) I plan to only add HAVE_ARCH_FB_UNMAPPED_AREA and use this default function

Ah, so it's for support of a future patch. You should explain that in the commit message.

OK

Quoted 7 lines
Quoted 4 lines

The other question I asked was whether it would be possible to come up with a generic implementation of this function that would work on all architectures. At first sight the blackfin implementation is similar, but the sparc one is quite different. Why does it have to be arch-specific ?

I don't know but I guess it is link to how memory is mmapped by the architecture

Well, how about trying to find out then ? :-)

Quoted 23 lines
Quoted 23 lines
Quoted 23 lines

By testing those two flags I avoid to define twince get_fb_unmapped_area() if the architecture already provide it.

Quoted 19 lines
Quoted 19 lines
drivers/video/fbdev/core/fbmem.c +3 -0
+unsigned long get_fb_unmapped_area(struct file *filp,
+                                unsigned long addr, unsigned long
 len,
+                                unsigned long pgoff, unsigned long

flags)

drivers/video/fbdev/core/fbmem.c +11 -0
+{
+     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,
Signature · 8 lines
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#7 lore raw

Re: [RFC v3 1/3] fbmem: add default get_fb_unmapped_area function

In reply to Benjamin Gaignard
Quoted 22 lines · Benjamin Gaignard

2016-11-30 20:39 GMT+01:00 Laurent Pinchart <[email protected]>:

Quoted 17 lines · On Wednesday 30 Nov 2016 20:34:17 Benjamin Gaignard wrote:
Quoted 16 lines

If HAVE_ARCH_FB_UNMAPPED_AREA is set and get_fb_unmapped_area function not defined in platform architecture let use a default function.

---
 drivers/video/fbdev/core/fbmem.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
(quoted diff) +0 -0

b/drivers/video/fbdev/core/fbmem.c index 76c1ad9..54488ee 100644

drivers/video/fbdev/core/fbmem.c +0 -0
@@ -1492,6 +1492,21 @@ static long fb_compat_ioctl(struct file *file,
 unsigned int cmd, return 0;
 }
 
Quoted 3 lines

drivers/video/fbdev/core/fbmem.c static long fb_compat_ioctl(struct file *file, unsigned int cmd, · line 1495

Quoted 1 line
drivers/video/fbdev/core/fbmem.c +1 -0
+#if defined(HAVE_ARCH_FB_UNMAPPED_AREA) && !defined(get_fb_unmapped_area)

I think I've asked this twice already, how is that possible ?

Quoted 5 lines

As you said before only sparc and blackfin architectures have define HAVE_ARCH_FB_UNMAPPED_AREA
and get_fb_unmapped_area().
For stm32f4 (ARMv7m) I plan to only add HAVE_ARCH_FB_UNMAPPED_AREA and use this default function

Note that the preprocessor only considers defined(get_fb_unmapped_area) true if get_fb_unmapped_area is defined as a macro, not if it's a normal function. Since AFAICT get_fb_unmapped_area is a normal function on sparc and blackfin, this default function will be compiled on those architectures as well.

Signature · 6 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#8 lore raw

Re: [RFC v3 1/3] fbmem: add default get_fb_unmapped_area function

2016-12-01 3:31 GMT+01:00 Michel Dänzer <[email protected]>:

Quoted 29 lines · Benjamin Gaignard
Quoted 22 lines

2016-11-30 20:39 GMT+01:00 Laurent Pinchart <[email protected]>:

Quoted 17 lines · On Wednesday 30 Nov 2016 20:34:17 Benjamin Gaignard wrote:
Quoted 16 lines

If HAVE_ARCH_FB_UNMAPPED_AREA is set and get_fb_unmapped_area function not defined in platform architecture let use a default function.

---
 drivers/video/fbdev/core/fbmem.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
(quoted diff) +0 -0

b/drivers/video/fbdev/core/fbmem.c index 76c1ad9..54488ee 100644

drivers/video/fbdev/core/fbmem.c +0 -0
@@ -1492,6 +1492,21 @@ static long fb_compat_ioctl(struct file *file,
 unsigned int cmd, return 0;
 }
 
Quoted 3 lines

drivers/video/fbdev/core/fbmem.c static long fb_compat_ioctl(struct file *file, unsigned int cmd, · line 1495

Quoted 1 line
drivers/video/fbdev/core/fbmem.c +1 -0
+#if defined(HAVE_ARCH_FB_UNMAPPED_AREA) && !defined(get_fb_unmapped_area)

I think I've asked this twice already, how is that possible ?

Quoted 5 lines

As you said before only sparc and blackfin architectures have define HAVE_ARCH_FB_UNMAPPED_AREA
and get_fb_unmapped_area().
For stm32f4 (ARMv7m) I plan to only add HAVE_ARCH_FB_UNMAPPED_AREA and use this default function

Quoted 5 lines

Note that the preprocessor only considers defined(get_fb_unmapped_area) true if get_fb_unmapped_area is defined as a macro, not if it's a normal function. Since AFAICT get_fb_unmapped_area is a normal function on sparc and blackfin, this default function will be compiled on those architectures as well.

Since only sparc and blackfin have this function already, I will change the condition to:
#ifdef HAVE_ARCH_FB_UNMAPPED_AREA
#ifndef CONFIG_SPARC
#ifndef CONFIG_BLACKFIN

so this function won't be compiled for those architectures

Quoted 4 lines

--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer

Signature · 11 lines
Benjamin Gaignard

Graphic Study Group

Linaro.org │ Open source software for ARM SoCs

Follow Linaro: Facebook | Twitter | Blog
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#9 lore raw

Re: [RFC v3 1/3] fbmem: add default get_fb_unmapped_area function

Quoted 40 lines · On Thursday 01 Dec 2016 08:27:58 Benjamin Gaignard wrote:

2016-12-01 3:31 GMT+01:00 Michel Dänzer <[email protected]>:

Quoted 33 lines · Benjamin Gaignard
Quoted 26 lines

2016-11-30 20:39 GMT+01:00 Laurent Pinchart:

Quoted 18 lines · On Wednesday 30 Nov 2016 20:34:17 Benjamin Gaignard wrote:
Quoted 17 lines

If HAVE_ARCH_FB_UNMAPPED_AREA is set and get_fb_unmapped_area function not defined in platform architecture let use a default function.

---

 drivers/video/fbdev/core/fbmem.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
(quoted diff) +0 -0

b/drivers/video/fbdev/core/fbmem.c index 76c1ad9..54488ee 100644

drivers/video/fbdev/core/fbmem.c +0 -0
@@ -1492,6 +1492,21 @@ static long fb_compat_ioctl(struct file *file,
 unsigned int cmd, return 0;
 
Quoted 6 lines

drivers/video/fbdev/core/fbmem.c static long fb_compat_ioctl(struct file *file, · line 1497

Quoted 4 lines
drivers/video/fbdev/core/fbmem.c +1 -0
 }
 
+#if defined(HAVE_ARCH_FB_UNMAPPED_AREA) &&
 !defined(get_fb_unmapped_area)

I think I've asked this twice already, how is that possible ?

Quoted 5 lines

As you said before only sparc and blackfin architectures have define HAVE_ARCH_FB_UNMAPPED_AREA
and get_fb_unmapped_area().
For stm32f4 (ARMv7m) I plan to only add HAVE_ARCH_FB_UNMAPPED_AREA and use this default function

Quoted 5 lines

Note that the preprocessor only considers defined(get_fb_unmapped_area) true if get_fb_unmapped_area is defined as a macro, not if it's a normal function. Since AFAICT get_fb_unmapped_area is a normal function on sparc and blackfin, this default function will be compiled on those architectures as well.

Quoted 5 lines

Since only sparc and blackfin have this function already, I will change the condition to:
#ifdef HAVE_ARCH_FB_UNMAPPED_AREA
#ifndef CONFIG_SPARC
#ifndef CONFIG_BLACKFIN

No, that's really hackish. HAVE_ARCH_FB_UNMAPPED_AREA means that the architecture provides the function. The generic version should not be provided when that macro is defined.

Please try to see if you can't share the implementation with at least blackfin, and possibly sparc. If sparc requires its own version, you need a different mechanism to decide whether to provide the generic one.

Quoted 1 line

so this function won't be compiled for those architectures

Signature · 8 lines
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#10 lore raw

RFC v3 2/3 drm: compile drm_vm.c only when needed

In reply to Benjamin Gaignard

drm_vm.c functions are only need for DRM_LEGACY and DRM_NOUVEAU. Use a new DRM_VM to define when drm_vm.c in needed.

stub drm_legacy_vma_flush() to avoid compilation issues

---
 drivers/gpu/drm/Kconfig         | 1 +
 drivers/gpu/drm/Makefile        | 3 ++-
 drivers/gpu/drm/drm_legacy.h    | 7 +++++++
 drivers/gpu/drm/nouveau/Kconfig | 1 +
 4 files changed, 11 insertions(+), 1 deletion(-)
drivers/gpu/drm/Kconfig +1 -0
index 8d9cf73..383989c 100644
@@ -246,6 +246,7 @@ source "drivers/gpu/drm/zte/Kconfig"
 menuconfig DRM_LEGACY
 	bool "Enable legacy drivers (DANGEROUS)"
 	depends on DRM
+	select DRM_VM
 	help
 	  Enable legacy DRI1 drivers. Those drivers expose unsafe and dangerous
 	  APIs to user-space, which can be used to circumvent access
drivers/gpu/drm/Makefile +2 -1
index e10e935..5b73b16 100644
@@ -5,7 +5,7 @@
 drm-y       :=	drm_auth.o drm_bufs.o drm_cache.o \
 		drm_context.o drm_dma.o \
 		drm_fops.o drm_gem.o drm_ioctl.o drm_irq.o \
-		drm_lock.o drm_memory.o drm_drv.o drm_vm.o \
+		drm_lock.o drm_memory.o drm_drv.o \
 		drm_scatter.o drm_pci.o \
 		drm_platform.o drm_sysfs.o drm_hashtab.o drm_mm.o \
 		drm_crtc.o drm_fourcc.o drm_modes.o drm_edid.o \
@@ -18,6 +18,7 @@ drm-y       :=	drm_auth.o drm_bufs.o drm_cache.o \
 		drm_plane.o drm_color_mgmt.o drm_print.o \
 		drm_dumb_buffers.o drm_mode_config.o
 
+drm-$(CONFIG_DRM_VM) += drm_vm.o
 drm-$(CONFIG_COMPAT) += drm_ioc32.o
 drm-$(CONFIG_DRM_GEM_CMA_HELPER) += drm_gem_cma_helper.o
 drm-$(CONFIG_PCI) += ati_pcigart.o
drivers/gpu/drm/drm_legacy.h +7 -0
index c6f422e..e4bb5ad 100644
@@ -74,7 +74,14 @@ int drm_legacy_getmap_ioctl(struct drm_device *dev, void *data,
 int drm_legacy_mapbufs(struct drm_device *d, void *v, struct drm_file *f);
 int drm_legacy_dma_ioctl(struct drm_device *d, void *v, struct drm_file *f);
 
+#ifdef CONFIG_DRM_VM
 void drm_legacy_vma_flush(struct drm_device *d);
+#else
+static inline void drm_legacy_vma_flush(struct drm_device *d)
+{
+	/* do nothing */
+}
+#endif
 
 /*
  * AGP Support
drivers/gpu/drm/nouveau/Kconfig +1 -0
index 2922a82..0f2f0af 100644
@@ -16,6 +16,7 @@ config DRM_NOUVEAU
 	select INPUT if ACPI && X86
 	select THERMAL if ACPI && X86
 	select ACPI_VIDEO if ACPI && X86
+	select DRM_VM
 	help
 	  Choose this option for open-source NVIDIA support.
 
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Acked-by on v3 2/3
#11 lore raw

Re: [RFC v3 2/3] drm: compile drm_vm.c only when needed

Quoted 18 lines · On Wednesday 30 Nov 2016 20:34:18 Benjamin Gaignard wrote:

drm_vm.c functions are only need for DRM_LEGACY and DRM_NOUVEAU. Use a new DRM_VM to define when drm_vm.c in needed.

stub drm_legacy_vma_flush() to avoid compilation issues

---
 drivers/gpu/drm/Kconfig         | 1 +
 drivers/gpu/drm/Makefile        | 3 ++-
 drivers/gpu/drm/drm_legacy.h    | 7 +++++++
 drivers/gpu/drm/nouveau/Kconfig | 1 +
 4 files changed, 11 insertions(+), 1 deletion(-)
drivers/gpu/drm/Kconfig +0 -0
index 8d9cf73..383989c 100644

drivers/gpu/drm/Kconfig source "drivers/gpu/drm/zte/Kconfig" · line 249

Quoted 4 lines
drivers/gpu/drm/Kconfig +1 -0
@@ -246,6 +246,7 @@ source "drivers/gpu/drm/zte/Kconfig"
 menuconfig DRM_LEGACY
 	bool "Enable legacy drivers (DANGEROUS)"
 	depends on DRM
+	select DRM_VM

I don't see a config DRM_VM anywhere in this patch.

Apart from that,

drivers/gpu/drm/Kconfig source "drivers/gpu/drm/zte/Kconfig" · line 251

Quoted 2 lines
drivers/gpu/drm/Kconfig +0 -0
 	help
 	  Enable legacy DRI1 drivers. Those drivers expose unsafe and 

dangerous

Quoted 53 lines
drivers/gpu/drm/Kconfig +0 -0
 	  APIs to user-space, which can be used to circumvent access
drivers/gpu/drm/Makefile +2 -1
index e10e935..5b73b16 100644
@@ -5,7 +5,7 @@
 drm-y       :=	drm_auth.o drm_bufs.o drm_cache.o \
 		drm_context.o drm_dma.o \
 		drm_fops.o drm_gem.o drm_ioctl.o drm_irq.o \
-		drm_lock.o drm_memory.o drm_drv.o drm_vm.o \
+		drm_lock.o drm_memory.o drm_drv.o \
 		drm_scatter.o drm_pci.o \
 		drm_platform.o drm_sysfs.o drm_hashtab.o drm_mm.o \
 		drm_crtc.o drm_fourcc.o drm_modes.o drm_edid.o \
@@ -18,6 +18,7 @@ drm-y       :=	drm_auth.o drm_bufs.o drm_cache.o \
 		drm_plane.o drm_color_mgmt.o drm_print.o \
 		drm_dumb_buffers.o drm_mode_config.o
 
+drm-$(CONFIG_DRM_VM) += drm_vm.o
 drm-$(CONFIG_COMPAT) += drm_ioc32.o
 drm-$(CONFIG_DRM_GEM_CMA_HELPER) += drm_gem_cma_helper.o
 drm-$(CONFIG_PCI) += ati_pcigart.o
drivers/gpu/drm/drm_legacy.h +7 -0
index c6f422e..e4bb5ad 100644
@@ -74,7 +74,14 @@ int drm_legacy_getmap_ioctl(struct drm_device *dev, void
 *data, int drm_legacy_mapbufs(struct drm_device *d, void *v, struct
 drm_file *f); int drm_legacy_dma_ioctl(struct drm_device *d, void *v,
 struct drm_file *f);
 
+#ifdef CONFIG_DRM_VM
 void drm_legacy_vma_flush(struct drm_device *d);
+#else
+static inline void drm_legacy_vma_flush(struct drm_device *d)
+{
+	/* do nothing */
+}
+#endif
 
 /*

* AGP Support

(quoted diff) +0 -0

b/drivers/gpu/drm/nouveau/Kconfig index 2922a82..0f2f0af 100644

drivers/gpu/drm/nouveau/Kconfig +1 -0
@@ -16,6 +16,7 @@ config DRM_NOUVEAU
 	select INPUT if ACPI && X86
 	select THERMAL if ACPI && X86
 	select ACPI_VIDEO if ACPI && X86
+	select DRM_VM
 	help
 	  Choose this option for open-source NVIDIA support.
Signature · 8 lines
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#12 lore raw

RFC v3 3/3 drm: allow to use mmuless SoC

In reply to Benjamin Gaignard

Some platforms without MMU have display driver where a drm/kms driver could be implemented.

To doing that this patch remove the dependency of DRM on MMU configuration flag.

MMU configuration flag migrate to DRM_TTM, DRM_GEM_CMA_HELPER and DRM_KMS_CMA_HELPER.

Since MMUless platform will need contiguous memory it duplicate cma helpers files with "_nommu" suffix.
Main changes are the usage of vm_iomap_memory instead of dma_mmap_wc.

DRM_GEM_CMA_HELPER and DRM_KMS_CMA_HELPER are duplicated into DRM_GEM_CMA_HELPER_NOMMU and DRM_KMS_CMA_HELPER_NOMMU to select the correct files to compile.

---
 drivers/gpu/drm/Kconfig                    |  27 +-
 drivers/gpu/drm/Makefile                   |   2 +
 drivers/gpu/drm/drm_fb_cma_helper_nommu.c  | 648 +++++++++++++++++++++++++++++
 drivers/gpu/drm/drm_gem_cma_helper_nommu.c | 574 +++++++++++++++++++++++++
 include/drm/drm_gem_cma_helper.h           |   8 +
 5 files changed, 1255 insertions(+), 4 deletions(-)
 create mode 100644 drivers/gpu/drm/drm_fb_cma_helper_nommu.c
 create mode 100644 drivers/gpu/drm/drm_gem_cma_helper_nommu.c
drivers/gpu/drm/Kconfig +23 -4
index 383989c..81c7e60 100644
@@ -6,7 +6,7 @@
 #
 menuconfig DRM
 	tristate "Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)"
-	depends on (AGP || AGP=n) && !EMULATED_CMPXCHG && MMU && HAS_DMA
+	depends on (AGP || AGP=n) && !EMULATED_CMPXCHG && HAS_DMA
 	select HDMI
 	select FB_CMDLINE
 	select I2C
@@ -98,7 +98,7 @@ config DRM_LOAD_EDID_FIRMWARE
 
 config DRM_TTM
 	tristate
-	depends on DRM
+	depends on DRM && MMU
 	help
 	  GPU memory management subsystem for devices with multiple
 	  GPU memory types. Will be enabled automatically if a device driver
@@ -106,13 +106,13 @@ config DRM_TTM
 
 config DRM_GEM_CMA_HELPER
 	bool
-	depends on DRM
+	depends on DRM && MMU
 	help
 	  Choose this if you need the GEM CMA helper functions
 
 config DRM_KMS_CMA_HELPER
 	bool
-	depends on DRM
+	depends on DRM && MMU
 	select DRM_GEM_CMA_HELPER
 	select DRM_KMS_FB_HELPER
 	select FB_SYS_FILLRECT
@@ -121,6 +121,25 @@ config DRM_KMS_CMA_HELPER
 	help
 	  Choose this if you need the KMS CMA helper functions
 
+config DRM_GEM_CMA_HELPER_NOMMU
+	bool
+	depends on DRM && !MMU
+	help
+	  Choose this if you need the GEM CMA helper functions
+	  for platforms without MMU
+
+config DRM_KMS_CMA_HELPER_NOMMU
+	bool
+	depends on DRM && !MMU
+	select DRM_GEM_CMA_HELPER_NOMMU
+	select DRM_KMS_FB_HELPER
+	select FB_SYS_FILLRECT
+	select FB_SYS_COPYAREA
+	select FB_SYS_IMAGEBLIT
+	help
+	  Choose this if you need the KMS CMA helper functions
+	  for platforms without MMU
+
 source "drivers/gpu/drm/i2c/Kconfig"
 
 source "drivers/gpu/drm/arm/Kconfig"
drivers/gpu/drm/Makefile +2 -0
index 5b73b16..a296214 100644
@@ -21,6 +21,7 @@ drm-y       :=	drm_auth.o drm_bufs.o drm_cache.o \
 drm-$(CONFIG_DRM_VM) += drm_vm.o
 drm-$(CONFIG_COMPAT) += drm_ioc32.o
 drm-$(CONFIG_DRM_GEM_CMA_HELPER) += drm_gem_cma_helper.o
+drm-$(CONFIG_DRM_GEM_CMA_HELPER_NOMMU) += drm_gem_cma_helper_nommu.o
 drm-$(CONFIG_PCI) += ati_pcigart.o
 drm-$(CONFIG_DRM_PANEL) += drm_panel.o
 drm-$(CONFIG_OF) += drm_of.o
@@ -35,6 +36,7 @@ drm_kms_helper-y := drm_crtc_helper.o drm_dp_helper.o drm_probe_helper.o \
 drm_kms_helper-$(CONFIG_DRM_LOAD_EDID_FIRMWARE) += drm_edid_load.o
 drm_kms_helper-$(CONFIG_DRM_FBDEV_EMULATION) += drm_fb_helper.o
 drm_kms_helper-$(CONFIG_DRM_KMS_CMA_HELPER) += drm_fb_cma_helper.o
+drm_kms_helper-$(CONFIG_DRM_KMS_CMA_HELPER_NOMMU) += drm_fb_cma_helper_nommu.o
 drm_kms_helper-$(CONFIG_DRM_DP_AUX_CHARDEV) += drm_dp_aux_dev.o
 
 obj-$(CONFIG_DRM_KMS_HELPER) += drm_kms_helper.o
drivers/gpu/drm/drm_fb_cma_helper_nommu.c new file +648 -0

648 lines not on this page · raw message

drivers/gpu/drm/drm_gem_cma_helper_nommu.c new file +574 -0

574 lines not on this page · raw message

include/drm/drm_gem_cma_helper.h +8 -0
index acd6af8..ddb2390 100644
@@ -53,6 +53,14 @@ struct drm_gem_cma_object *drm_gem_cma_create(struct drm_device *drm,
 
 extern const struct vm_operations_struct drm_gem_cma_vm_ops;
 
+#ifdef DRM_GEM_CMA_HELPER_NOMMU
+unsigned long drm_gem_cma_get_unmapped_area(struct file *filp,
+					    unsigned long addr,
+					    unsigned long len,
+					    unsigned long pgoff,
+					    unsigned long flags);
+#endif
+
 #ifdef CONFIG_DEBUG_FS
 void drm_gem_cma_describe(struct drm_gem_cma_object *obj, struct seq_file *m);
 #endif
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel