Skip to contentSkip to conversation

drm/bochs: new driver

PATCH Superseded Gerd Hoffmann 2 participants 2 messages Dec 12, 2013 – Dec 13, 2013

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/bochs: new driver

DRM driver for (virtual) vga cards using the bochs dispi interface, such as the qemu standard vga (qemu -vga std).

Don't bother supporting anything but 32bpp for now, even though the virtual hardware is able to do that.

Known issue: mmap(/dev/fb0) doesn't work.

---
 drivers/gpu/drm/Kconfig             |   2 +
 drivers/gpu/drm/Makefile            |   1 +
 drivers/gpu/drm/bochs/Kconfig       |  11 +
 drivers/gpu/drm/bochs/Makefile      |   4 +
 drivers/gpu/drm/bochs/bochs.h       | 164 +++++++++++
 drivers/gpu/drm/bochs/bochs_drv.c   | 178 ++++++++++++
 drivers/gpu/drm/bochs/bochs_fbdev.c | 215 ++++++++++++++
 drivers/gpu/drm/bochs/bochs_hw.c    | 177 ++++++++++++
 drivers/gpu/drm/bochs/bochs_kms.c   | 294 +++++++++++++++++++
 drivers/gpu/drm/bochs/bochs_mm.c    | 546 ++++++++++++++++++++++++++++++++++++
 10 files changed, 1592 insertions(+)
 create mode 100644 drivers/gpu/drm/bochs/Kconfig
 create mode 100644 drivers/gpu/drm/bochs/Makefile
 create mode 100644 drivers/gpu/drm/bochs/bochs.h
 create mode 100644 drivers/gpu/drm/bochs/bochs_drv.c
 create mode 100644 drivers/gpu/drm/bochs/bochs_fbdev.c
 create mode 100644 drivers/gpu/drm/bochs/bochs_hw.c
 create mode 100644 drivers/gpu/drm/bochs/bochs_kms.c
 create mode 100644 drivers/gpu/drm/bochs/bochs_mm.c
drivers/gpu/drm/Kconfig +2 -0
index f864275..5f6e715 100644
@@ -188,6 +188,8 @@ source "drivers/gpu/drm/tilcdc/Kconfig"
 
 source "drivers/gpu/drm/qxl/Kconfig"
 
+source "drivers/gpu/drm/bochs/Kconfig"
+
 source "drivers/gpu/drm/msm/Kconfig"
 
 source "drivers/gpu/drm/tegra/Kconfig"
drivers/gpu/drm/Makefile +1 -0
index cc08b84..e6997e4 100644
@@ -56,6 +56,7 @@ obj-$(CONFIG_DRM_SHMOBILE) +=shmobile/
 obj-$(CONFIG_DRM_OMAP)	+= omapdrm/
 obj-$(CONFIG_DRM_TILCDC)	+= tilcdc/
 obj-$(CONFIG_DRM_QXL) += qxl/
+obj-$(CONFIG_DRM_BOCHS) += bochs/
 obj-$(CONFIG_DRM_MSM) += msm/
 obj-$(CONFIG_DRM_TEGRA) += tegra/
 obj-y			+= i2c/
drivers/gpu/drm/bochs/Kconfig new file +11 -0
new file mode 100644
index 0000000..c8fcf12
@@ -0,0 +1,11 @@
+config DRM_BOCHS
+	tristate "DRM Support for bochs dispi vga interface (qemu stdvga)"
+	depends on DRM && PCI
+	select DRM_KMS_HELPER
+	select FB_SYS_FILLRECT
+	select FB_SYS_COPYAREA
+	select FB_SYS_IMAGEBLIT
+	select DRM_TTM
+	help
+	  Choose this option for qemu.
+	  If M is selected the module will be called bochs-drm.
drivers/gpu/drm/bochs/Makefile new file +4 -0
new file mode 100644
index 0000000..844a556
@@ -0,0 +1,4 @@
+ccflags-y := -Iinclude/drm
+bochs-drm-y := bochs_drv.o bochs_mm.o bochs_kms.o bochs_fbdev.o bochs_hw.o
+
+obj-$(CONFIG_DRM_BOCHS)	+= bochs-drm.o
drivers/gpu/drm/bochs/bochs.h new file +164 -0

164 lines not on this page · raw message

drivers/gpu/drm/bochs/bochs_drv.c new file +178 -0

178 lines not on this page · raw message

drivers/gpu/drm/bochs/bochs_fbdev.c new file +215 -0

215 lines not on this page · raw message

drivers/gpu/drm/bochs/bochs_hw.c new file +177 -0

177 lines not on this page · raw message

drivers/gpu/drm/bochs/bochs_kms.c new file +294 -0

294 lines not on this page · raw message

drivers/gpu/drm/bochs/bochs_mm.c new file +546 -0

546 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#1 lore raw

Hi

Quoted 10 lines · Gerd Hoffmann

DRM driver for (virtual) vga cards using the bochs dispi interface, such as the qemu standard vga (qemu -vga std).

Don't bother supporting anything but 32bpp for now, even though the virtual hardware is able to do that.

Known issue: mmap(/dev/fb0) doesn't work.

---

[…]

Quoted 5 lines
drivers/gpu/drm/bochs/bochs_mm.c new file +0 -0
new file mode 100644
index 0000000..afe104f

[…]

drivers/gpu/drm/bochs/bochs_mm.c line 388

Quoted 9 lines
drivers/gpu/drm/bochs/bochs_mm.c new file +9 -0
+int bochs_gem_create(struct drm_device *dev, u32 size, bool iskernel,
+		     struct drm_gem_object **obj)
+{
+	struct bochs_bo *bochsbo;
+	int ret;
+
+	*obj = NULL;
+
+	size = roundup(size, PAGE_SIZE);

[…]

Using roundup() this way will fail to build in 32 bit architectures/ i386:

ERROR: "__udivdi3" [drivers/gpu/drm/bochs/bochs-drm.ko] undefined!
ERROR: "__umoddi3" [drivers/gpu/drm/bochs/bochs-drm.ko] undefined!

[drm/bochs works pretty nicely for me on amd64]

Regards
Stefan Lippers-Hollmann