1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-02-04 11:23:46 +00:00

- Reduce diff from Linux OpenGL support. Note we do not have to manually

turn off AIGLX any more.
- Do not install vboxvideo.ko when OPENGL is disabled.  It is only required
for OpenGL support.
- Install vboxvideo.ko.symbols when both DEBUG and OPENGL are enabled.
- Do not try to load vboxvideo.ko if it does not exist.
This commit is contained in:
Jung-uk Kim 2014-12-23 00:05:04 +00:00
parent 484c6163fb
commit b8592bbae4
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=375294
9 changed files with 413 additions and 3 deletions

View File

@ -3,7 +3,7 @@
PORTNAME= virtualbox-ose
DISTVERSION= 4.3.20
PORTREVISION= 2
PORTREVISION= 3
CATEGORIES= emulators
MASTER_SITES= http://download.virtualbox.org/virtualbox/${DISTVERSION}/ \
http://tmp.chruetertee.ch/ \
@ -113,6 +113,8 @@ EXTRA_PATCHES+= ${PATCHDIR}/extrapatch-src-VBox-Additions-x11-VBoxClient-Makefil
.endif
.endif
SUB_LIST+= KMODDIR=${KMODDIR}
pre-everything::
.if ${ARCH} == "amd64"
.if !exists(/usr/lib32/libc.so)
@ -159,8 +161,11 @@ do-install:
.if ${PORT_OPTIONS:MDEBUG}
${INSTALL_KLD} ${VBOX_BIN}/src/vboxguest/vboxguest.ko.symbols ${STAGEDIR}${KMODDIR}
.endif
.if ${PORT_OPTIONS:MX11}
.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_PROGRAM} ${VBOX_SBINS:S|^|${VBOX_BIN}/|} \

View File

@ -32,6 +32,7 @@ vboxguest_start()
return 1
fi
fi
test -f "%%KMODDIR%%/vboxvideo.ko" || return 0
if ! kldstat -q -m vgapci/vboxvideo;
then
if ! kldload vboxvideo > /dev/null 2>&1;

View File

@ -16,4 +16,5 @@ sbin/VBoxService
%%X11%%share/autostart/vboxclient.desktop
/%%KMODDIR%%/vboxguest.ko
%%DEBUG%%/%%KMODDIR%%/vboxguest.ko.symbols
%%X11%%/%%KMODDIR%%/vboxvideo.ko
%%OPENGL%%/%%KMODDIR%%/vboxvideo.ko
%%DEBUG%%%%OPENGL%%/%%KMODDIR%%/vboxvideo.ko.symbols

View File

@ -119,3 +119,11 @@
/usr/local/lib
else ifeq ($(KBUILD_HOST),solaris)
TEMPLATE_VBoxBldProg_TOOL = GXX3PLAIN
@@ -5427,6 +5407,7 @@
-current_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
-compatibility_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)
TEMPLATE_VBOXCROGLR3HOSTDLL_LDFLAGS.linux = -Wl,--no-as-needed
+TEMPLATE_VBOXCROGLR3HOSTDLL_LDFLAGS.freebsd = -Wl,--no-as-needed
TEMPLATE_VBOXCROGLR3HOSTDLL_BLDDIRS = $(VBOX_PATH_CROGL_GENFILES)/
#

View File

