Skip to contentSkip to conversation

staging: vboxvideo: Add vboxvideo to drivers/staging

PATCH Superseded Hans de Goede 1 participant 1 message Jun 28, 2017 Staging

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v5 1/1 staging: vboxvideo: Add vboxvideo to drivers/staging

This commit adds the vboxvideo drm/kms driver for the virtual graphics card used in Virtual Box virtual machines to drivers/staging.

Why drivers/staging? This driver is already being patched into the kernel by several distros, thus it is good to get this driver upstream soon, so that work on the driver can be easily shared.

At the same time we want to take our time to get this driver properly cleaned up (mainly converted to the new atomic modesetting APIs) before submitting it as a normal driver under drivers/gpu/drm, putting this driver in staging for now allows both.

Note this driver has already been significantly cleaned up, when I started working on this the files under /usr/src/vboxguest/vboxvideo as installed by Virtual Box 5.1.18 Guest Additions had a total linecount of 52681 lines. The version in this commit has 4874 lines.

---
Changes in v2:
-Add Michael's S-o-b
-Improve Kconfig help text
-Remove .config changes which accidentally got added to the commit

Changes in v3:
-Convert the files shared with the video-driver for other operating-systems
to kernel coding style too
-Remove unused code from these files

Changes in v4:
-Removed some unneeded local variable initializations
-Reworked some code paths to have the straight (error free path) keep the
same indendation by checking for failure + bailing rather then nesting success checks into each other
-Reworked error handling to clean up acquired resources in the failing
init / create function, rather then calling the fini / destroy counterpart on a partly initialized struct / object
-Use devm_kzalloc and friends for simpler error handling and _fini functions

Changes in v5:
-Use various drm_fb_helper funcs instead of DIY code

---
 drivers/staging/Kconfig                     |   2 +
 drivers/staging/Makefile                    |   1 +
 drivers/staging/vboxvideo/Kconfig           |  12 +
 drivers/staging/vboxvideo/Makefile          |   7 +
 drivers/staging/vboxvideo/TODO              |   9 +
 drivers/staging/vboxvideo/hgsmi_base.c      | 246 ++++++++
 drivers/staging/vboxvideo/hgsmi_ch_setup.h  |  66 +++
 drivers/staging/vboxvideo/hgsmi_channels.h  |  53 ++
 drivers/staging/vboxvideo/hgsmi_defs.h      |  92 +++
 drivers/staging/vboxvideo/modesetting.c     | 142 +++++
 drivers/staging/vboxvideo/vbox_drv.c        | 286 +++++++++
 drivers/staging/vboxvideo/vbox_drv.h        | 296 ++++++++++
 drivers/staging/vboxvideo/vbox_err.h        |  50 ++
 drivers/staging/vboxvideo/vbox_fb.c         | 412 +++++++++++++
 drivers/staging/vboxvideo/vbox_hgsmi.c      | 115 ++++
 drivers/staging/vboxvideo/vbox_irq.c        | 197 +++++++
 drivers/staging/vboxvideo/vbox_main.c       | 534 +++++++++++++++++
 drivers/staging/vboxvideo/vbox_mode.c       | 877 ++++++++++++++++++++++++++++
 drivers/staging/vboxvideo/vbox_prime.c      |  74 +++
 drivers/staging/vboxvideo/vbox_ttm.c        | 472 +++++++++++++++
 drivers/staging/vboxvideo/vboxvideo.h       | 491 ++++++++++++++++
 drivers/staging/vboxvideo/vboxvideo_guest.h |  95 +++
 drivers/staging/vboxvideo/vboxvideo_vbe.h   |  84 +++
 drivers/staging/vboxvideo/vbva_base.c       | 233 ++++++++
 24 files changed, 4846 insertions(+)
 create mode 100644 drivers/staging/vboxvideo/Kconfig
 create mode 100644 drivers/staging/vboxvideo/Makefile
 create mode 100644 drivers/staging/vboxvideo/TODO
 create mode 100644 drivers/staging/vboxvideo/hgsmi_base.c
 create mode 100644 drivers/staging/vboxvideo/hgsmi_ch_setup.h
 create mode 100644 drivers/staging/vboxvideo/hgsmi_channels.h
 create mode 100644 drivers/staging/vboxvideo/hgsmi_defs.h
 create mode 100644 drivers/staging/vboxvideo/modesetting.c
 create mode 100644 drivers/staging/vboxvideo/vbox_drv.c
 create mode 100644 drivers/staging/vboxvideo/vbox_drv.h
 create mode 100644 drivers/staging/vboxvideo/vbox_err.h
 create mode 100644 drivers/staging/vboxvideo/vbox_fb.c
 create mode 100644 drivers/staging/vboxvideo/vbox_hgsmi.c
 create mode 100644 drivers/staging/vboxvideo/vbox_irq.c
 create mode 100644 drivers/staging/vboxvideo/vbox_main.c
 create mode 100644 drivers/staging/vboxvideo/vbox_mode.c
 create mode 100644 drivers/staging/vboxvideo/vbox_prime.c
 create mode 100644 drivers/staging/vboxvideo/vbox_ttm.c
 create mode 100644 drivers/staging/vboxvideo/vboxvideo.h
 create mode 100644 drivers/staging/vboxvideo/vboxvideo_guest.h
 create mode 100644 drivers/staging/vboxvideo/vboxvideo_vbe.h
 create mode 100644 drivers/staging/vboxvideo/vbva_base.c
