summaryrefslogtreecommitdiff
path: root/src/VBox/Additions/common/crOpenGL
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2014-03-26 19:21:20 +0000
committer <>2014-05-08 15:03:54 +0000
commitfb123f93f9f5ce42c8e5785d2f8e0edaf951740e (patch)
treec2103d76aec5f1f10892cd1d3a38e24f665ae5db /src/VBox/Additions/common/crOpenGL
parent58ed4748338f9466599adfc8a9171280ed99e23f (diff)
downloadVirtualBox-master.tar.gz
Imported from /home/lorry/working-area/delta_VirtualBox/VirtualBox-4.3.10.tar.bz2.HEADVirtualBox-4.3.10master
Diffstat (limited to 'src/VBox/Additions/common/crOpenGL')
-rwxr-xr-xsrc/VBox/Additions/common/crOpenGL/Linux_i386_glxapi_exports.py2
-rw-r--r--src/VBox/Additions/common/crOpenGL/Makefile.kmk105
-rwxr-xr-xsrc/VBox/Additions/common/crOpenGL/SunOS_i386_exports.py2
-rwxr-xr-xsrc/VBox/Additions/common/crOpenGL/SunOS_i386_exports_dri.py2
-rwxr-xr-xsrc/VBox/Additions/common/crOpenGL/SunOS_i386_glxapi_exports.py2
-rw-r--r--src/VBox/Additions/common/crOpenGL/VBoxICDList.h2
-rw-r--r--src/VBox/Additions/common/crOpenGL/context.c107
-rw-r--r--src/VBox/Additions/common/crOpenGL/defs.py13
-rw-r--r--src/VBox/Additions/common/crOpenGL/defs64.py10
-rw-r--r--src/VBox/Additions/common/crOpenGL/dri_drv.c2
-rw-r--r--src/VBox/Additions/common/crOpenGL/dri_drv.h2
-rw-r--r--src/VBox/Additions/common/crOpenGL/dri_glx.h2
-rw-r--r--src/VBox/Additions/common/crOpenGL/fakedri_drv.c110
-rw-r--r--src/VBox/Additions/common/crOpenGL/fakedri_drv.h2
-rw-r--r--src/VBox/Additions/common/crOpenGL/fakedri_glfuncsList.h2
-rw-r--r--src/VBox/Additions/common/crOpenGL/fakedri_glxfuncsList.h2
-rw-r--r--src/VBox/Additions/common/crOpenGL/feedback/feedback_context.c2
-rw-r--r--src/VBox/Additions/common/crOpenGL/glx.c116
-rw-r--r--src/VBox/Additions/common/crOpenGL/glx_c_exports.c2
-rw-r--r--src/VBox/Additions/common/crOpenGL/glx_proto.h2
-rw-r--r--src/VBox/Additions/common/crOpenGL/icd_drv.c2
-rw-r--r--src/VBox/Additions/common/crOpenGL/icd_drv.h2
-rw-r--r--src/VBox/Additions/common/crOpenGL/load.c508
-rw-r--r--src/VBox/Additions/common/crOpenGL/pack/packspu.h13
-rw-r--r--src/VBox/Additions/common/crOpenGL/pack/packspu_bufferobject.c28
-rw-r--r--src/VBox/Additions/common/crOpenGL/pack/packspu_context.c70
-rw-r--r--src/VBox/Additions/common/crOpenGL/pack/packspu_framebuffer.c50
-rw-r--r--src/VBox/Additions/common/crOpenGL/pack/packspu_get.py8
-rw-r--r--src/VBox/Additions/common/crOpenGL/pack/packspu_getshaders.c10
-rw-r--r--src/VBox/Additions/common/crOpenGL/pack/packspu_glsl.c55
-rw-r--r--src/VBox/Additions/common/crOpenGL/pack/packspu_init.c9
-rw-r--r--src/VBox/Additions/common/crOpenGL/pack/packspu_misc.c17
-rw-r--r--src/VBox/Additions/common/crOpenGL/pack/packspu_special11
-rw-r--r--src/VBox/Additions/common/crOpenGL/pack/packspu_texture.c31
-rw-r--r--src/VBox/Additions/common/crOpenGL/stub.c7
-rw-r--r--src/VBox/Additions/common/crOpenGL/stub.h8
-rw-r--r--src/VBox/Additions/common/crOpenGL/wgl.c173
-rw-r--r--src/VBox/Additions/common/crOpenGL/windows_getprocaddress.py24
38 files changed, 1011 insertions, 504 deletions
diff --git a/src/VBox/Additions/common/crOpenGL/Linux_i386_glxapi_exports.py b/src/VBox/Additions/common/crOpenGL/Linux_i386_glxapi_exports.py
index c47f990a..65c4660d 100755
--- a/src/VBox/Additions/common/crOpenGL/Linux_i386_glxapi_exports.py
+++ b/src/VBox/Additions/common/crOpenGL/Linux_i386_glxapi_exports.py
@@ -1,5 +1,5 @@
"""
-Copyright (C) 2009 Oracle Corporation
+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;
diff --git a/src/VBox/Additions/common/crOpenGL/Makefile.kmk b/src/VBox/Additions/common/crOpenGL/Makefile.kmk
index 4f3b9257..9d21e1a2 100644
--- a/src/VBox/Additions/common/crOpenGL/Makefile.kmk
+++ b/src/VBox/Additions/common/crOpenGL/Makefile.kmk
@@ -40,9 +40,20 @@ DLLS += \
VBoxOGLfeedbackspu
endif
+VBOX_OGL_X86_GUEST_DLLS = \
+ VBoxOGL-x86 \
+ VBoxOGLarrayspu-x86 \
+ VBoxOGLpassthroughspu-x86 \
+ VBoxOGLpackspu-x86 \
+ VBoxOGLfeedbackspu-x86
+
+ifdef VBOX_WITH_WDDM
+ DLLS.win.amd64 += $(VBOX_OGL_X86_GUEST_DLLS)
+endif
+
if1of ($(KBUILD_TARGET), linux solaris freebsd)
#VBoxOGL_DRI = 1
- ifn1of ($(KBUILD_TARGET),solaris freebsd) # No DRI on Solaris yet
+ ifn1of ($(KBUILD_TARGET),solaris) # No DRI on Solaris yet
VBoxOGL_FAKEDRI = 1
endif
@@ -209,8 +220,13 @@ if1of ($(KBUILD_TARGET), linux solaris freebsd)
$(PATH_STAGE_LIB)/libXfixes.so \
$(PATH_STAGE_LIB)/libXext.so
ifdef VBoxOGL_FAKEDRI
- VBoxOGL_LIBS += \
+ ifeq ($(KBUILD_TARGET), freebsd)
+ VBoxOGL_LIBS += \
+ elf
+ else
+ VBoxOGL_LIBS += \
dl
+ endif
endif
endif
ifdef VBOX_WITH_CRHGSMI
@@ -224,7 +240,6 @@ ifdef VBOX_WITH_WDDM
#
# VBoxOGL-x86 - x86 VBoxOGL version built for amd64 build
#
-DLLS.win.amd64 += VBoxOGL-x86
VBoxOGL-x86_EXTENDS = VBoxOGL
VBoxOGL-x86_BLD_TRG_ARCH = x86
VBoxOGL-x86_LIBS = $(VBOX_LIB_IPRT_GUEST_R3_SHARED_X86) \
@@ -242,14 +257,18 @@ endif
$(VBOX_PATH_CROGL_GENFILES)/NULLfuncs.c: $(PATH_SUB_CURRENT)/NULLfuncs.py $(VBOX_CROGL_API_FILES) | $$(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)/tsfuncs.c: $(PATH_SUB_CURRENT)/tsfuncs.py $(VBOX_CROGL_API_FILES) | $$(dir $$@)
$(call MSG_GENERATE,python,$@,$<)
$(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI)
+
ifeq ($(KBUILD_TARGET),win)
+ # Windows
$(VBOX_PATH_CROGL_GENFILES)/getprocaddress.c: $(PATH_SUB_CURRENT)/windows_getprocaddress.py $(VBOX_CROGL_API_FILES) | $$(dir $$@)
$(call MSG_GENERATE,python,$@,$<)
$(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI)
+
ifeq ($(KBUILD_TARGET_ARCH),amd64)
$(VBOX_PATH_CROGL_GENFILES)/cropengl.def: $(PATH_SUB_CURRENT)/defs64.py $(VBOX_CROGL_API_FILES) | $$(dir $$@)
$(call MSG_GENERATE,python,$@,$<)
@@ -259,15 +278,18 @@ $(VBOX_PATH_CROGL_GENFILES)/cropengl.def: $(PATH_SUB_CURRENT)/defs.py $(VBOX_CRO
$(call MSG_GENERATE,python,$@,$<)
$(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI)
endif
+
$(VBOX_PATH_CROGL_GENFILES)/cr_gl.h: $(PATH_SUB_CURRENT)/cr_gl.py $(VBOX_CROGL_API_FILES) | $$(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)/windows_exports.asm: \
$(PATH_SUB_CURRENT)/windows_i386_exports.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)
+
ifdef VBOX_WITH_WDDM
ifeq ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),win.amd64)
$(VBOX_PATH_CROGL_GENFILES)/cropengl-x86.def: $(PATH_SUB_CURRENT)/defs.py $(VBOX_CROGL_API_FILES) | $$(dir $$@)
@@ -275,71 +297,85 @@ $(VBOX_PATH_CROGL_GENFILES)/cropengl-x86.def: $(PATH_SUB_CURRENT)/defs.py $(VBOX
$(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI)
endif #ifeq ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),win.amd64)
endif #ifdef VBOX_WITH_WDDM
-else if1of ($(KBUILD_TARGET), linux solaris freebsd)
+
+
+else if1of ($(KBUILD_TARGET), freebsd linux solaris)
+ # FreeBSD, Linux, Solaris
$(VBOX_PATH_CROGL_GENFILES)/getprocaddress.c: $(PATH_SUB_CURRENT)/getprocaddress.py $(VBOX_CROGL_API_FILES) | $$(dir $$@)
$(call MSG_GENERATE,python,$@,$<)
$(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI)
-if !defined(VBoxOGL_DRI) && !defined(VBoxOGL_FAKEDRI)
- ifeq ($(KBUILD_TARGET),solaris)
+
+ if !defined(VBoxOGL_DRI) && !defined(VBoxOGL_FAKEDRI)
+ ifeq ($(KBUILD_TARGET),solaris)
$(VBOX_PATH_CROGL_GENFILES)/solaris_exports.c: \
$(PATH_SUB_CURRENT)/SunOS_exports.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)
- else ifeq ($(KBUILD_TARGET),freebsd)
+
+ else ifeq ($(KBUILD_TARGET),freebsd)
$(VBOX_PATH_CROGL_GENFILES)/freebsd_exports.c: \
$(PATH_SUB_CURRENT)/FreeBSD_exports.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)
- else
+
+ else
$(VBOX_PATH_CROGL_GENFILES)/linux_exports.asm: \
$(PATH_SUB_CURRENT)/Linux_i386_exports.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)
- endif
-else ifdef VBoxOGL_DRI
+ endif
+
+ else ifdef VBoxOGL_DRI
$(VBOX_PATH_CROGL_GENFILES)/cr_gl.h: $(PATH_SUB_CURRENT)/cr_gl.py $(VBOX_CROGL_API_FILES) | $$(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)/DD_gl.h: $(PATH_SUB_CURRENT)/DD_glh.py $(VBOX_CROGL_API_FILES) | $$(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)/DD_gl.c: $(PATH_SUB_CURRENT)/DD_glc.py $(VBOX_CROGL_API_FILES) | $$(dir $$@)
$(call MSG_GENERATE,python,$@,$<)
$(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI)
- ifeq ($(KBUILD_TARGET),solaris)
+
+ ifeq ($(KBUILD_TARGET),solaris)
$(VBOX_PATH_CROGL_GENFILES)/solaris_exports_dri.asm: \
$(PATH_SUB_CURRENT)/SunOS_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)
- else ifeq ($(KBUILD_TARGET),freebsd)
+
+ 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)
- else
+
+ else
$(VBOX_PATH_CROGL_GENFILES)/linux_exports_dri.asm: \
$(PATH_SUB_CURRENT)/Linux_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)
- endif
-else ifdef VBoxOGL_FAKEDRI
+ endif
+
+ else ifdef VBoxOGL_FAKEDRI
$(VBOX_PATH_CROGL_GENFILES)/cr_gl.h: $(PATH_SUB_CURRENT)/cr_gl.py $(VBOX_CROGL_API_FILES) | $$(dir $$@)
$(call MSG_GENERATE,python,$@,$<)
$(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI)
- ifndef VBOX_OGL_GLX_USE_CSTUBS
- ifeq ($(KBUILD_TARGET),solaris)
+
+ ifndef VBOX_OGL_GLX_USE_CSTUBS
+ ifeq ($(KBUILD_TARGET),solaris)
$(VBOX_PATH_CROGL_GENFILES)/solaris_exports_dri.asm: \
$(PATH_SUB_CURRENT)/SunOS_i386_exports_dri.py \
$(VBOX_CROGL_API_FILES) $(PATH_SUB_CURRENT)/entrypoints.py \
@@ -349,7 +385,8 @@ $(VBOX_PATH_CROGL_GENFILES)/solaris_exports_dri.asm: \
$(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
+
+ else
$(VBOX_PATH_CROGL_GENFILES)/linux_exports_dri.asm: \
$(PATH_SUB_CURRENT)/Linux_i386_exports_dri.py \
$(VBOX_CROGL_API_FILES) $(PATH_SUB_CURRENT)/entrypoints.py \
@@ -359,15 +396,24 @@ $(VBOX_PATH_CROGL_GENFILES)/linux_exports_dri.asm: \
$(VBOX_PATH_CROGL_GENFILES)/linux_glxapi_exports.asm: $(PATH_SUB_CURRENT)/Linux_i386_glxapi_exports.py | $$(dir $$@)
$(call MSG_GENERATE,python,$@,$<)
$(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $<
- endif
- else
- ifeq ($(KBUILD_TARGET),solaris)
+ endif
+
+ else
+ ifeq ($(KBUILD_TARGET),solaris)
$(VBOX_PATH_CROGL_GENFILES)/solaris_exports.c: \
$(PATH_SUB_CURRENT)/SunOS_exports.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)
+
+ else ifeq ($(KBUILD_TARGET),freebsd)
+$(VBOX_PATH_CROGL_GENFILES)/freebsd_exports.c: \
+ $(PATH_SUB_CURRENT)/FreeBSD_exports.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)
else
$(VBOX_PATH_CROGL_GENFILES)/linux_exports.c: \
$(PATH_SUB_CURRENT)/Linux_exports.py \
@@ -375,9 +421,10 @@ $(VBOX_PATH_CROGL_GENFILES)/linux_exports.c: \
| $$(dir $$@)
$(call MSG_GENERATE,python,$@,$<)
$(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI)
- endif
- endif # VBOX_OGL_GLX_USE_CSTUBS
-endif
+ endif
+
+ endif # VBOX_OGL_GLX_USE_CSTUBS
+ endif
endif
#
@@ -420,7 +467,6 @@ ifdef VBOX_WITH_WDDM
#
# VBoxOGLarrayspu-x86 - x86 version of VBoxOGLarrayspu built for amd64 build
#
-DLLS.win.amd64 += VBoxOGLarrayspu-x86
VBoxOGLarrayspu-x86_EXTENDS = VBoxOGLarrayspu
VBoxOGLarrayspu-x86_BLD_TRG_ARCH = x86
VBoxOGLarrayspu-x86_LIBS = $(VBOX_LIB_OGL_CRUTIL_X86) \
@@ -464,7 +510,6 @@ ifdef VBOX_WITH_WDDM
#
# VBoxOGLpassthroughspu-x86 - x86 version of VBoxOGLpassthroughspu built for amd64 build
#
-DLLS.win.amd64 += VBoxOGLpassthroughspu-x86
VBoxOGLpassthroughspu-x86_EXTENDS = VBoxOGLpassthroughspu
VBoxOGLpassthroughspu-x86_BLD_TRG_ARCH = x86
VBoxOGLpassthroughspu-x86_LIBS = $(VBOX_LIB_OGL_CRUTIL_X86)
@@ -532,6 +577,12 @@ VBoxOGLpackspu_LIBS = \
ifdef VBOX_WITH_CRHGSMI
VBoxOGLpackspu_DEFS.win += VBOX_WITH_CRHGSMI
endif
+ifdef VBOX_WITH_CRDUMPER
+VBoxOGLpackspu_DEFS += VBOX_WITH_CRDUMPER
+endif
+ifdef VBOX_WITH_CRPACKSPU_DUMPER
+VBoxOGLpackspu_DEFS += VBOX_WITH_CRPACKSPU_DUMPER
+endif
ifdef VBOX_WITH_WDDM
VBoxOGLpackspu_DEFS.win += VBOX_WITH_WDDM
endif
@@ -540,7 +591,6 @@ ifdef VBOX_WITH_WDDM
#
# VBoxOGLpackspu-x86 - x86 version of VBoxOGLpackspu built for amd64 build
#
-DLLS.win.amd64 += VBoxOGLpackspu-x86
VBoxOGLpackspu-x86_EXTENDS = VBoxOGLpackspu
VBoxOGLpackspu-x86_BLD_TRG_ARCH = x86
VBoxOGLpackspu-x86_LIBS = $(VBOX_LIB_OGL_CRUTIL_X86) \
@@ -617,7 +667,6 @@ ifdef VBOX_WITH_WDDM
#
# VBoxOGLfeedbackspu-x86 - x86 version of VBoxOGLfeedbackspu built for amd64 build
#
-DLLS.win.amd64 += VBoxOGLfeedbackspu-x86
VBoxOGLfeedbackspu-x86_EXTENDS = VBoxOGLfeedbackspu
VBoxOGLfeedbackspu-x86_BLD_TRG_ARCH = x86
VBoxOGLfeedbackspu-x86_LIBS = $(VBOX_LIB_OGL_CRUTIL_X86) \
diff --git a/src/VBox/Additions/common/crOpenGL/SunOS_i386_exports.py b/src/VBox/Additions/common/crOpenGL/SunOS_i386_exports.py
index b7fe6b9f..7fc6cddb 100755
--- a/src/VBox/Additions/common/crOpenGL/SunOS_i386_exports.py
+++ b/src/VBox/Additions/common/crOpenGL/SunOS_i386_exports.py
@@ -1,5 +1,5 @@
"""
-Copyright (C) 2009 Oracle Corporation
+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;
diff --git a/src/VBox/Additions/common/crOpenGL/SunOS_i386_exports_dri.py b/src/VBox/Additions/common/crOpenGL/SunOS_i386_exports_dri.py
index 7d9378e6..26903439 100755
--- a/src/VBox/Additions/common/crOpenGL/SunOS_i386_exports_dri.py
+++ b/src/VBox/Additions/common/crOpenGL/SunOS_i386_exports_dri.py
@@ -1,5 +1,5 @@
"""
-Copyright (C) 2009 Oracle Corporation
+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;
diff --git a/src/VBox/Additions/common/crOpenGL/SunOS_i386_glxapi_exports.py b/src/VBox/Additions/common/crOpenGL/SunOS_i386_glxapi_exports.py
index d395732d..e835ecb2 100755
--- a/src/VBox/Additions/common/crOpenGL/SunOS_i386_glxapi_exports.py
+++ b/src/VBox/Additions/common/crOpenGL/SunOS_i386_glxapi_exports.py
@@ -1,5 +1,5 @@
"""
-Copyright (C) 2009 Oracle Corporation
+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;
diff --git a/src/VBox/Additions/common/crOpenGL/VBoxICDList.h b/src/VBox/Additions/common/crOpenGL/VBoxICDList.h
index 54c7e452..cc43c1c6 100644
--- a/src/VBox/Additions/common/crOpenGL/VBoxICDList.h
+++ b/src/VBox/Additions/common/crOpenGL/VBoxICDList.h
@@ -2,7 +2,7 @@
*
* VirtualBox Windows NT/2000/XP guest OpenGL ICD
*
- * Copyright (C) 2006-2007 Oracle Corporation
+ * Copyright (C) 2006-2010 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Additions/common/crOpenGL/context.c b/src/VBox/Additions/common/crOpenGL/context.c
index 4a077a5d..6c6e4b97 100644
--- a/src/VBox/Additions/common/crOpenGL/context.c
+++ b/src/VBox/Additions/common/crOpenGL/context.c
@@ -107,6 +107,22 @@ void stubForcedFlush(GLint con)
#endif
}
+void stubConChromiumParameteriCR(GLint con, GLenum param, GLint value)
+{
+ if (con)
+ stub.spu->dispatch_table.VBoxConChromiumParameteriCR(con, param, value);
+ else
+ crError("VBoxConChromiumParameteriCR called with null connection");
+}
+
+void stubConFlush(GLint con)
+{
+ if (con)
+ stub.spu->dispatch_table.VBoxConFlush(con);
+ else
+ crError("stubConFlush called with null connection");
+}
+
static void stubWindowCleanupForContextsCB(unsigned long key, void *data1, void *data2)
{
ContextInfo *context = (ContextInfo *) data1;
@@ -144,6 +160,7 @@ void stubDestroyWindow( GLint con, GLint window )
}
# endif
#endif
+
stubForcedFlush(con);
crHashtableWalk(stub.contextTable, stubWindowCleanupForContextsCB, winInfo);
@@ -189,7 +206,7 @@ stubNewWindow( const char *dpyName, GLint visBits )
#ifdef VBOX_WITH_WDDM
if (stub.bRunningUnderWDDM)
{
- crError("Should not be here: WindowCreate/Destroy & VBoxPackGetInjectID recuire connection id!");
+ crError("Should not be here: WindowCreate/Destroy & VBoxPackGetInjectID require connection id!");
winInfo->mapped = 0;
}
else
@@ -433,10 +450,6 @@ stubDestroyContextLocked( ContextInfo *context )
#ifdef GLX
crFreeHashtable(context->pGLXPixmapsHash, crFree);
- if (context->damageDpy)
- {
- XCloseDisplay(context->damageDpy);
- }
#endif
crHashtableDelete(stub.contextTable, contextId, NULL);
@@ -535,8 +548,7 @@ stubNewContext( const char *dpyName, GLint visBits, ContextType type,
#ifdef GLX
context->pGLXPixmapsHash = crAllocHashtable();
- context->damageInitFailed = GL_FALSE;
- context->damageDpy = NULL;
+ context->damageQueryFailed = GL_FALSE;
context->damageEventsBase = 0;
#endif
@@ -1089,6 +1101,50 @@ static void stubWindowCheckOwnerCB(unsigned long key, void *data1, void *data2)
}
}
+GLboolean stubCtxCreate(ContextInfo *context)
+{
+ /*
+ * Create a Chromium context.
+ */
+#if defined(GLX) || defined(DARWIN)
+ GLint spuShareCtx = context->share ? context->share->spuContext : 0;
+#else
+ GLint spuShareCtx = 0;
+#endif
+ GLint spuConnection = 0;
+ CRASSERT(stub.spu);
+ CRASSERT(stub.spu->dispatch_table.CreateContext);
+ context->type = CHROMIUM;
+
+#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
+ if (context->pHgsmi)
+ {
+ spuConnection = stub.spu->dispatch_table.VBoxConCreate(context->pHgsmi);
+ if (!spuConnection)
+ {
+ crWarning("VBoxConCreate failed");
+ return GL_FALSE;
+ }
+ context->spuConnection = spuConnection;
+ }
+#endif
+
+ context->spuContext
+ = stub.spu->dispatch_table.VBoxCreateContext(spuConnection, context->dpyName,
+ context->visBits,
+ spuShareCtx);
+
+ return GL_TRUE;
+}
+
+GLboolean stubCtxCheckCreate(ContextInfo *context)
+{
+ if (context->type == UNDECIDED)
+ return stubCtxCreate(context);
+ return CHROMIUM == context->type;
+}
+
+
GLboolean
stubMakeCurrent( WindowInfo *window, ContextInfo *context )
{
@@ -1119,42 +1175,22 @@ stubMakeCurrent( WindowInfo *window, ContextInfo *context )
#endif
if (stubCheckUseChromium(window)) {
- /*
- * Create a Chromium context.
- */
-#if defined(GLX) || defined(DARWIN)
- GLint spuShareCtx = context->share ? context->share->spuContext : 0;
-#else
- GLint spuShareCtx = 0;
-#endif
GLint spuConnection = 0;
- CRASSERT(stub.spu);
- CRASSERT(stub.spu->dispatch_table.CreateContext);
- context->type = CHROMIUM;
-#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
- if (context->pHgsmi)
+ if (!stubCtxCreate(context))
{
- spuConnection = stub.spu->dispatch_table.VBoxConCreate(context->pHgsmi);
- if (!spuConnection)
- {
- crWarning("VBoxConCreate failed");
- return GL_FALSE;
- }
- context->spuConnection = spuConnection;
+ crWarning("stubCtxCreate failed");
+ return GL_FALSE;
}
+
+#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
+ spuConnection = context->spuConnection;
#endif
- context->spuContext
- = stub.spu->dispatch_table.VBoxCreateContext(spuConnection, context->dpyName,
- context->visBits,
- spuShareCtx);
if (window->spuWindow == -1)
{
/*crDebug("(1)stubMakeCurrent ctx=%p(%i) window=%p(%i)", context, context->spuContext, window, window->spuWindow);*/
- window->spuWindow = stub.spu->dispatch_table.VBoxWindowCreate(
- spuConnection,
- window->dpyName, context->visBits );
+ window->spuWindow = stub.spu->dispatch_table.VBoxWindowCreate(spuConnection, window->dpyName, context->visBits );
#ifdef CR_NEWWINTRACK
window->u32ClientID = stub.spu->dispatch_table.VBoxPackGetInjectID(spuConnection);
#endif
@@ -1311,7 +1347,8 @@ stubMakeCurrent( WindowInfo *window, ContextInfo *context )
stub.spu->dispatch_table.Viewport( 0, 0, winW, winH );
}
#ifdef VBOX_WITH_WDDM
- stub.spu->dispatch_table.WindowVisibleRegion(window->spuWindow, 0, NULL);
+ if (stub.trackWindowVisibleRgn)
+ stub.spu->dispatch_table.WindowVisibleRegion(window->spuWindow, 0, NULL);
#endif
}
diff --git a/src/VBox/Additions/common/crOpenGL/defs.py b/src/VBox/Additions/common/crOpenGL/defs.py
index 5129f0db..de0d031e 100644
--- a/src/VBox/Additions/common/crOpenGL/defs.py
+++ b/src/VBox/Additions/common/crOpenGL/defs.py
@@ -9,8 +9,9 @@ import apiutil
apiutil.CopyrightDef()
-print "LIBRARY VBoxOGL"
-print "DESCRIPTION \"\""
+# NOTE: if we need a LIBRARY statement, we would need to create a defs-x86.py to generate a .def file for VBoxOGL-x86 library
+#print "LIBRARY VBoxOGL"
+#print "DESCRIPTION \"\"" - warning LNK4017: DESCRIPTION statement not supported for the target platform; ignored
print "EXPORTS"
# XXX can't these values be automatically computed by analyzing parameters?
@@ -454,7 +455,7 @@ for func_name in ( "wglChoosePixelFormat",
"wglGetPixelFormatAttribivEXT",
"wglGetPixelFormatAttribfvEXT",
"wglGetExtensionsStringEXT"):
- print "%s@%d = %s_prox" % (func_name,stack_sizes[func_name],func_name)
+ print "%s = %s_prox" % (func_name,func_name)
"""
for func_name in ( "CopyContext",
@@ -495,5 +496,9 @@ print """crCreateContext
crMakeCurrent
crSwapBuffers
crGetProcAddress
-VBoxCreateContext"""
+VBoxCreateContext
+VBoxCtxChromiumParameteriCR
+VBoxGetWindowId
+VBoxGetContextId
+VBoxFlushToHost"""
#print "DllMain"
diff --git a/src/VBox/Additions/common/crOpenGL/defs64.py b/src/VBox/Additions/common/crOpenGL/defs64.py
index e98bb89b..68b3fd21 100644
--- a/src/VBox/Additions/common/crOpenGL/defs64.py
+++ b/src/VBox/Additions/common/crOpenGL/defs64.py
@@ -9,8 +9,8 @@ import apiutil
apiutil.CopyrightDef()
-print "LIBRARY VBoxOGL"
-print "DESCRIPTION \"\""
+#print "LIBRARY VBoxOGL"
+#print "DESCRIPTION \"\"" - warning LNK4017: DESCRIPTION statement not supported for the target platform; ignored
print "EXPORTS"
# XXX can't these values be automatically computed by analyzing parameters?
@@ -476,5 +476,9 @@ print """crCreateContext
crMakeCurrent
crSwapBuffers
crGetProcAddress
-VBoxCreateContext"""
+VBoxCreateContext
+VBoxCtxChromiumParameteriCR
+VBoxGetWindowId
+VBoxGetContextId
+VBoxFlushToHost"""
#print "DllMain"
diff --git a/src/VBox/Additions/common/crOpenGL/dri_drv.c b/src/VBox/Additions/common/crOpenGL/dri_drv.c
index d19b99b1..37f501e9 100644
--- a/src/VBox/Additions/common/crOpenGL/dri_drv.c
+++ b/src/VBox/Additions/common/crOpenGL/dri_drv.c
@@ -5,7 +5,7 @@
*/
/*
- * Copyright (C) 2009 Oracle Corporation
+ * Copyright (C) 2009-2010 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Additions/common/crOpenGL/dri_drv.h b/src/VBox/Additions/common/crOpenGL/dri_drv.h
index 9ee57766..7c5807d2 100644
--- a/src/VBox/Additions/common/crOpenGL/dri_drv.h
+++ b/src/VBox/Additions/common/crOpenGL/dri_drv.h
@@ -6,7 +6,7 @@
*/
/*
- * Copyright (C) 2009 Oracle Corporation
+ * Copyright (C) 2009-2010 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Additions/common/crOpenGL/dri_glx.h b/src/VBox/Additions/common/crOpenGL/dri_glx.h
index a2a38970..5ff29561 100644
--- a/src/VBox/Additions/common/crOpenGL/dri_glx.h
+++ b/src/VBox/Additions/common/crOpenGL/dri_glx.h
@@ -6,7 +6,7 @@
*/
/*
- * Copyright (C) 2009 Oracle Corporation
+ * Copyright (C) 2009-2010 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Additions/common/crOpenGL/fakedri_drv.c b/src/VBox/Additions/common/crOpenGL/fakedri_drv.c
index 8e7b6ba5..f6793dab 100644
--- a/src/VBox/Additions/common/crOpenGL/fakedri_drv.c
+++ b/src/VBox/Additions/common/crOpenGL/fakedri_drv.c
@@ -5,7 +5,7 @@
*/
/*
- * Copyright (C) 2009 Oracle Corporation
+ * 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;
@@ -29,6 +29,15 @@
#include <dlfcn.h>
#include <elf.h>
#include <unistd.h>
+
+#if defined(RT_OS_FREEBSD)
+#include <sys/param.h>
+#include <fcntl.h>
+#include <gelf.h>
+#include <libelf.h>
+#include <string.h>
+#endif
+
/** X server message type definitions. */
typedef enum {
X_PROBED, /* Value was probed */
@@ -50,11 +59,21 @@ typedef enum {
//@todo this could be different...
#ifdef RT_ARCH_AMD64
-# define DRI_DEFAULT_DRIVER_DIR "/usr/lib64/dri:/usr/lib/dri:/usr/lib/x86_64-linux-gnu/dri"
-# define DRI_XORG_DRV_DIR "/usr/lib/xorg/modules/drivers/"
+# ifdef RT_OS_FREEBSD
+# define DRI_DEFAULT_DRIVER_DIR "/usr/local/lib/dri"
+# define DRI_XORG_DRV_DIR "/usr/local/lib/xorg/modules/drivers/"
+# else
+# define DRI_DEFAULT_DRIVER_DIR "/usr/lib64/dri:/usr/lib/dri:/usr/lib/x86_64-linux-gnu/dri:/usr/lib/xorg/modules/dri"
+# define DRI_XORG_DRV_DIR "/usr/lib/xorg/modules/drivers/"
+# endif
#else
-# define DRI_DEFAULT_DRIVER_DIR "/usr/lib/dri:/usr/lib/i386-linux-gnu/dri"
-# define DRI_XORG_DRV_DIR "/usr/lib/xorg/modules/drivers/"
+# ifdef RT_OS_FREEBSD
+# define DRI_DEFAULT_DRIVER_DIR "/usr/local/lib/dri"
+# define DRI_XORG_DRV_DIR "/usr/local/lib/xorg/modules/drivers/"
+# else
+# define DRI_DEFAULT_DRIVER_DIR "/usr/lib/dri:/usr/lib/i386-linux-gnu/dri:/usr/lib/xorg/modules/dri"
+# define DRI_XORG_DRV_DIR "/usr/lib/xorg/modules/drivers/"
+# endif
#endif
#ifdef DEBUG_DRI_CALLS
@@ -209,6 +228,85 @@ vboxApplyPatch(const char* psFuncName, void *pDst, const void *pSrc, unsigned lo
#define FAKEDRI_JMP64_PATCH_SIZE 13
+#if defined(RT_OS_FREEBSD)
+/* Provide basic dladdr1 flags */
+enum {
+ RTLD_DL_SYMENT = 1
+};
+
+/* Provide a minimal local version of dladdr1 */
+static int
+dladdr1(const void *address, Dl_info *dlip, void **info, int flags)
+{
+ static DRI_ELFSYM desym;
+ GElf_Sym sym;
+ GElf_Shdr shdr;
+ Elf *elf;
+ Elf_Scn *scn;
+ Elf_Data *data;
+ int ret, fd, count, i;
+
+ /* Initialize variables */
+ fd = -1;
+ elf = NULL;
+
+ /* Call dladdr first */
+ ret = dladdr(address, dlip);
+ if (ret == 0) goto err_exit;
+
+ /* Check for supported flags */
+ if (flags != RTLD_DL_SYMENT) return 1;
+
+ /* Open shared library's ELF file */
+ if (elf_version(EV_CURRENT) == EV_NONE) goto err_exit;
+ fd = open(dlip->dli_fname, O_RDONLY);
+ if (fd < 0) goto err_exit;
+ elf = elf_begin(fd, ELF_C_READ, NULL);
+ if (elf == NULL) goto err_exit;
+
+ /* Find the '.dynsym' section */
+ scn = elf_nextscn(elf, NULL);
+ while (scn != NULL) {
+ if (gelf_getshdr(scn, &shdr) == NULL) goto err_exit;
+ if (shdr.sh_type == SHT_DYNSYM) break;
+ scn = elf_nextscn(elf, scn);
+ }
+ if (scn == NULL) goto err_exit;
+
+ /* Search for the requested symbol by name and offset */
+ data = elf_getdata(scn, NULL);
+ count = shdr.sh_size / shdr.sh_entsize;
+ for (i = 0; i < count; i++) {
+ gelf_getsym(data, i, &sym);
+ if ((strcmp(dlip->dli_sname,
+ elf_strptr(elf, shdr.sh_link, sym.st_name)) == 0) &&
+ (sym.st_value == (dlip->dli_saddr - dlip->dli_fbase))) {
+ break;
+ }
+ }
+
+ /* Close ELF file */
+ elf_end(elf);
+ close(fd);
+
+ /* Return symbol entry in native format */
+ desym.st_name = sym.st_name;
+ desym.st_info = sym.st_info;
+ desym.st_other = sym.st_other;
+ desym.st_shndx = sym.st_shndx;
+ desym.st_value = sym.st_value;
+ desym.st_size = sym.st_size;
+ *info = &desym;
+ return 1;
+
+ /* Error handler */
+err_exit:
+ if (elf != NULL) elf_end(elf);
+ if (fd >= 0) close(fd);
+ return 0;
+}
+#endif
+
static void
vboxPatchMesaExport(const char* psFuncName, const void *pStart, const void *pEnd)
{
@@ -262,7 +360,7 @@ vboxPatchMesaExport(const char* psFuncName, const void *pStart, const void *pEnd
#ifndef VBOX_NO_MESA_PATCH_REPORTS
crDebug("Mesa Entry: %p, start: %p(%s:%s), size: %li", pMesaEntry, dlip.dli_saddr, dlip.dli_fname, dlip.dli_sname, sym->st_size);
- crDebug("Vbox code: start: %p, end %p, size: %li", pStart, pEnd, pEnd-pStart);
+ crDebug("VBox code: start: %p, end %p, size: %li", pStart, pEnd, pEnd-pStart);
#endif
#ifndef VBOX_OGL_GLX_USE_CSTUBS
diff --git a/src/VBox/Additions/common/crOpenGL/fakedri_drv.h b/src/VBox/Additions/common/crOpenGL/fakedri_drv.h
index 0d94e1c3..acbc7116 100644
--- a/src/VBox/Additions/common/crOpenGL/fakedri_drv.h
+++ b/src/VBox/Additions/common/crOpenGL/fakedri_drv.h
@@ -6,7 +6,7 @@
*/
/*
- * Copyright (C) 2009 Oracle Corporation
+ * Copyright (C) 2009-2010 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Additions/common/crOpenGL/fakedri_glfuncsList.h b/src/VBox/Additions/common/crOpenGL/fakedri_glfuncsList.h
index ce5510f5..a8551de6 100644
--- a/src/VBox/Additions/common/crOpenGL/fakedri_glfuncsList.h
+++ b/src/VBox/Additions/common/crOpenGL/fakedri_glfuncsList.h
@@ -5,7 +5,7 @@
*/
/*
- * Copyright (C) 2009 Oracle Corporation
+ * Copyright (C) 2009-2010 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Additions/common/crOpenGL/fakedri_glxfuncsList.h b/src/VBox/Additions/common/crOpenGL/fakedri_glxfuncsList.h
index c1592cdf..6c449f85 100644
--- a/src/VBox/Additions/common/crOpenGL/fakedri_glxfuncsList.h
+++ b/src/VBox/Additions/common/crOpenGL/fakedri_glxfuncsList.h
@@ -5,7 +5,7 @@
*/
/*
- * Copyright (C) 2009 Oracle Corporation
+ * Copyright (C) 2009-2010 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Additions/common/crOpenGL/feedback/feedback_context.c b/src/VBox/Additions/common/crOpenGL/feedback/feedback_context.c
index 232a7c67..2dc757ae 100644
--- a/src/VBox/Additions/common/crOpenGL/feedback/feedback_context.c
+++ b/src/VBox/Additions/common/crOpenGL/feedback/feedback_context.c
@@ -5,7 +5,7 @@
*/
/*
- * Copyright (C) 2009 Oracle Corporation
+ * 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;
diff --git a/src/VBox/Additions/common/crOpenGL/glx.c b/src/VBox/Additions/common/crOpenGL/glx.c
index cdb43590..328ed208 100644
--- a/src/VBox/Additions/common/crOpenGL/glx.c
+++ b/src/VBox/Additions/common/crOpenGL/glx.c
@@ -57,7 +57,7 @@ struct VisualInfo {
static struct VisualInfo *VisualInfoList = NULL;
static void stubXshmUpdateImageRect(Display *dpy, GLXDrawable draw, GLX_Pixmap_t *pGlxPixmap, XRectangle *pRect);
-static void stubInitXDamageExtension(ContextInfo *pContext);
+static void stubQueryXDamageExtension(Display *dpy, ContextInfo *pContext);
static void
AddVisualInfo(Display *dpy, int screen, VisualID visualid, int visBits)
@@ -624,9 +624,7 @@ VBOXGLXTAG(glXCreateContext)(Display *dpy, XVisualInfo *vis, GLXContext share, B
context->visual = vis;
context->direct = direct;
- /* This means that clients can't hold a server grab during
- * glXCreateContext! */
- stubInitXDamageExtension(context);
+ stubQueryXDamageExtension(dpy, context);
return (GLXContext) context->id;
}
@@ -830,7 +828,7 @@ DECLEXPORT(int) VBOXGLXTAG(glXGetConfig)( Display *dpy, XVisualInfo *vis, int at
case GLX_DEPTH_SIZE:
visBits |= CR_DEPTH_BIT;
- *value = 16;
+ *value = 24;
break;
case GLX_STENCIL_SIZE:
@@ -969,7 +967,7 @@ DECLEXPORT(int) VBOXGLXTAG(glXGetConfig)( Display *dpy, XVisualInfo *vis, int at
break;
case GLX_DEPTH_SIZE:
- *value = 16;
+ *value = 24;
break;
case GLX_STENCIL_SIZE:
@@ -1501,7 +1499,7 @@ VBOXGLXTAG(glXChooseFBConfig)(Display *dpy, int screen, ATTRIB_TYPE *attrib_list
break;
case GLX_DEPTH_SIZE:
- if (attrib[1] > 16)
+ if (attrib[1] > 24)
goto err_exit;
attrib++;
break;
@@ -1533,7 +1531,8 @@ VBOXGLXTAG(glXChooseFBConfig)(Display *dpy, int screen, ATTRIB_TYPE *attrib_list
break;
case GLX_DRAWABLE_TYPE:
- if (attrib[1]!=GLX_WINDOW_BIT)
+ if ( !(attrib[1] & GLX_WINDOW_BIT)
+ && !(attrib[1] & GLX_PIXMAP_BIT))
goto err_exit;
attrib++;
break;
@@ -1782,7 +1781,7 @@ DECLEXPORT(void) VBOXGLXTAG(glXDestroyPixmap)(Display *dpy, GLXPixmap pixmap)
if (parms.pGlxPixmap->hDamage>0)
{
//crDebug("Destroy: Damage for drawable 0x%x, handle 0x%x", (unsigned int) pixmap, (unsigned int) parms.pGlxPixmap->damage);
- XDamageDestroy(parms.pCtx->damageDpy, parms.pGlxPixmap->hDamage);
+ XDamageDestroy(dpy, parms.pGlxPixmap->hDamage);
}
if (parms.pGlxPixmap->pDamageRegion)
@@ -1822,7 +1821,7 @@ DECLEXPORT(int) VBOXGLXTAG(glXGetFBConfigAttrib)(Display *dpy, GLXFBConfig confi
switch (attribute)
{
case GLX_DRAWABLE_TYPE:
- *value = GLX_PIXMAP_BIT;
+ *value = GLX_PIXMAP_BIT | GLX_WINDOW_BIT;
break;
case GLX_BIND_TO_TEXTURE_TARGETS_EXT:
*value = GLX_TEXTURE_2D_BIT_EXT;
@@ -1860,7 +1859,7 @@ DECLEXPORT(int) VBOXGLXTAG(glXGetFBConfigAttrib)(Display *dpy, GLXFBConfig confi
*value = 8;
break;
case GLX_DEPTH_SIZE:
- *value = 16;
+ *value = 24;
//crDebug("attribute=GLX_DEPTH_SIZE");
break;
case GLX_BIND_TO_MIPMAP_TEXTURE_EXT:
@@ -2172,69 +2171,76 @@ static void stubInitXSharedMemory(Display *dpy)
#endif
}
-void stubInitXDamageExtension(ContextInfo *pContext)
+void stubQueryXDamageExtension(Display *dpy, ContextInfo *pContext)
{
int erb, vma, vmi;
CRASSERT(pContext);
- if (pContext->damageInitFailed || pContext->damageDpy)
+ if (pContext->damageQueryFailed)
return;
- pContext->damageInitFailed = True;
-
- /* Open second xserver connection to make sure we'd receive all the xdamage messages
- * and those wouldn't be eaten by application even queue */
- pContext->damageDpy = XOpenDisplay(DisplayString(pContext->dpy));
-
- if (!pContext->damageDpy)
- {
- crWarning("XDamage: Can't connect to display %s", DisplayString(pContext->dpy));
- return;
- }
+ pContext->damageQueryFailed = True;
- if (!XDamageQueryExtension(pContext->damageDpy, &pContext->damageEventsBase, &erb)
- || !XDamageQueryVersion(pContext->damageDpy, &vma, &vmi))
+ if (!XDamageQueryExtension(dpy, &pContext->damageEventsBase, &erb)
+ || !XDamageQueryVersion(dpy, &vma, &vmi))
{
crWarning("XDamage not found or old version (%i.%i), going to run *very* slow", vma, vmi);
- XCloseDisplay(pContext->damageDpy);
- pContext->damageDpy = NULL;
return;
}
crDebug("XDamage %i.%i", vma, vmi);
- pContext->damageInitFailed = False;
+ pContext->damageQueryFailed = False;
}
-static void stubCheckXDamageCB(unsigned long key, void *data1, void *data2)
+static void stubFetchDamageOnDrawable(Display *dpy, GLX_Pixmap_t *pGlxPixmap)
{
- GLX_Pixmap_t *pGlxPixmap = (GLX_Pixmap_t *) data1;
- XDamageNotifyEvent *e = (XDamageNotifyEvent *) data2;
+ Damage damage = pGlxPixmap->hDamage;
- if (pGlxPixmap->hDamage==e->damage)
+ if (damage)
{
- /*crDebug("Event: Damage for pixmap 0x%lx(drawable 0x%x), handle 0x%x (level=%i) [%i,%i,%i,%i]",
- key, (unsigned int) e->drawable, (unsigned int) e->damage, (int) e->level,
- e->area.x, e->area.y, e->area.width, e->area.height);*/
+ XRectangle *returnRects;
+ int nReturnRects;
+
+ /* Get the damage region as a server region */
+ XserverRegion serverDamageRegion = XFixesCreateRegion (dpy, NULL, 0);
+
+ /* Unite damage region with server region and clear damage region */
+ XDamageSubtract (dpy,
+ damage,
+ None, /* subtract all damage from this region */
+ serverDamageRegion /* save in serverDamageRegion */);
+
+ /* Fetch damage rectangles */
+ returnRects = XFixesFetchRegion (dpy, serverDamageRegion, &nReturnRects);
+
+ /* Delete region */
+ XFixesDestroyRegion (dpy, serverDamageRegion);
if (pGlxPixmap->pDamageRegion)
{
/* If it's dirty and regions are empty, it marked for full update, so do nothing.*/
if (!pGlxPixmap->bPixmapImageDirty || !XEmptyRegion(pGlxPixmap->pDamageRegion))
{
- if (CR_MAX_DAMAGE_REGIONS_TRACKED <= pGlxPixmap->pDamageRegion->numRects)
+ int i = 0;
+ for (; i < nReturnRects; ++i)
{
- /* Mark for full update */
- EMPTY_REGION(pGlxPixmap->pDamageRegion);
- }
- else
- {
- /* Add to damage regions */
- XUnionRectWithRegion(&e->area, pGlxPixmap->pDamageRegion, pGlxPixmap->pDamageRegion);
+ if (CR_MAX_DAMAGE_REGIONS_TRACKED <= pGlxPixmap->pDamageRegion->numRects)
+ {
+ /* Mark for full update */
+ EMPTY_REGION(pGlxPixmap->pDamageRegion);
+ }
+ else
+ {
+ /* Add to damage regions */
+ XUnionRectWithRegion(&returnRects[i], pGlxPixmap->pDamageRegion, pGlxPixmap->pDamageRegion);
+ }
}
}
}
+ XFree(returnRects);
+
pGlxPixmap->bPixmapImageDirty = True;
}
}
@@ -2338,9 +2344,9 @@ static GLX_Pixmap_t* stubInitGlxPixmap(GLX_Pixmap_t* pCreateInfoPixmap, Display
XUNLOCK(dpy);
/* If there's damage extension, then get handle for damage events related to this pixmap */
- if (pContext->damageDpy)
+ if (!pContext->damageQueryFailed)
{
- pGlxPixmap->hDamage = XDamageCreate(pContext->damageDpy, (Pixmap)draw, XDamageReportRawRectangles);
+ pGlxPixmap->hDamage = XDamageCreate(dpy, (Pixmap)draw, XDamageReportNonEmpty);
/*crDebug("Create: Damage for drawable 0x%x, handle 0x%x (level=%i)",
(unsigned int) draw, (unsigned int) pGlxPixmap->damage, (int) XDamageReportRawRectangles);*/
pGlxPixmap->pDamageRegion = XCreateRegion();
@@ -2532,24 +2538,14 @@ DECLEXPORT(void) VBOXGLXTAG(glXBindTexImageEXT)(Display *dpy, GLXDrawable draw,
}
/* If there's damage extension, then process incoming events as we need the information right now */
- if (context->damageDpy)
+ if (!context->damageQueryFailed)
{
- /* Sync connections, note that order of syncs is important here.
- * First make sure client commands are finished, then make sure we get all the damage events back*/
+ /* Sync connection */
XLOCK(dpy);
XSync(dpy, False);
XUNLOCK(dpy);
- XSync(context->damageDpy, False);
- while (XPending(context->damageDpy))
- {
- XEvent event;
- XNextEvent(context->damageDpy, &event);
- if (event.type==context->damageEventsBase+XDamageNotify)
- {
- crHashtableWalk(context->pGLXPixmapsHash, stubCheckXDamageCB, &event);
- }
- }
+ stubFetchDamageOnDrawable(dpy, pGlxPixmap);
}
/* No shared memory? Rollback to use slow x protocol then */
@@ -2597,7 +2593,7 @@ DECLEXPORT(void) VBOXGLXTAG(glXBindTexImageEXT)(Display *dpy, GLXDrawable draw,
else /* Use shm to get pixmap data */
{
/* Check if we have damage extension */
- if (context->damageDpy)
+ if (!context->damageQueryFailed)
{
if (pGlxPixmap->bPixmapImageDirty)
{
diff --git a/src/VBox/Additions/common/crOpenGL/glx_c_exports.c b/src/VBox/Additions/common/crOpenGL/glx_c_exports.c
index 4f94870a..183c0219 100644
--- a/src/VBox/Additions/common/crOpenGL/glx_c_exports.c
+++ b/src/VBox/Additions/common/crOpenGL/glx_c_exports.c
@@ -5,7 +5,7 @@
*/
/*
- * Copyright (C) 2006-2008 Oracle Corporation
+ * Copyright (C) 2006-2010 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Additions/common/crOpenGL/glx_proto.h b/src/VBox/Additions/common/crOpenGL/glx_proto.h
index 2ab6d05c..61084749 100644
--- a/src/VBox/Additions/common/crOpenGL/glx_proto.h
+++ b/src/VBox/Additions/common/crOpenGL/glx_proto.h
@@ -5,7 +5,7 @@
*/
/*
- * Copyright (C) 2006-2008 Oracle Corporation
+ * Copyright (C) 2006-2010 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Additions/common/crOpenGL/icd_drv.c b/src/VBox/Additions/common/crOpenGL/icd_drv.c
index 22a9eadb..cff7f9ac 100644
--- a/src/VBox/Additions/common/crOpenGL/icd_drv.c
+++ b/src/VBox/Additions/common/crOpenGL/icd_drv.c
@@ -5,7 +5,7 @@
*/
/*
- * Copyright (C) 2006-2008 Oracle Corporation
+ * Copyright (C) 2006-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;
diff --git a/src/VBox/Additions/common/crOpenGL/icd_drv.h b/src/VBox/Additions/common/crOpenGL/icd_drv.h
index e610de15..46c0b56c 100644
--- a/src/VBox/Additions/common/crOpenGL/icd_drv.h
+++ b/src/VBox/Additions/common/crOpenGL/icd_drv.h
@@ -6,7 +6,7 @@
*/
/*
- * Copyright (C) 2006-2008 Oracle Corporation
+ * Copyright (C) 2006-2010 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Additions/common/crOpenGL/load.c b/src/VBox/Additions/common/crOpenGL/load.c
index a9cf34e1..35d1f72a 100644
--- a/src/VBox/Additions/common/crOpenGL/load.c
+++ b/src/VBox/Additions/common/crOpenGL/load.c
@@ -47,10 +47,6 @@
#define PYTHON_EXE "python"
#endif
-#ifdef WINDOWS
-static char* gsViewportHackApps[] = {"googleearth.exe", NULL};
-#endif
-
static bool stub_initialized = 0;
#ifdef WINDOWS
static CRmutex stub_init_mutex;
@@ -213,16 +209,19 @@ static void stubCheckWindowsState(void)
return;
#endif
+ /* Try to keep a consistent locking order. */
+ crHashtableLock(stub.windowTable);
#if defined(CR_NEWWINTRACK) && !defined(WINDOWS)
crLockMutex(&stub.mutex);
#endif
stubCheckWindowState(context->currentDrawable, GL_TRUE);
- crHashtableWalk(stub.windowTable, stubCheckWindowsCB, context);
+ crHashtableWalkUnlocked(stub.windowTable, stubCheckWindowsCB, context);
#if defined(CR_NEWWINTRACK) && !defined(WINDOWS)
crUnlockMutex(&stub.mutex);
#endif
+ crHashtableUnlock(stub.windowTable);
}
@@ -246,20 +245,7 @@ static void SPU_APIENTRY trapViewport(GLint x, GLint y, GLsizei w, GLsizei h)
{
stubCheckWindowsState();
/* call the original SPU glViewport function */
- if (!stub.viewportHack)
- {
- origViewport(x, y, w, h);
- }
- else
- {
- ContextInfo *context = stubGetCurrentContext();
- int winX, winY;
- unsigned int winW, winH;
- WindowInfo *pWindow;
- pWindow = context->currentDrawable;
- stubGetWindowGeometry(pWindow, &winX, &winY, &winW, &winH);
- origViewport(0, 0, winW, winH);
- }
+ origViewport(x, y, w, h);
}
static void SPU_APIENTRY trapSwapBuffers(GLint window, GLint flags)
@@ -304,8 +290,6 @@ static void stubInitSPUDispatch(SPU *spu)
stub.spuDispatch.Clear = trapClear;
stub.spuDispatch.Viewport = trapViewport;
- if (stub.viewportHack)
- stub.spuDispatch.Scissor = trapScissor;
/*stub.spuDispatch.SwapBuffers = trapSwapBuffers;
stub.spuDispatch.DrawBuffer = trapDrawBuffer;*/
}
@@ -415,7 +399,7 @@ static void stubSPUSafeTearDown(void)
#if defined(CR_NEWWINTRACK)
crUnlockMutex(mutex);
# if defined(WINDOWS)
- if (RTThreadGetState(stub.hSyncThread)!=RTTHREADSTATE_TERMINATED)
+ if (stub.hSyncThread && RTThreadGetState(stub.hSyncThread)!=RTTHREADSTATE_TERMINATED)
{
HANDLE hNative;
DWORD ec=0;
@@ -752,30 +736,11 @@ void stubSetDefaultConfigurationOptions(void)
crNetSetNodeRange("iam0", "iamvis20");
crNetSetKey(key,sizeof(key));
stub.force_pbuffers = 0;
- stub.viewportHack = 0;
#ifdef WINDOWS
- {
- char name[1000];
- int i;
-
# ifdef VBOX_WITH_WDDM
- stub.bRunningUnderWDDM = false;
+ stub.bRunningUnderWDDM = false;
# endif
- /* Apply viewport hack only if we're running under wine */
- if (NULL!=GetModuleHandle("wined3d.dll") || NULL != GetModuleHandle("wined3dwddm.dll"))
- {
- crGetProcName(name, 1000);
- for (i=0; gsViewportHackApps[i]; ++i)
- {
- if (!stricmp(name, gsViewportHackApps[i]))
- {
- stub.viewportHack = 1;
- break;
- }
- }
- }
- }
#endif
}
@@ -819,161 +784,7 @@ static HRGN stubMakeRegionFromRects(PVBOXVIDEOCM_CMD_RECTS pRegions, uint32_t st
return hRgn;
}
-typedef struct VBOXCR_UPDATEWNDCB
-{
- VBOXDISPMP_REGIONS Regions;
- bool fSendUpdateMsg;
-} VBOXCR_UPDATEWNDCB, *PVBOXCR_UPDATEWNDCB;
-
-static void stubSyncTrUpdateWindowCB(unsigned long key, void *data1, void *data2)
-{
- WindowInfo *pWindow = (WindowInfo *) data1;
- PVBOXCR_UPDATEWNDCB pCbData = (PVBOXCR_UPDATEWNDCB) data2;
- VBOXDISPMP_REGIONS *pRegions = &pCbData->Regions;
- bool bChanged = false, bDoMap = false;
- HRGN hNewRgn = INVALID_HANDLE_VALUE;
-
- if (pRegions->hWnd != pWindow->hWnd)
- {
- return;
- }
-
- stub.spu->dispatch_table.VBoxPackSetInjectID(pWindow->u32ClientID);
-
- if (!stubSystemWindowExist(pWindow))
- {
- stubDestroyWindow(0, (GLint)pWindow->hWnd);
- return;
- }
-
- if (pRegions->pRegions->fFlags.bAddVisibleRects || pRegions->pRegions->fFlags.bSetViewRect)
- {
- if (!pWindow->mapped)
- {
- bDoMap = true;
- }
-
- /* ensure data integrity */
- Assert(!pRegions->pRegions->fFlags.bAddHiddenRects);
-
- if (pRegions->pRegions->fFlags.bSetViewRect)
- {
- int winX, winY;
- unsigned int winW, winH;
- BOOL bRc;
-
- winX = pRegions->pRegions->RectsInfo.aRects[0].left;
- winY = pRegions->pRegions->RectsInfo.aRects[0].top;
- winW = pRegions->pRegions->RectsInfo.aRects[0].right - winX;
- winH = pRegions->pRegions->RectsInfo.aRects[0].bottom - winY;
-
- if (stub.trackWindowPos && (bDoMap || winX!=pWindow->x || winY!=pWindow->y))
- {
- crDebug("Dispatched WindowPosition (%i)", pWindow->spuWindow);
- stub.spuDispatch.WindowPosition(pWindow->spuWindow, winX, winY);
- pWindow->x = winX;
- pWindow->y = winY;
- bChanged = true;
- }
-
- if (stub.trackWindowSize && (bDoMap || winW!=pWindow->width || winH!=pWindow->height))
- {
- crDebug("Dispatched WindowSize (%i)", pWindow->spuWindow);
- stub.spuDispatch.WindowSize(pWindow->spuWindow, winW, winH);
- pWindow->width = winW;
- pWindow->height = winH;
- bChanged = true;
- }
-
- bRc = MoveWindow(pRegions->hWnd, winX, winY, winW, winH, FALSE /*BOOL bRepaint*/);
- if (!bRc)
- {
- DWORD winEr = GetLastError();
- crWarning("stubSyncTrUpdateWindowCB: MoveWindow failed winEr(%d)", winEr);
- }
- }
-
- if (pRegions->pRegions->fFlags.bAddVisibleRects)
- {
- hNewRgn = stubMakeRegionFromRects(pRegions->pRegions, pRegions->pRegions->fFlags.bSetViewRect ? 1 : 0);
- }
- }
- else if (!pRegions->pRegions->fFlags.bHide)
- {
- Assert(pRegions->pRegions->fFlags.bAddHiddenRects);
- hNewRgn = stubMakeRegionFromRects(pRegions->pRegions, 0);
- }
- else
- {
- Assert(pRegions->pRegions->fFlags.bAddHiddenRects);
- hNewRgn = CreateRectRgn(pWindow->x, pWindow->y, pWindow->x + pWindow->width, pWindow->y + pWindow->height);
- }
-
- if (hNewRgn!=INVALID_HANDLE_VALUE)
- {
- if (pRegions->pRegions->fFlags.bAddVisibleRects)
- {
- HRGN hEmptyRgn = CreateRectRgn(0, 0, 0, 0);
-
- if (hEmptyRgn!=INVALID_HANDLE_VALUE)
- {
- if (pWindow->hVisibleRegion==INVALID_HANDLE_VALUE || EqualRgn(pWindow->hVisibleRegion, hEmptyRgn))
- {
- pCbData->fSendUpdateMsg = true;
- }
-
- DeleteObject(hEmptyRgn);
- }
- else
- {
- crWarning("Failed to created empty region!");
- }
- }
-
- OffsetRgn(hNewRgn, -pWindow->x, -pWindow->y);
-
- if (pWindow->hVisibleRegion!=INVALID_HANDLE_VALUE)
- {
- CombineRgn(hNewRgn, pWindow->hVisibleRegion, hNewRgn,
- pRegions->pRegions->fFlags.bAddHiddenRects ? RGN_DIFF:RGN_OR);
-
- if (!EqualRgn(pWindow->hVisibleRegion, hNewRgn))
- {
- DeleteObject(pWindow->hVisibleRegion);
- pWindow->hVisibleRegion = hNewRgn;
- stubDispatchVisibleRegions(pWindow);
- bChanged = true;
- }
- else
- {
- DeleteObject(hNewRgn);
- }
- }
- else
- {
- if (pRegions->pRegions->fFlags.bAddVisibleRects)
- {
- pWindow->hVisibleRegion = hNewRgn;
- stubDispatchVisibleRegions(pWindow);
- bChanged = true;
- }
- }
- }
-
- if (bDoMap)
- {
- pWindow->mapped = GL_TRUE;
- bChanged = true;
- crDebug("Dispatched: WindowShow(%i, %i)", pWindow->spuWindow, pWindow->mapped);
- stub.spu->dispatch_table.WindowShow(pWindow->spuWindow, pWindow->mapped);
- }
-
- if (bChanged)
- {
- stub.spu->dispatch_table.Flush();
- }
-}
-# endif
+# endif /* VBOX_WITH_WDDM */
static void stubSyncTrCheckWindowsCB(unsigned long key, void *data1, void *data2)
{
@@ -1010,10 +821,7 @@ static DECLCALLBACK(int) stubSyncThreadProc(RTTHREAD ThreadSelf, void *pvUser)
#ifdef WINDOWS
MSG msg;
# ifdef VBOX_WITH_WDDM
- static VBOXDISPMP_CALLBACKS VBoxDispMpTstCallbacks = {NULL, NULL, NULL};
HMODULE hVBoxD3D = NULL;
- VBOXCR_UPDATEWNDCB RegionsData;
- HRESULT hr;
GLint spuConnection = 0;
# endif
#endif
@@ -1024,42 +832,18 @@ static DECLCALLBACK(int) stubSyncThreadProc(RTTHREAD ThreadSelf, void *pvUser)
#ifdef WINDOWS
PeekMessage(&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE);
# ifdef VBOX_WITH_WDDM
- hVBoxD3D = GetModuleHandle(VBOX_MODNAME_DISPD3D);
- if (hVBoxD3D)
+ hVBoxD3D = NULL;
+ if (!GetModuleHandleEx(0, VBOX_MODNAME_DISPD3D, &hVBoxD3D))
{
- hVBoxD3D = LoadLibrary(VBOX_MODNAME_DISPD3D);
+ crDebug("GetModuleHandleEx failed err %d", GetLastError());
+ hVBoxD3D = NULL;
}
if (hVBoxD3D)
{
- PFNVBOXDISPMP_GETCALLBACKS pfnVBoxDispMpGetCallbacks;
- pfnVBoxDispMpGetCallbacks = (PFNVBOXDISPMP_GETCALLBACKS)GetProcAddress(hVBoxD3D, TEXT("VBoxDispMpGetCallbacks"));
- if (pfnVBoxDispMpGetCallbacks)
- {
- hr = pfnVBoxDispMpGetCallbacks(VBOXDISPMP_VERSION, &VBoxDispMpTstCallbacks);
- if (S_OK==hr)
- {
- CRASSERT(VBoxDispMpTstCallbacks.pfnEnableEvents);
- CRASSERT(VBoxDispMpTstCallbacks.pfnDisableEvents);
- CRASSERT(VBoxDispMpTstCallbacks.pfnGetRegions);
-
- hr = VBoxDispMpTstCallbacks.pfnEnableEvents();
- if (hr != S_OK)
- {
- crWarning("VBoxDispMpTstCallbacks.pfnEnableEvents failed");
- }
- else
- {
crDebug("running with " VBOX_MODNAME_DISPD3D);
stub.trackWindowVisibleRgn = 0;
stub.bRunningUnderWDDM = true;
- }
- }
- else
- {
- crWarning("VBoxDispMpGetCallbacks failed");
- }
- }
}
# endif /* VBOX_WITH_WDDM */
#endif /* WINDOWS */
@@ -1085,38 +869,9 @@ static DECLCALLBACK(int) stubSyncThreadProc(RTTHREAD ThreadSelf, void *pvUser)
if (!PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
{
# ifdef VBOX_WITH_WDDM
- if (VBoxDispMpTstCallbacks.pfnGetRegions)
+ if (stub.bRunningUnderWDDM)
{
- hr = VBoxDispMpTstCallbacks.pfnGetRegions(&RegionsData.Regions, 50);
- if (S_OK==hr)
- {
- RegionsData.fSendUpdateMsg = false;
-# if 0
- uint32_t i;
- crDebug(">>>Regions for HWND(0x%x)>>>", RegionsData.Regions.hWnd);
- crDebug("Flags(0x%x)", RegionsData.Regions.pRegions->fFlags.Value);
- for (i = 0; i < RegionsData.Regions.pRegions->RectsInfo.cRects; ++i)
- {
- RECT *pRect = &RegionsData.Regions.pRegions->RectsInfo.aRects[i];
- crDebug("Rect(%d): left(%d), top(%d), right(%d), bottom(%d)", i, pRect->left, pRect->top, pRect->right, pRect->bottom);
- }
- crDebug("<<<<<");
-# endif
- /*hacky way to make sure window wouldn't be deleted in another thread as we hold hashtable lock here*/
- crHashtableWalk(stub.windowTable, stubSyncTrUpdateWindowCB, &RegionsData);
- if (RegionsData.fSendUpdateMsg)
- {
- SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0, 0, SMTO_NORMAL, 1000, NULL);
- }
- }
- else
- {
- if (WAIT_TIMEOUT!=hr)
- {
- crWarning("VBoxDispMpTstCallbacks.pfnGetRegions failed with 0x%x", hr);
- }
- crHashtableWalk(stub.windowTable, stubSyncTrCheckWindowsCB, NULL);
- }
+
}
else
# endif
@@ -1139,18 +894,17 @@ static DECLCALLBACK(int) stubSyncThreadProc(RTTHREAD ThreadSelf, void *pvUser)
}
}
#else
+ /* Try to keep a consistent locking order. */
+ crHashtableLock(stub.windowTable);
crLockMutex(&stub.mutex);
- crHashtableWalk(stub.windowTable, stubSyncTrCheckWindowsCB, NULL);
+ crHashtableWalkUnlocked(stub.windowTable, stubSyncTrCheckWindowsCB, NULL);
crUnlockMutex(&stub.mutex);
+ crHashtableUnlock(stub.windowTable);
RTThreadSleep(50);
#endif
}
#ifdef VBOX_WITH_WDDM
- if (VBoxDispMpTstCallbacks.pfnDisableEvents)
- {
- VBoxDispMpTstCallbacks.pfnDisableEvents();
- }
if (spuConnection)
{
stub.spu->dispatch_table.VBoxConDestroy(spuConnection);
@@ -1163,7 +917,7 @@ static DECLCALLBACK(int) stubSyncThreadProc(RTTHREAD ThreadSelf, void *pvUser)
crDebug("Sync thread stopped");
return 0;
}
-#endif
+#endif /* CR_NEWWINTRACK */
/**
* Do one-time initializations for the faker.
@@ -1188,6 +942,9 @@ stubInitLocked(void)
const char *app_id;
int i;
int disable_sync = 0;
+#if defined(WINDOWS) && defined(VBOX_WITH_WDDM)
+ HMODULE hVBoxD3D = NULL;
+#endif
stubInitVars();
@@ -1230,15 +987,6 @@ stubInitLocked(void)
{
crNetFreeConnection(ns.conn);
}
-#if 0 && defined(CR_NEWWINTRACK)
- {
- Status st = XInitThreads();
- if (st==0)
- {
- crWarning("XInitThreads returned %i", (int)st);
- }
- }
-#endif
}
#endif
@@ -1256,6 +1004,27 @@ stubInitLocked(void)
stubSetDefaultConfigurationOptions();
+#if defined(WINDOWS) && defined(VBOX_WITH_WDDM)
+ hVBoxD3D = NULL;
+ if (!GetModuleHandleEx(0, VBOX_MODNAME_DISPD3D, &hVBoxD3D))
+ {
+ crDebug("GetModuleHandleEx failed err %d", GetLastError());
+ hVBoxD3D = NULL;
+ }
+
+ if (hVBoxD3D)
+ {
+ disable_sync = 1;
+ crDebug("running with %s", VBOX_MODNAME_DISPD3D);
+ stub.trackWindowVisibleRgn = 0;
+ /* @todo: should we enable that? */
+ stub.trackWindowSize = 0;
+ stub.trackWindowPos = 0;
+ stub.trackWindowVisibility = 0;
+ stub.bRunningUnderWDDM = true;
+ }
+#endif
+
stub.spu = crSPULoadChain( num_spus, spu_ids, spu_names, stub.spu_dir, NULL );
crFree( spuchain );
@@ -1296,7 +1065,7 @@ raise(SIGINT);*/
{
int rc;
- RTR3InitDll(0);
+ RTR3InitDll(RTR3INIT_FLAGS_UNOBTRUSIVE);
if (!disable_sync)
{
@@ -1358,14 +1127,144 @@ stubInit(void)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
-#ifdef DEBUG_misha
+#if 1//def DEBUG_misha
/* debugging: this is to be able to catch first-chance notifications
* for exceptions other than EXCEPTION_BREAKPOINT in kernel debugger */
# define VDBG_VEHANDLER
#endif
#ifdef VDBG_VEHANDLER
-static PVOID g_VBoxWDbgVEHandler = NULL;
+# include <dbghelp.h>
+static PVOID g_VBoxVehHandler = NULL;
+static DWORD g_VBoxVehEnable = 0;
+
+/* generate a crash dump on exception */
+#define VBOXVEH_F_DUMP 0x00000001
+/* generate a debugger breakpoint exception */
+#define VBOXVEH_F_BREAK 0x00000002
+/* exit on exception */
+#define VBOXVEH_F_EXIT 0x00000004
+
+static DWORD g_VBoxVehFlags = 0
+#ifdef DEBUG_misha
+ | VBOXVEH_F_BREAK
+#else
+ | VBOXVEH_F_DUMP
+#endif
+ ;
+
+typedef BOOL WINAPI FNVBOXDBG_MINIDUMPWRITEDUMP(HANDLE hProcess,
+ DWORD ProcessId,
+ HANDLE hFile,
+ MINIDUMP_TYPE DumpType,
+ PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,
+ PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,
+ PMINIDUMP_CALLBACK_INFORMATION CallbackParam);
+typedef FNVBOXDBG_MINIDUMPWRITEDUMP *PFNVBOXDBG_MINIDUMPWRITEDUMP;
+
+static HMODULE g_hVBoxMdDbgHelp = NULL;
+static PFNVBOXDBG_MINIDUMPWRITEDUMP g_pfnVBoxMdMiniDumpWriteDump = NULL;
+static uint32_t g_cVBoxMdFilePrefixLen = 0;
+static WCHAR g_aszwVBoxMdFilePrefix[MAX_PATH];
+static WCHAR g_aszwVBoxMdDumpCount = 0;
+static MINIDUMP_TYPE g_enmVBoxMdDumpType = MiniDumpNormal
+ | MiniDumpWithDataSegs
+ | MiniDumpWithFullMemory
+ | MiniDumpWithHandleData
+//// | MiniDumpFilterMemory
+//// | MiniDumpScanMemory
+// | MiniDumpWithUnloadedModules
+//// | MiniDumpWithIndirectlyReferencedMemory
+//// | MiniDumpFilterModulePaths
+// | MiniDumpWithProcessThreadData
+// | MiniDumpWithPrivateReadWriteMemory
+//// | MiniDumpWithoutOptionalData
+// | MiniDumpWithFullMemoryInfo
+// | MiniDumpWithThreadInfo
+// | MiniDumpWithCodeSegs
+// | MiniDumpWithFullAuxiliaryState
+// | MiniDumpWithPrivateWriteCopyMemory
+// | MiniDumpIgnoreInaccessibleMemory
+// | MiniDumpWithTokenInformation
+//// | MiniDumpWithModuleHeaders
+//// | MiniDumpFilterTriage
+ ;
+
+
+
+#define VBOXMD_DUMP_DIR_PREFIX_DEFAULT L"C:\\dumps\\vboxdmp"
+
+static HMODULE loadSystemDll(const char *pszName)
+{
+ char szPath[MAX_PATH];
+ UINT cchPath = GetSystemDirectoryA(szPath, sizeof(szPath));
+ size_t cbName = strlen(pszName) + 1;
+ if (cchPath + 1 + cbName > sizeof(szPath))
+ {
+ SetLastError(ERROR_FILENAME_EXCED_RANGE);
+ return NULL;
+ }
+ szPath[cchPath] = '\\';
+ memcpy(&szPath[cchPath + 1], pszName, cbName);
+ return LoadLibraryA(szPath);
+}
+
+static DWORD vboxMdMinidumpCreate(struct _EXCEPTION_POINTERS *pExceptionInfo)
+{
+ WCHAR aszwMdFileName[MAX_PATH];
+ HANDLE hProcess = GetCurrentProcess();
+ DWORD ProcessId = GetCurrentProcessId();
+ MINIDUMP_EXCEPTION_INFORMATION ExceptionInfo;
+ HANDLE hFile;
+ DWORD winErr = ERROR_SUCCESS;
+
+ if (!g_pfnVBoxMdMiniDumpWriteDump)
+ {
+ if (!g_hVBoxMdDbgHelp)
+ {
+ g_hVBoxMdDbgHelp = loadSystemDll("DbgHelp.dll");
+ if (!g_hVBoxMdDbgHelp)
+ return GetLastError();
+ }
+
+ g_pfnVBoxMdMiniDumpWriteDump = (PFNVBOXDBG_MINIDUMPWRITEDUMP)GetProcAddress(g_hVBoxMdDbgHelp, "MiniDumpWriteDump");
+ if (!g_pfnVBoxMdMiniDumpWriteDump)
+ return GetLastError();
+ }
+
+ /* @todo: this is a tmp stuff until we get that info from the settings properly */
+ if (!g_cVBoxMdFilePrefixLen)
+ {
+ g_cVBoxMdFilePrefixLen = sizeof (VBOXMD_DUMP_DIR_PREFIX_DEFAULT)/sizeof (g_aszwVBoxMdFilePrefix[0]) - 1 /* <- don't include nul terminator */;
+ memcpy(g_aszwVBoxMdFilePrefix, VBOXMD_DUMP_DIR_PREFIX_DEFAULT, sizeof (VBOXMD_DUMP_DIR_PREFIX_DEFAULT));
+ }
+
+
+ if (RT_ELEMENTS(aszwMdFileName) <= g_cVBoxMdFilePrefixLen)
+ {
+ return ERROR_INVALID_STATE;
+ }
+
+ ++g_aszwVBoxMdDumpCount;
+
+ memcpy(aszwMdFileName, g_aszwVBoxMdFilePrefix, g_cVBoxMdFilePrefixLen * sizeof (g_aszwVBoxMdFilePrefix[0]));
+ swprintf(aszwMdFileName + g_cVBoxMdFilePrefixLen, RT_ELEMENTS(aszwMdFileName) - g_cVBoxMdFilePrefixLen, L"%d_%d.dmp", ProcessId, g_aszwVBoxMdDumpCount);
+
+ hFile = CreateFileW(aszwMdFileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ if (hFile == INVALID_HANDLE_VALUE)
+ return GetLastError();
+
+ ExceptionInfo.ThreadId = GetCurrentThreadId();
+ ExceptionInfo.ExceptionPointers = pExceptionInfo;
+ ExceptionInfo.ClientPointers = FALSE;
+
+ if (!g_pfnVBoxMdMiniDumpWriteDump(hProcess, ProcessId, hFile, g_enmVBoxMdDumpType, &ExceptionInfo, NULL, NULL))
+ winErr = GetLastError();
+
+ CloseHandle(hFile);
+ return winErr;
+}
+
LONG WINAPI vboxVDbgVectoredHandler(struct _EXCEPTION_POINTERS *pExceptionInfo)
{
PEXCEPTION_RECORD pExceptionRecord = pExceptionInfo->ExceptionRecord;
@@ -1380,7 +1279,33 @@ LONG WINAPI vboxVDbgVectoredHandler(struct _EXCEPTION_POINTERS *pExceptionInfo)
case EXCEPTION_FLT_INVALID_OPERATION:
case EXCEPTION_INT_DIVIDE_BY_ZERO:
case EXCEPTION_ILLEGAL_INSTRUCTION:
- CRASSERT(0);
+ if (g_VBoxVehFlags & VBOXVEH_F_BREAK)
+ {
+ BOOL fBreak = TRUE;
+#ifndef DEBUG_misha
+ if (pExceptionRecord->ExceptionCode == EXCEPTION_BREAKPOINT)
+ {
+ HANDLE hProcess = GetCurrentProcess();
+ BOOL fDebuggerPresent = FALSE;
+ /* we do not want to generate breakpoint exceptions recursively, so do it only when running under debugger */
+ if (CheckRemoteDebuggerPresent(hProcess, &fDebuggerPresent))
+ fBreak = !!fDebuggerPresent;
+ else
+ fBreak = FALSE; /* <- the function has failed, don't break for sanity */
+ }
+#endif
+
+ if (fBreak)
+ {
+ RT_BREAKPOINT();
+ }
+ }
+
+ if (g_VBoxVehFlags & VBOXVEH_F_DUMP)
+ vboxMdMinidumpCreate(pExceptionInfo);
+
+ if (g_VBoxVehFlags & VBOXVEH_F_EXIT)
+ exit(1);
break;
default:
break;
@@ -1390,19 +1315,19 @@ LONG WINAPI vboxVDbgVectoredHandler(struct _EXCEPTION_POINTERS *pExceptionInfo)
void vboxVDbgVEHandlerRegister()
{
- CRASSERT(!g_VBoxWDbgVEHandler);
- g_VBoxWDbgVEHandler = AddVectoredExceptionHandler(1,vboxVDbgVectoredHandler);
- CRASSERT(g_VBoxWDbgVEHandler);
+ CRASSERT(!g_VBoxVehHandler);
+ g_VBoxVehHandler = AddVectoredExceptionHandler(1,vboxVDbgVectoredHandler);
+ CRASSERT(g_VBoxVehHandler);
}
void vboxVDbgVEHandlerUnregister()
{
ULONG uResult;
- if (g_VBoxWDbgVEHandler)
+ if (g_VBoxVehHandler)
{
- uResult = RemoveVectoredExceptionHandler(g_VBoxWDbgVEHandler);
+ uResult = RemoveVectoredExceptionHandler(g_VBoxVehHandler);
CRASSERT(uResult);
- g_VBoxWDbgVEHandler = NULL;
+ g_VBoxVehHandler = NULL;
}
}
#endif
@@ -1425,7 +1350,12 @@ BOOL WINAPI DllMain(HINSTANCE hDLLInst, DWORD fdwReason, LPVOID lpvReserved)
crInitMutex(&stub_init_mutex);
#ifdef VDBG_VEHANDLER
- vboxVDbgVEHandlerRegister();
+ g_VBoxVehEnable = !!crGetenv("CR_DBG_VEH_ENABLE");
+# ifdef DEBUG_misha
+ g_VBoxVehEnable = 1;
+# endif
+ if (g_VBoxVehEnable)
+ vboxVDbgVEHandlerRegister();
#endif
crNetInit(NULL, NULL);
@@ -1440,12 +1370,15 @@ BOOL WINAPI DllMain(HINSTANCE hDLLInst, DWORD fdwReason, LPVOID lpvReserved)
{
crDebug("Failed to connect to host (is guest 3d acceleration enabled?), aborting ICD load.");
#ifdef VDBG_VEHANDLER
- vboxVDbgVEHandlerUnregister();
+ if (g_VBoxVehEnable)
+ vboxVDbgVEHandlerUnregister();
#endif
return FALSE;
}
else
+ {
crNetFreeConnection(ns.conn);
+ }
break;
}
@@ -1468,7 +1401,8 @@ BOOL WINAPI DllMain(HINSTANCE hDLLInst, DWORD fdwReason, LPVOID lpvReserved)
#endif
#ifdef VDBG_VEHANDLER
- vboxVDbgVEHandlerUnregister();
+ if (g_VBoxVehEnable)
+ vboxVDbgVEHandlerUnregister();
#endif
break;
}
diff --git a/src/VBox/Additions/common/crOpenGL/pack/packspu.h b/src/VBox/Additions/common/crOpenGL/pack/packspu.h
index 27f3526f..942761a8 100644
--- a/src/VBox/Additions/common/crOpenGL/pack/packspu.h
+++ b/src/VBox/Additions/common/crOpenGL/pack/packspu.h
@@ -19,6 +19,9 @@
#include "cr_spu.h"
#include "cr_threads.h"
#include "state/cr_client.h"
+#ifdef VBOX_WITH_CRPACKSPU_DUMPER
+# include "cr_dump.h"
+#endif
typedef struct thread_info_t ThreadInfo;
typedef struct context_info_t ContextInfo;
@@ -70,6 +73,13 @@ typedef struct {
bool bRunningUnderWDDM;
#endif
+#ifdef VBOX_WITH_CRPACKSPU_DUMPER
+ SPUDispatchTable self;
+
+ CR_RECORDER Recorder;
+ CR_DBGPRINT_DUMPER Dumper;
+#endif
+
int numContexts;
ContextInfo context[CR_MAX_CONTEXTS];
} PackSPU;
@@ -82,7 +92,8 @@ extern PackSPU pack_spu;
extern CRmutex _PackMutex;
extern CRtsd _PackTSD;
#define GET_THREAD_VAL() (crGetTSD(&_PackTSD))
-#define GET_THREAD_VAL_ID(_id) (&(pack_spu.thread[(_id) - THREAD_OFFSET_MAGIC]))
+#define GET_THREAD_IDX(_id) ((_id) - THREAD_OFFSET_MAGIC)
+#define GET_THREAD_VAL_ID(_id) (&(pack_spu.thread[GET_THREAD_IDX(_id)]))
#else
#define GET_THREAD_VAL() (&(pack_spu.thread[0]))
#endif
diff --git a/src/VBox/Additions/common/crOpenGL/pack/packspu_bufferobject.c b/src/VBox/Additions/common/crOpenGL/pack/packspu_bufferobject.c
index 8a741137..53cd3aff 100644
--- a/src/VBox/Additions/common/crOpenGL/pack/packspu_bufferobject.c
+++ b/src/VBox/Additions/common/crOpenGL/pack/packspu_bufferobject.c
@@ -130,3 +130,31 @@ packspu_BindBufferARB( GLenum target, GLuint buffer )
crStateBindBufferARB(target, buffer);
crPackBindBufferARB(target, buffer);
}
+
+void PACKSPU_APIENTRY packspu_GenBuffersARB( GLsizei n, GLuint * buffer )
+{
+ GET_THREAD(thread);
+ int writeback = 1;
+ if (!CRPACKSPU_IS_WDDM_CRHGSMI() && !(pack_spu.thread[pack_spu.idxThreadInUse].netServer.conn->actual_network))
+ {
+ crError( "packspu_GenBuffersARB doesn't work when there's no actual network involved!\nTry using the simplequery SPU in your chain!" );
+ }
+ if (pack_spu.swap)
+ {
+ crPackGenBuffersARBSWAP( n, buffer, &writeback );
+ }
+ else
+ {
+ crPackGenBuffersARB( n, buffer, &writeback );
+ }
+ packspuFlush( (void *) thread );
+ CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
+
+ crStateRegBuffers(n, buffer);
+}
+
+void PACKSPU_APIENTRY packspu_DeleteBuffersARB( GLsizei n, const GLuint * buffer )
+{
+ crStateDeleteBuffersARB( n, buffer );
+ crPackDeleteBuffersARB(n, buffer);
+}
diff --git a/src/VBox/Additions/common/crOpenGL/pack/packspu_context.c b/src/VBox/Additions/common/crOpenGL/pack/packspu_context.c
index 90fb5f90..08e41300 100644
--- a/src/VBox/Additions/common/crOpenGL/pack/packspu_context.c
+++ b/src/VBox/Additions/common/crOpenGL/pack/packspu_context.c
@@ -130,6 +130,8 @@ packspu_VBoxConFlush(GLint con)
CRASSERT(CRPACKSPU_IS_WDDM_CRHGSMI());
CRASSERT(thread->packer);
packspuFlush((void *) thread);
+#else
+ crError("VBoxConFlush not implemented!");
#endif
}
@@ -148,8 +150,17 @@ packspu_VBoxConDestroy(GLint con)
crPackDeleteContext(thread->packer);
+ if (thread->buffer.pack)
+ {
+ crNetFree(thread->netServer.conn, thread->buffer.pack);
+ thread->buffer.pack = NULL;
+ }
+
crNetFreeConnection(thread->netServer.conn);
+ if (thread->netServer.name)
+ crFree(thread->netServer.name);
+
pack_spu.numThreads--;
/*note can't shift the array here, because other threads have TLS references to array elements*/
crMemZero(thread, sizeof(ThreadInfo));
@@ -173,6 +184,63 @@ packspu_VBoxConDestroy(GLint con)
#endif
}
+GLvoid PACKSPU_APIENTRY
+packspu_VBoxConChromiumParameteriCR(GLint con, GLenum param, GLint value)
+{
+ GET_THREAD(thread);
+ CRPackContext * curPacker = crPackGetContext();
+ ThreadInfo *curThread = thread;
+ int writeback = 1;
+ GLint serverCtx = (GLint) -1;
+
+ CRASSERT(!curThread == !curPacker);
+ CRASSERT(!curThread || !curPacker || curThread->packer == curPacker);
+#ifdef CHROMIUM_THREADSAFE
+ crLockMutex(&_PackMutex);
+#endif
+
+#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
+ CRASSERT(!con == !CRPACKSPU_IS_WDDM_CRHGSMI());
+#endif
+
+ if (CRPACKSPU_IS_WDDM_CRHGSMI())
+ {
+ if (!con)
+ {
+ crError("connection should be specified!");
+ return;
+ }
+ thread = GET_THREAD_VAL_ID(con);
+ }
+ else
+ {
+ CRASSERT(!con);
+ if (!thread)
+ {
+ thread = packspuNewThread(
+#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
+ NULL
+#endif
+ );
+ }
+ }
+ CRASSERT(thread);
+ CRASSERT(thread->packer);
+
+ crPackSetContext( thread->packer );
+
+ packspu_ChromiumParameteriCR(param, value);
+
+#ifdef CHROMIUM_THREADSAFE
+ crUnlockMutex(&_PackMutex);
+#endif
+
+ if (CRPACKSPU_IS_WDDM_CRHGSMI())
+ {
+ /* restore the packer context to the tls */
+ crPackSetContext(curPacker);
+ }
+}
GLint PACKSPU_APIENTRY
packspu_VBoxCreateContext( GLint con, const char *dpyName, GLint visual, GLint shareCtx )
@@ -412,7 +480,7 @@ void PACKSPU_APIENTRY packspu_MakeCurrent( GLint window, GLint nativeWindow, GLi
}
else
{
- if (!newCtx->fAutoFlush)
+ if (newCtx->fAutoFlush)
{
if (newCtx->currentThread && newCtx->currentThread != thread)
{
diff --git a/src/VBox/Additions/common/crOpenGL/pack/packspu_framebuffer.c b/src/VBox/Additions/common/crOpenGL/pack/packspu_framebuffer.c
index 555e60cd..ed555c48 100644
--- a/src/VBox/Additions/common/crOpenGL/pack/packspu_framebuffer.c
+++ b/src/VBox/Additions/common/crOpenGL/pack/packspu_framebuffer.c
@@ -5,7 +5,7 @@
*/
/*
- * Copyright (C) 2009 Oracle Corporation
+ * 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;
@@ -59,8 +59,8 @@ packspu_DeleteFramebuffersEXT(GLsizei n, const GLuint * framebuffers)
void PACKSPU_APIENTRY
packspu_DeleteRenderbuffersEXT(GLsizei n, const GLuint * renderbuffers)
{
- crStateDeleteFramebuffersEXT(n, renderbuffers);
- crPackDeleteFramebuffersEXT(n, renderbuffers);
+ crStateDeleteRenderbuffersEXT(n, renderbuffers);
+ crPackDeleteRenderbuffersEXT(n, renderbuffers);
}
void PACKSPU_APIENTRY
@@ -97,3 +97,47 @@ packspu_CheckFramebufferStatusEXT(GLenum target)
crStateSetFramebufferStatus(target, status);
return status;
}
+
+void PACKSPU_APIENTRY packspu_GenFramebuffersEXT( GLsizei n, GLuint * framebuffers )
+{
+ GET_THREAD(thread);
+ int writeback = 1;
+ if (!CRPACKSPU_IS_WDDM_CRHGSMI() && !(pack_spu.thread[pack_spu.idxThreadInUse].netServer.conn->actual_network))
+ {
+ crError( "packspu_GenFramebuffersEXT doesn't work when there's no actual network involved!\nTry using the simplequery SPU in your chain!" );
+ }
+ if (pack_spu.swap)
+ {
+ crPackGenFramebuffersEXTSWAP( n, framebuffers, &writeback );
+ }
+ else
+ {
+ crPackGenFramebuffersEXT( n, framebuffers, &writeback );
+ }
+ packspuFlush( (void *) thread );
+ CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
+
+ crStateRegFramebuffers(n, framebuffers);
+}
+
+void PACKSPU_APIENTRY packspu_GenRenderbuffersEXT( GLsizei n, GLuint * renderbuffers )
+{
+ GET_THREAD(thread);
+ int writeback = 1;
+ if (!CRPACKSPU_IS_WDDM_CRHGSMI() && !(pack_spu.thread[pack_spu.idxThreadInUse].netServer.conn->actual_network))
+ {
+ crError( "packspu_GenRenderbuffersEXT doesn't work when there's no actual network involved!\nTry using the simplequery SPU in your chain!" );
+ }
+ if (pack_spu.swap)
+ {
+ crPackGenRenderbuffersEXTSWAP( n, renderbuffers, &writeback );
+ }
+ else
+ {
+ crPackGenRenderbuffersEXT( n, renderbuffers, &writeback );
+ }
+ packspuFlush( (void *) thread );
+ CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
+
+ crStateRegRenderbuffers(n, renderbuffers);
+}
diff --git a/src/VBox/Additions/common/crOpenGL/pack/packspu_get.py b/src/VBox/Additions/common/crOpenGL/pack/packspu_get.py
index 25aa4de2..82f00a85 100644
--- a/src/VBox/Additions/common/crOpenGL/pack/packspu_get.py
+++ b/src/VBox/Additions/common/crOpenGL/pack/packspu_get.py
@@ -48,7 +48,6 @@ GLboolean crPackIsPixelStoreParm(GLenum pname)
"""
from get_sizes import *
-from get_components import *
easy_swaps = {
'GenTextures': '(unsigned int) n',
@@ -117,6 +116,11 @@ for func_name in keys:
#ifdef CR_ARB_vertex_program
|| pname == GL_MAX_VERTEX_ATTRIBS_ARB
#endif
+#ifndef GL_EXT_framebuffer_object
+ || pname == GL_FRAMEBUFFER_BINDING_EXT
+ || pname == GL_READ_FRAMEBUFFER_BINDING_EXT
+ || pname == GL_DRAW_FRAMEBUFFER_BINDING_EXT
+#endif
)
{
#ifdef DEBUG
@@ -200,7 +204,7 @@ for func_name in keys:
if func_name in hard_funcs.keys():
print '\tif (pack_spu.swap)'
print '\t{'
- print '\t\tfor (i = 0 ; i < lookupComponents(pname) ; i++)'
+ print '\t\tfor (i = 0 ; i < crStateHlpComponentsCount(pname) ; i++)'
print '\t\t{'
if hard_funcs[func_name] == 'SWAPDOUBLE':
print '\t\t\t%s[i] = %s(%s[i]);' % (lastParamName, hard_funcs[func_name], lastParamName)
diff --git a/src/VBox/Additions/common/crOpenGL/pack/packspu_getshaders.c b/src/VBox/Additions/common/crOpenGL/pack/packspu_getshaders.c
index d0cc9040..6b3271d5 100644
--- a/src/VBox/Additions/common/crOpenGL/pack/packspu_getshaders.c
+++ b/src/VBox/Additions/common/crOpenGL/pack/packspu_getshaders.c
@@ -5,7 +5,7 @@
*/
/*
- * Copyright (C) 2009 Oracle Corporation
+ * 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;
@@ -98,7 +98,7 @@ void PACKSPU_APIENTRY packspu_GetAttachedShaders(GLuint program, GLsizei maxCoun
crFree(pLocal);
}
-void PACKSPU_APIENTRY packspu_GetAttachedObjectsARB(GLhandleARB containerObj, GLsizei maxCount, GLsizei * count, GLhandleARB * obj)
+void PACKSPU_APIENTRY packspu_GetAttachedObjectsARB(VBoxGLhandleARB containerObj, GLsizei maxCount, GLsizei * count, VBoxGLhandleARB * obj)
{
GET_THREAD(thread);
int writeback = 1;
@@ -106,7 +106,7 @@ void PACKSPU_APIENTRY packspu_GetAttachedObjectsARB(GLhandleARB containerObj, GL
if (!obj) return;
- pLocal = (GLsizei*) crAlloc(maxCount*sizeof(GLhandleARB)+sizeof(GLsizei));
+ pLocal = (GLsizei*) crAlloc(maxCount*sizeof(VBoxGLhandleARB)+sizeof(GLsizei));
if (!pLocal) return;
crPackGetAttachedObjectsARB(containerObj, maxCount, pLocal, NULL, &writeback);
@@ -115,13 +115,13 @@ void PACKSPU_APIENTRY packspu_GetAttachedObjectsARB(GLhandleARB containerObj, GL
CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
if (count) *count=*pLocal;
- crMemcpy(obj, &pLocal[1], *pLocal*sizeof(GLhandleARB));
+ crMemcpy(obj, &pLocal[1], *pLocal*sizeof(VBoxGLhandleARB));
crFree(pLocal);
}
AssertCompile(sizeof(GLsizei) == 4);
-void PACKSPU_APIENTRY packspu_GetInfoLogARB(GLhandleARB obj, GLsizei maxLength, GLsizei * length, GLcharARB * infoLog)
+void PACKSPU_APIENTRY packspu_GetInfoLogARB(VBoxGLhandleARB obj, GLsizei maxLength, GLsizei * length, GLcharARB * infoLog)
{
GET_THREAD(thread);
int writeback = 1;
diff --git a/src/VBox/Additions/common/crOpenGL/pack/packspu_glsl.c b/src/VBox/Additions/common/crOpenGL/pack/packspu_glsl.c
index e19959a3..d58202ef 100644
--- a/src/VBox/Additions/common/crOpenGL/pack/packspu_glsl.c
+++ b/src/VBox/Additions/common/crOpenGL/pack/packspu_glsl.c
@@ -5,7 +5,7 @@
*/
/*
- * Copyright (C) 2009 Oracle Corporation
+ * 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;
@@ -129,12 +129,14 @@ void PACKSPU_APIENTRY packspu_DeleteProgram(GLuint program)
crPackDeleteProgram(program);
}
-void PACK_APIENTRY packspu_DeleteObjectARB(GLhandleARB obj)
+void PACK_APIENTRY packspu_DeleteObjectARB(VBoxGLhandleARB obj)
{
GLuint hwid = crStateGetProgramHWID(obj);
CRASSERT(obj);
+ /* we do not track shader creation inside guest since it is not needed currently.
+ * this is why we only care about programs here */
if (hwid)
{
crStateDeleteProgram(obj);
@@ -143,8 +145,57 @@ void PACK_APIENTRY packspu_DeleteObjectARB(GLhandleARB obj)
crPackDeleteObjectARB(obj);
}
+#ifdef VBOX_WITH_CRPACKSPU_DUMPER
+static void packspu_RecCheckInitRec()
+{
+ if (pack_spu.Recorder.pDumper)
+ return;
+
+ crDmpDbgPrintInit(&pack_spu.Dumper);
+
+ crRecInit(&pack_spu.Recorder, NULL /*pBlitter: we do not support blitter operations here*/, &pack_spu.self, &pack_spu.Dumper.Base);
+}
+#endif
+
void PACKSPU_APIENTRY packspu_LinkProgram(GLuint program)
{
+#ifdef VBOX_WITH_CRPACKSPU_DUMPER
+ GLint linkStatus = 0;
+#endif
+
crStateLinkProgram(program);
crPackLinkProgram(program);
+
+#ifdef VBOX_WITH_CRPACKSPU_DUMPER
+ pack_spu.self.GetObjectParameterivARB(program, GL_OBJECT_LINK_STATUS_ARB, &linkStatus);
+ Assert(linkStatus);
+ if (!linkStatus)
+ {
+ CRContext *ctx = crStateGetCurrent();
+ packspu_RecCheckInitRec();
+ crRecDumpProgram(&pack_spu.Recorder, ctx, program, program);
+ }
+#endif
}
+
+void PACKSPU_APIENTRY packspu_CompileShader(GLuint shader)
+{
+#ifdef VBOX_WITH_CRPACKSPU_DUMPER
+ GLint compileStatus = 0;
+#endif
+
+// crStateCompileShader(shader);
+ crPackCompileShader(shader);
+
+#ifdef VBOX_WITH_CRPACKSPU_DUMPER
+ pack_spu.self.GetObjectParameterivARB(shader, GL_OBJECT_COMPILE_STATUS_ARB, &compileStatus);
+ Assert(compileStatus);
+ if (!compileStatus)
+ {
+ CRContext *ctx = crStateGetCurrent();
+ packspu_RecCheckInitRec();
+ crRecDumpShader(&pack_spu.Recorder, ctx, shader, shader);
+ }
+#endif
+}
+
diff --git a/src/VBox/Additions/common/crOpenGL/pack/packspu_init.c b/src/VBox/Additions/common/crOpenGL/pack/packspu_init.c
index 6682058d..2781fa6f 100644
--- a/src/VBox/Additions/common/crOpenGL/pack/packspu_init.c
+++ b/src/VBox/Additions/common/crOpenGL/pack/packspu_init.c
@@ -50,6 +50,10 @@ packSPUInit( int id, SPU *child, SPU *self,
pack_spu.bRunningUnderWDDM = !!GetModuleHandle(VBOX_MODNAME_DISPD3D);
#endif
+#ifdef VBOX_WITH_CRPACKSPU_DUMPER
+ memset(&pack_spu.Dumper, 0, sizeof (pack_spu.Dumper));
+#endif
+
if (!CRPACKSPU_IS_WDDM_CRHGSMI())
{
/* This connects to the server, sets up the packer, etc. */
@@ -75,7 +79,12 @@ packSPUInit( int id, SPU *child, SPU *self,
static void
packSPUSelfDispatch(SPUDispatchTable *self)
{
+#ifdef VBOX_WITH_CRPACKSPU_DUMPER
+ crSPUInitDispatchTable( &(pack_spu.self) );
+ crSPUCopyDispatchTable( &(pack_spu.self), self );
+#else
(void)self;
+#endif
}
static int
diff --git a/src/VBox/Additions/common/crOpenGL/pack/packspu_misc.c b/src/VBox/Additions/common/crOpenGL/pack/packspu_misc.c
index ee4d4f88..3048bbc3 100644
--- a/src/VBox/Additions/common/crOpenGL/pack/packspu_misc.c
+++ b/src/VBox/Additions/common/crOpenGL/pack/packspu_misc.c
@@ -615,9 +615,18 @@ void PACKSPU_APIENTRY packspu_VBoxDetachThread()
crPackSetContext(NULL);
CR_UNLOCK_PACKER_CONTEXT(thread->packer);
crPackDeleteContext(pack_spu.thread[i].packer);
+
+ if (pack_spu.thread[i].buffer.pack)
+ {
+ crNetFree(pack_spu.thread[i].netServer.conn, pack_spu.thread[i].buffer.pack);
+ pack_spu.thread[i].buffer.pack = NULL;
+ }
}
crNetFreeConnection(pack_spu.thread[i].netServer.conn);
+ if (pack_spu.thread[i].netServer.name)
+ crFree(pack_spu.thread[i].netServer.name);
+
pack_spu.numThreads--;
/*note can't shift the array here, because other threads have TLS references to array elements*/
crMemZero(&pack_spu.thread[i], sizeof(ThreadInfo));
@@ -712,3 +721,11 @@ void PACKSPU_APIENTRY packspu_VBoxPackDetachThread()
{
}
#endif /*CHROMIUM_THREADSAFE*/
+
+void PACKSPU_APIENTRY packspu_VBoxPresentComposition(GLint win, const struct VBOXVR_SCR_COMPOSITOR * pCompositor, const struct VBOXVR_SCR_COMPOSITOR_ENTRY *pChangedEntry)
+{
+}
+
+void PACKSPU_APIENTRY packspu_StringMarkerGREMEDY(GLsizei len, const GLvoid *string)
+{
+}
diff --git a/src/VBox/Additions/common/crOpenGL/pack/packspu_special b/src/VBox/Additions/common/crOpenGL/pack/packspu_special
index 6b9edd95..d7a12124 100644
--- a/src/VBox/Additions/common/crOpenGL/pack/packspu_special
+++ b/src/VBox/Additions/common/crOpenGL/pack/packspu_special
@@ -107,11 +107,13 @@ VBoxPackSetInjectID
VBoxAttachThread
VBoxDetachThread
VBoxCreateContext
+VBoxConChromiumParameteriCR
VBoxWindowCreate
VBoxWindowDestroy
VBoxConCreate
VBoxConDestroy
VBoxConFlush
+VBoxPresentComposition
ChromiumParameteriCR
CompressedTexImage1DARB
CompressedTexImage2DARB
@@ -119,3 +121,12 @@ CompressedTexImage3DARB
CompressedTexSubImage1DARB
CompressedTexSubImage2DARB
CompressedTexSubImage3DARB
+GenFramebuffersEXT
+GenRenderbuffersEXT
+DeleteFramebuffersEXT
+DeleteRenderbuffersEXT
+GenBuffersARB
+DeleteBuffersARB
+StringMarkerGREMEDY
+GenTextures
+CompileShader \ No newline at end of file
diff --git a/src/VBox/Additions/common/crOpenGL/pack/packspu_texture.c b/src/VBox/Additions/common/crOpenGL/pack/packspu_texture.c
index b5c60aec..fca7fe66 100644
--- a/src/VBox/Additions/common/crOpenGL/pack/packspu_texture.c
+++ b/src/VBox/Additions/common/crOpenGL/pack/packspu_texture.c
@@ -5,7 +5,7 @@
*/
/*
- * Copyright (C) 2009 Oracle Corporation
+ * Copyright (C) 2009-2010 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -39,3 +39,32 @@ void PACKSPU_APIENTRY packspu_DeleteTextures(GLsizei n, const GLuint * textures)
crPackDeleteTextures(n, textures);
}
+void PACKSPU_APIENTRY packspu_GenTextures( GLsizei n, GLuint * textures )
+{
+ GET_THREAD(thread);
+ int writeback = 1;
+ unsigned int i;
+ if (!CRPACKSPU_IS_WDDM_CRHGSMI() && !(pack_spu.thread[pack_spu.idxThreadInUse].netServer.conn->actual_network))
+ {
+ crError( "packspu_GenTextures doesn't work when there's no actual network involved!\nTry using the simplequery SPU in your chain!" );
+ }
+ if (pack_spu.swap)
+ {
+ crPackGenTexturesSWAP( n, textures, &writeback );
+ }
+ else
+ {
+ crPackGenTextures( n, textures, &writeback );
+ }
+ packspuFlush( (void *) thread );
+ CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
+ if (pack_spu.swap)
+ {
+ for (i = 0 ; i < (unsigned int) n ; i++)
+ {
+ textures[i] = SWAP32(textures[i]);
+ }
+ }
+
+ crStateRegTextures(n, textures);
+}
diff --git a/src/VBox/Additions/common/crOpenGL/stub.c b/src/VBox/Additions/common/crOpenGL/stub.c
index 5131d4bf..5f0f3745 100644
--- a/src/VBox/Additions/common/crOpenGL/stub.c
+++ b/src/VBox/Additions/common/crOpenGL/stub.c
@@ -142,7 +142,7 @@ void APIENTRY crWindowPosition( GLint window, GLint x, GLint y )
}
}
-void APIENTRY crWindowVisibleRegion( GLint window, GLint cRects, void *pRects )
+void APIENTRY crWindowVisibleRegion( GLint window, GLint cRects, const void *pRects )
{
const WindowInfo *winInfo = (const WindowInfo *)
crHashtableSearch(stub.windowTable, (unsigned int) window);
@@ -153,6 +153,11 @@ void APIENTRY crWindowVisibleRegion( GLint window, GLint cRects, void *pRects )
}
}
+void APIENTRY crVBoxTexPresent(GLuint texture, GLuint cfg, GLint xPos, GLint yPos, GLint cRects, const GLint *pRects)
+{
+ crError("not expected!");
+}
+
void APIENTRY crWindowShow( GLint window, GLint flag )
{
WindowInfo *winInfo = (WindowInfo *)
diff --git a/src/VBox/Additions/common/crOpenGL/stub.h b/src/VBox/Additions/common/crOpenGL/stub.h
index 61ca2b92..f398e134 100644
--- a/src/VBox/Additions/common/crOpenGL/stub.h
+++ b/src/VBox/Additions/common/crOpenGL/stub.h
@@ -146,8 +146,7 @@ struct context_info_t
Bool direct;
GLXContext glxContext;
CRHashTable *pGLXPixmapsHash;
- Bool damageInitFailed;
- Display *damageDpy; /* second display connection to read xdamage extension data */
+ Bool damageQueryFailed;
int damageEventsBase;
#endif
};
@@ -222,7 +221,6 @@ typedef struct {
int trackWindowVisibleRgn;
char *spu_dir;
int force_pbuffers;
- int viewportHack;
/* thread safety stuff */
GLboolean threadSafe;
@@ -343,6 +341,9 @@ extern ContextInfo *stubNewContext( const char *dpyName, GLint visBits, ContextT
, struct VBOXUHGSMI *pHgsmi
#endif
);
+extern void stubConChromiumParameteriCR(GLint con, GLenum param, GLint value);
+extern GLboolean stubCtxCreate(ContextInfo *context);
+extern GLboolean stubCtxCheckCreate(ContextInfo *context);
extern void stubDestroyContext( unsigned long contextId );
extern GLboolean stubMakeCurrent( WindowInfo *window, ContextInfo *context );
extern GLint stubNewWindow( const char *dpyName, GLint visBits );
@@ -354,6 +355,7 @@ extern GLboolean stubIsWindowVisible(WindowInfo *win);
extern bool stubInit(void);
extern void stubForcedFlush(GLint con);
+extern void stubConFlush(GLint con);
extern void APIENTRY stub_GetChromiumParametervCR( GLenum target, GLuint index, GLenum type, GLsizei count, GLvoid *values );
extern void APIENTRY glBoundsInfoCR(const CRrecti *, const GLbyte *, GLint, GLint);
diff --git a/src/VBox/Additions/common/crOpenGL/wgl.c b/src/VBox/Additions/common/crOpenGL/wgl.c
index 71166343..a2ccf751 100644
--- a/src/VBox/Additions/common/crOpenGL/wgl.c
+++ b/src/VBox/Additions/common/crOpenGL/wgl.c
@@ -16,6 +16,8 @@
#include <windows.h>
#include <stdio.h>
+#include <iprt/cdefs.h>
+
/* Currently host part will misbehave re-creating context with proper visual bits
* if contexts with alternative visual bits is requested.
* For now we just report a superset of all visual bits to avoid that.
@@ -65,7 +67,7 @@ static GLuint ComputeVisBits( HDC hdc )
}
#endif
-int WINAPI wglChoosePixelFormat_prox( HDC hdc, CONST PIXELFORMATDESCRIPTOR *pfd )
+DECLEXPORT(int) WINAPI wglChoosePixelFormat_prox( HDC hdc, CONST PIXELFORMATDESCRIPTOR *pfd )
{
DWORD okayFlags;
@@ -162,7 +164,7 @@ int WINAPI wglChoosePixelFormat_prox( HDC hdc, CONST PIXELFORMATDESCRIPTOR *pfd
return 1;
}
-BOOL WINAPI wglSetPixelFormat_prox( HDC hdc, int pixelFormat,
+DECLEXPORT(BOOL) WINAPI wglSetPixelFormat_prox( HDC hdc, int pixelFormat,
CONST PIXELFORMATDESCRIPTOR *pdf )
{
CR_DDI_PROLOGUE();
@@ -174,14 +176,14 @@ BOOL WINAPI wglSetPixelFormat_prox( HDC hdc, int pixelFormat,
return 1;
}
-BOOL WINAPI wglDeleteContext_prox( HGLRC hglrc )
+DECLEXPORT(BOOL) WINAPI wglDeleteContext_prox( HGLRC hglrc )
{
CR_DDI_PROLOGUE();
stubDestroyContext( (unsigned long) hglrc );
return 1;
}
-BOOL WINAPI wglMakeCurrent_prox( HDC hdc, HGLRC hglrc )
+DECLEXPORT(BOOL) WINAPI wglMakeCurrent_prox( HDC hdc, HGLRC hglrc )
{
ContextInfo *context;
WindowInfo *window;
@@ -208,14 +210,14 @@ BOOL WINAPI wglMakeCurrent_prox( HDC hdc, HGLRC hglrc )
return ret;
}
-HGLRC WINAPI wglGetCurrentContext_prox( void )
+DECLEXPORT(HGLRC) WINAPI wglGetCurrentContext_prox( void )
{
ContextInfo *context = stubGetCurrentContext();
CR_DDI_PROLOGUE();
return (HGLRC) (context ? context->id : 0);
}
-HDC WINAPI wglGetCurrentDC_prox( void )
+DECLEXPORT(HDC) WINAPI wglGetCurrentDC_prox( void )
{
ContextInfo *context = stubGetCurrentContext();
CR_DDI_PROLOGUE();
@@ -225,14 +227,14 @@ HDC WINAPI wglGetCurrentDC_prox( void )
return (HDC) NULL;
}
-int WINAPI wglGetPixelFormat_prox( HDC hdc )
+DECLEXPORT(int) WINAPI wglGetPixelFormat_prox( HDC hdc )
{
CR_DDI_PROLOGUE();
/* this is what we call our generic pixelformat, regardless of the HDC */
return 1;
}
-int WINAPI wglDescribePixelFormat_prox( HDC hdc, int pixelFormat, UINT nBytes,
+DECLEXPORT(int) WINAPI wglDescribePixelFormat_prox( HDC hdc, int pixelFormat, UINT nBytes,
LPPIXELFORMATDESCRIPTOR pfd )
{
CR_DDI_PROLOGUE();
@@ -286,15 +288,37 @@ int WINAPI wglDescribePixelFormat_prox( HDC hdc, int pixelFormat, UINT nBytes,
return 1;
}
-BOOL WINAPI wglShareLists_prox( HGLRC hglrc1, HGLRC hglrc2 )
+DECLEXPORT(BOOL) WINAPI wglShareLists_prox( HGLRC hglrc1, HGLRC hglrc2 )
{
CR_DDI_PROLOGUE();
crWarning( "wglShareLists: unsupported" );
return 0;
}
+DECLEXPORT(void) WINAPI VBoxCtxChromiumParameteriCR(HGLRC hglrc, GLenum param, GLint value)
+{
+ ContextInfo *context;
+
+ CR_DDI_PROLOGUE();
+
+// crHashtableLock(stub.windowTable);
+ crHashtableLock(stub.contextTable);
+
+ context = (ContextInfo *) crHashtableSearch(stub.contextTable, (unsigned long) hglrc);
+
+ if (context)
+ {
+ stubCtxCheckCreate(context);
+ stubConChromiumParameteriCR(CR_CTX_CON(context), param, value);
+ }
+ else
+ crWarning("invalid context %#x", hglrc);
-HGLRC WINAPI VBoxCreateContext( HDC hdc, struct VBOXUHGSMI *pHgsmi )
+ crHashtableUnlock(stub.contextTable);
+// crHashtableUnlock(stub.windowTable);
+}
+
+DECLEXPORT(HGLRC) WINAPI VBoxCreateContext( HDC hdc, struct VBOXUHGSMI *pHgsmi )
{
char dpyName[MAX_DPY_NAME];
ContextInfo *context;
@@ -324,12 +348,97 @@ HGLRC WINAPI VBoxCreateContext( HDC hdc, struct VBOXUHGSMI *pHgsmi )
return (HGLRC) context->id;
}
-HGLRC WINAPI wglCreateContext_prox( HDC hdc )
+DECLEXPORT(GLint) WINAPI VBoxGetWindowId( HDC hdc )
+{
+ WindowInfo *window;
+ GLint winid = 0;
+
+ CR_DDI_PROLOGUE();
+
+ crHashtableLock(stub.windowTable);
+
+ window = stubGetWindowInfo(hdc);
+ if (!window)
+ {
+ crWarning("stubGetWindowInfo: window not found!");
+ goto end;
+ }
+ if (!window->spuWindow)
+ {
+ crWarning("stubGetWindowInfo: window is null!");
+ goto end;
+ }
+
+ winid = window->spuWindow;
+
+end:
+ crHashtableUnlock(stub.windowTable);
+ return winid;
+}
+
+DECLEXPORT(GLint) WINAPI VBoxGetContextId( HGLRC hglrc )
+{
+ ContextInfo *context;
+ GLint ctxid = 0;
+
+ CR_DDI_PROLOGUE();
+
+// crHashtableLock(stub.windowTable);
+ crHashtableLock(stub.contextTable);
+
+ context = (ContextInfo *) crHashtableSearch(stub.contextTable, (unsigned long) hglrc);
+ if (!context)
+ {
+ crWarning("crHashtableSearch: context not found!");
+ goto end;
+ }
+
+ if (context->type != CHROMIUM)
+ {
+ crWarning("unexpected context type %d", context->type);
+ goto end;
+ }
+
+ if (context->spuContext <= 0)
+ {
+ crWarning("no spuSontext defined");
+ goto end;
+ }
+
+ ctxid = context->spuContext;
+
+end:
+ crHashtableUnlock(stub.contextTable);
+ return ctxid;
+}
+
+
+DECLEXPORT(HGLRC) WINAPI wglCreateContext_prox( HDC hdc )
{
return VBoxCreateContext(hdc, NULL);
}
-BOOL WINAPI
+DECLEXPORT(void) WINAPI VBoxFlushToHost ( HGLRC hglrc )
+{
+ ContextInfo *context;
+
+ CR_DDI_PROLOGUE();
+
+// crHashtableLock(stub.windowTable);
+ crHashtableLock(stub.contextTable);
+
+ context = (ContextInfo *) crHashtableSearch(stub.contextTable, (unsigned long) hglrc);
+
+ if (context)
+ stubConFlush(CR_CTX_CON(context));
+ else
+ crWarning("invalid context %#x", hglrc);
+
+ crHashtableUnlock(stub.contextTable);
+// crHashtableUnlock(stub.windowTable);
+}
+
+DECLEXPORT(BOOL) WINAPI
wglSwapBuffers_prox( HDC hdc )
{
WindowInfo *window = stubGetWindowInfo(hdc);
@@ -338,14 +447,14 @@ wglSwapBuffers_prox( HDC hdc )
return 1;
}
-BOOL WINAPI wglCopyContext_prox( HGLRC src, HGLRC dst, UINT mask )
+DECLEXPORT(BOOL) WINAPI wglCopyContext_prox( HGLRC src, HGLRC dst, UINT mask )
{
CR_DDI_PROLOGUE();
crWarning( "wglCopyContext: unsupported" );
return 0;
}
-HGLRC WINAPI wglCreateLayerContext_prox( HDC hdc, int layerPlane )
+DECLEXPORT(HGLRC) WINAPI wglCreateLayerContext_prox( HDC hdc, int layerPlane )
{
CR_DDI_PROLOGUE();
stubInit();
@@ -353,27 +462,27 @@ HGLRC WINAPI wglCreateLayerContext_prox( HDC hdc, int layerPlane )
return 0;
}
-PROC WINAPI wglGetProcAddress_prox( LPCSTR name )
+DECLEXPORT(PROC) WINAPI wglGetProcAddress_prox( LPCSTR name )
{
CR_DDI_PROLOGUE();
return (PROC) crGetProcAddress( name );
}
-BOOL WINAPI wglUseFontBitmapsA_prox( HDC hdc, DWORD first, DWORD count, DWORD listBase )
+DECLEXPORT(BOOL) WINAPI wglUseFontBitmapsA_prox( HDC hdc, DWORD first, DWORD count, DWORD listBase )
{
CR_DDI_PROLOGUE();
crWarning( "wglUseFontBitmapsA: unsupported" );
return 0;
}
-BOOL WINAPI wglUseFontBitmapsW_prox( HDC hdc, DWORD first, DWORD count, DWORD listBase )
+DECLEXPORT(BOOL) WINAPI wglUseFontBitmapsW_prox( HDC hdc, DWORD first, DWORD count, DWORD listBase )
{
CR_DDI_PROLOGUE();
crWarning( "wglUseFontBitmapsW: unsupported" );
return 0;
}
-BOOL WINAPI wglDescribeLayerPlane_prox( HDC hdc, int pixelFormat, int layerPlane,
+DECLEXPORT(BOOL) WINAPI wglDescribeLayerPlane_prox( HDC hdc, int pixelFormat, int layerPlane,
UINT nBytes, LPLAYERPLANEDESCRIPTOR lpd )
{
CR_DDI_PROLOGUE();
@@ -381,7 +490,7 @@ BOOL WINAPI wglDescribeLayerPlane_prox( HDC hdc, int pixelFormat, int layerPlane
return 0;
}
-int WINAPI wglSetLayerPaletteEntries_prox( HDC hdc, int layerPlane, int start,
+DECLEXPORT(int) WINAPI wglSetLayerPaletteEntries_prox( HDC hdc, int layerPlane, int start,
int entries, CONST COLORREF *cr )
{
CR_DDI_PROLOGUE();
@@ -389,7 +498,7 @@ int WINAPI wglSetLayerPaletteEntries_prox( HDC hdc, int layerPlane, int start,
return 0;
}
-int WINAPI wglGetLayerPaletteEntries_prox( HDC hdc, int layerPlane, int start,
+DECLEXPORT(int) WINAPI wglGetLayerPaletteEntries_prox( HDC hdc, int layerPlane, int start,
int entries, COLORREF *cr )
{
CR_DDI_PROLOGUE();
@@ -397,21 +506,21 @@ int WINAPI wglGetLayerPaletteEntries_prox( HDC hdc, int layerPlane, int start,
return 0;
}
-BOOL WINAPI wglRealizeLayerPalette_prox( HDC hdc, int layerPlane, BOOL realize )
+DECLEXPORT(BOOL) WINAPI wglRealizeLayerPalette_prox( HDC hdc, int layerPlane, BOOL realize )
{
CR_DDI_PROLOGUE();
crWarning( "wglRealizeLayerPalette: unsupported" );
return 0;
}
-DWORD WINAPI wglSwapMultipleBuffers_prox( UINT a, CONST void *b )
+DECLEXPORT(DWORD) WINAPI wglSwapMultipleBuffers_prox( UINT a, CONST void *b )
{
CR_DDI_PROLOGUE();
crWarning( "wglSwapMultipleBuffer: unsupported" );
return 0;
}
-BOOL WINAPI wglUseFontOutlinesA_prox( HDC hdc, DWORD first, DWORD count, DWORD listBase,
+DECLEXPORT(BOOL) WINAPI wglUseFontOutlinesA_prox( HDC hdc, DWORD first, DWORD count, DWORD listBase,
FLOAT deviation, FLOAT extrusion, int format,
LPGLYPHMETRICSFLOAT gmf )
{
@@ -420,7 +529,7 @@ BOOL WINAPI wglUseFontOutlinesA_prox( HDC hdc, DWORD first, DWORD count, DWORD l
return 0;
}
-BOOL WINAPI wglUseFontOutlinesW_prox( HDC hdc, DWORD first, DWORD count, DWORD listBase,
+DECLEXPORT(BOOL) WINAPI wglUseFontOutlinesW_prox( HDC hdc, DWORD first, DWORD count, DWORD listBase,
FLOAT deviation, FLOAT extrusion, int format,
LPGLYPHMETRICSFLOAT gmf )
{
@@ -429,7 +538,7 @@ BOOL WINAPI wglUseFontOutlinesW_prox( HDC hdc, DWORD first, DWORD count, DWORD l
return 0;
}
-BOOL WINAPI wglSwapLayerBuffers_prox( HDC hdc, UINT planes )
+DECLEXPORT(BOOL) WINAPI wglSwapLayerBuffers_prox( HDC hdc, UINT planes )
{
CR_DDI_PROLOGUE();
if (planes == WGL_SWAP_MAIN_PLANE)
@@ -443,7 +552,7 @@ BOOL WINAPI wglSwapLayerBuffers_prox( HDC hdc, UINT planes )
}
}
-BOOL WINAPI wglChoosePixelFormatEXT_prox
+DECLEXPORT(BOOL) WINAPI wglChoosePixelFormatEXT_prox
(HDC hdc, const int *piAttributes, const FLOAT *pfAttributes, UINT nMaxFormats, int *piFormats, UINT *nNumFormats)
{
int *pi;
@@ -565,7 +674,7 @@ BOOL WINAPI wglChoosePixelFormatEXT_prox
return 1;
}
-BOOL WINAPI wglGetPixelFormatAttribivEXT_prox
+DECLEXPORT(BOOL) WINAPI wglGetPixelFormatAttribivEXT_prox
(HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *pValues)
{
UINT i;
@@ -700,7 +809,7 @@ BOOL WINAPI wglGetPixelFormatAttribivEXT_prox
return 1;
}
-BOOL WINAPI wglGetPixelFormatAttribfvEXT_prox
+DECLEXPORT(BOOL) WINAPI wglGetPixelFormatAttribfvEXT_prox
(HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, float *pValues)
{
UINT i;
@@ -835,13 +944,13 @@ BOOL WINAPI wglGetPixelFormatAttribfvEXT_prox
return 1;
}
-BOOL WINAPI wglSwapIntervalEXT_prox(int interval)
+DECLEXPORT(BOOL) WINAPI wglSwapIntervalEXT_prox(int interval)
{
CR_DDI_PROLOGUE();
return TRUE;
}
-int WINAPI wglGetSwapIntervalEXT_prox()
+DECLEXPORT(int) WINAPI wglGetSwapIntervalEXT_prox()
{
CR_DDI_PROLOGUE();
return 1;
@@ -849,13 +958,13 @@ int WINAPI wglGetSwapIntervalEXT_prox()
static GLubyte *gsz_wgl_extensions = "WGL_EXT_pixel_format WGL_ARB_pixel_format WGL_ARB_multisample";
-const GLubyte * WINAPI wglGetExtensionsStringEXT_prox()
+DECLEXPORT(const GLubyte *) WINAPI wglGetExtensionsStringEXT_prox()
{
CR_DDI_PROLOGUE();
return gsz_wgl_extensions;
}
-const GLubyte * WINAPI wglGetExtensionsStringARB_prox(HDC hdc)
+DECLEXPORT(const GLubyte *) WINAPI wglGetExtensionsStringARB_prox(HDC hdc)
{
CR_DDI_PROLOGUE();
(void) hdc;
diff --git a/src/VBox/Additions/common/crOpenGL/windows_getprocaddress.py b/src/VBox/Additions/common/crOpenGL/windows_getprocaddress.py
index 5de8cee9..fc167bed 100644
--- a/src/VBox/Additions/common/crOpenGL/windows_getprocaddress.py
+++ b/src/VBox/Additions/common/crOpenGL/windows_getprocaddress.py
@@ -37,7 +37,7 @@ static struct name_address functions[] = {
"""
-keys = apiutil.GetAllFunctions(sys.argv[1]+"/APIspec.txt")
+keys = apiutil.GetAllFunctionsAndOmittedAliases(sys.argv[1]+"/APIspec.txt")
for func_name in keys:
if "Chromium" == apiutil.Category(func_name):
continue
@@ -48,9 +48,16 @@ for func_name in keys:
if "GL_chromium" == apiutil.Category(func_name):
pass #continue
+ # alias is the function we're aliasing
+ proc_name = func_name
+ if "omit" in apiutil.ChromiumProps(func_name):
+ alias = apiutil.Alias(func_name)
+ if alias:
+ proc_name = alias
+
wrap = apiutil.GetCategoryWrapper(func_name)
name = "gl" + func_name
- address = "cr_gl" + func_name
+ address = "cr_gl" + proc_name
if wrap:
print '#ifdef CR_%s' % wrap
print '\t{ "%s", (CR_PROC) %s },' % (name, address)
@@ -136,18 +143,7 @@ CR_PROC CR_APIENTRY crGetProcAddress( const char *name )
if (!crStrcmp( name, "wglSwapIntervalEXT" )) return (CR_PROC) wglSwapIntervalEXT;
- /* this is needed for VSG Open Inventor stuff.
- * @todo: make all these auto-generated!!! */
- if (!crStrcmp( name, "glBeginQuery" )) return (CR_PROC) cr_glBeginQueryARB;
- if (!crStrcmp( name, "glDeleteQueries" )) return (CR_PROC) cr_glDeleteQueriesARB;
- if (!crStrcmp( name, "glEndQuery" )) return (CR_PROC) cr_glEndQueryARB;
- if (!crStrcmp( name, "glGenQueries" )) return (CR_PROC) cr_glGenQueriesARB;
- if (!crStrcmp( name, "glGetQueryObjectiv" )) return (CR_PROC) cr_glGetQueryObjectivARB;
- if (!crStrcmp( name, "glGetQueryObjectuiv" )) return (CR_PROC) cr_glGetQueryObjectuivARB;
- if (!crStrcmp( name, "glGetQueryiv" )) return (CR_PROC) cr_glGetQueryivARB;
- if (!crStrcmp( name, "glIsQuery" )) return (CR_PROC) cr_glIsQueryARB;
-
- crWarning("Returning GetProcAddress:NULL for %s", name);
+ crDebug("Returning GetProcAddress:NULL for %s", name);
return NULL;
}