@ -0,0 +1,98 @@
--- src/VBox/Additions/common/crOpenGL/FreeBSD_i386_exports.py.orig 2014-12-19 16:58:04.474417000 -0500
+++ src/VBox/Additions/common/crOpenGL/FreeBSD_i386_exports.py 2014-11-21 10:16:35.000000000 -0500
@@ -0,0 +1,95 @@
+# Copyright (c) 2001, Stanford University
+# All rights reserved.
+#
+# See the file LICENSE.txt for information on redistributing this software.
+
+
+import sys
+
+import apiutil
+
+
+def GenerateEntrypoints():
+
+ #apiutil.CopyrightC()
+
+ # Get sorted list of dispatched functions.
+ # The order is very important - it must match cr_opcodes.h
+ # and spu_dispatch_table.h
+ print '%include "iprt/asmdefs.mac"'
+ print ""
+ print "%ifdef RT_ARCH_AMD64"
+ print "extern glim"
+ print "%else ; X86"
+ print "extern glim"
+ print "%endif"
+ print ""
+
+ keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt")
+
+ for index in range(len(keys)):
+ func_name = keys[index]
+ if apiutil.Category(func_name) == "Chromium":
+ continue
+ if apiutil.Category(func_name) == "VBox":
+ continue
+
+ print "BEGINPROC_EXPORTED gl%s" % func_name
+ print "%ifdef RT_ARCH_AMD64"
+ print "\tmov \trax, qword glim+%d" % (8*index)
+ print "\tjmp \t[rax]"
+ print "%else ; X86"
+ print "\tmov \teax, dword glim+%d" % (4*index)
+ print "\tjmp \t[eax]"
+ print "%endif"
+ print "ENDPROC gl%s" % func_name
+ print ""
+
+
+ print ';'
+ print '; Aliases'
+ print ';'
+
+ # Now loop over all the functions and take care of any aliases
+ allkeys = apiutil.GetAllFunctions(sys.argv[1]+"/APIspec.txt")
+ for func_name in allkeys:
+ if "omit" in apiutil.ChromiumProps(func_name):
+ continue
+
+ if func_name in keys:
+ # we already processed this function earlier
+ continue
+
+ # alias is the function we're aliasing
+ alias = apiutil.Alias(func_name)
+ if alias:
+ # this dict lookup should never fail (raise an exception)!
+ index = keys.index(alias)
+ print "BEGINPROC_EXPORTED gl%s" % func_name
+ print "%ifdef RT_ARCH_AMD64"
+ print "\tmov \trax, qword glim+%d" % (8*index)
+ print "\tjmp \t[rax]"
+ print "%else ; X86"
+ print "\tmov \teax, dword glim+%d" % (4*index)
+ print "\tjmp \t[eax]"
+ print "%endif"
+ print "ENDPROC gl%s" % func_name
+ print ""
+
+
+ print ';'
+ print '; No-op stubs'
+ print ';'
+
+ # Now generate no-op stub functions
+ for func_name in allkeys:
+ if "stub" in apiutil.ChromiumProps(func_name):
+ print "BEGINPROC_EXPORTED gl%s" % func_name
+ print "\tleave"
+ print "\tret"
+ print "ENDPROC gl%s" % func_name
+ print ""
+
+
+GenerateEntrypoints()
+

View File

@ -0,0 +1,98 @@
--- src/VBox/Additions/common/crOpenGL/FreeBSD_i386_exports_dri.py.orig 2014-12-19 16:58:04.474417000 -0500
+++ src/VBox/Additions/common/crOpenGL/FreeBSD_i386_exports_dri.py 2014-11-21 10:16:35.000000000 -0500
@@ -0,0 +1,95 @@
+# Copyright (c) 2001, Stanford University
+# All rights reserved.
+#
+# See the file LICENSE.txt for information on redistributing this software.
+
+
+import sys
+
+import apiutil
+
+
+def GenerateEntrypoints():
+
+ #apiutil.CopyrightC()
+
+ # Get sorted list of dispatched functions.
+ # The order is very important - it must match cr_opcodes.h
+ # and spu_dispatch_table.h
+ print '%include "iprt/asmdefs.mac"'
+ print ""
+ print "%ifdef RT_ARCH_AMD64"
+ print "extern glim"
+ print "%else ; X86"
+ print "extern glim"
+ print "%endif"
+ print ""
+
+ keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt")
+
+ for index in range(len(keys)):
+ func_name = keys[index]
+ if apiutil.Category(func_name) == "Chromium":
+ continue
+ if apiutil.Category(func_name) == "VBox":
+ continue
+
+ print "BEGINPROC_EXPORTED cr_gl%s" % func_name
+ print "%ifdef RT_ARCH_AMD64"
+ print "\tmov \trax, qword glim+%d" % (8*index)
+ print "\tjmp \t[rax]"
+ print "%else ; X86"
+ print "\tmov \teax, dword glim+%d" % (4*index)
+ print "\tjmp \t[eax]"
+ print "%endif"
+ print "ENDPROC cr_gl%s" % func_name
+ print ""
+
+
+ print ';'
+ print '; Aliases'
+ print ';'
+
+ # Now loop over all the functions and take care of any aliases
+ allkeys = apiutil.GetAllFunctions(sys.argv[1]+"/APIspec.txt")
+ for func_name in allkeys:
+ if "omit" in apiutil.ChromiumProps(func_name):
+ continue
+
+ if func_name in keys:
+ # we already processed this function earlier
+ continue
+
+ # alias is the function we're aliasing
+ alias = apiutil.Alias(func_name)
+ if alias:
+ # this dict lookup should never fail (raise an exception)!
+ index = keys.index(alias)
+ print "BEGINPROC_EXPORTED cr_gl%s" % func_name
+ print "%ifdef RT_ARCH_AMD64"
+ print "\tmov \trax, qword glim+%d" % (8*index)
+ print "\tjmp \t[rax]"
+ print "%else ; X86"
+ print "\tmov \teax, dword glim+%d" % (4*index)
+ print "\tjmp \t[eax]"
+ print "%endif"
+ print "ENDPROC cr_gl%s" % func_name
+ print ""
+
+
+ print ';'
+ print '; No-op stubs'
+ print ';'
+
+ # Now generate no-op stub functions
+ for func_name in allkeys:
+ if "stub" in apiutil.ChromiumProps(func_name):
+ print "BEGINPROC_EXPORTED cr_gl%s" % func_name
+ print "\tleave"
+ print "\tret"
+ print "ENDPROC cr_gl%s" % func_name
+ print ""
+
+
+GenerateEntrypoints()
+