drivers/staging/Kconfig +2 -0
index 268d4e6ef48a..ef28a1cb64ae 100644
@@ -110,4 +110,6 @@ source "drivers/staging/ccree/Kconfig"
 
 source "drivers/staging/typec/Kconfig"
 
+source "drivers/staging/vboxvideo/Kconfig"
+
 endif # STAGING
drivers/staging/Makefile +1 -0
index b93e6f5f0f6e..2918580bdb9e 100644
@@ -44,3 +44,4 @@ obj-$(CONFIG_KS7010)		+= ks7010/
 obj-$(CONFIG_GREYBUS)		+= greybus/
 obj-$(CONFIG_BCM2835_VCHIQ)	+= vc04_services/
 obj-$(CONFIG_CRYPTO_DEV_CCREE)	+= ccree/
+obj-$(CONFIG_DRM_VBOXVIDEO)	+= vboxvideo/
drivers/staging/vboxvideo/Kconfig new file +12 -0
new file mode 100644
index 000000000000..a52746f9a670
@@ -0,0 +1,12 @@
+config DRM_VBOXVIDEO
+	tristate "Virtual Box Graphics Card"
+	depends on DRM && X86 && PCI
+	select DRM_KMS_HELPER
+	help
+	  This is a KMS driver for the virtual Graphics Card used in
+	  Virtual Box virtual machines.
+
+	  Although it is possible to builtin this module, it is advised
+	  to build this driver as a module, so that it can be updated
+	  independently of the kernel. Select M to built this driver as a
+	  module and add support for these devices via drm/kms interfaces.
drivers/staging/vboxvideo/Makefile new file +7 -0
new file mode 100644
index 000000000000..2d0b3bc7ad73
@@ -0,0 +1,7 @@
+ccflags-y := -Iinclude/drm
+
+vboxvideo-y :=  hgsmi_base.o modesetting.o vbva_base.o \
+		vbox_drv.o vbox_fb.o vbox_hgsmi.o vbox_irq.o vbox_main.o \
+		vbox_mode.o vbox_prime.o vbox_ttm.o
+
+obj-$(CONFIG_DRM_VBOXVIDEO) += vboxvideo.o
drivers/staging/vboxvideo/TODO new file +9 -0
new file mode 100644
index 000000000000..ce764309b079
@@ -0,0 +1,9 @@
+TODO:
+-Move the driver over to the atomic API
+-Stop using old load / unload drm_driver hooks
+-Get a full review from the drm-maintainers on dri-devel done on this driver
+-Extend this TODO with the results of that review
+
+Please send any patches to Greg Kroah-Hartman <[email protected]>,
+Hans de Goede <[email protected]> and
+Michael Thayer <[email protected]>.
drivers/staging/vboxvideo/hgsmi_base.c new file +246 -0

246 lines not on this page · raw message

drivers/staging/vboxvideo/hgsmi_ch_setup.h new file +66 -0

66 lines not on this page · raw message

drivers/staging/vboxvideo/hgsmi_channels.h new file +53 -0

53 lines not on this page · raw message

drivers/staging/vboxvideo/hgsmi_defs.h new file +92 -0

92 lines not on this page · raw message

drivers/staging/vboxvideo/modesetting.c new file +142 -0

142 lines not on this page · raw message

drivers/staging/vboxvideo/vbox_drv.c new file +286 -0

286 lines not on this page · raw message

drivers/staging/vboxvideo/vbox_drv.h new file +296 -0

296 lines not on this page · raw message

drivers/staging/vboxvideo/vbox_err.h new file +50 -0

50 lines not on this page · raw message

drivers/staging/vboxvideo/vbox_fb.c new file +412 -0

412 lines not on this page · raw message

drivers/staging/vboxvideo/vbox_hgsmi.c new file +115 -0

115 lines not on this page · raw message

drivers/staging/vboxvideo/vbox_irq.c new file +197 -0

197 lines not on this page · raw message

drivers/staging/vboxvideo/vbox_main.c new file +534 -0

534 lines not on this page · raw message

drivers/staging/vboxvideo/vbox_mode.c new file +877 -0

473 lines not on this page · raw message

drivers/staging/vboxvideo/vbox_prime.c new file +74 -0

74 lines not on this page · raw message

drivers/staging/vboxvideo/vbox_ttm.c new file +472 -0

472 lines not on this page · raw message

drivers/staging/vboxvideo/vboxvideo.h new file +491 -0

491 lines not on this page · raw message

drivers/staging/vboxvideo/vboxvideo_guest.h new file +95 -0

95 lines not on this page · raw message

drivers/staging/vboxvideo/vboxvideo_vbe.h new file +84 -0

84 lines not on this page · raw message

drivers/staging/vboxvideo/vbva_base.c new file +233 -0

233 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 6 lines
2.13.0

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

Part of the diff is not shown here. View the raw message.