Changeset 39602 in vbox for trunk/src/VBox/Additions/WINNT
- Timestamp:
- Dec 14, 2011 11:12:17 AM (13 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Wine
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Wine/Makefile.kmk
r39570 r39602 129 129 LIB_TO_DATADIR=\"\" \ 130 130 BIN_TO_DATADIR=\"\" 131 wined3d_DEFS.x86 = __i386__132 131 if "$(KBUILD_TYPE)" != "debug" || defined(VBOX_WINE_NO_DEBUG_MSGS) 133 132 wined3d_DEFS += WINE_NO_DEBUG_MSGS 134 133 endif 135 wined3d_DEFS .amd64 += VBOX_WINE_WITHOUT_LIBWINE136 wined3d_ INCS.x86 := $(PATH_SUB_CURRENT)/include137 wined3d_INCS .amd64:= vbox/libWineStub/include134 wined3d_DEFS += VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT 135 wined3d_DEFS += VBOX_WINE_WITHOUT_LIBWINE 136 wined3d_INCS := vbox/libWineStub/include 138 137 wined3d_SOURCES := \ 139 138 wined3d/arb_program_shader.c \ … … 171 170 wined3d/volumetexture.c \ 172 171 wined3d/wined3d_main.c \ 172 wined3d/vboxext.c \ 173 vbox/libWineStub/debug.c \ 173 174 wined3d/wined3d.def 174 wined3d_SOURCES.amd64 = vbox/libWineStub/debug.c 175 wined3d_LIBS.x86 = \ 176 $(PATH_STAGE_LIB)/libWine$(VBOX_SUFF_LIB) 177 wined3d_SDKS.amd64 = WINDDKWLH 175 wined3d_SDKS = WINDDKWLH 178 176 ifdef VBOX_WINE_WITH_IPRT 179 177 wined3d_LIBS += \ … … 191 189 endif 192 190 wined3dwddm_INCS = vbox/libWineStub/include 193 wined3dwddm_INCS.x86 = $(NO_SUCH_VARIABLE) 194 wined3dwddm_LIBS.x86 = $(NO_SUCH_VARIABLE) 195 wined3dwddm_DEFS = $(subst __i386__,,$(wined3d_DEFS)) VBOX_WITH_WDDM VBOX_WINE_WITHOUT_LIBWINE 196 wined3dwddm_DEFS.x86 = $(NO_SUCH_VARIABLE) 197 wined3dwddm_SOURCES = $(subst wined3d.def,wined3dwddm.def,$(wined3d_SOURCES)) vbox/libWineStub/debug.c wined3d/vboxext.c vbox/VBoxDbgGl.c 198 wined3dwddm_SOURCES.x86 = $(NO_SUCH_VARIABLE) 199 wined3dwddm_SOURCES.amd64 = $(NO_SUCH_VARIABLE) 200 wined3dwddm_SDKS = WINDDKWLH 201 wined3dwddm_SDKS.amd64 = $(NO_SUCH_VARIABLE) 202 #VBOX_WINE_WITH_IPRT is used for debugging currently to enable Assert & stuff 203 #ifdef VBOX_WINE_WITH_IPRT 204 #wined3dwddm_LIBS += \ 205 $(VBOX_LIB_IPRT_GUEST_R3) \ 206 $(VBOX_LIB_VBGL_R3) 207 #wined3dwddm_DEFS += VBOX_WINE_WITH_IPRT 208 #endif 209 wined3dwddm_DEFS += VBOX_WINE_WITH_SINGLE_CONTEXT 191 wined3dwddm_DEFS = $(subst VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT,,$(wined3d_DEFS)) 192 wined3dwddm_DEFS += VBOX_WITH_WDDM VBOX_WINE_WITH_SINGLE_CONTEXT 193 wined3dwddm_SOURCES = $(subst wined3d.def,wined3dwddm.def,$(wined3d_SOURCES)) vbox/VBoxDbgGl.c 210 194 211 195 DLLS.amd64 += wined3dwddm-x86 … … 230 214 LIB_TO_DATADIR=\"\" \ 231 215 BIN_TO_DATADIR=\"\" 232 VBoxD3D8_DEFS.x86 = __i386__233 216 if "$(KBUILD_TYPE)" != "debug" || defined(VBOX_WINE_NO_DEBUG_MSGS) 234 217 VBoxD3D8_DEFS += WINE_NO_DEBUG_MSGS 235 218 endif 236 VBoxD3D8_DEFS.amd64 += VBOX_WINE_WITHOUT_LIBWINE 237 VBoxD3D8_INCS.x86 := $(PATH_SUB_CURRENT)/include 238 VBoxD3D8_INCS.amd64 := vbox/libWineStub/include 239 VBoxD3D8_SOURCES := \ 219 VBoxD3D8_DEFS += VBOX_WINE_WITHOUT_LIBWINE 220 VBoxD3D8_INCS := vbox/libWineStub/include 221 VBoxD3D8_SOURCES := \ 240 222 d3d8/cubetexture.c \ 241 223 d3d8/d3d8_main.c \ … … 252 234 d3d8/volume.c \ 253 235 d3d8/volumetexture.c \ 236 vbox/libWineStub/debug.c \ 254 237 d3d8/d3d8.def 255 VBoxD3D8_LIBS.x86 = \ 256 $(PATH_STAGE_LIB)/libWine$(VBOX_SUFF_LIB) 257 VBoxD3D8_LIBS = \ 238 VBoxD3D8_LIBS = \ 258 239 $(PATH_STAGE_LIB)/wined3d$(VBOX_SUFF_LIB) 259 VBoxD3D8_SOURCES.amd64 = vbox/libWineStub/debug.c 260 VBoxD3D8_SDKS.amd64 = WINDDKWLH 240 VBoxD3D8_SDKS = WINDDKWLH 261 241 ifdef VBOX_WINE_WITH_IPRT 262 242 VBoxD3D8_LIBS += \ … … 277 257 LIB_TO_DATADIR=\"\" \ 278 258 BIN_TO_DATADIR=\"\" 279 VBoxD3D9_DEFS.x86 = __i386__280 259 if "$(KBUILD_TYPE)" != "debug" || defined(VBOX_WINE_NO_DEBUG_MSGS) 281 VBoxD3D9_DEFS += WINE_NO_DEBUG_MSGS 282 endif 283 VBoxD3D9_DEFS.amd64 += VBOX_WINE_WITHOUT_LIBWINE 284 VBoxD3D9_INCS.x86 := $(PATH_SUB_CURRENT)/include 285 VBoxD3D9_INCS.amd64 := vbox/libWineStub/include 260 VBoxD3D9_DEFS += WINE_NO_DEBUG_MSGS 261 endif 262 VBoxD3D9_DEFS += VBOX_WINE_WITHOUT_LIBWINE 263 VBoxD3D9_INCS := vbox/libWineStub/include 286 264 VBoxD3D9_SOURCES := \ 287 265 d3d9/cubetexture.c \ … … 300 278 d3d9/vertexshader.c \ 301 279 d3d9/volume.c \ 302 d3d9/volumetexture.c 303 304 VBoxD3D9_SOURCES.x86 = \ 305 d3d9/d3d9.def 306 VBoxD3D9_SOURCES.amd64 = \ 307 vbox/libWineStub/debug.c \ 308 d3d9/d3d9xpdm.def 309 VBoxD3D9_LIBS.x86 = \ 310 $(PATH_STAGE_LIB)/libWine$(VBOX_SUFF_LIB) 280 d3d9/volumetexture.c \ 281 vbox/libWineStub/debug.c \ 282 d3d9/d3d9xpdm.def 311 283 VBoxD3D9_LIBS = \ 312 284 $(PATH_STAGE_LIB)/wined3d$(VBOX_SUFF_LIB) 313 VBoxD3D9_SDKS .amd64= WINDDKWLH285 VBoxD3D9_SDKS = WINDDKWLH 314 286 ifdef VBOX_WINE_WITH_IPRT 315 287 VBoxD3D9_LIBS += \ … … 327 299 endif 328 300 VBoxD3D9wddm_INCS = vbox/libWineStub/include 329 VBoxD3D9wddm_INCS.x86 = $(NO_SUCH_VARIABLE) 330 VBoxD3D9wddm_DEFS.x86 = $(NO_SUCH_VARIABLE) 331 VBoxD3D9wddm_DEFS += $(subst __i386__,,$(VBoxD3D9_DEFS)) VBOX_WITH_WDDM VBOX_WINE_WITHOUT_LIBWINE IN_VBOXWINEEX 332 VBoxD3D9wddm_SOURCES = $(VBoxD3D9_SOURCES) d3d9/d3d9wddm.def vbox/libWineStub/debug.c 333 VBoxD3D9wddm_SOURCES.x86 = $(NO_SUCH_VARIABLE) 334 VBoxD3D9wddm_SOURCES.amd64 = $(NO_SUCH_VARIABLE) 301 VBoxD3D9wddm_DEFS += $(VBoxD3D9_DEFS) VBOX_WITH_WDDM VBOX_WINE_WITHOUT_LIBWINE IN_VBOXWINEEX 302 VBoxD3D9wddm_SOURCES = $(subst d3d9xpdm.def,d3d9wddm.def,$(VBoxD3D9_SOURCES)) 335 303 VBoxD3D9wddm_LIBS = $(subst $(PATH_STAGE_LIB)/wined3d$(VBOX_SUFF_LIB),$(PATH_STAGE_LIB)/wined3dwddm$(VBOX_SUFF_LIB),$(VBoxD3D9_LIBS)) 336 VBoxD3D9wddm_LIBS.x86 = $(NO_SUCH_VARIABLE)337 VBoxD3D9wddm_SDKS = WINDDKWLH338 VBoxD3D9wddm_SDKS.amd64 = $(NO_SUCH_VARIABLE)339 304 #ifdef VBOX_WINE_WITH_IPRT 340 305 #VBoxD3D9wddm_LIBS += \ -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/device.c
r39570 r39602 478 478 return ret; 479 479 } 480 #ifdef VBOX_WITH_WDDM 480 481 481 static HRESULT IDirect3DDevice9Impl_DoCreateAdditionalSwapChain(IDirect3DDevice9Ex *iface, 482 482 D3DPRESENT_PARAMETERS *present_parameters, IDirect3DSwapChain9 **swapchain) 483 #else484 static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_CreateAdditionalSwapChain(IDirect3DDevice9Ex *iface,485 D3DPRESENT_PARAMETERS *present_parameters, IDirect3DSwapChain9 **swapchain)486 #endif487 483 { 488 484 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; … … 514 510 } 515 511 516 #ifdef VBOX_WITH_WDDM517 512 static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_CreateAdditionalSwapChain(IDirect3DDevice9Ex *iface, 518 513 D3DPRESENT_PARAMETERS *present_parameters, IDirect3DSwapChain9 **swapchain) … … 541 536 return D3D_OK; 542 537 } 543 #endif544 538 545 539 static HRESULT WINAPI reset_enum_callback(IWineD3DResource *resource, void *data) { … … 3111 3105 local_parameters.PresentationInterval = present_parameters->PresentationInterval; 3112 3106 3113 #ifdef VBOX_WITH_WDDM3114 3107 hr = IDirect3DDevice9Impl_DoCreateAdditionalSwapChain((IDirect3DDevice9Ex *)This, 3115 3108 &local_parameters, (IDirect3DSwapChain9 **)&d3d_swapchain); 3116 #else3117 hr = IDirect3DDevice9Impl_CreateAdditionalSwapChain((IDirect3DDevice9Ex *)This,3118 &local_parameters, (IDirect3DSwapChain9 **)&d3d_swapchain);3119 #endif3120 3109 if (FAILED(hr)) 3121 3110 { -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/directx.c
r39570 r39602 434 434 /* fixup caps */ 435 435 #ifdef VBOX_WITH_WDDM 436 /* needed for Windows Media Player to work properly */ 437 pCaps->Caps |= D3DCAPS_READ_SCANLINE; 436 438 pCaps->Caps2 |= 0x00080000 /*D3DCAPS2_CANRENDERWINDOWED*/; 437 439 pCaps->Caps2 |= D3DCAPS2_CANSHARERESOURCE; … … 482 484 #endif 483 485 484 /* needed for Windows Media Player to work properly */485 pCaps->Caps |= D3DCAPS_READ_SCANLINE;486 487 486 TRACE("(%p) returning %p\n", This, pCaps); 488 487 -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/include/wine/wined3d.h
r38982 r39602 7395 7395 ) = 0; 7396 7396 7397 virtual HRESULT STDMETHODCALLTYPE AddSwapChain( 7398 IWineD3DSwapChain *swapchain) = 0; 7399 7400 virtual HRESULT STDMETHODCALLTYPE RemoveSwapChain( 7401 IWineD3DSwapChain *swapchain) = 0; 7402 7397 7403 #ifdef VBOX_WITH_WDDM 7398 7404 virtual HRESULT STDMETHODCALLTYPE Flush( 7399 7405 ) = 0; 7400 7401 virtual HRESULT STDMETHODCALLTYPE AddSwapChain(7402 IWineD3DSwapChain *swapchain) = 0;7403 7404 virtual HRESULT STDMETHODCALLTYPE RemoveSwapChain(7405 IWineD3DSwapChain *swapchain) = 0;7406 7406 #endif 7407 7407 }; … … 8170 8170 IWineD3DDevice* This); 8171 8171 8172 HRESULT (STDMETHODCALLTYPE *AddSwapChain)( 8173 IWineD3DDevice* This, 8174 IWineD3DSwapChain *swapchain); 8175 8176 HRESULT (STDMETHODCALLTYPE *RemoveSwapChain)( 8177 IWineD3DDevice* This, 8178 IWineD3DSwapChain *swapchain); 8179 8172 8180 #ifdef VBOX_WITH_WDDM 8173 8181 HRESULT (STDMETHODCALLTYPE *Flush)( 8174 8182 IWineD3DDevice* This); 8175 8176 HRESULT (STDMETHODCALLTYPE *AddSwapChain)(8177 IWineD3DDevice* This,8178 IWineD3DSwapChain *swapchain);8179 8180 HRESULT (STDMETHODCALLTYPE *RemoveSwapChain)(8181 IWineD3DDevice* This,8182 IWineD3DSwapChain *swapchain);8183 8183 #endif 8184 8184 … … 8342 8342 #define IWineD3DDevice_AcquireFocusWindow(This,window) (This)->lpVtbl->AcquireFocusWindow(This,window) 8343 8343 #define IWineD3DDevice_ReleaseFocusWindow(This) (This)->lpVtbl->ReleaseFocusWindow(This) 8344 #define IWineD3DDevice_AddSwapChain(This,swapchain) (This)->lpVtbl->AddSwapChain(This,swapchain) 8345 #define IWineD3DDevice_RemoveSwapChain(This,swapchain) (This)->lpVtbl->RemoveSwapChain(This,swapchain) 8344 8346 #ifdef VBOX_WITH_WDDM 8345 8347 #define IWineD3DDevice_Flush(This) (This)->lpVtbl->Flush(This) 8346 #define IWineD3DDevice_AddSwapChain(This,swapchain) (This)->lpVtbl->AddSwapChain(This,swapchain)8347 #define IWineD3DDevice_RemoveSwapChain(This,swapchain) (This)->lpVtbl->RemoveSwapChain(This,swapchain)8348 8348 #endif 8349 8349 #endif -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/vbox/libWineStub/include/wine/debug.h
r39570 r39602 121 121 #ifndef WINE_NO_DEBUG_MSGS 122 122 # define __WINE_GET_DEBUGGING_WARN(dbch) ((dbch)->flags & (1 << __WINE_DBCL_WARN)) 123 # if 0// && defined( VBOX_WITH_WDDM) && defined(DEBUG_misha)123 # if 0// && defined(DEBUG_misha) 124 124 # define __WINE_GET_DEBUGGING_FIXME(dbch) (RT_BREAKPOINT(), ((dbch)->flags & (1 << __WINE_DBCL_FIXME))) 125 125 # else … … 128 128 #else 129 129 # define __WINE_GET_DEBUGGING_WARN(dbch) 0 130 # if 0 && defined( VBOX_WITH_WDDM) && defined(DEBUG_misha)130 # if 0 && defined(DEBUG_misha) 131 131 # define __WINE_GET_DEBUGGING_FIXME(dbch) (RT_BREAKPOINT(), 0) 132 132 # else … … 136 136 137 137 /* define error macro regardless of what is configured */ 138 #if defined( VBOX_WITH_WDDM) && defined(DEBUG_misha)138 #if defined(DEBUG_misha) 139 139 #define __WINE_GET_DEBUGGING_ERR(dbch) (RT_BREAKPOINT(), ((dbch)->flags & (1 << __WINE_DBCL_ERR))) 140 140 #else -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/vbox/libWineStub/include/wine/wined3d.h
r38982 r39602 7393 7393 ) = 0; 7394 7394 7395 virtual HRESULT STDMETHODCALLTYPE AddSwapChain( 7396 IWineD3DSwapChain *swapchain) = 0; 7397 7398 virtual HRESULT STDMETHODCALLTYPE RemoveSwapChain( 7399 IWineD3DSwapChain *swapchain) = 0; 7400 7395 7401 #ifdef VBOX_WITH_WDDM 7396 7402 virtual HRESULT STDMETHODCALLTYPE Flush( 7397 7403 ) = 0; 7398 7399 virtual HRESULT STDMETHODCALLTYPE AddSwapChain(7400 IWineD3DSwapChain *swapchain) = 0;7401 7402 virtual HRESULT STDMETHODCALLTYPE RemoveSwapChain(7403 IWineD3DSwapChain *swapchain) = 0;7404 7404 #endif 7405 7405 }; … … 8168 8168 IWineD3DDevice* This); 8169 8169 8170 HRESULT (STDMETHODCALLTYPE *AddSwapChain)( 8171 IWineD3DDevice* This, 8172 IWineD3DSwapChain *swapchain); 8173 8174 HRESULT (STDMETHODCALLTYPE *RemoveSwapChain)( 8175 IWineD3DDevice* This, 8176 IWineD3DSwapChain *swapchain); 8177 8170 8178 #ifdef VBOX_WITH_WDDM 8171 8179 HRESULT (STDMETHODCALLTYPE *Flush)( 8172 8180 IWineD3DDevice* This); 8173 8174 HRESULT (STDMETHODCALLTYPE *AddSwapChain)(8175 IWineD3DDevice* This,8176 IWineD3DSwapChain *swapchain);8177 8178 HRESULT (STDMETHODCALLTYPE *RemoveSwapChain)(8179 IWineD3DDevice* This,8180 IWineD3DSwapChain *swapchain);8181 8181 #endif 8182 8182 … … 8340 8340 #define IWineD3DDevice_AcquireFocusWindow(This,window) (This)->lpVtbl->AcquireFocusWindow(This,window) 8341 8341 #define IWineD3DDevice_ReleaseFocusWindow(This) (This)->lpVtbl->ReleaseFocusWindow(This) 8342 #define IWineD3DDevice_AddSwapChain(This,swapchain) (This)->lpVtbl->AddSwapChain(This,swapchain) 8343 #define IWineD3DDevice_RemoveSwapChain(This,swapchain) (This)->lpVtbl->RemoveSwapChain(This,swapchain) 8342 8344 #ifdef VBOX_WITH_WDDM 8343 8345 #define IWineD3DDevice_Flush(This) (This)->lpVtbl->Flush(This) 8344 #define IWineD3DDevice_AddSwapChain(This,swapchain) (This)->lpVtbl->AddSwapChain(This,swapchain)8345 #define IWineD3DDevice_RemoveSwapChain(This,swapchain) (This)->lpVtbl->RemoveSwapChain(This,swapchain)8346 8346 #endif 8347 8347 #endif -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/context.c
r39501 r39602 42 42 static DWORD wined3d_context_tls_idx; 43 43 44 #if defined(VBOX_WINE_WITH_SINGLE_CONTEXT) || defined(VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT) 45 # define vboxGetCurrentContext() VBoxTlsRefGetCurrent(struct wined3d_context, wined3d_context_tls_idx) 46 # define vboxSetCurrentContext(_ctx) VBoxTlsRefSetCurrent(struct wined3d_context, wined3d_context_tls_idx, (_ctx)) 47 #endif 48 44 49 /* FBO helper functions */ 45 50 … … 808 813 if (context->valid) 809 814 { 810 if (! ReleaseDC(context->win_handle, context->hdc))815 if (!VBoxExtReleaseDC(context->win_handle, context->hdc)) 811 816 { 812 817 ERR("Failed to release device context %p, last error %#x.\n", … … 817 822 818 823 context->win_handle = context->swapchain->win_handle; 819 if (!(context->hdc = GetDC(context->win_handle)))824 if (!(context->hdc = VBoxExtGetDC(context->win_handle))) 820 825 { 821 826 ERR("Failed to get a device context for window %p.\n", context->win_handle); … … 1051 1056 #ifndef VBOX_WINE_WITH_SINGLE_CONTEXT 1052 1057 # ifndef VBOX_WITH_WDDM 1053 ReleaseDC(context->win_handle, context->hdc);1058 VBoxExtReleaseDC(context->win_handle, context->hdc); 1054 1059 # else 1055 1060 VBoxExtReleaseDC(context->win_handle, context->hdc); … … 1073 1078 } 1074 1079 1075 #if def VBOX_WINE_WITH_SINGLE_CONTEXT1080 #if defined(VBOX_WINE_WITH_SINGLE_CONTEXT) || defined(VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT) 1076 1081 static struct wined3d_context *context_get_current_ex(DWORD adjustTid) 1077 1082 { 1078 struct wined3d_context *ctx = TlsGetValue(wined3d_context_tls_idx);1083 struct wined3d_context *ctx = vboxGetCurrentContext(); 1079 1084 if (!adjustTid) 1080 1085 return ctx; … … 1093 1098 struct wined3d_context *context_get_current(void) 1094 1099 { 1095 #if ndef VBOX_WINE_WITH_SINGLE_CONTEXT1100 #if !defined(VBOX_WINE_WITH_SINGLE_CONTEXT) && !defined(VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT) 1096 1101 return TlsGetValue(wined3d_context_tls_idx); 1097 1102 #else … … 1104 1109 BOOL context_set_current(struct wined3d_context *ctx) 1105 1110 { 1106 #if def VBOX_WINE_WITH_SINGLE_CONTEXT1111 #if defined(VBOX_WINE_WITH_SINGLE_CONTEXT) || defined(VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT) 1107 1112 struct wined3d_context *old = context_get_current_ex(0); 1108 1113 DWORD tid = GetCurrentThreadId(); … … 1112 1117 if (old == ctx) 1113 1118 { 1114 #if def VBOX_WINE_WITH_SINGLE_CONTEXT1119 #if defined(VBOX_WINE_WITH_SINGLE_CONTEXT) || defined(VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT) 1115 1120 if (ctx && ctx->tid != tid) 1116 1121 { … … 1127 1132 if (old) 1128 1133 { 1129 #if def VBOX_WINE_WITH_SINGLE_CONTEXT1134 #if defined(VBOX_WINE_WITH_SINGLE_CONTEXT) || defined(VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT) 1130 1135 old->tid = 0; 1131 #endif 1136 old->current = 0; 1137 #else 1132 1138 if (old->destroyed) 1133 1139 { … … 1140 1146 old->current = 0; 1141 1147 } 1148 #endif 1142 1149 } 1143 1150 … … 1151 1158 ERR("Failed to make GL context %p current on device context %p, last error %#x.\n", 1152 1159 ctx->glCtx, ctx->currentSwapchain->hDC, err); 1153 TlsSetValue(wined3d_context_tls_idx,NULL);1160 vboxSetCurrentContext(NULL); 1154 1161 return FALSE; 1155 1162 } … … 1161 1168 ERR("Failed to make GL context %p current on device context %p, last error %#x.\n", 1162 1169 ctx->glCtx, ctx->hdc, err); 1163 TlsSetValue(wined3d_context_tls_idx,NULL);1170 vboxSetCurrentContext(NULL); 1164 1171 return FALSE; 1165 1172 } … … 1174 1181 DWORD err = GetLastError(); 1175 1182 ERR("Failed to clear current GL context, last error %#x.\n", err); 1176 TlsSetValue(wined3d_context_tls_idx,NULL);1183 vboxSetCurrentContext(NULL); 1177 1184 return FALSE; 1178 1185 } 1179 1186 } 1180 1187 1181 #if ndef VBOX_WINE_WITH_SINGLE_CONTEXT1188 #if !defined(VBOX_WINE_WITH_SINGLE_CONTEXT) && !defined(VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT) 1182 1189 return TlsSetValue(wined3d_context_tls_idx, ctx); 1183 1190 #else 1184 if (TlsSetValue(wined3d_context_tls_idx, ctx)) 1185 { 1186 if (ctx) 1187 { 1188 ctx->tid = tid; 1189 } 1190 return TRUE; 1191 } 1192 else 1193 { 1194 DWORD err = GetLastError(); 1195 ERR("Failed to set tls value, last error %#x.\n", err); 1196 } 1197 return FALSE; 1198 #endif 1199 } 1191 vboxSetCurrentContext(ctx); 1192 if (ctx) 1193 ctx->tid = tid; 1194 return TRUE; 1195 #endif 1196 } 1197 1198 #if defined(VBOX_WINE_WITH_SINGLE_CONTEXT) || defined(VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT) 1199 void context_clear_on_thread_detach() 1200 { 1201 /* In theory, we should do context_set_current(NULL) here, 1202 * but since it may result in calling a context dtor, it should be done under wined3d lock. 1203 * We can not acquire a wined3d lock here since this routine is called in a DllMain context 1204 * and this would result in a lock order violation, which may result in a deadlock. 1205 * In other words, wined3d may internally call Win32 API functions which result in 1206 * a DLL lock acquisition while holding wined3d lock. 1207 * So lock order should always be "wined3d lock" -> "dll lock". 1208 * 1209 * This is why we do the following: 1210 * */ 1211 1212 /* 1. get the current context w/o adjusting its thread id, etc. */ 1213 struct wined3d_context *old = context_get_current_ex(0); 1214 if (!old) 1215 return; 1216 1217 /* there is a currently assigned context, 1218 * 2. now increase its ref count to ensure its dtor routine is not called while making set_current(NULL). 1219 * This is needed since dtor can only be run with a wined3d lock held */ 1220 VBoxTlsRefAddRef(old); 1221 1222 /* 3. now we can call context_set_current(NULL) */ 1223 context_set_current(NULL); 1224 1225 /* 4. to avoid possible deadlocks we make an asynchronous call to a worker thread to make 1226 * wined3d lock - context release - wined3d unlock from there. */ 1227 VBoxExtReleaseContextAsync(old); 1228 } 1229 #endif 1200 1230 1201 1231 void context_release(struct wined3d_context *context) … … 1220 1250 context->restore_ctx, context->restore_dc, err); 1221 1251 } 1222 #ifdef VBOX_WITH_WDDM1223 1252 else 1224 1253 { … … 1228 1257 if (current_context && current_context->glCtx != context->restore_ctx) 1229 1258 { 1259 #ifdef VBOX_WITH_WDDM 1230 1260 IWineD3DDeviceImpl *device = context->device; 1261 #else 1262 IWineD3DDeviceImpl *device = context->swapchain->device; 1263 #endif 1231 1264 UINT i = 0; 1232 1265 for (; i < device->numContexts; ++i) … … 1246 1279 } 1247 1280 } 1248 #endif1249 1281 1250 1282 context->restore_ctx = NULL; … … 1469 1501 } 1470 1502 1503 #if defined(VBOX_WINE_WITH_SINGLE_CONTEXT) || defined(VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT) 1504 static DECLCALLBACK(void) context_tls_dtor(void* pvCtx) 1505 { 1506 struct wined3d_context * context = (struct wined3d_context *)pvCtx; 1507 context_destroy_gl_resources(context); 1508 HeapFree(GetProcessHeap(), 0, context); 1509 } 1510 #endif 1471 1511 1472 1512 /***************************************************************************** … … 1507 1547 } 1508 1548 1549 #if defined(VBOX_WINE_WITH_SINGLE_CONTEXT) || defined(VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT) 1550 VBoxTlsRefInit(ret, context_tls_dtor); 1551 #endif 1552 1509 1553 if (!(hdc = 1510 1554 #ifdef VBOX_WINE_WITH_SINGLE_CONTEXT 1511 1555 swapchain->hDC 1512 1556 #else 1513 GetDC(swapchain->win_handle)1557 VBoxExtGetDC(swapchain->win_handle) 1514 1558 #endif 1515 1559 ) … … 1635 1679 #endif 1636 1680 ret->current_rt = (IWineD3DSurface *)target; 1637 #if ndef VBOX_WINE_WITH_SINGLE_CONTEXT1681 #if !defined(VBOX_WINE_WITH_SINGLE_CONTEXT) && !defined(VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT) 1638 1682 ret->tid = GetCurrentThreadId(); 1639 1683 #endif … … 1785 1829 } 1786 1830 1787 #ifdef VBOX_WITH_WDDM 1831 /* for WDDM case this is used for shared resource handling 1832 * 1833 * for XPDM this is needed to at least support texture sharing between device contexts. 1834 * this is a kinda hack, but it is needed since our ogl driver currently does not support ShareLists */ 1788 1835 GL_EXTCALL(glChromiumParameteriCR(GL_SHARE_CONTEXT_RESOURCES_CR, GL_TRUE)); 1836 #if defined(VBOX_WITH_WDDM) || defined(VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT) 1789 1837 GL_EXTCALL(glChromiumParameteriCR(GL_FLUSH_ON_THREAD_SWITCH_CR, GL_TRUE)); 1790 1838 #endif 1791 1792 1839 LEAVE_GL(); 1793 1840 … … 1886 1933 } 1887 1934 #else 1935 # ifdef VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT 1936 # error "Port Me!" 1937 # endif 1888 1938 context = device->numContexts ? device->contexts[0] : NULL; 1889 1939 #endif … … 1925 1975 void context_destroy(IWineD3DDeviceImpl *This, struct wined3d_context *context) 1926 1976 { 1977 #if !defined(VBOX_WINE_WITH_SINGLE_CONTEXT) && !defined(VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT) 1927 1978 BOOL destroy; 1979 #endif 1928 1980 1929 1981 TRACE("Destroying ctx %p\n", context); 1930 1982 1983 #if !defined(VBOX_WINE_WITH_SINGLE_CONTEXT) && !defined(VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT) 1931 1984 if (context->tid == GetCurrentThreadId() || !context->current) 1932 1985 { … … 1940 1993 destroy = FALSE; 1941 1994 } 1995 #endif 1942 1996 1943 1997 HeapFree(GetProcessHeap(), 0, context->vshader_const_dirty); 1944 1998 HeapFree(GetProcessHeap(), 0, context->pshader_const_dirty); 1945 1999 device_context_remove(This, context); 2000 #ifndef VBOX_WITH_WDDM 2001 context->swapchain = NULL; 2002 #endif 2003 #if !defined(VBOX_WINE_WITH_SINGLE_CONTEXT) && !defined(VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT) 1946 2004 if (destroy) HeapFree(GetProcessHeap(), 0, context); 1947 # ifndef VBOX_WITH_WDDM1948 else context->swapchain = NULL;2005 #else 2006 VBoxTlsRefRelease(context); 1949 2007 #endif 1950 2008 } … … 2186 2244 *****************************************************************************/ 2187 2245 static struct wined3d_context *findThreadContextForSwapChain(IWineD3DSwapChain *swapchain 2188 #if ndef VBOX_WINE_WITH_SINGLE_CONTEXT2246 #if !defined(VBOX_WINE_WITH_SINGLE_CONTEXT) && !defined(VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT) 2189 2247 , DWORD tid 2190 2248 #endif … … 2201 2259 for (i = 0; i < device->numContexts; ++i) 2202 2260 { 2261 # ifdef VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT 2262 # error "port me!" 2263 # endif 2203 2264 if (device->contexts[i]->tid == tid) 2204 2265 return device->contexts[i]; … … 2206 2267 # else 2207 2268 for(i = 0; i < ((IWineD3DSwapChainImpl *) swapchain)->num_contexts; i++) { 2269 # ifdef VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT 2270 if(VBoxTlsRefIsFunctional(((IWineD3DSwapChainImpl *) swapchain)->context[i])) { 2271 # else 2208 2272 if(((IWineD3DSwapChainImpl *) swapchain)->context[i]->tid == tid) { 2273 # endif 2209 2274 return ((IWineD3DSwapChainImpl *) swapchain)->context[i]; 2210 2275 } … … 2234 2299 IWineD3DSwapChain *swapchain = NULL; 2235 2300 struct wined3d_context *current_context = context_get_current(); 2236 #ifndef VBOX_WINE_WITH_SINGLE_ CONTEXT2301 #ifndef VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT 2237 2302 DWORD tid = GetCurrentThreadId(); 2238 2303 #endif 2239 2304 struct wined3d_context *context; 2240 2305 2241 if (current_context && current_context->destroyed) current_context = NULL; 2306 if (current_context 2307 #ifndef VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT 2308 && current_context->destroyed 2309 #else 2310 && !VBoxTlsRefIsFunctional(current_context) 2311 #endif 2312 ) current_context = NULL; 2242 2313 2243 2314 if (!target) … … 2287 2358 2288 2359 context = findThreadContextForSwapChain(swapchain 2289 #ifndef VBOX_WINE_WITH_SINGLE_ CONTEXT2360 #ifndef VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT 2290 2361 , tid 2291 2362 #endif … … 2315 2386 #ifdef VBOX_WITH_WDDM /* tmp work-around */ 2316 2387 context = findThreadContextForSwapChain(This->swapchains[This->NumberOfSwapChains-1] 2317 # ifndef VBOX_WINE_WITH_SINGLE_ CONTEXT2388 # ifndef VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT 2318 2389 , tid 2319 2390 # endif 2320 2391 ); 2321 2392 #else 2322 context = findThreadContextForSwapChain(This->swapchains[0], tid); 2393 context = findThreadContextForSwapChain(This->swapchains[0] 2394 # ifndef VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT 2395 , tid 2396 # endif 2397 ); 2323 2398 #endif 2324 2399 } … … 2355 2430 2356 2431 2357 if (context && context->destroyed)2432 if (context && !VBoxTlsRefIsFunctional(context)) 2358 2433 { 2359 2434 ERR("context is destroyed"); … … 2753 2828 context_setup_target(device, context, target); 2754 2829 context_enter(context); 2755 if (!context->valid) return context; 2830 if (!context->valid) 2831 { 2832 ERR("context_acquire failed to get a valid context!"); 2833 return context; 2834 } 2756 2835 2757 2836 if (context != current_context) … … 2792 2871 } 2793 2872 2873 #ifdef DEBUG 2874 Assert(context->tid == GetCurrentThreadId()); 2875 #endif 2876 2794 2877 context_apply_state(context, device, usage); 2795 2878 2879 #ifdef DEBUG 2880 Assert(context->tid == GetCurrentThreadId()); 2881 #endif 2882 2796 2883 return context; 2797 2884 } -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/device.c
r38982 r39602 6922 6922 } 6923 6923 6924 static HRESULT WINAPI IWineD3DDeviceImpl_AddSwapChain(IWineD3DDevice *iface, IWineD3DSwapChain *swapchain) 6925 { 6926 IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; 6927 VOID *pvNewBuf = HeapReAlloc(GetProcessHeap(), 0, This->swapchains, (This->NumberOfSwapChains + 1) * sizeof(IWineD3DSwapChain *)); 6928 if(!pvNewBuf) { 6929 ERR("Out of memory!\n"); 6930 return E_OUTOFMEMORY; 6931 } 6932 This->swapchains = (IWineD3DSwapChain **)pvNewBuf; 6933 This->swapchains[This->NumberOfSwapChains] = swapchain; 6934 ++This->NumberOfSwapChains; 6935 return WINED3D_OK; 6936 } 6937 6938 static HRESULT WINAPI IWineD3DDeviceImpl_RemoveSwapChain(IWineD3DDevice *iface, IWineD3DSwapChain *swapchain) 6939 { 6940 IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; 6941 int i; 6942 for (i = 0; i < This->NumberOfSwapChains; ++i) 6943 { 6944 if (This->swapchains[i] == swapchain) 6945 { 6946 break; 6947 } 6948 } 6949 6950 if (i == This->NumberOfSwapChains) 6951 { 6952 WARN("swapchain 0x%p is not part of device 0x%p\n", swapchain, iface); 6953 return E_INVALIDARG; 6954 } 6955 6956 --This->NumberOfSwapChains; 6957 if (This->NumberOfSwapChains) 6958 { 6959 IWineD3DSwapChain **pvNewBuf = (IWineD3DSwapChain **)HeapAlloc(GetProcessHeap(), 0, (This->NumberOfSwapChains) * sizeof(IWineD3DSwapChain *)); 6960 if(!pvNewBuf) { 6961 ERR("Out of memory!\n"); 6962 return E_OUTOFMEMORY; 6963 } 6964 if (i) { 6965 memcpy (pvNewBuf, This->swapchains, i*sizeof(IWineD3DSwapChain *)); 6966 } 6967 if (i < This->NumberOfSwapChains) { 6968 memcpy (pvNewBuf + i, This->swapchains +i+1, (This->NumberOfSwapChains - i)*sizeof(IWineD3DSwapChain *)); 6969 } 6970 6971 This->swapchains = pvNewBuf; 6972 } 6973 else 6974 { 6975 while (This->numContexts) 6976 { 6977 context_destroy(This, This->contexts[0]); 6978 } 6979 } 6980 return WINED3D_OK; 6981 } 6982 6924 6983 #ifdef VBOX_WITH_WDDM 6925 6984 static HRESULT WINAPI IWineD3DDeviceImpl_Flush(IWineD3DDevice *iface) … … 6948 7007 { 6949 7008 WARN("Invalid context, skipping flush.\n"); 6950 }6951 }6952 return WINED3D_OK;6953 }6954 6955 static HRESULT WINAPI IWineD3DDeviceImpl_AddSwapChain(IWineD3DDevice *iface, IWineD3DSwapChain *swapchain)6956 {6957 IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;6958 VOID *pvNewBuf = HeapReAlloc(GetProcessHeap(), 0, This->swapchains, (This->NumberOfSwapChains + 1) * sizeof(IWineD3DSwapChain *));6959 if(!pvNewBuf) {6960 ERR("Out of memory!\n");6961 return E_OUTOFMEMORY;6962 }6963 This->swapchains = (IWineD3DSwapChain **)pvNewBuf;6964 This->swapchains[This->NumberOfSwapChains] = swapchain;6965 ++This->NumberOfSwapChains;6966 return WINED3D_OK;6967 }6968 6969 static HRESULT WINAPI IWineD3DDeviceImpl_RemoveSwapChain(IWineD3DDevice *iface, IWineD3DSwapChain *swapchain)6970 {6971 IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;6972 int i;6973 for (i = 0; i < This->NumberOfSwapChains; ++i)6974 {6975 if (This->swapchains[i] == swapchain)6976 {6977 break;6978 }6979 }6980 6981 if (i == This->NumberOfSwapChains)6982 {6983 WARN("swapchain 0x%p is not part of device 0x%p\n", swapchain, iface);6984 return E_INVALIDARG;6985 }6986 6987 --This->NumberOfSwapChains;6988 if (This->NumberOfSwapChains)6989 {6990 IWineD3DSwapChain **pvNewBuf = (IWineD3DSwapChain **)HeapAlloc(GetProcessHeap(), 0, (This->NumberOfSwapChains) * sizeof(IWineD3DSwapChain *));6991 if(!pvNewBuf) {6992 ERR("Out of memory!\n");6993 return E_OUTOFMEMORY;6994 }6995 if (i) {6996 memcpy (pvNewBuf, This->swapchains, i*sizeof(IWineD3DSwapChain *));6997 }6998 if (i < This->NumberOfSwapChains) {6999 memcpy (pvNewBuf + i, This->swapchains +i+1, (This->NumberOfSwapChains - i)*sizeof(IWineD3DSwapChain *));7000 }7001 7002 This->swapchains = pvNewBuf;7003 }7004 else7005 {7006 while (This->numContexts)7007 {7008 context_destroy(This, This->contexts[0]);7009 7009 } 7010 7010 } … … 7165 7165 IWineD3DDeviceImpl_AcquireFocusWindow, 7166 7166 IWineD3DDeviceImpl_ReleaseFocusWindow, 7167 /* VBox extensions */ 7168 IWineD3DDeviceImpl_AddSwapChain, 7169 IWineD3DDeviceImpl_RemoveSwapChain, 7167 7170 #ifdef VBOX_WITH_WDDM 7168 7171 /* VBox WDDM extensions */ 7169 7172 IWineD3DDeviceImpl_Flush, 7170 IWineD3DDeviceImpl_AddSwapChain,7171 IWineD3DDeviceImpl_RemoveSwapChain,7172 7173 #endif 7173 7174 }; -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/directx.c
r38112 r39602 2208 2208 gl_info->supported[WINED3D_GL_EXT_NONE] = TRUE; 2209 2209 2210 #ifdef VBOX_WITH_WDDM2211 2210 gl_info->supported[VBOX_SHARED_CONTEXTS] = TRUE; 2212 #endif2213 2211 2214 2212 while (*GL_Extensions) … … 2912 2910 if (DevModeW.dmFields&DM_DISPLAYFLAGS) 2913 2911 { 2914 #if defined(RT_ARCH_AMD64) && !defined(VBOX_WITH_WDDM)2912 #if 0 //defined(RT_ARCH_AMD64) && !defined(VBOX_WITH_WDDM) 2915 2913 # ifndef DM_INTERLACED 2916 2914 # define DM_INTERLACED 0x00000002 … … 2931 2929 if (DevModeW.dmFields&DM_DISPLAYORIENTATION) 2932 2930 { 2933 #if defined(RT_ARCH_AMD64) && !defined(VBOX_WITH_WDDM)2931 #if 0 //defined(RT_ARCH_AMD64) && !defined(VBOX_WITH_WDDM) 2934 2932 switch (DevModeW.dmDisplayOrientation) 2935 2933 #else … … 2950 2948 break; 2951 2949 default: 2952 #if defined(RT_ARCH_AMD64) && !defined(VBOX_WITH_WDDM)2950 #if 0 //defined(RT_ARCH_AMD64) && !defined(VBOX_WITH_WDDM) 2953 2951 WARN("Unexpected display orientation %#x", DevModeW.dmDisplayOrientation); 2954 2952 #else … … 5205 5203 #ifdef USE_WIN32_OPENGL 5206 5204 #define USE_GL_FUNC(pfn) pfn = (void*)GetProcAddress(mod_gl, #pfn); 5207 #if def VBOX_WITH_WDDM5205 #if defined(VBOX_WITH_WDDM) || defined(VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT) 5208 5206 BOOL (APIENTRY *pDrvValidateVersion)(DWORD) DECLSPEC_HIDDEN; 5209 5207 #ifdef VBOX_WDDM_WOW64 … … 5219 5217 goto nogl_adapter; 5220 5218 } 5221 #if def VBOX_WITH_WDDM5219 #if defined(VBOX_WITH_WDDM) || defined(VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT) 5222 5220 /* init properly */ 5223 5221 pDrvValidateVersion = (void*)GetProcAddress(mod_gl, "DrvValidateVersion"); -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/surface_base.c
r37760 r39602 40 40 #include "wine/port.h" 41 41 #include "wined3d_private.h" 42 43 #include <float.h> 42 44 43 45 WINE_DEFAULT_DEBUG_CHANNEL(d3d_surface); -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/swapchain.c
r39486 r39602 139 139 This->backBuffer = NULL; 140 140 } 141 #if ndef VBOX_WITH_WDDM141 #if 0 142 142 for (i = 0; i < This->num_contexts; ++i) 143 143 { … … 146 146 #else 147 147 148 #ifdef VBOX_WITH_WDDM 148 149 if (This->presentRt) 149 150 { … … 153 154 This->presentRt = NULL; 154 155 } 156 #endif 157 155 158 IWineD3DDevice_RemoveSwapChain((IWineD3DDevice*)This->device, (IWineD3DSwapChain*)This); 156 159 if (!This->device->NumberOfSwapChains) … … 479 482 pwglSwapLayerBuffers(context->currentSwapchain->hDC, WGL_SWAP_MAIN_PLANE); 480 483 #else 484 # ifdef VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT 485 pwglSwapLayerBuffers(context->hdc, WGL_SWAP_MAIN_PLANE); 486 # else 481 487 SwapBuffers(context->hdc); /* TODO: cycle through the swapchain buffers */ 488 # endif 482 489 #endif 483 490 -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/vboxext.c
r39257 r39602 15 15 */ 16 16 #include "config.h" 17 #include "wine/port.h" 17 18 #include "wined3d_private.h" 18 19 #include "vboxext.h" … … 23 24 typedef FNVBOXEXTWORKERCB *PFNVBOXEXTWORKERCB; 24 25 25 HRESULT VBoxExtDwSubmitProc(PFNVBOXEXTWORKERCB pfnCb, void *pvCb); 26 HRESULT VBoxExtDwSubmitProcSync(PFNVBOXEXTWORKERCB pfnCb, void *pvCb); 27 HRESULT VBoxExtDwSubmitProcAsync(PFNVBOXEXTWORKERCB pfnCb, void *pvCb); 26 28 27 29 /*******************************/ 28 #if defined(VBOX_WDDM_WOW64) 30 #ifdef VBOX_WITH_WDDM 31 # if defined(VBOX_WDDM_WOW64) 29 32 # define VBOXEXT_WINE_MODULE_NAME "wined3dwddm-x86.dll" 33 # else 34 # define VBOXEXT_WINE_MODULE_NAME "wined3dwddm.dll" 35 # endif 30 36 #else 31 # define VBOXEXT_WINE_MODULE_NAME "wined3dwddm.dll" 37 /* both 32bit and 64bit versions of xpdm wine libs are named identically */ 38 # define VBOXEXT_WINE_MODULE_NAME "wined3d.dll" 32 39 #endif 33 40 … … 61 68 static VBOXEXT_GLOBAL g_VBoxExtGlobal; 62 69 63 #define WM_VBOXEXT_CALLPROC (WM_APP+1) 70 #define WM_VBOXEXT_CALLPROC (WM_APP+1) 71 #define WM_VBOXEXT_INIT_QUIT (WM_APP+2) 64 72 65 73 typedef struct VBOXEXT_CALLPROC … … 103 111 pData->pfnCb(pData->pvCb); 104 112 SetEvent(pWorker->hEvent); 113 break; 114 } 115 case WM_VBOXEXT_INIT_QUIT: 116 case WM_CLOSE: 117 { 118 PostQuitMessage(0); 105 119 break; 106 120 } … … 165 179 HRESULT VBoxExtWorkerDestroy(PVBOXEXT_WORKER pWorker) 166 180 { 167 BOOL bResult = PostThreadMessage(pWorker->idThread, WM_ QUIT, 0, 0);181 BOOL bResult = PostThreadMessage(pWorker->idThread, WM_VBOXEXT_INIT_QUIT, 0, 0); 168 182 DWORD dwErr; 169 183 if (!bResult) … … 191 205 } 192 206 193 static HRESULT vboxExtWorkerSubmit(VBOXEXT_WORKER *pWorker, UINT Msg, LPARAM lParam )207 static HRESULT vboxExtWorkerSubmit(VBOXEXT_WORKER *pWorker, UINT Msg, LPARAM lParam, BOOL fSync) 194 208 { 195 209 HRESULT hr = E_FAIL; … … 201 215 if (bResult) 202 216 { 203 DWORD dwErr = WaitForSingleObject(pWorker->hEvent, INFINITE); 204 if (dwErr == WAIT_OBJECT_0) 205 { 217 if (fSync) 218 { 219 DWORD dwErr = WaitForSingleObject(pWorker->hEvent, INFINITE); 220 if (dwErr == WAIT_OBJECT_0) 221 { 222 hr = S_OK; 223 } 224 else 225 { 226 ERR("WaitForSingleObject returned (%d)", dwErr); 227 } 228 } 229 else 206 230 hr = S_OK; 207 }208 else209 {210 ERR("WaitForSingleObject returned (%d)", dwErr);211 }212 231 } 213 232 else … … 221 240 } 222 241 223 HRESULT VBoxExtWorkerSubmitProc (PVBOXEXT_WORKER pWorker, PFNVBOXEXTWORKERCB pfnCb, void *pvCb)242 HRESULT VBoxExtWorkerSubmitProcSync(PVBOXEXT_WORKER pWorker, PFNVBOXEXTWORKERCB pfnCb, void *pvCb) 224 243 { 225 244 VBOXEXT_CALLPROC Ctx; 226 245 Ctx.pfnCb = pfnCb; 227 246 Ctx.pvCb = pvCb; 228 return vboxExtWorkerSubmit(pWorker, WM_VBOXEXT_CALLPROC, (LPARAM)&Ctx); 229 } 247 return vboxExtWorkerSubmit(pWorker, WM_VBOXEXT_CALLPROC, (LPARAM)&Ctx, TRUE); 248 } 249 250 static DECLCALLBACK(void) vboxExtWorkerSubmitProcAsyncWorker(void *pvUser) 251 { 252 PVBOXEXT_CALLPROC pCallInfo = (PVBOXEXT_CALLPROC)pvUser; 253 pCallInfo[1].pfnCb(pCallInfo[1].pvCb); 254 HeapFree(GetProcessHeap(), 0, pCallInfo); 255 } 256 257 HRESULT VBoxExtWorkerSubmitProcAsync(PVBOXEXT_WORKER pWorker, PFNVBOXEXTWORKERCB pfnCb, void *pvCb) 258 { 259 HRESULT hr; 260 PVBOXEXT_CALLPROC pCallInfo = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof (VBOXEXT_CALLPROC) * 2); 261 if (!pCallInfo) 262 { 263 ERR("HeapAlloc failed\n"); 264 return E_OUTOFMEMORY; 265 } 266 pCallInfo[0].pfnCb = vboxExtWorkerSubmitProcAsyncWorker; 267 pCallInfo[0].pvCb = pCallInfo; 268 pCallInfo[1].pfnCb = pfnCb; 269 pCallInfo[1].pvCb = pvCb; 270 hr = vboxExtWorkerSubmit(pWorker, WM_VBOXEXT_CALLPROC, (LPARAM)pCallInfo, FALSE); 271 if (FAILED(hr)) 272 { 273 ERR("vboxExtWorkerSubmit failed, hr 0x%x\n", hr); 274 HeapFree(GetProcessHeap(), 0, pCallInfo); 275 return hr; 276 } 277 return S_OK; 278 } 279 230 280 231 281 static HRESULT vboxExtInit() … … 295 345 } 296 346 297 HRESULT VBoxExtDwSubmitProc(PFNVBOXEXTWORKERCB pfnCb, void *pvCb) 298 { 299 return VBoxExtWorkerSubmitProc(&g_VBoxExtGlobal.Worker, pfnCb, pvCb); 300 } 301 347 HRESULT VBoxExtDwSubmitProcSync(PFNVBOXEXTWORKERCB pfnCb, void *pvCb) 348 { 349 return VBoxExtWorkerSubmitProcSync(&g_VBoxExtGlobal.Worker, pfnCb, pvCb); 350 } 351 352 HRESULT VBoxExtDwSubmitProcAsync(PFNVBOXEXTWORKERCB pfnCb, void *pvCb) 353 { 354 return VBoxExtWorkerSubmitProcAsync(&g_VBoxExtGlobal.Worker, pfnCb, pvCb); 355 } 356 357 #if defined(VBOX_WINE_WITH_SINGLE_CONTEXT) || defined(VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT) 358 # ifndef VBOX_WITH_WDDM 302 359 typedef struct VBOXEXT_GETDC_CB 303 360 { … … 324 381 pData->ret = ReleaseDC(pData->hWnd, pData->hDC); 325 382 } 326 #if 0 383 327 384 HDC VBoxExtGetDC(HWND hWnd) 328 385 { 329 #ifdef VBOX_WINE_WITH_SINGLE_CONTEXT330 386 HRESULT hr; 331 387 VBOXEXT_GETDC_CB Data = {0}; … … 333 389 Data.hDC = NULL; 334 390 335 hr = VBoxExtDwSubmitProc (vboxExtGetDCWorker, &Data);391 hr = VBoxExtDwSubmitProcSync(vboxExtGetDCWorker, &Data); 336 392 if (FAILED(hr)) 337 393 { 338 ERR("VBoxExtDwSubmitProc feiled, hr (0x%x)\n", hr);394 ERR("VBoxExtDwSubmitProcSync feiled, hr (0x%x)\n", hr); 339 395 return NULL; 340 396 } 341 397 342 398 return Data.hDC; 343 #else344 return GetDC(hWnd);345 #endif346 399 } 347 400 348 401 int VBoxExtReleaseDC(HWND hWnd, HDC hDC) 349 402 { 350 #ifdef VBOX_WINE_WITH_SINGLE_CONTEXT351 403 HRESULT hr; 352 404 VBOXEXT_RELEASEDC_CB Data = {0}; … … 355 407 Data.ret = 0; 356 408 357 hr = VBoxExtDwSubmitProc (vboxExtReleaseDCWorker, &Data);409 hr = VBoxExtDwSubmitProcSync(vboxExtReleaseDCWorker, &Data); 358 410 if (FAILED(hr)) 359 411 { 360 ERR("VBoxExtDwSubmitProc feiled, hr (0x%x)\n", hr);412 ERR("VBoxExtDwSubmitProcSync feiled, hr (0x%x)\n", hr); 361 413 return -1; 362 414 } 363 415 364 416 return Data.ret; 365 #else 366 return ReleaseDC(hWnd, hDC); 367 #endif 368 } 369 #endif 417 } 418 # endif /* #ifndef VBOX_WITH_WDDM */ 419 420 static DECLCALLBACK(void) vboxExtReleaseContextWorker(void *pvUser) 421 { 422 struct wined3d_context *context = (struct wined3d_context *)pvUser; 423 wined3d_mutex_lock(); 424 VBoxTlsRefRelease(context); 425 wined3d_mutex_unlock(); 426 } 427 428 void VBoxExtReleaseContextAsync(struct wined3d_context *context) 429 { 430 HRESULT hr; 431 432 hr = VBoxExtDwSubmitProcAsync(vboxExtReleaseContextWorker, context); 433 if (FAILED(hr)) 434 { 435 ERR("VBoxExtDwSubmitProcAsync feiled, hr (0x%x)\n", hr); 436 return; 437 } 438 } 439 440 #endif /* #if defined(VBOX_WINE_WITH_SINGLE_CONTEXT) || defined(VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT) */ 370 441 371 442 /* window creation API */ … … 507 578 Info.hWnd = hWnd; 508 579 Info.hDC = hDC; 509 hr = VBoxExtDwSubmitProc (vboxExtWndDestroyWorker, &Info);580 hr = VBoxExtDwSubmitProcSync(vboxExtWndDestroyWorker, &Info); 510 581 Assert(hr == S_OK); 511 582 if (hr == S_OK) … … 524 595 Info.width = width; 525 596 Info.height = height; 526 hr = VBoxExtDwSubmitProc (vboxExtWndCreateWorker, &Info);597 hr = VBoxExtDwSubmitProcSync(vboxExtWndCreateWorker, &Info); 527 598 Assert(hr == S_OK); 528 599 if (hr == S_OK) -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/vboxext.h
r38363 r39602 17 17 #define ___VBOXEXT_H__ 18 18 19 #include <windows.h> 19 #ifdef VBOX_WINE_WITHOUT_LIBWINE 20 # include <windows.h> 21 #endif 20 22 #include <iprt/cdefs.h> 21 22 23 23 24 HRESULT VBoxExtCheckInit(); 24 25 HRESULT VBoxExtCheckTerm(); 25 #if 0 26 #if defined(VBOX_WINE_WITH_SINGLE_CONTEXT) || defined(VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT) 27 # ifndef VBOX_WITH_WDDM 26 28 /* Windows destroys HDC created by a given thread when the thread is terminated 27 29 * this leads to a mess-up in Wine & Chromium code in some situations, e.g. … … 30 32 HDC VBoxExtGetDC(HWND hWnd); 31 33 int VBoxExtReleaseDC(HWND hWnd, HDC hDC); 34 # endif 35 /* We need to do a VBoxTlsRefRelease for the current thread context on thread exit to avoid memory leaking 36 * Calling VBoxTlsRefRelease may result in a call to context dtor callback, which is supposed to be run under wined3d lock. 37 * We can not acquire a wined3d lock in DllMain since this would result in a lock order violation, which may result in a deadlock. 38 * In other words, wined3d may internally call Win32 API functions which result in a DLL lock acquisition while holding wined3d lock. 39 * So lock order should always be "wined3d lock" -> "dll lock". 40 * To avoid possible deadlocks we make an asynchronous call to a worker thread to make a context release from there. */ 41 void VBoxExtReleaseContextAsync(struct wined3d_context *context); 32 42 #endif 33 43 -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/wined3d_gl.h
r38565 r39602 1845 1845 WGL_WINE_PIXEL_FORMAT_PASSTHROUGH, 1846 1846 1847 #ifdef VBOX_WITH_WDDM1848 1847 VBOX_SHARED_CONTEXTS, 1849 #endif 1848 1850 1849 /* Internally used */ 1851 1850 WINE_NORMALIZED_TEXRECT, … … 3775 3774 const PIXELFORMATDESCRIPTOR *ppfd); 3776 3775 3777 #ifdef VBOX_WITH_WDDM3778 3776 #define GL_SHARE_CONTEXT_RESOURCES_CR 0x8B27 3779 3777 #define GL_FLUSH_ON_THREAD_SWITCH_CR 0x8B28 … … 3784 3782 glChromiumParameteriCR, VBOX_SHARED_CONTEXTS, NULL) \ 3785 3783 3786 #else3787 # define VBOXWDDM_GL_EXT_FUNCS_GEN3788 #endif3789 3784 3790 3785 #define GL_EXT_FUNCS_GEN \ -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/wined3d_main.c
r39570 r39602 96 96 HRESULT hr; 97 97 98 #ifdef VBOX_WITH_WDDM99 98 hr = VBoxExtCheckInit(); 100 99 if (FAILED(hr)) … … 103 102 return NULL; 104 103 } 105 #endif106 104 107 105 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); … … 109 107 { 110 108 ERR("Failed to allocate wined3d object memory.\n"); 111 #ifdef VBOX_WITH_WDDM112 109 VBoxExtCheckTerm(); 113 #endif114 110 return NULL; 115 111 } … … 151 147 } 152 148 153 #ifdef VBOX_WITH_WDDM 154 void WINAPI wined3d_mutex_init(void) 149 static void WINAPI wined3d_mutex_init(void) 155 150 { 156 151 InitializeCriticalSection(&wined3d_cs); 157 152 } 158 153 159 void WINAPI wined3d_mutex_term(void)154 static void WINAPI wined3d_mutex_term(void) 160 155 { 161 156 DeleteCriticalSection(&wined3d_cs); 162 157 } 163 #endif164 158 165 159 static BOOL wined3d_dll_init(HINSTANCE hInstDLL) … … 174 168 WNDCLASSA wc; 175 169 176 #ifdef VBOX_WITH_WDDM177 170 wined3d_mutex_init(); 178 #endif179 171 180 172 wined3d_context_tls_idx = TlsAlloc(); … … 183 175 DWORD err = GetLastError(); 184 176 ERR("Failed to allocate context TLS index, err %#x.\n", err); 185 #ifdef VBOX_WITH_WDDM 177 186 178 wined3d_mutex_term(); 187 #endif188 179 return FALSE; 189 180 } … … 212 203 ERR("Failed to free context TLS index, err %#x.\n", err); 213 204 } 214 #ifdef VBOX_WITH_WDDM 205 215 206 wined3d_mutex_term(); 216 #endif 207 217 208 return FALSE; 218 209 } … … 413 404 UnregisterClassA(WINED3D_OPENGL_WINDOW_CLASS_NAME, hInstDLL); 414 405 415 #ifdef VBOX_WITH_WDDM416 406 wined3d_mutex_term(); 417 #endif418 407 419 408 return TRUE; … … 544 533 case DLL_THREAD_DETACH: 545 534 { 535 #if defined(VBOX_WINE_WITH_SINGLE_CONTEXT) || defined(VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT) 536 context_clear_on_thread_detach(); 537 #else 546 538 if (!context_set_current(NULL)) 547 539 { 548 540 ERR("Failed to clear current context.\n"); 549 541 } 542 #endif 550 543 return TRUE; 551 544 } -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/wined3d_private.h
r39130 r39602 51 51 #include "wine/debug.h" 52 52 #include "wine/unicode.h" 53 #ifdef VBOX_WITH_WDDM54 # include "vboxext.h"55 #endif56 57 53 58 54 #ifndef VBOX_WINE_WITHOUT_LIBWINE … … 64 60 #include "wine/rbtree.h" 65 61 62 #include "vboxext.h" 63 66 64 #ifdef VBOX_WITH_WDDM 67 65 # include "vboxsharedrc.h" 66 #endif 67 68 #if defined(VBOX_WINE_WITH_SINGLE_CONTEXT) || defined(VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT) 69 # define VBoxTlsRefGetImpl(_tls) (TlsGetValue((DWORD)(_tls))) 70 # define VBoxTlsRefSetImpl(_tls, _val) (TlsSetValue((DWORD)(_tls), (_val))) 71 # define VBoxTlsRefAssertImpl Assert 72 # include <VBox/VBoxVideo3D.h> 68 73 #endif 69 74 … … 1121 1126 WORD num_untracked_materials : 2; /* Max value 2 */ 1122 1127 WORD current : 1; 1128 #if !defined(VBOX_WINE_WITH_SINGLE_CONTEXT) && !defined(VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT) 1123 1129 WORD destroyed : 1; 1130 #endif 1124 1131 WORD valid : 1; 1125 1132 BYTE texShaderBumpMap; /* MAX_TEXTURES, 8 */ … … 1142 1149 HDC hdc; 1143 1150 #endif 1151 1152 #if defined(VBOX_WINE_WITH_SINGLE_CONTEXT) || defined(VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT) 1153 VBOXTLSREFDATA 1154 #endif 1155 1144 1156 int pixel_format; 1145 1157 GLint aux_buffers; … … 1288 1300 void context_set_tls_idx(DWORD idx) DECLSPEC_HIDDEN; 1289 1301 void context_surface_update(struct wined3d_context *context, IWineD3DSurfaceImpl *surface) DECLSPEC_HIDDEN; 1290 1302 #if defined(VBOX_WINE_WITH_SINGLE_CONTEXT) || defined(VBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT) 1303 void context_clear_on_thread_detach(); 1304 #endif 1291 1305 /* Macros for doing basic GPU detection based on opengl capabilities */ 1292 1306 #define WINE_D3D6_CAPABLE(gl_info) (gl_info->supported[ARB_MULTITEXTURE])
Note:
See TracChangeset
for help on using the changeset viewer.