View File

@ -0,0 +1,107 @@
--- src/VBox/Additions/common/crOpenGL/FreeBSD_i386_glxapi_exports.py.orig 2014-12-19 16:58:04.474417000 -0500
+++ src/VBox/Additions/common/crOpenGL/FreeBSD_i386_glxapi_exports.py 2014-11-21 10:16:35.000000000 -0500
@@ -0,0 +1,104 @@
+"""
+Copyright (C) 2009-2012 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+"""
+
+import sys
+
+#Note, this should match the fakedri_glxfuncsList.h order
+glx_functions = [
+"CopyContext",
+"UseXFont",
+#"GetDriverConfig",
+"GetProcAddress",
+"QueryExtension",
+"IsDirect",
+"DestroyGLXPbufferSGIX",
+"QueryGLXPbufferSGIX",
+"CreateGLXPixmap",
+"CreateGLXPixmapWithConfigSGIX",
+"QueryContext",
+"CreateContextWithConfigSGIX",
+"SwapBuffers",
+"CreateNewContext",
+"SelectEventSGIX",
+"GetCurrentDrawable",
+"ChooseFBConfig",
+"WaitGL",
+"GetFBConfigs",
+"CreatePixmap",
+"GetSelectedEventSGIX",
+"GetCurrentReadDrawable",
+"GetCurrentDisplay",
+"QueryServerString",
+"CreateWindow",
+"SelectEvent",
+"GetVisualFromFBConfigSGIX",
+"GetFBConfigFromVisualSGIX",
+"QueryDrawable",
+"CreateContext",
+"GetConfig",
+"CreateGLXPbufferSGIX",
+"CreatePbuffer",
+"ChooseFBConfigSGIX",
+"WaitX",
+"GetVisualFromFBConfig",
+#"GetScreenDriver",
+"GetFBConfigAttrib",
+"GetCurrentContext",
+"GetClientString",
+"DestroyPixmap",
+"MakeCurrent",
+"DestroyContext",
+"GetProcAddressARB",
+"GetSelectedEvent",
+"DestroyPbuffer",
+"DestroyWindow",
+"DestroyGLXPixmap",
+"QueryVersion",
+"ChooseVisual",
+"MakeContextCurrent",
+"QueryExtensionsString",
+"GetFBConfigAttribSGIX",
+"FreeMemoryMESA",
+"QueryContextInfoEXT",
+"ImportContextEXT",
+"GetContextIDEXT",
+"MakeCurrentReadSGI",
+"AllocateMemoryMESA",
+"GetMemoryOffsetMESA",
+"CreateGLXPixmapMESA",
+"GetCurrentDisplayEXT",
+"FreeContextEXT"
+];
+
+print '%include "iprt/asmdefs.mac"'
+print ""
+print "%ifdef RT_ARCH_AMD64"
+print "extern glxim"
+print "%else ; X86"
+print "extern glxim"
+print "%endif"
+print ""
+
+for index in range(len(glx_functions)):
+ func_name = glx_functions[index]
+
+ print "BEGINPROC_EXPORTED vbox_glX%s" % func_name
+ print "%ifdef RT_ARCH_AMD64"
+ print "\tmov \trax, qword glxim+%d" % (8*index)
+ print "\tjmp \t[rax]"
+ print "%else ; X86"
+ print "\tmov \teax, dword glxim+%d" % (4*index)
+ print "\tjmp \t[eax]"
+ print "%endif"
+ print "ENDPROC vbox_glX%s" % func_name
+ print ""
+

