aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjkim <jkim@FreeBSD.org>2016-07-27 05:49:12 +0800
committerjkim <jkim@FreeBSD.org>2016-07-27 05:49:12 +0800
commitefb93fd5490456e34fc687817a6a44903bf8c7dc (patch)
treec516adc43ef5f727d6b9ffe08f73e0c63b4b6fe3
parent25f885bc043e9eb0c1531702854b491197163abf (diff)
downloadfreebsd-ports-graphics-efb93fd5490456e34fc687817a6a44903bf8c7dc.tar.gz
freebsd-ports-graphics-efb93fd5490456e34fc687817a6a44903bf8c7dc.tar.zst
freebsd-ports-graphics-efb93fd5490456e34fc687817a6a44903bf8c7dc.zip
Remove fake DRM and install OpenGL wrappers.
-rw-r--r--emulators/virtualbox-ose-additions/Makefile29
-rw-r--r--emulators/virtualbox-ose-additions/files/pkg-post-install.in6
-rw-r--r--emulators/virtualbox-ose-additions/files/pkg-pre-deinstall.in18
-rw-r--r--emulators/virtualbox-ose-additions/files/vboxguest.in2
-rw-r--r--emulators/virtualbox-ose-additions/pkg-plist3
-rw-r--r--emulators/virtualbox-ose/files/extrapatch-src-VBox-Additions-freebsd-drm-Makefile17
-rw-r--r--emulators/virtualbox-ose/files/extrapatch-src-VBox-Additions-freebsd-drm-Makefile.kmk38
-rw-r--r--emulators/virtualbox-ose/files/extrapatch-src_VBox_Additions_freebsd_Makefile.kmk11
-rw-r--r--emulators/virtualbox-ose/files/patch-src-VBox-Additions-common-crOpenGL-Makefile.kmk65
-rw-r--r--emulators/virtualbox-ose/files/patch-src-VBox-Additions-freebsd-drm-vboxvideo_drm.c77
-rw-r--r--emulators/virtualbox-ose/files/patch-src_VBox_Additions_common_crOpenGL_stub.h11
-rw-r--r--emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_Makefile.kmk19
12 files changed, 94 insertions, 202 deletions
diff --git a/emulators/virtualbox-ose-additions/Makefile b/emulators/virtualbox-ose-additions/Makefile
index fa3a87be472..9ba810e4ee9 100644
--- a/emulators/virtualbox-ose-additions/Makefile
+++ b/emulators/virtualbox-ose-additions/Makefile
@@ -76,6 +76,9 @@ MAKE_ARGS+= DEBUG_FLAGS="-O1 -g"
.endif
.if ${PORT_OPTIONS:MOPENGL}
+PKGPOSTINSTALL= ${WRKDIR}/pkg-post-install
+PKGPREDEINSTALL= ${WRKDIR}/pkg-pre-deinstall
+SUB_FILES= pkg-post-install pkg-pre-deinstall
USE_XORG= xcomposite xdamage xfixes
USE_GL= gl
VBOX_LIBS= VBoxEGL.so \
@@ -86,8 +89,6 @@ VBOX_LIBS= VBoxEGL.so \
VBoxOGLfeedbackspu.so \
VBoxOGLpackspu.so \
VBoxOGLpassthroughspu.so
-.else
-EXTRA_PATCHES= ${PATCHDIR}/extrapatch-src_VBox_Additions_freebsd_Makefile.kmk
.endif
.if ${PORT_OPTIONS:MX11}
@@ -107,8 +108,6 @@ KMK_ARCH= freebsd.x86
KMK_ARCH= freebsd.${ARCH}
.endif
-SUB_LIST+= VBOX_KMODS="${VBOX_KMODS}"
-
.include <bsd.port.pre.mk>
.if ${COMPILER_TYPE} == clang
@@ -120,18 +119,6 @@ EXTRA_PATCHES+= ${PATCHDIR}/extrapatch-src-VBox-Additions-x11-VBoxClient-Makefil
.endif
.endif
-.if ${OSVERSION} >= 1001514
-EXTRA_PATCHES+= ${PATCHDIR}/extrapatch-src-VBox-Additions-freebsd-drm-Makefile
-EXTRA_PATCHES+= ${PATCHDIR}/extrapatch-src-VBox-Additions-freebsd-drm-Makefile.kmk
-.endif
-
-VBOX_KMODS= vboxguest:pci/vboxguest
-# DRI support was removed from the X.Org vboxvideo driver:
-# https://www.virtualbox.org/changeset/59194
-#.if ${PORT_OPTIONS:MOPENGL}
-#VBOX_KMODS+= vboxvideo:vgapci/vboxvideo
-#.endif
-
pre-everything::
.if ${ARCH} == "amd64"
.if !exists(/usr/lib32/libc.so)
@@ -180,12 +167,6 @@ do-install:
.if ${PORT_OPTIONS:MDEBUG}
${INSTALL_KLD} ${VBOX_BIN}/src/vboxguest/vboxguest.ko.symbols ${STAGEDIR}${KMODDIR}
.endif
-.if ${PORT_OPTIONS:MOPENGL}
- ${INSTALL_KLD} ${VBOX_BIN}/vboxvideo.ko ${STAGEDIR}${KMODDIR}
-.if ${PORT_OPTIONS:MDEBUG}
- ${INSTALL_KLD} ${VBOX_BIN}/vboxvideo.ko.symbols ${STAGEDIR}${KMODDIR}
-.endif
-.endif
${INSTALL_LIB} ${VBOX_BIN}/pam_vbox.so ${STAGEDIR}${PREFIX}/lib
${INSTALL_PROGRAM} ${VBOX_SBINS:S|^|${VBOX_BIN}/|} \
@@ -218,10 +199,6 @@ do-install:
.if ${PORT_OPTIONS:MOPENGL}
${INSTALL_DATA} ${VBOX_LIBS:S|^|${VBOX_BIN}/|} \
${STAGEDIR}${PREFIX}/lib/
-
- ${MKDIR} ${STAGEDIR}${PREFIX}/lib/dri
- ${LN} -sf ${PREFIX}/lib/VBoxOGL.so \
- ${STAGEDIR}${PREFIX}/lib/dri/vboxvideo_dri.so
.endif
.include <bsd.port.post.mk>
diff --git a/emulators/virtualbox-ose-additions/files/pkg-post-install.in b/emulators/virtualbox-ose-additions/files/pkg-post-install.in
new file mode 100644
index 00000000000..568bf738097
--- /dev/null
+++ b/emulators/virtualbox-ose-additions/files/pkg-post-install.in
@@ -0,0 +1,6 @@
+/bin/rm -f %%PREFIX%%/lib/libEGL.so*
+/bin/ln -f %%PREFIX%%/lib/VBoxEGL.so %%PREFIX%%/lib/libEGL.so
+/bin/ln -f %%PREFIX%%/lib/VBoxEGL.so %%PREFIX%%/lib/libEGL.so.1
+/bin/rm -f %%PREFIX%%/lib/libGL.so*
+/bin/ln -f %%PREFIX%%/lib/VBoxOGL.so %%PREFIX%%/lib/libGL.so
+/bin/ln -f %%PREFIX%%/lib/VBoxOGL.so %%PREFIX%%/lib/libGL.so.1
diff --git a/emulators/virtualbox-ose-additions/files/pkg-pre-deinstall.in b/emulators/virtualbox-ose-additions/files/pkg-pre-deinstall.in
new file mode 100644
index 00000000000..2fe0b996779
--- /dev/null
+++ b/emulators/virtualbox-ose-additions/files/pkg-pre-deinstall.in
@@ -0,0 +1,18 @@
+/bin/rm -f %%PREFIX%%/lib/libEGL.so*
+if [ -f %%PREFIX%%/lib/.nvidia/libEGL.so.1 ]; then
+ /bin/ln -f %%PREFIX%%/lib/.nvidia/libEGL.so.1 %%PREFIX%%/lib/libEGL.so
+ /bin/ln -f %%PREFIX%%/lib/.nvidia/libEGL.so.1 %%PREFIX%%/lib/libEGL.so.1
+elif [ -f %%PREFIX%%/lib/.mesa/libEGL.so.1.0.0 ]; then
+ /bin/ln -f %%PREFIX%%/lib/.mesa/libEGL.so.1.0.0 %%PREFIX%%/lib/libEGL.so
+ /bin/ln -f %%PREFIX%%/lib/.mesa/libEGL.so.1.0.0 %%PREFIX%%/lib/libEGL.so.1
+ /bin/ln -f %%PREFIX%%/lib/.mesa/libEGL.so.1.0.0 %%PREFIX%%/lib/libEGL.so.1.0.0
+fi
+/bin/rm -f %%PREFIX%%/lib/libGL.so*
+if [ -f %%PREFIX%%/lib/.nvidia/libGL.so.1 ]; then
+ /bin/ln -f %%PREFIX%%/lib/.nvidia/libGL.so.1 %%PREFIX%%/lib/libGL.so
+ /bin/ln -f %%PREFIX%%/lib/.nvidia/libGL.so.1 %%PREFIX%%/lib/libGL.so.1
+elif [ -f %%PREFIX%%/lib/.mesa/libGL.so.1.2.0 ]; then
+ /bin/ln -f %%PREFIX%%/lib/.mesa/libGL.so.1.2.0 %%PREFIX%%/lib/libGL.so
+ /bin/ln -f %%PREFIX%%/lib/.mesa/libGL.so.1.2.0 %%PREFIX%%/lib/libGL.so.1
+ /bin/ln -f %%PREFIX%%/lib/.mesa/libGL.so.1.2.0 %%PREFIX%%/lib/libGL.so.1.2.0
+fi
diff --git a/emulators/virtualbox-ose-additions/files/vboxguest.in b/emulators/virtualbox-ose-additions/files/vboxguest.in
index 5be9476c453..08f3ef8ebab 100644
--- a/emulators/virtualbox-ose-additions/files/vboxguest.in
+++ b/emulators/virtualbox-ose-additions/files/vboxguest.in
@@ -22,7 +22,7 @@ rcvar=vboxguest_enable
start_cmd="vboxguest_start"
stop_cmd="vboxguest_stop"
-vboxguest_modules="%%VBOX_KMODS%%"
+vboxguest_modules="vboxguest:pci/vboxguest"
vboxguest_start()
{
diff --git a/emulators/virtualbox-ose-additions/pkg-plist b/emulators/virtualbox-ose-additions/pkg-plist
index bfa6c51e8c6..9fdd824c62b 100644
--- a/emulators/virtualbox-ose-additions/pkg-plist
+++ b/emulators/virtualbox-ose-additions/pkg-plist
@@ -10,7 +10,6 @@
%%OPENGL%%lib/VBoxOGLpackspu.so
%%OPENGL%%lib/VBoxOGLpassthroughspu.so
lib/pam_vbox.so
-%%OPENGL%%lib/dri/vboxvideo_dri.so
%%X11%%lib/xorg/modules/drivers/vboxvideo_drv.so
%%X11%%lib/xorg/modules/input/vboxmouse_drv.so
sbin/VBoxControl
@@ -18,5 +17,3 @@ sbin/VBoxService
%%X11%%share/autostart/vboxclient.desktop
/%%KMODDIR%%/vboxguest.ko
%%DEBUG%%/%%KMODDIR%%/vboxguest.ko.symbols
-%%OPENGL%%/%%KMODDIR%%/vboxvideo.ko
-%%DEBUG%%%%OPENGL%%/%%KMODDIR%%/vboxvideo.ko.symbols
diff --git a/emulators/virtualbox-ose/files/extrapatch-src-VBox-Additions-freebsd-drm-Makefile b/emulators/virtualbox-ose/files/extrapatch-src-VBox-Additions-freebsd-drm-Makefile
deleted file mode 100644
index ef93e11beff..00000000000
--- a/emulators/virtualbox-ose/files/extrapatch-src-VBox-Additions-freebsd-drm-Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
---- src/VBox/Additions/freebsd/drm/Makefile.orig 2015-03-16 13:00:32.000000000 -0400
-+++ src/VBox/Additions/freebsd/drm/Makefile 2015-03-27 18:18:03.432353000 -0400
-@@ -18,10 +18,10 @@
-
- KMOD = vboxvideo
-
--SRCS = \
-- vboxvideo_drm.c
-+SRCS = vboxvideo_drm.c
-+SRCS += device_if.h bus_if.h pci_if.h
-+SRCS += opt_compat.h opt_drm.h opt_syscons.h
-
--SRCS += device_if.h bus_if.h pci_if.h opt_drm.h
-+CFLAGS+= -DVBOXVIDEO_DRM2
-
- .include <bsd.kmod.mk>
--
diff --git a/emulators/virtualbox-ose/files/extrapatch-src-VBox-Additions-freebsd-drm-Makefile.kmk b/emulators/virtualbox-ose/files/extrapatch-src-VBox-Additions-freebsd-drm-Makefile.kmk
deleted file mode 100644
index b14967fe5a2..00000000000
--- a/emulators/virtualbox-ose/files/extrapatch-src-VBox-Additions-freebsd-drm-Makefile.kmk
+++ /dev/null
@@ -1,38 +0,0 @@
---- src/VBox/Additions/freebsd/drm/Makefile.kmk.orig 2015-03-16 13:00:32.000000000 -0400
-+++ src/VBox/Additions/freebsd/drm/Makefile.kmk 2015-03-27 22:28:21.000000000 -0400
-@@ -46,6 +46,7 @@
- vboxvideo_drm_TEMPLATE = VBOXGUESTR0
- vboxvideo_drm_NAME = vboxvideo
- vboxvideo_drm_DEFS = VBOX_WITH_HGCM VBOX_SVN_REV=$(VBOX_SVN_REV)
-+vboxvideo_drm_DEFS += VBOXVIDEO_DRM2
- vboxvideo_drm_DEPS += $(VBOX_SVN_REV_KMK)
- vboxvideo_drm_INCS.freebsd = \
- $(vboxvideo_drm_0_OUTDIR) \
-@@ -58,15 +59,24 @@
- $(PATH_STAGE)/gen-sys-hdrs/pci_if.h \
- $(PATH_STAGE)/gen-sys-hdrs/bus_if.h \
- $(PATH_STAGE)/gen-sys-hdrs/device_if.h \
-- $(vboxvideo_drm_0_OUTDIR)/opt_drm.h
-+ $(vboxvideo_drm_0_OUTDIR)/opt_compat.h \
-+ $(vboxvideo_drm_0_OUTDIR)/opt_drm.h \
-+ $(vboxvideo_drm_0_OUTDIR)/opt_syscons.h
- vboxvideo_drm_CLEAN.freebsd = $(vboxvideo_drm_DEPS)
-
- #
--# Header for DRM not included by us.
-+# Headers for DRM not included by us.
- #
-+$$(vboxvideo_drm_0_OUTDIR)/opt_compat.h:
-+ $(QUIET)$(MKDIR) -p $(vboxvideo_drm_0_OUTDIR)
-+ $(QUIET)touch $(vboxvideo_drm_0_OUTDIR)/opt_compat.h
-+
- $$(vboxvideo_drm_0_OUTDIR)/opt_drm.h:
- $(QUIET)$(MKDIR) -p $(vboxvideo_drm_0_OUTDIR)
- $(QUIET)touch $(vboxvideo_drm_0_OUTDIR)/opt_drm.h
-
--include $(FILE_KBUILD_SUB_FOOTER)
-+$$(vboxvideo_drm_0_OUTDIR)/opt_syscons.h:
-+ $(QUIET)$(MKDIR) -p $(vboxvideo_drm_0_OUTDIR)
-+ $(QUIET)touch $(vboxvideo_drm_0_OUTDIR)/opt_syscons.h
-
-+include $(FILE_KBUILD_SUB_FOOTER)
diff --git a/emulators/virtualbox-ose/files/extrapatch-src_VBox_Additions_freebsd_Makefile.kmk b/emulators/virtualbox-ose/files/extrapatch-src_VBox_Additions_freebsd_Makefile.kmk
deleted file mode 100644
index 3735ce84764..00000000000
--- a/emulators/virtualbox-ose/files/extrapatch-src_VBox_Additions_freebsd_Makefile.kmk
+++ /dev/null
@@ -1,11 +0,0 @@
---- src/VBox/Additions/freebsd/Makefile.kmk.orig 2016-07-18 11:50:44 UTC
-+++ src/VBox/Additions/freebsd/Makefile.kmk
-@@ -24,7 +24,7 @@ endif
-
- # Include sub-makefiles.
- #include $(PATH_SUB_CURRENT)/vboxvfs/Makefile.kmk
--include $(PATH_SUB_CURRENT)/drm/Makefile.kmk
-+#include $(PATH_SUB_CURRENT)/drm/Makefile.kmk
-
- #
- # Globals
diff --git a/emulators/virtualbox-ose/files/patch-src-VBox-Additions-common-crOpenGL-Makefile.kmk b/emulators/virtualbox-ose/files/patch-src-VBox-Additions-common-crOpenGL-Makefile.kmk
index cd8bc4499c7..c33cb64cdcf 100644
--- a/emulators/virtualbox-ose/files/patch-src-VBox-Additions-common-crOpenGL-Makefile.kmk
+++ b/emulators/virtualbox-ose/files/patch-src-VBox-Additions-common-crOpenGL-Makefile.kmk
@@ -1,20 +1,22 @@
---- src/VBox/Additions/common/crOpenGL/Makefile.kmk.orig 2014-11-21 10:16:35.000000000 -0500
-+++ src/VBox/Additions/common/crOpenGL/Makefile.kmk 2014-12-19 16:55:22.000000000 -0500
-@@ -172,7 +172,7 @@
- VBoxOGL_SOURCES.solaris += \
- $(VBOX_PATH_CROGL_GENFILES)/solaris_exports.c
- VBoxOGL_SOURCES.freebsd += \
-- $(VBOX_PATH_CROGL_GENFILES)/freebsd_exports.c
-+ $(VBOX_PATH_CROGL_GENFILES)/freebsd_exports.asm
- endif
- endif
+--- src/VBox/Additions/common/crOpenGL/Makefile.kmk.orig 2016-07-18 11:50:43 UTC
++++ src/VBox/Additions/common/crOpenGL/Makefile.kmk
+@@ -47,9 +47,7 @@ endif
+ if1of ($(KBUILD_TARGET), linux solaris freebsd)
+ #VBoxOGL_DRI = 1
+ DLLS += VBoxEGL
+- ifn1of ($(KBUILD_TARGET),linux solaris) # No DRI on Solaris yet
+- VBoxOGL_FAKEDRI = 1
+- endif
++ #VBoxOGL_FAKEDRI = 1
-@@ -190,10 +190,12 @@
- $(VBOX_PATH_CROGL_GENFILES)/linux_exports.asm
+ # Only Solaris right now needs C stubs because I can't figure out how to
+ # generate the GOT based relocation ASM yet.
+@@ -184,10 +182,12 @@ VBoxOGL_CLEAN.linux += \
+ $(VBOX_PATH_CROGL_GENFILES)/linux_exports.c
VBoxOGL_CLEAN.solaris += \
$(VBOX_PATH_CROGL_GENFILES)/solaris_exports.c
+VBoxOGL_CLEAN.freebsd += \
-+ $(VBOX_PATH_CROGL_GENFILES)/freebsd_exports.asm
++ $(VBOX_PATH_CROGL_GENFILES)/freebsd_exports.c
VBoxOGL_CLEAN.win = \
$(VBOX_PATH_CROGL_GENFILES)/windows_exports.asm \
$(VBOX_PATH_CROGL_GENFILES)/cropengl.def
@@ -23,7 +25,7 @@
ifdef VBoxOGL_DRI
VBoxOGL_CLEAN += \
$(VBOX_PATH_CROGL_GENFILES)/cr_gl.h \
-@@ -206,6 +208,8 @@
+@@ -200,6 +200,8 @@ if1of ($(KBUILD_TARGET), linux solaris)
$(VBOX_PATH_CROGL_GENFILES)/linux_glxapi_exports.asm
VBoxOGL_CLEAN.solaris += \
$(VBOX_PATH_CROGL_GENFILES)/solaris_glxapi_exports.asm
@@ -32,7 +34,16 @@
endif
endif
VBoxOGL_LIBS = \
-@@ -235,7 +239,7 @@
+@@ -229,6 +231,8 @@ if1of ($(KBUILD_TARGET), linux solaris f
+ else
+ VBoxOGL_SONAME.linux = libGL.so.1
+ VBoxOGL_LDFLAGS.linux += -Wl,-e,LibMain
++ VBoxOGL_SONAME.freebsd = libGL.so.1
++ VBoxOGL_LDFLAGS.freebsd += -Wl,-e,LibMain
+ endif
+ endif
+ ifdef VBOX_WITH_CRHGSMI
+@@ -237,7 +241,7 @@ endif
ifdef VBOX_WITH_WDDM
VBoxOGL_DEFS.win += VBOX_WITH_WDDM
endif
@@ -41,22 +52,10 @@
VBoxOGL_LDFLAGS += -Wl,-z,nodelete
endif
ifdef VBOX_WITH_WDDM
-@@ -317,8 +321,8 @@
- $(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI)
-
- else ifeq ($(KBUILD_TARGET),freebsd)
--$(VBOX_PATH_CROGL_GENFILES)/freebsd_exports.c: \
-- $(PATH_SUB_CURRENT)/FreeBSD_exports.py \
-+$(VBOX_PATH_CROGL_GENFILES)/freebsd_exports.asm: \
-+ $(PATH_SUB_CURRENT)/FreeBSD_i386_exports.py \
- $(VBOX_CROGL_API_FILES) $(PATH_SUB_CURRENT)/entrypoints.py \
- | $$(dir $$@)
- $(call MSG_GENERATE,python,$@,$<)
-@@ -387,7 +391,16 @@
+@@ -395,6 +399,16 @@ $(VBOX_PATH_CROGL_GENFILES)/solaris_expo
$(VBOX_PATH_CROGL_GENFILES)/solaris_glxapi_exports.asm: $(PATH_SUB_CURRENT)/SunOS_i386_glxapi_exports.py | $$(dir $$@)
$(call MSG_GENERATE,python,$@,$<)
$(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $<
--
+ else ifeq ($(KBUILD_TARGET),freebsd)
+$(VBOX_PATH_CROGL_GENFILES)/freebsd_exports_dri.asm: \
+ $(PATH_SUB_CURRENT)/FreeBSD_i386_exports_dri.py \
@@ -67,6 +66,14 @@
+$(VBOX_PATH_CROGL_GENFILES)/freebsd_glxapi_exports.asm: $(PATH_SUB_CURRENT)/FreeBSD_i386_glxapi_exports.py | $$(dir $$@)
+ $(call MSG_GENERATE,python,$@,$<)
+ $(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $<
+
else
$(VBOX_PATH_CROGL_GENFILES)/linux_exports_dri.asm: \
- $(PATH_SUB_CURRENT)/Linux_i386_exports_dri.py \
+@@ -712,6 +726,7 @@ VBoxEGL_SOURCES = egl.c
+ VBoxEGL_INCS = $(VBOX_PATH_X11_ROOT)/mesa-11.0.7
+ VBoxEGL_LIBS = $(VBOX_LIB_OGL) $(VBOX_LIB_IPRT_GUEST_R3_SHARED)
+ VBoxEGL_SONAME.linux = libEGL.so.1
++VBoxEGL_SONAME.freebsd = libEGL.so.1
+
+ include $(FILE_KBUILD_SUB_FOOTER)
+
diff --git a/emulators/virtualbox-ose/files/patch-src-VBox-Additions-freebsd-drm-vboxvideo_drm.c b/emulators/virtualbox-ose/files/patch-src-VBox-Additions-freebsd-drm-vboxvideo_drm.c
deleted file mode 100644
index 19934c9a20f..00000000000
--- a/emulators/virtualbox-ose/files/patch-src-VBox-Additions-freebsd-drm-vboxvideo_drm.c
+++ /dev/null
@@ -1,77 +0,0 @@
---- src/VBox/Additions/freebsd/drm/vboxvideo_drm.c.orig 2015-03-16 13:00:32.000000000 -0400
-+++ src/VBox/Additions/freebsd/drm/vboxvideo_drm.c 2015-03-27 17:40:43.686690000 -0400
-@@ -54,8 +54,13 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD$");
-
-+#ifdef VBOXVIDEO_DRM2
-+#include "dev/drm2/drmP.h"
-+#include "dev/drm2/drm_pciids.h"
-+#else
- #include "dev/drm/drmP.h"
- #include "dev/drm/drm_pciids.h"
-+#endif
-
- #define DRIVER_AUTHOR "Oracle Corporation"
- #define DRIVER_NAME "vboxvideo"
-@@ -74,6 +79,54 @@
- vboxvideo_PCI_IDS
- };
-
-+#ifdef VBOXVIDEO_DRM2
-+
-+static struct drm_driver vboxvideo_info = {
-+ .buf_priv_size = 1, /* No dev_priv */
-+
-+ .num_ioctls = 0,
-+
-+ .name = DRIVER_NAME,
-+ .desc = DRIVER_DESC,
-+ .date = DRIVER_DATE,
-+ .major = DRIVER_MAJOR,
-+ .minor = DRIVER_MINOR,
-+ .patchlevel = DRIVER_PATCHLEVEL,
-+};
-+
-+static int
-+vboxvideo_probe(device_t kdev)
-+{
-+ return -drm_probe_helper(kdev, vboxvideo_pciidlist);
-+}
-+
-+static int
-+vboxvideo_attach(device_t kdev)
-+{
-+ return -drm_attach_helper(kdev, vboxvideo_pciidlist, &vboxvideo_info);
-+}
-+
-+static device_method_t vboxvideo_methods[] = {
-+ /* Device interface */
-+ DEVMETHOD(device_probe, vboxvideo_probe),
-+ DEVMETHOD(device_attach, vboxvideo_attach),
-+ DEVMETHOD(device_detach, drm_generic_detach),
-+
-+ DEVMETHOD_END
-+};
-+
-+static driver_t vboxvideo_driver = {
-+ "drmn",
-+ vboxvideo_methods,
-+ sizeof(struct drm_device)
-+};
-+
-+extern devclass_t drm_devclass;
-+DRIVER_MODULE(vboxvideo, vgapci, vboxvideo_driver, drm_devclass, 0, 0);
-+MODULE_DEPEND(vboxvideo, drmn, 1, 1, 1);
-+
-+#else /* !VBOXVIDEO_DRM2 */
-+
- static void vboxvideo_configure(struct drm_device *dev)
- {
- #if __FreeBSD_version >= 702000
-@@ -161,3 +214,5 @@
- DRIVER_MODULE(vboxvideo, pci, vboxvideo_driver, drm_devclass, 0, 0);
- #endif
- MODULE_DEPEND(vboxvideo, drm, 1, 1, 1);
-+
-+#endif /* VBOXVIDEO_DRM2 */
diff --git a/emulators/virtualbox-ose/files/patch-src_VBox_Additions_common_crOpenGL_stub.h b/emulators/virtualbox-ose/files/patch-src_VBox_Additions_common_crOpenGL_stub.h
new file mode 100644
index 00000000000..8b49aa94686
--- /dev/null
+++ b/emulators/virtualbox-ose/files/patch-src_VBox_Additions_common_crOpenGL_stub.h
@@ -0,0 +1,11 @@
+--- src/VBox/Additions/common/crOpenGL/stub.h.orig 2016-07-18 11:50:44 UTC
++++ src/VBox/Additions/common/crOpenGL/stub.h
+@@ -47,7 +47,7 @@
+ #include <X11/extensions/Xfixes.h>
+ #endif
+
+-#if defined(WINDOWS) || defined(Linux) || defined(SunOS)
++#if defined(WINDOWS) || defined(Linux) || defined(FreeBSD) || defined(SunOS)
+ # define CR_NEWWINTRACK
+ #endif
+
diff --git a/emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_Makefile.kmk b/emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_Makefile.kmk
index 9c2791c791e..79654201adf 100644
--- a/emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_Makefile.kmk
+++ b/emulators/virtualbox-ose/files/patch-src_VBox_Additions_freebsd_Makefile.kmk
@@ -1,5 +1,14 @@
--- src/VBox/Additions/freebsd/Makefile.kmk.orig 2016-07-18 11:50:44 UTC
+++ src/VBox/Additions/freebsd/Makefile.kmk
+@@ -24,7 +24,7 @@ endif
+
+ # Include sub-makefiles.
+ #include $(PATH_SUB_CURRENT)/vboxvfs/Makefile.kmk
+-include $(PATH_SUB_CURRENT)/drm/Makefile.kmk
++#include $(PATH_SUB_CURRENT)/drm/Makefile.kmk
+
+ #
+ # Globals
@@ -67,6 +67,7 @@ VBOX_FBSD_ADD_STRIP_BIN = \
vboxvideo_drv_15.so \
vboxvideo_drv_16.so \
@@ -8,3 +17,13 @@
VBoxOGLarrayspu.so \
VBoxOGLcrutil.so \
VBoxOGLerrorspu.so \
+@@ -76,8 +77,7 @@ VBOX_FBSD_ADD_STRIP_BIN = \
+ VBoxOGL.so
+
+ VBOX_FBSD_ADD_MODULES = \
+- vboxguest \
+- vboxvideo_drm
++ vboxguest
+
+ #
+ # All the bin files that go into the archives.