[RFC 3/6] drm: add SimpleDRM driver
Hi On Wed, Jun 26, 2013 at 10:58 PM, Stephen Warren wrote: > On 06/24/2013 04:27 PM, David Herrmann wrote: >> The SimpleDRM driver binds to simple-framebuffer devices and provides a >> DRM/KMS API. It provides only a single CRTC+encoder+connector combination >> plus one initial mode. >> >> Userspace can create one dumb-buffer and attach it to the CRTC. Only if >> the buffer is destroyed, a new buffer can be created. The buffer is >> directly mapped into user-space, so we have only resources for a single >> buffer. Otherwise, shadow buffers plus damage-request would be needed. > >> diff --git a/drivers/gpu/drm/simpledrm/Kconfig >> b/drivers/gpu/drm/simpledrm/Kconfig > >> +config DRM_SIMPLEDRM >> + tristate "Simple firmware framebuffer DRM driver" >> + depends on DRM && !FB_SIMPLE >> + help >> + SimpleDRM can run on all systems with pre-initialized graphics >> + hardware. It uses a framebuffer that was initialized during >> + firmware boot. No page-flipping, modesetting or other advanced >> + features are available. However, other DRM drivers can be loaded >> + later and take over from SimpleDRM if they provide real hardware >> + support. >> + >> + SimpleDRM supports: "simple-framebuffer" DeviceTree objects, x86 VESA >> + BIOS Extensions (VBE), EFI framebuffers > > DT objects, yes. I'm not sure it's quite true to say it actually > directly supports VBE or EFI FBs; it's more the code in patch 2/6 that > supports those. I guess this is a bit nit-picky of a distinction though. I initially intended to add support for "platform-framebuffer" objects, too. This would make vesafb/... obsolete but I dropped that idea for now. I will fix the Kconfig description. >> diff --git a/drivers/gpu/drm/simpledrm/simpledrm_drv.c >> b/drivers/gpu/drm/simpledrm/simpledrm_drv.c > >> +static int parse_dt(struct platform_device *pdev, >> + struct simplefb_platform_data *mode) > >> + strlcpy(mode->format, format, sizeof(mode->format)); > > Even here, I believe the DT data sticks around so just copying the > pointer should be safe. It'd be worth validating that for sure though. Yep, indeed, I fixed that. Thanks! David > I didn't review the DRM stuff here since I'm not at all familiar with DRM.
[RFC 3/6] drm: add SimpleDRM driver
Hi On Tue, Jun 25, 2013 at 3:05 AM, Andy Lutomirski wrote: > On 06/24/2013 03:27 PM, David Herrmann wrote: >> + sdrm->fb_map = ioremap(sdrm->fb_base, sdrm->fb_size); > > This should probably be ioremap_wc. Otherwise it will be *really* slow > if used in legacy mode and it may cause conflicts with the > pgprot_writecombine mode for mmap. Whoops, yepp, I fixed that. Thanks David
Re: [RFC 3/6] drm: add SimpleDRM driver
Hi On Wed, Jun 26, 2013 at 10:58 PM, Stephen Warren wrote: > On 06/24/2013 04:27 PM, David Herrmann wrote: >> The SimpleDRM driver binds to simple-framebuffer devices and provides a >> DRM/KMS API. It provides only a single CRTC+encoder+connector combination >> plus one initial mode. >> >> Userspace can create one dumb-buffer and attach it to the CRTC. Only if >> the buffer is destroyed, a new buffer can be created. The buffer is >> directly mapped into user-space, so we have only resources for a single >> buffer. Otherwise, shadow buffers plus damage-request would be needed. > >> diff --git a/drivers/gpu/drm/simpledrm/Kconfig >> b/drivers/gpu/drm/simpledrm/Kconfig > >> +config DRM_SIMPLEDRM >> + tristate "Simple firmware framebuffer DRM driver" >> + depends on DRM && !FB_SIMPLE >> + help >> + SimpleDRM can run on all systems with pre-initialized graphics >> + hardware. It uses a framebuffer that was initialized during >> + firmware boot. No page-flipping, modesetting or other advanced >> + features are available. However, other DRM drivers can be loaded >> + later and take over from SimpleDRM if they provide real hardware >> + support. >> + >> + SimpleDRM supports: "simple-framebuffer" DeviceTree objects, x86 VESA >> + BIOS Extensions (VBE), EFI framebuffers > > DT objects, yes. I'm not sure it's quite true to say it actually > directly supports VBE or EFI FBs; it's more the code in patch 2/6 that > supports those. I guess this is a bit nit-picky of a distinction though. I initially intended to add support for "platform-framebuffer" objects, too. This would make vesafb/... obsolete but I dropped that idea for now. I will fix the Kconfig description. >> diff --git a/drivers/gpu/drm/simpledrm/simpledrm_drv.c >> b/drivers/gpu/drm/simpledrm/simpledrm_drv.c > >> +static int parse_dt(struct platform_device *pdev, >> + struct simplefb_platform_data *mode) > >> + strlcpy(mode->format, format, sizeof(mode->format)); > > Even here, I believe the DT data sticks around so just copying the > pointer should be safe. It'd be worth validating that for sure though. Yep, indeed, I fixed that. Thanks! David > I didn't review the DRM stuff here since I'm not at all familiar with DRM. ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [RFC 3/6] drm: add SimpleDRM driver
Hi On Tue, Jun 25, 2013 at 3:05 AM, Andy Lutomirski wrote: > On 06/24/2013 03:27 PM, David Herrmann wrote: >> + sdrm->fb_map = ioremap(sdrm->fb_base, sdrm->fb_size); > > This should probably be ioremap_wc. Otherwise it will be *really* slow > if used in legacy mode and it may cause conflicts with the > pgprot_writecombine mode for mmap. Whoops, yepp, I fixed that. Thanks David ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[RFC 3/6] drm: add SimpleDRM driver
On 06/24/2013 04:27 PM, David Herrmann wrote: > The SimpleDRM driver binds to simple-framebuffer devices and provides a > DRM/KMS API. It provides only a single CRTC+encoder+connector combination > plus one initial mode. > > Userspace can create one dumb-buffer and attach it to the CRTC. Only if > the buffer is destroyed, a new buffer can be created. The buffer is > directly mapped into user-space, so we have only resources for a single > buffer. Otherwise, shadow buffers plus damage-request would be needed. > diff --git a/drivers/gpu/drm/simpledrm/Kconfig > b/drivers/gpu/drm/simpledrm/Kconfig > +config DRM_SIMPLEDRM > + tristate "Simple firmware framebuffer DRM driver" > + depends on DRM && !FB_SIMPLE > + help > + SimpleDRM can run on all systems with pre-initialized graphics > + hardware. It uses a framebuffer that was initialized during > + firmware boot. No page-flipping, modesetting or other advanced > + features are available. However, other DRM drivers can be loaded > + later and take over from SimpleDRM if they provide real hardware > + support. > + > + SimpleDRM supports: "simple-framebuffer" DeviceTree objects, x86 VESA > + BIOS Extensions (VBE), EFI framebuffers DT objects, yes. I'm not sure it's quite true to say it actually directly supports VBE or EFI FBs; it's more the code in patch 2/6 that supports those. I guess this is a bit nit-picky of a distinction though. > diff --git a/drivers/gpu/drm/simpledrm/simpledrm_drv.c > b/drivers/gpu/drm/simpledrm/simpledrm_drv.c > +static int parse_dt(struct platform_device *pdev, > + struct simplefb_platform_data *mode) > + strlcpy(mode->format, format, sizeof(mode->format)); Even here, I believe the DT data sticks around so just copying the pointer should be safe. It'd be worth validating that for sure though. I didn't review the DRM stuff here since I'm not at all familiar with DRM.
Re: [RFC 3/6] drm: add SimpleDRM driver
On 06/24/2013 04:27 PM, David Herrmann wrote: > The SimpleDRM driver binds to simple-framebuffer devices and provides a > DRM/KMS API. It provides only a single CRTC+encoder+connector combination > plus one initial mode. > > Userspace can create one dumb-buffer and attach it to the CRTC. Only if > the buffer is destroyed, a new buffer can be created. The buffer is > directly mapped into user-space, so we have only resources for a single > buffer. Otherwise, shadow buffers plus damage-request would be needed. > diff --git a/drivers/gpu/drm/simpledrm/Kconfig > b/drivers/gpu/drm/simpledrm/Kconfig > +config DRM_SIMPLEDRM > + tristate "Simple firmware framebuffer DRM driver" > + depends on DRM && !FB_SIMPLE > + help > + SimpleDRM can run on all systems with pre-initialized graphics > + hardware. It uses a framebuffer that was initialized during > + firmware boot. No page-flipping, modesetting or other advanced > + features are available. However, other DRM drivers can be loaded > + later and take over from SimpleDRM if they provide real hardware > + support. > + > + SimpleDRM supports: "simple-framebuffer" DeviceTree objects, x86 VESA > + BIOS Extensions (VBE), EFI framebuffers DT objects, yes. I'm not sure it's quite true to say it actually directly supports VBE or EFI FBs; it's more the code in patch 2/6 that supports those. I guess this is a bit nit-picky of a distinction though. > diff --git a/drivers/gpu/drm/simpledrm/simpledrm_drv.c > b/drivers/gpu/drm/simpledrm/simpledrm_drv.c > +static int parse_dt(struct platform_device *pdev, > + struct simplefb_platform_data *mode) > + strlcpy(mode->format, format, sizeof(mode->format)); Even here, I believe the DT data sticks around so just copying the pointer should be safe. It'd be worth validating that for sure though. I didn't review the DRM stuff here since I'm not at all familiar with DRM. ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [RFC 3/6] drm: add SimpleDRM driver
On 06/24/2013 03:27 PM, David Herrmann wrote: > + sdrm->fb_map = ioremap(sdrm->fb_base, sdrm->fb_size); This should probably be ioremap_wc. Otherwise it will be *really* slow if used in legacy mode and it may cause conflicts with the pgprot_writecombine mode for mmap. (Watching boot messages go by on fbcon on efifb was like using an old 2400 baud modem before I made the corresponding change to efifb.) --Andy ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[RFC 3/6] drm: add SimpleDRM driver
The SimpleDRM driver binds to simple-framebuffer devices and provides a DRM/KMS API. It provides only a single CRTC+encoder+connector combination plus one initial mode. Userspace can create one dumb-buffer and attach it to the CRTC. Only if the buffer is destroyed, a new buffer can be created. The buffer is directly mapped into user-space, so we have only resources for a single buffer. Otherwise, shadow buffers plus damage-request would be needed. Signed-off-by: David Herrmann --- MAINTAINERS| 8 + drivers/gpu/drm/Kconfig| 2 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/simpledrm/Kconfig | 18 ++ drivers/gpu/drm/simpledrm/Makefile | 5 + drivers/gpu/drm/simpledrm/simpledrm.h | 91 drivers/gpu/drm/simpledrm/simpledrm_drv.c | 230 drivers/gpu/drm/simpledrm/simpledrm_main.c | 330 + drivers/gpu/drm/simpledrm/simpledrm_mem.c | 254 ++ 9 files changed, 939 insertions(+) create mode 100644 drivers/gpu/drm/simpledrm/Kconfig create mode 100644 drivers/gpu/drm/simpledrm/Makefile create mode 100644 drivers/gpu/drm/simpledrm/simpledrm.h create mode 100644 drivers/gpu/drm/simpledrm/simpledrm_drv.c create mode 100644 drivers/gpu/drm/simpledrm/simpledrm_main.c create mode 100644 drivers/gpu/drm/simpledrm/simpledrm_mem.c diff --git a/MAINTAINERS b/MAINTAINERS index 5be702c..0f651845 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -7305,6 +7305,14 @@ S: Odd Fixes F: drivers/media/platform/sh_vou.c F: include/media/sh_vou.h +SIMPLE DRM DRIVER +M: David Herrmann +L: dri-devel at lists.freedesktop.org +T: git git://people.freedesktop.org/~dvdhrm/linux +S: Maintained +F: drivers/gpu/drm/simpledrm +F: include/linux/platform_data/simpledrm.h + SIMPLE FIRMWARE INTERFACE (SFI) M: Len Brown L: sfi-devel at simplefirmware.org diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index b16c50e..b3ccef6 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig @@ -220,3 +220,5 @@ source "drivers/gpu/drm/omapdrm/Kconfig" source "drivers/gpu/drm/tilcdc/Kconfig" source "drivers/gpu/drm/qxl/Kconfig" + +source "drivers/gpu/drm/simpledrm/Kconfig" diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile index 1c9f2439..59c424d 100644 --- a/drivers/gpu/drm/Makefile +++ b/drivers/gpu/drm/Makefile @@ -52,4 +52,5 @@ obj-$(CONFIG_DRM_SHMOBILE) +=shmobile/ obj-$(CONFIG_DRM_OMAP) += omapdrm/ obj-$(CONFIG_DRM_TILCDC) += tilcdc/ obj-$(CONFIG_DRM_QXL) += qxl/ +obj-$(CONFIG_DRM_SIMPLEDRM) += simpledrm/ obj-y += i2c/ diff --git a/drivers/gpu/drm/simpledrm/Kconfig b/drivers/gpu/drm/simpledrm/Kconfig new file mode 100644 index 000..1d4f38e --- /dev/null +++ b/drivers/gpu/drm/simpledrm/Kconfig @@ -0,0 +1,18 @@ +config DRM_SIMPLEDRM + tristate "Simple firmware framebuffer DRM driver" + depends on DRM && !FB_SIMPLE + help + SimpleDRM can run on all systems with pre-initialized graphics + hardware. It uses a framebuffer that was initialized during + firmware boot. No page-flipping, modesetting or other advanced + features are available. However, other DRM drivers can be loaded + later and take over from SimpleDRM if they provide real hardware + support. + + SimpleDRM supports: "simple-framebuffer" DeviceTree objects, x86 VESA + BIOS Extensions (VBE), EFI framebuffers + + If unsure, say Y. + + To compile this driver as a module, choose M here: the + module will be called simpledrm. diff --git a/drivers/gpu/drm/simpledrm/Makefile b/drivers/gpu/drm/simpledrm/Makefile new file mode 100644 index 000..2d474a5 --- /dev/null +++ b/drivers/gpu/drm/simpledrm/Makefile @@ -0,0 +1,5 @@ +ccflags-y := -Iinclude/drm + +simpledrm-y := simpledrm_drv.o simpledrm_main.o simpledrm_mem.o + +obj-$(CONFIG_DRM_SIMPLEDRM) := simpledrm.o diff --git a/drivers/gpu/drm/simpledrm/simpledrm.h b/drivers/gpu/drm/simpledrm/simpledrm.h new file mode 100644 index 000..279d847 --- /dev/null +++ b/drivers/gpu/drm/simpledrm/simpledrm.h @@ -0,0 +1,91 @@ +/* + * SimpleDRM firmware framebuffer driver + * Copyright (c) 2012-2013 David Herrmann + */ + +/* + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + */ + +#ifndef SDRM_DRV_H +#define SDRM_DRV_H + +#include +#include +#include +#include +#include +#include +#include +#include + +struct sdrm_device; +struct sdrm_gem_object; +struct sdrm_framebuffer; + +/* simpledrm devices */ + +struct sdrm_device { + struct drm_device *ddev; + + /* framebuffer information */ + const struct simplefb_format *fb_sformat
[RFC 3/6] drm: add SimpleDRM driver
On 06/24/2013 03:27 PM, David Herrmann wrote: > + sdrm->fb_map = ioremap(sdrm->fb_base, sdrm->fb_size); This should probably be ioremap_wc. Otherwise it will be *really* slow if used in legacy mode and it may cause conflicts with the pgprot_writecombine mode for mmap. (Watching boot messages go by on fbcon on efifb was like using an old 2400 baud modem before I made the corresponding change to efifb.) --Andy
[RFC 3/6] drm: add SimpleDRM driver
The SimpleDRM driver binds to simple-framebuffer devices and provides a DRM/KMS API. It provides only a single CRTC+encoder+connector combination plus one initial mode. Userspace can create one dumb-buffer and attach it to the CRTC. Only if the buffer is destroyed, a new buffer can be created. The buffer is directly mapped into user-space, so we have only resources for a single buffer. Otherwise, shadow buffers plus damage-request would be needed. Signed-off-by: David Herrmann --- MAINTAINERS| 8 + drivers/gpu/drm/Kconfig| 2 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/simpledrm/Kconfig | 18 ++ drivers/gpu/drm/simpledrm/Makefile | 5 + drivers/gpu/drm/simpledrm/simpledrm.h | 91 drivers/gpu/drm/simpledrm/simpledrm_drv.c | 230 drivers/gpu/drm/simpledrm/simpledrm_main.c | 330 + drivers/gpu/drm/simpledrm/simpledrm_mem.c | 254 ++ 9 files changed, 939 insertions(+) create mode 100644 drivers/gpu/drm/simpledrm/Kconfig create mode 100644 drivers/gpu/drm/simpledrm/Makefile create mode 100644 drivers/gpu/drm/simpledrm/simpledrm.h create mode 100644 drivers/gpu/drm/simpledrm/simpledrm_drv.c create mode 100644 drivers/gpu/drm/simpledrm/simpledrm_main.c create mode 100644 drivers/gpu/drm/simpledrm/simpledrm_mem.c diff --git a/MAINTAINERS b/MAINTAINERS index 5be702c..0f651845 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -7305,6 +7305,14 @@ S: Odd Fixes F: drivers/media/platform/sh_vou.c F: include/media/sh_vou.h +SIMPLE DRM DRIVER +M: David Herrmann +L: dri-devel@lists.freedesktop.org +T: git git://people.freedesktop.org/~dvdhrm/linux +S: Maintained +F: drivers/gpu/drm/simpledrm +F: include/linux/platform_data/simpledrm.h + SIMPLE FIRMWARE INTERFACE (SFI) M: Len Brown L: sfi-de...@simplefirmware.org diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index b16c50e..b3ccef6 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig @@ -220,3 +220,5 @@ source "drivers/gpu/drm/omapdrm/Kconfig" source "drivers/gpu/drm/tilcdc/Kconfig" source "drivers/gpu/drm/qxl/Kconfig" + +source "drivers/gpu/drm/simpledrm/Kconfig" diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile index 1c9f2439..59c424d 100644 --- a/drivers/gpu/drm/Makefile +++ b/drivers/gpu/drm/Makefile @@ -52,4 +52,5 @@ obj-$(CONFIG_DRM_SHMOBILE) +=shmobile/ obj-$(CONFIG_DRM_OMAP) += omapdrm/ obj-$(CONFIG_DRM_TILCDC) += tilcdc/ obj-$(CONFIG_DRM_QXL) += qxl/ +obj-$(CONFIG_DRM_SIMPLEDRM) += simpledrm/ obj-y += i2c/ diff --git a/drivers/gpu/drm/simpledrm/Kconfig b/drivers/gpu/drm/simpledrm/Kconfig new file mode 100644 index 000..1d4f38e --- /dev/null +++ b/drivers/gpu/drm/simpledrm/Kconfig @@ -0,0 +1,18 @@ +config DRM_SIMPLEDRM + tristate "Simple firmware framebuffer DRM driver" + depends on DRM && !FB_SIMPLE + help + SimpleDRM can run on all systems with pre-initialized graphics + hardware. It uses a framebuffer that was initialized during + firmware boot. No page-flipping, modesetting or other advanced + features are available. However, other DRM drivers can be loaded + later and take over from SimpleDRM if they provide real hardware + support. + + SimpleDRM supports: "simple-framebuffer" DeviceTree objects, x86 VESA + BIOS Extensions (VBE), EFI framebuffers + + If unsure, say Y. + + To compile this driver as a module, choose M here: the + module will be called simpledrm. diff --git a/drivers/gpu/drm/simpledrm/Makefile b/drivers/gpu/drm/simpledrm/Makefile new file mode 100644 index 000..2d474a5 --- /dev/null +++ b/drivers/gpu/drm/simpledrm/Makefile @@ -0,0 +1,5 @@ +ccflags-y := -Iinclude/drm + +simpledrm-y := simpledrm_drv.o simpledrm_main.o simpledrm_mem.o + +obj-$(CONFIG_DRM_SIMPLEDRM) := simpledrm.o diff --git a/drivers/gpu/drm/simpledrm/simpledrm.h b/drivers/gpu/drm/simpledrm/simpledrm.h new file mode 100644 index 000..279d847 --- /dev/null +++ b/drivers/gpu/drm/simpledrm/simpledrm.h @@ -0,0 +1,91 @@ +/* + * SimpleDRM firmware framebuffer driver + * Copyright (c) 2012-2013 David Herrmann + */ + +/* + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + */ + +#ifndef SDRM_DRV_H +#define SDRM_DRV_H + +#include +#include +#include +#include +#include +#include +#include +#include + +struct sdrm_device; +struct sdrm_gem_object; +struct sdrm_framebuffer; + +/* simpledrm devices */ + +struct sdrm_device { + struct drm_device *ddev; + + /* framebuffer information */ + const struct simplefb_format *fb_sformat; +