View File

@ -0,0 +1,72 @@
--- 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
@@ -190,10 +190,12 @@
$(VBOX_PATH_CROGL_GENFILES)/linux_exports.asm
VBoxOGL_CLEAN.solaris += \
$(VBOX_PATH_CROGL_GENFILES)/solaris_exports.c
+VBoxOGL_CLEAN.freebsd += \
+ $(VBOX_PATH_CROGL_GENFILES)/freebsd_exports.asm
VBoxOGL_CLEAN.win = \
$(VBOX_PATH_CROGL_GENFILES)/windows_exports.asm \
$(VBOX_PATH_CROGL_GENFILES)/cropengl.def
-if1of ($(KBUILD_TARGET), linux solaris)
+if1of ($(KBUILD_TARGET), linux solaris freebsd)
ifdef VBoxOGL_DRI
VBoxOGL_CLEAN += \
$(VBOX_PATH_CROGL_GENFILES)/cr_gl.h \
@@ -206,6 +208,8 @@
$(VBOX_PATH_CROGL_GENFILES)/linux_glxapi_exports.asm
VBoxOGL_CLEAN.solaris += \
$(VBOX_PATH_CROGL_GENFILES)/solaris_glxapi_exports.asm
+ VBoxOGL_CLEAN.freebsd += \
+ $(VBOX_PATH_CROGL_GENFILES)/freebsd_glxapi_exports.asm
endif
endif
VBoxOGL_LIBS = \
@@ -235,7 +239,7 @@
ifdef VBOX_WITH_WDDM
VBoxOGL_DEFS.win += VBOX_WITH_WDDM
endif
-if1of ($(KBUILD_TARGET), linux)
+if1of ($(KBUILD_TARGET), linux freebsd)
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 @@
$(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 \
+ $(VBOX_CROGL_API_FILES) $(PATH_SUB_CURRENT)/entrypoints.py \
+ | $$(dir $$@)
+ $(call MSG_GENERATE,python,$@,$<)
+ $(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI)
+$(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 \

View File

@ -0,0 +1,20 @@
--- src/VBox/GuestHost/OpenGL/Makefile.kmk.orig 2014-11-21 10:22:21.000000000 -0500
+++ src/VBox/GuestHost/OpenGL/Makefile.kmk 2014-12-22 17:20:31.000000000 -0500
@@ -116,7 +116,7 @@
endif
VBoxOGLcrutil_CLEAN = \
$(VBOX_PATH_CROGL_GENFILES)/debug_opcodes.c
-if1of ($(KBUILD_TARGET), linux)
+if1of ($(KBUILD_TARGET), linux freebsd)
VBoxOGLcrutil_LDFLAGS += -Wl,-z,nodelete
endif
@@ -160,7 +160,7 @@
if defined(VBOX_SIGNING_MODE) && defined(VBOX_WITH_WDDM)
VBoxOGLhostcrutil_INSTTYPE.win = both
endif
-if1of ($(KBUILD_TARGET), linux)
+if1of ($(KBUILD_TARGET), linux freebsd)
VBoxOGLhostcrutil_LDFLAGS = $(NO_SUCH_VARIABLE)
endif
VBoxOGLhostcrutil_LDFLAGS.darwin = $(VBoxOGLcrutil_LDFLAGS.darwin) \