Skip to contentSkip to conversation

drm: new VESA BIOS Extension DRM driver

RFC New David Herrmann 1 participant 1 message Jan 27, 2013

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

RFC 1/1 drm: new VESA BIOS Extension DRM driver

This driver uses the VESA BIOS Extensions to control the display device. Modesetting has to be done during the boot-process by the architecture code (same way as vesafb requires it). No runtime modesetting is allowed due to RealMode/ProtectedMode restrictions.

The driver simply provides a single crtc+encoder+connector combination that user-space can use to access the VBE framebuffer. No page-flips are supported and users must explicitly mark buffers as dirty to get them copied into the framebuffer.

All buffer objects are backed by shmem so we can later add PRIME support. On dirty-ioctls we simply vmap the framebuffer memory and copy each pixel into the target framebuffer. Unfortunately, the VBE bpp/depth combinations cannot easily be forwarded to the user via the DRM API as it allows a lot more combinations. Hence, we need to convert each pixel from the user's buffer format into the target format while blitting. Fast-paths for xrgb32/etc. could be implemented if we want to improve blitting performance.

---
Hi

This driver is a very basic DRM driver with roughly the same functionality as vesafb but with a userspace API that doesn't suck. It is part of my effort to replace the linux console with a user-space replacement.
This driver is basically meant as a replacement for vesafb+fbcon. I am still working on a "drmlog" driver which can show the kernel-log (panics, oopses, ...) on all connected monitors via the in-kernel DRM API. As I want to avoid using the fbdev API, I thought a VBE DRM driver would be a really useful thing to have as it works on all x86 hardware. I previously sent patches for an "fblog" driver which does exactly that by using the in-kernel fbdev notifier. However, the fbdev notifiers are so racy that I decided to do that with DRM instead.

This driver currently lacks any shared-resource-control so you should not use it in parallel with i915/nouveau/radeon/etc. We would have to add some mechanism to unload it when a conflicting driver gets loaded.

We might also add some driver-specific ioctls to introduce real modesetting like uvesafb provides so user-space can perform the VBE BIOS calls. However, I don't really care for this as I am totally fine with the vga= kernel command-line.

There is still some stuff missing (unload on conflicting drivers) which I will work on in the following weeks but I thought I'd first try to get some comments from other developers. I tested this on a nvidia nv50 and i915 gen3 card and it worked fine. Comments are welcome!

Some notes if you want to review the driver:
dvbe_drv.c: Implements the platform_driver and probes a single device dvbe_main.c: Implements device loading/unloading and modesetting dvbe_mem.c: Memory management, dumb-buffers + framebuffers dvbe_vesa.c: VBE initialization and blitting functions

Regards
David

 drivers/gpu/drm/Kconfig          |   2 +
 drivers/gpu/drm/Makefile         |   1 +
 drivers/gpu/drm/dvbe/Kconfig     |  14 ++
 drivers/gpu/drm/dvbe/Makefile    |   4 +
 drivers/gpu/drm/dvbe/dvbe.h      |  98 +++++++++
 drivers/gpu/drm/dvbe/dvbe_drv.c  | 133 ++++++++++++
 drivers/gpu/drm/dvbe/dvbe_main.c | 432 +++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/dvbe/dvbe_mem.c  | 269 ++++++++++++++++++++++++
 drivers/gpu/drm/dvbe/dvbe_vesa.c | 242 ++++++++++++++++++++++
 9 files changed, 1195 insertions(+)
 create mode 100644 drivers/gpu/drm/dvbe/Kconfig
 create mode 100644 drivers/gpu/drm/dvbe/Makefile
 create mode 100644 drivers/gpu/drm/dvbe/dvbe.h
 create mode 100644 drivers/gpu/drm/dvbe/dvbe_drv.c
 create mode 100644 drivers/gpu/drm/dvbe/dvbe_main.c
 create mode 100644 drivers/gpu/drm/dvbe/dvbe_mem.c
 create mode 100644 drivers/gpu/drm/dvbe/dvbe_vesa.c
drivers/gpu/drm/Kconfig +2 -0
index 983201b..e116998 100644
@@ -212,3 +212,5 @@ source "drivers/gpu/drm/cirrus/Kconfig"
 source "drivers/gpu/drm/shmobile/Kconfig"
 
 source "drivers/gpu/drm/tegra/Kconfig"
+
+source "drivers/gpu/drm/dvbe/Kconfig"
drivers/gpu/drm/Makefile +1 -0
index 6f58c81..daf3114 100644
@@ -50,4 +50,5 @@ obj-$(CONFIG_DRM_UDL) += udl/
 obj-$(CONFIG_DRM_AST) += ast/
 obj-$(CONFIG_DRM_SHMOBILE) +=shmobile/
 obj-$(CONFIG_DRM_TEGRA) += tegra/
+obj-$(CONFIG_DRM_DVBE) += dvbe/
 obj-y			+= i2c/
drivers/gpu/drm/dvbe/Kconfig new file +14 -0
new file mode 100644
index 0000000..a5277c6
@@ -0,0 +1,14 @@
+config DRM_DVBE
+	tristate "VESA BIOS Extension DRM Driver"
+	depends on DRM
+	select DRM_KMS_HELPER
+	help
+	  This is a DRM/KMS driver for VESA BIOS Extension (VBE) compatible
+	  cards. It does not allow mode-switching during runtime but requires
+	  the kernel to setup the mode with the vga= kernel command line
+	  option.
+
+	  If unsure, say N.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called dvbe.
drivers/gpu/drm/dvbe/Makefile new file +4 -0
new file mode 100644
index 0000000..f6fb888
@@ -0,0 +1,4 @@
+ccflags-y := -Iinclude/drm
+
+dvbe-y := dvbe_drv.o dvbe_main.o dvbe_mem.o dvbe_vesa.o
+obj-$(CONFIG_DRM_DVBE) := dvbe.o
drivers/gpu/drm/dvbe/dvbe.h new file +98 -0

98 lines not on this page · raw message

drivers/gpu/drm/dvbe/dvbe_drv.c new file +133 -0

133 lines not on this page · raw message

drivers/gpu/drm/dvbe/dvbe_main.c new file +432 -0

432 lines not on this page · raw message

drivers/gpu/drm/dvbe/dvbe_mem.c new file +269 -0

269 lines not on this page · raw message

drivers/gpu/drm/dvbe/dvbe_vesa.c new file +242 -0

242 lines not on this page · raw message

Signature · 1 line
1.8.1.1