- Timestamp:
- Apr 28, 2019 4:47:51 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 26 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Config.kmk
r78336 r78341 7345 7345 TEMPLATE_VBOXCROGLR3HOSTDLL_EXTENDS := $(if-expr "$(KBUILD_TARGET)" == "win",VBOXR3,VBOXR3NP) 7346 7346 TEMPLATE_VBOXCROGLR3HOSTDLL_EXTENDS_BY = prepending 7347 TEMPLATE_VBOXCROGLR3HOSTDLL_DEFS = CHROMIUM_THREADSAFEVBOX_WITH_HGCM UNPACKS7347 TEMPLATE_VBOXCROGLR3HOSTDLL_DEFS = VBOX_WITH_HGCM UNPACKS 7348 7348 TEMPLATE_VBOXCROGLR3HOSTDLL_DEFS.win = _WIN32_WINNT=0x0500 WINDOWS=1 7349 7349 TEMPLATE_VBOXCROGLR3HOSTDLL_DEFS.linux = Linux=1 _GNU_SOURCE … … 7388 7388 TEMPLATE_VBOXCROGLR3GUESTDLL_EXTENDS = VBOXGUESTR3NPDLL 7389 7389 #endif 7390 TEMPLATE_VBOXCROGLR3GUESTDLL_DEFS = $(TEMPLATE_$(TEMPLATE_VBOXCROGLR3GUESTDLL_EXTENDS)_DEFS) CHROMIUM_THREADSAFEVBOX_WITH_HGCM7390 TEMPLATE_VBOXCROGLR3GUESTDLL_DEFS = $(TEMPLATE_$(TEMPLATE_VBOXCROGLR3GUESTDLL_EXTENDS)_DEFS) VBOX_WITH_HGCM 7391 7391 TEMPLATE_VBOXCROGLR3GUESTDLL_DEFS.win = $(TEMPLATE_$(TEMPLATE_VBOXCROGLR3GUESTDLL_EXTENDS)_DEFS.win) WINDOWS=1 7392 7392 TEMPLATE_VBOXCROGLR3GUESTDLL_DEFS.linux = $(TEMPLATE_$(TEMPLATE_VBOXCROGLR3GUESTDLL_EXTENDS)_DEFS.linux) Linux=1 _GNU_SOURCE -
trunk/src/VBox/Additions/common/crOpenGL/context.c
r78190 r78341 35 35 * we're in a multi-thread situation, and do the right thing for dispatch. 36 36 */ 37 #ifdef CHROMIUM_THREADSAFE 38 static void 39 stubCheckMultithread( void ) 37 static void stubCheckMultithread( void ) 40 38 { 41 39 static unsigned long knownID; … … 55 53 } 56 54 } 57 #endif58 55 59 56 … … 66 63 CRASSERT(table); 67 64 68 #ifdef CHROMIUM_THREADSAFE69 65 /* always set the per-thread dispatch pointer */ 70 66 crSetTSD(&stub.dispatchTSD, (void *) table); … … 75 71 } 76 72 else 77 #endif78 73 { 79 74 /* Single thread mode - just install the caller's dispatch table */ … … 468 463 } 469 464 470 #ifdef CHROMIUM_THREADSAFE471 465 static DECLCALLBACK(void) stubContextDtor(void*pvContext) 472 466 { 473 467 stubContextFree((ContextInfo*)pvContext); 474 468 } 475 #endif476 469 477 470 /** … … 549 542 #endif 550 543 551 #ifdef CHROMIUM_THREADSAFE552 544 VBoxTlsRefInit(context, stubContextDtor); 553 #endif554 545 555 546 #if defined(GLX) || defined(DARWIN) … … 1181 1172 } 1182 1173 1183 #ifdef CHROMIUM_THREADSAFE1184 1174 stubCheckMultithread(); 1185 #endif1186 1175 1187 1176 if (context->type == UNDECIDED) { 1188 1177 /* Here's where we really create contexts */ 1189 #ifdef CHROMIUM_THREADSAFE1190 1178 crLockMutex(&stub.mutex); 1191 #endif1192 1179 1193 1180 if (stubCheckUseChromium(window)) { … … 1220 1207 if (!InstantiateNativeContext(window, context)) 1221 1208 { 1222 # ifdef CHROMIUM_THREADSAFE1223 1209 crUnlockMutex(&stub.mutex); 1224 # endif1225 1210 return 0; /* false */ 1226 1211 } … … 1229 1214 #endif /* !GLX */ 1230 1215 1231 #ifdef CHROMIUM_THREADSAFE1232 1216 crUnlockMutex(&stub.mutex); 1233 #endif1234 1217 } 1235 1218 … … 1408 1391 crError("No context."); 1409 1392 1410 #ifdef CHROMIUM_THREADSAFE1411 1393 if (stubGetCurrentContext() == context) { 1412 1394 stubSetCurrentContext(NULL); … … 1415 1397 VBoxTlsRefMarkDestroy(context); 1416 1398 VBoxTlsRefRelease(context); 1417 #else1418 if (stubGetCurrentContext() == context) {1419 stubSetCurrentContext(NULL);1420 }1421 stubContextFree(context);1422 #endif1423 1399 crHashtableUnlock(stub.contextTable); 1424 1400 crHashtableUnlock(stub.windowTable); -
trunk/src/VBox/Additions/common/crOpenGL/feedback/feedback_context.c
r76553 r78341 36 36 GLint ctx, slot; 37 37 38 #ifdef CHROMIUM_THREADSAFE39 38 crLockMutex(&feedback_spu.mutex); 40 #endif41 42 39 ctx = feedback_spu.child.VBoxCreateContext(con, dpyName, visual, shareCtx); 43 40 … … 56 53 feedback_spu.context[slot].clientCtx = ctx; 57 54 58 #ifdef CHROMIUM_THREADSAFE59 55 crUnlockMutex(&feedback_spu.mutex); 60 #endif61 62 56 return ctx; 63 57 } … … 72 66 feedbackspu_MakeCurrent( GLint window, GLint nativeWindow, GLint ctx ) 73 67 { 74 #ifdef CHROMIUM_THREADSAFE75 68 crLockMutex(&feedback_spu.mutex); 76 #endif77 69 feedback_spu.child.MakeCurrent(window, nativeWindow, ctx); 78 70 … … 99 91 } 100 92 101 #ifdef CHROMIUM_THREADSAFE102 93 crUnlockMutex(&feedback_spu.mutex); 103 #endif104 94 } 105 95 … … 107 97 feedbackspu_DestroyContext( GLint ctx ) 108 98 { 109 #ifdef CHROMIUM_THREADSAFE110 99 crLockMutex(&feedback_spu.mutex); 111 #endif112 100 feedback_spu.child.DestroyContext(ctx); 113 101 … … 125 113 } 126 114 127 #ifdef CHROMIUM_THREADSAFE128 115 crUnlockMutex(&feedback_spu.mutex); 129 #endif130 116 } 131 117 -
trunk/src/VBox/Additions/common/crOpenGL/feedback/feedbackspu.h
r78190 r78341 42 42 ContextInfo context[CR_MAX_CONTEXTS]; 43 43 44 #ifdef CHROMIUM_THREADSAFE45 44 CRmutex mutex; 46 #endif47 45 } feedbackSPU; 48 46 -
trunk/src/VBox/Additions/common/crOpenGL/feedback/feedbackspu_init.c
r78190 r78341 31 31 (void) num_contexts; 32 32 33 #ifdef CHROMIUM_THREADSAFE34 33 crInitMutex(&feedback_spu.mutex); 35 #endif36 37 34 feedback_spu.id = id; 38 35 feedback_spu.has_child = 0; -
trunk/src/VBox/Additions/common/crOpenGL/load.c
r78190 r78341 63 63 /* NOTE: 'SPUDispatchTable stubThreadsafeDispatch' is declared in tsfuncs.c */ 64 64 Stub stub; 65 #ifdef CHROMIUM_THREADSAFE66 65 static bool g_stubIsCurrentContextTSDInited; 67 66 CRtsd g_stubCurrentContextTSD; 68 #endif69 70 67 71 68 #ifndef VBOX_NO_NATIVEGL … … 392 389 static void stubSPUSafeTearDown(void) 393 390 { 394 #ifdef CHROMIUM_THREADSAFE395 391 CRmutex *mutex; 396 #endif397 392 398 393 if (!stub_initialized) return; 399 394 stub_initialized = 0; 400 395 401 #ifdef CHROMIUM_THREADSAFE402 396 mutex = &stub.mutex; 403 397 crLockMutex(mutex); 404 #endif405 398 crDebug("stubSPUSafeTearDown"); 406 399 … … 489 482 #endif 490 483 491 #ifdef CHROMIUM_THREADSAFE492 484 crUnlockMutex(mutex); 493 485 crFreeMutex(mutex); 494 #endif495 486 crMemset(&stub, 0, sizeof(stub)); 496 487 } … … 515 506 516 507 #ifndef RT_OS_WINDOWS 517 # ifdef CHROMIUM_THREADSAFE518 508 static void stubThreadTlsDtor(void *pvValue) 519 509 { … … 521 511 VBoxTlsRefRelease(pCtx); 522 512 } 523 # endif524 513 #endif 525 514 … … 532 521 WindowInfo *defaultWin; 533 522 534 #ifdef CHROMIUM_THREADSAFE535 523 crInitMutex(&stub.mutex); 536 #endif537 524 538 525 /* At the very least we want CR_RGB_BIT. */ … … 559 546 stub.contextTable = crAllocHashtable(); 560 547 #ifndef RT_OS_WINDOWS 561 # ifdef CHROMIUM_THREADSAFE562 548 if (!g_stubIsCurrentContextTSDInited) 563 549 { … … 565 551 g_stubIsCurrentContextTSDInited = true; 566 552 } 567 # endif568 553 #endif 569 554 stubSetCurrentContext(NULL); … … 1202 1187 crDbgCmdSymLoadPrint("VBoxOGLcrutil.dll", hCrUtil); 1203 1188 #endif 1204 #ifdef CHROMIUM_THREADSAFE1205 1189 crInitTSD(&g_stubCurrentContextTSD); 1206 #endif1207 1208 1190 crInitMutex(&stub_init_mutex); 1209 1191 … … 1347 1329 1348 1330 stubSPUSafeTearDown(); 1349 1350 #ifdef CHROMIUM_THREADSAFE1351 1331 crFreeTSD(&g_stubCurrentContextTSD); 1352 #endif1353 1332 1354 1333 #ifdef VDBG_VEHANDLER -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu.h
r78190 r78341 115 115 #define THREAD_OFFSET_MAGIC 2000 116 116 117 #ifdef CHROMIUM_THREADSAFE118 117 extern CRmutex _PackMutex; 119 118 extern CRtsd _PackTSD; … … 121 120 #define GET_THREAD_IDX(_id) ((_id) - THREAD_OFFSET_MAGIC) 122 121 #define GET_THREAD_VAL_ID(_id) (&(pack_spu.thread[GET_THREAD_IDX(_id)])) 123 #else124 #define GET_THREAD_VAL() (&(pack_spu.thread[0]))125 #endif126 122 #define GET_THREAD(T) ThreadInfo *T = GET_THREAD_VAL() 127 123 #define GET_THREAD_ID(T, _id) ThreadInfo *T = GET_THREAD_VAL_ID(_id) -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_context.c
r78190 r78341 29 29 int i; 30 30 31 #ifdef CHROMIUM_THREADSAFE32 31 crLockMutex(&_PackMutex); 33 #else34 CRASSERT(pack_spu.numThreads == 0);35 #endif36 32 37 33 #if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST) … … 85 81 86 82 87 #ifdef CHROMIUM_THREADSAFE88 83 if (!CRPACKSPU_IS_WDDM_CRHGSMI()) 89 84 { 90 85 crSetTSD(&_PackTSD, thread); 91 86 } 92 #endif93 87 94 88 pack_spu.numThreads++; 95 89 96 #ifdef CHROMIUM_THREADSAFE97 90 crUnlockMutex(&_PackMutex); 98 #endif99 91 return thread; 100 92 } … … 199 191 CRASSERT(!curThread == !curPacker); 200 192 CRASSERT(!curThread || !curPacker || curThread->packer == curPacker); 201 #ifdef CHROMIUM_THREADSAFE202 193 crLockMutex(&_PackMutex); 203 #endif204 194 205 195 #if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST) … … 235 225 packspu_ChromiumParameteriCR(param, value); 236 226 237 #ifdef CHROMIUM_THREADSAFE238 227 crUnlockMutex(&_PackMutex); 239 #endif240 241 228 if (CRPACKSPU_IS_WDDM_CRHGSMI()) 242 229 { … … 255 242 CRASSERT(!curThread == !curPacker); 256 243 CRASSERT(!curThread || !curPacker || curThread->packer == curPacker); 257 #ifdef CHROMIUM_THREADSAFE258 244 crLockMutex(&_PackMutex); 259 #endif260 245 261 246 #if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST) … … 291 276 packspu_ChromiumParametervCR(target, type, count, values); 292 277 293 #ifdef CHROMIUM_THREADSAFE294 278 crUnlockMutex(&_PackMutex); 295 #endif296 297 279 if (CRPACKSPU_IS_WDDM_CRHGSMI()) 298 280 { … … 314 296 CRASSERT(!curThread == !curPacker); 315 297 CRASSERT(!curThread || !curPacker || curThread->packer == curPacker); 316 #ifdef CHROMIUM_THREADSAFE317 298 crLockMutex(&_PackMutex); 318 #endif319 299 320 300 #if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST) … … 383 363 384 364 if (serverCtx < 0) { 385 #ifdef CHROMIUM_THREADSAFE386 365 crUnlockMutex(&_PackMutex); 387 #endif388 366 crWarning("Failure in packspu_CreateContext"); 389 367 … … 420 398 pack_spu.context[slot].serverCtx = serverCtx; 421 399 422 #ifdef CHROMIUM_THREADSAFE423 400 crUnlockMutex(&_PackMutex); 424 #endif425 426 401 if (CRPACKSPU_IS_WDDM_CRHGSMI()) 427 402 { -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_init.c
r78190 r78341 22 22 PackSPU pack_spu; 23 23 24 #ifdef CHROMIUM_THREADSAFE25 24 CRtsd _PackTSD; 26 25 CRmutex _PackMutex; 27 #endif28 26 29 27 #if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST) … … 59 57 (void) self; 60 58 61 #if defined(CHROMIUM_THREADSAFE) &&!defined(WINDOWS)59 #if !defined(WINDOWS) 62 60 crInitMutex(&_PackMutex); 63 61 #endif 64 62 65 #ifdef CHROMIUM_THREADSAFE66 63 crInitTSD(&_PackerTSD); 67 64 crInitTSD(&_PackTSD); 68 #endif69 65 70 66 pack_spu.id = id; … … 113 109 { 114 110 int i; 115 #ifdef CHROMIUM_THREADSAFE116 111 crLockMutex(&_PackMutex); 117 #endif118 112 for (i=0; i<MAX_THREADS; ++i) 119 113 { … … 124 118 } 125 119 126 #ifdef CHROMIUM_THREADSAFE127 120 crFreeTSD(&_PackerTSD); 128 121 crFreeTSD(&_PackTSD); 129 122 crUnlockMutex(&_PackMutex); 130 # 123 #ifndef WINDOWS 131 124 crFreeMutex(&_PackMutex); 132 # endif 133 #endif /* CHROMIUM_THREADSAFE */ 125 #endif 134 126 return 1; 135 127 } -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_misc.c
r78190 r78341 495 495 } 496 496 497 #ifdef CHROMIUM_THREADSAFE498 497 GLint PACKSPU_APIENTRY packspu_VBoxPackSetInjectThread(struct VBOXUHGSMI *pHgsmi) 499 498 { … … 737 736 #endif 738 737 739 #else /*ifdef CHROMIUM_THREADSAFE*/740 GLint PACKSPU_APIENTRY packspu_VBoxPackSetInjectThread(struct VBOXUHGSMI *pHgsmi)741 {742 }743 744 GLuint PACKSPU_APIENTRY packspu_VBoxPackGetInjectID(GLint con)745 {746 return 0;747 }748 749 void PACKSPU_APIENTRY packspu_VBoxPackSetInjectID(GLuint id)750 {751 (void) id;752 }753 754 void PACKSPU_APIENTRY packspu_VBoxPackAttachThread()755 {756 }757 758 void PACKSPU_APIENTRY packspu_VBoxPackDetachThread()759 {760 }761 #endif /*CHROMIUM_THREADSAFE*/762 763 738 void PACKSPU_APIENTRY packspu_VBoxPresentComposition(GLint win, const struct VBOXVR_SCR_COMPOSITOR * pCompositor, 764 739 const struct VBOXVR_SCR_COMPOSITOR_ENTRY *pChangedEntry) -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_net.c
r78190 r78341 118 118 /* we should _always_ pass a valid <arg> value */ 119 119 CRASSERT(thread && thread->inUse); 120 #ifdef CHROMIUM_THREADSAFE121 120 CR_LOCK_PACKER_CONTEXT(thread->packer); 122 #endif123 121 ctx = thread->currentContext; 124 122 buf = &(thread->buffer); … … 145 143 crPackSetBuffer( thread->packer, buf ); 146 144 crPackResetPointers(thread->packer); 147 #ifdef CHROMIUM_THREADSAFE148 145 CR_UNLOCK_PACKER_CONTEXT(thread->packer); 149 #endif150 146 return; 151 147 } … … 174 170 175 171 crPackResetPointers(thread->packer); 176 177 #ifdef CHROMIUM_THREADSAFE178 172 CR_UNLOCK_PACKER_CONTEXT(thread->packer); 179 #endif180 173 } 181 174 -
trunk/src/VBox/Additions/common/crOpenGL/stub.h
r76563 r78341 54 54 #endif 55 55 56 #if !defined(CHROMIUM_THREADSAFE) && defined(CR_NEWWINTRACK) 57 # error CHROMIUM_THREADSAFE have to be defined 58 #endif 59 60 #ifdef CHROMIUM_THREADSAFE 61 # include <cr_threads.h> 62 #endif 56 #include <cr_threads.h> 63 57 64 58 #if 0 && defined(CR_NEWWINTRACK) && !defined(WINDOWS) … … 121 115 #endif 122 116 123 #ifdef CHROMIUM_THREADSAFE124 117 VBOXTLSREFDATA 125 #endif126 118 127 119 #ifdef WINDOWS … … 225 217 /* thread safety stuff */ 226 218 GLboolean threadSafe; 227 #ifdef CHROMIUM_THREADSAFE228 219 CRtsd dispatchTSD; 229 220 CRmutex mutex; 230 #endif231 221 232 222 CRpid mothershipPID; … … 235 225 int freeContextNumber; 236 226 CRHashTable *contextTable; 237 #ifndef CHROMIUM_THREADSAFE238 ContextInfo *currentContext; /* may be NULL */239 #endif240 227 241 228 /* windows */ … … 270 257 } Stub; 271 258 272 #ifdef CHROMIUM_THREADSAFE273 259 /* we place the g_stubCurrentContextTLS outside the Stub data because Stub data is inited by the client's call, 274 260 * while we need g_stubCurrentContextTLS the g_stubCurrentContextTLS to be valid at any time to be able to handle … … 291 277 } 292 278 # define stubSetCurrentContext(_ctx) VBoxTlsRefSetCurrent(ContextInfo, &g_stubCurrentContextTSD, _ctx) 293 #else294 # define stubGetCurrentContext() (stub.currentContext)295 # define stubSetCurrentContext(_ctx) do { stub.currentContext = (_ctx); } while (0)296 #endif297 279 298 280 extern Stub stub; -
trunk/src/VBox/GuestHost/OpenGL/include/cr_glstate.h
r69474 r78341 46 46 #include "spu_dispatch_table.h" 47 47 48 #ifdef CHROMIUM_THREADSAFE 49 # include <cr_threads.h> 50 #endif 48 #include "cr_threads.h" 51 49 52 50 #include <iprt/cdefs.h> … … 132 130 int id; 133 131 134 #ifdef CHROMIUM_THREADSAFE135 132 /* we keep reference counting of context's makeCurrent for different threads 136 133 * this is primarily needed to avoid having an invalid memory reference in the TLS … … 143 140 * */ 144 141 VBOXTLSREFDATA 145 #endif146 142 147 143 CRbitvalue bitid[CR_MAX_BITARRAY]; -
trunk/src/VBox/GuestHost/OpenGL/include/cr_pack.h
r78190 r78341 15 15 #include "state/cr_currentpointers.h" 16 16 #include "state/cr_client.h" 17 #ifdef CHROMIUM_THREADSAFE18 17 #include "cr_threads.h" 19 #endif20 18 21 19 #include <iprt/types.h> … … 84 82 int updateBBOX; 85 83 CRPackBuffer *currentBuffer; 86 #ifdef CHROMIUM_THREADSAFE87 84 CRmutex mutex; 88 #endif89 85 char *file; /**< for debugging only */ 90 86 int line; /**< for debugging only */ … … 97 93 # define CR_PACKER_CONTEXT_ARG_NOREF() do {} while (0) 98 94 # define CR_PACKER_CONTEXT_ARGCTX(C) 99 # ifdef CHROMIUM_THREADSAFE100 95 extern CRtsd _PackerTSD; 101 # define CR_GET_PACKER_CONTEXT(C) CRPackContext *C = (CRPackContext *) crGetTSD(&_PackerTSD) 102 # define CR_LOCK_PACKER_CONTEXT(PC) crLockMutex(&((PC)->mutex)) 103 # define CR_UNLOCK_PACKER_CONTEXT(PC) crUnlockMutex(&((PC)->mutex)) 104 # else 105 extern DLLDATA(CRPackContext) cr_packer_globals; 106 # define CR_GET_PACKER_CONTEXT(C) CRPackContext *C = &cr_packer_globals 107 # define CR_LOCK_PACKER_CONTEXT(PC) 108 # define CR_UNLOCK_PACKER_CONTEXT(PC) 109 # endif 96 # define CR_GET_PACKER_CONTEXT(C) CRPackContext *C = (CRPackContext *) crGetTSD(&_PackerTSD) 97 # define CR_LOCK_PACKER_CONTEXT(PC) crLockMutex(&((PC)->mutex)) 98 # define CR_UNLOCK_PACKER_CONTEXT(PC) crUnlockMutex(&((PC)->mutex)) 110 99 extern uint32_t cr_packer_cmd_blocks_enabled; 111 100 #else /* if defined IN_RING0 */ -
trunk/src/VBox/GuestHost/OpenGL/packer/pack_buffer.c
r78190 r78341 374 374 CR_UNLOCK_PACKER_CONTEXT(pc); 375 375 } 376 377 378 #ifndef CHROMIUM_THREADSAFE379 static unsigned char *sanityCheckPointer = NULL;380 #endif381 376 382 377 … … 452 447 453 448 *((unsigned int *) data_ptr) = size; 454 #ifndef CHROMIUM_THREADSAFE455 sanityCheckPointer = data_ptr + 4;456 #endif457 449 return data_ptr + 4; 458 450 } … … 469 461 { 470 462 CR_GET_PACKER_CONTEXT(pc); 471 #ifndef CHROMIUM_THREADSAFE472 CRASSERT(sanityCheckPointer == packet);473 sanityCheckPointer = NULL;474 #endif475 463 476 464 if ( IS_BUFFERED( packet ) ) -
trunk/src/VBox/GuestHost/OpenGL/packer/pack_init.c
r78190 r78341 10 10 #include <stdio.h> 11 11 12 #ifdef CHROMIUM_THREADSAFE13 12 CRtsd _PackerTSD; 14 13 int cr_packer_globals; /* dummy - for the sake of packer.def */ 15 #else16 int _PackerTSD; /* dummy - for the sake of packer.def */ /* drm1 */17 DLLDATA(CRPackContext) cr_packer_globals;18 #endif19 20 14 uint32_t cr_packer_cmd_blocks_enabled = 0; 21 15 22 16 CRPackContext *crPackNewContext(void) 23 17 { 24 #ifdef CHROMIUM_THREADSAFE25 18 CRPackContext *pc = crCalloc(sizeof(CRPackContext)); 26 19 if (!pc) 27 20 return NULL; 28 21 crInitMutex(&pc->mutex); 29 #else30 GET_PACKER_CONTEXT(pc);31 crMemZero( pc, sizeof(CRPackContext));32 #endif33 22 pc->u32CmdBlockState = 0; 34 23 pc->Flush = NULL; … … 40 29 void crPackDeleteContext(CRPackContext *pc) 41 30 { 42 #ifdef CHROMIUM_THREADSAFE43 31 crFreeMutex(&pc->mutex); 44 32 crFree(pc); 45 #endif46 33 } 47 34 … … 49 36 void crPackSetContext( CRPackContext *pc ) 50 37 { 51 #ifdef CHROMIUM_THREADSAFE52 38 crSetTSD( &_PackerTSD, pc ); 53 #else54 CRASSERT( pc == &cr_packer_globals );55 (void)pc;56 #endif57 39 } 58 40 … … 61 43 CRPackContext *crPackGetContext( void ) 62 44 { 63 #ifdef CHROMIUM_THREADSAFE64 45 return (CRPackContext *) crGetTSD( &_PackerTSD ); 65 #else66 return &cr_packer_globals;67 #endif68 46 } 69 47 -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state.h
r69474 r78341 29 29 #define GetCurrentBits() __currentBits 30 30 31 #ifdef CHROMIUM_THREADSAFE32 31 #include <cr_threads.h> 33 32 … … 39 38 * (i.e. state_glsl.c) is using it */ 40 39 #define SetCurrentContext(_ctx) VBoxTlsRefSetCurrent(CRContext, &__contextTSD, _ctx) 41 #else42 extern CRContext *__currentContext;43 #define GetCurrentContext() __currentContext44 #endif45 40 46 41 extern GLboolean g_bVBoxEnableDiffOnMakeCurrent; -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_glsl.c
r78263 r78341 192 192 /** @todo hack to allow crStateFreeGLSLProgram to work correctly, 193 193 as the current context isn't the one being destroyed*/ 194 #ifdef CHROMIUM_THREADSAFE195 194 CRASSERT(g != ctx); 196 195 VBoxTlsRefAddRef(ctx); /* <- this is a hack to avoid subsequent SetCurrentContext(g) do recursive Destroy for ctx */ … … 198 197 VBoxTlsRefAddRef(g); /* <- ensure the g is not destroyed by the following SetCurrentContext call */ 199 198 SetCurrentContext(ctx); 200 #else201 __currentContext = ctx;202 #endif203 199 204 200 crFreeHashtable(ctx->glsl.programs, crStateFreeGLSLProgram); 205 201 crFreeHashtable(ctx->glsl.shaders, crStateFreeGLSLShader); 206 202 207 #ifdef CHROMIUM_THREADSAFE208 203 SetCurrentContext(g); 209 204 if (g) 210 205 VBoxTlsRefRelease(g); 211 206 VBoxTlsRefRelease(ctx); /* <- restore back the cRefs (see above) */ 212 #else213 __currentContext = g;214 #endif215 216 207 } 217 208 -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_init.c
r78263 r78341 12 12 #include <iprt/asm.h> 13 13 14 #ifdef CHROMIUM_THREADSAFE15 14 static bool __isContextTLSInited = false; 16 15 CRtsd __contextTSD; 17 #else18 CRContext *__currentContext = NULL;19 #endif20 16 21 17 CRStateBits *__currentBits = NULL; … … 297 293 } 298 294 299 #ifdef CHROMIUM_THREADSAFE 300 static void 301 crStateFreeContext(CRContext *ctx); 295 static void crStateFreeContext(CRContext *ctx); 296 302 297 static DECLCALLBACK(void) crStateContextDtor(void *pvCtx) 303 298 { 304 299 crStateFreeContext((CRContext*)pvCtx); 305 300 } 306 #endif307 301 308 302 /* … … 334 328 CRASSERT(g_cContexts < RT_ELEMENTS(g_pAvailableContexts)); 335 329 ctx->id = i; 336 #ifdef CHROMIUM_THREADSAFE337 330 VBoxTlsRefInit(ctx, crStateContextDtor); 338 #endif339 331 ctx->flush_func = NULL; 340 332 for (j=0;j<CR_MAX_BITARRAY;j++){ … … 474 466 } 475 467 476 #ifdef CHROMIUM_THREADSAFE 477 # ifndef RT_OS_WINDOWS 468 #ifndef RT_OS_WINDOWS 478 469 static void crStateThreadTlsDtor(void *pvValue) 479 470 { … … 481 472 VBoxTlsRefRelease(pCtx); 482 473 } 483 # endif484 474 #endif 485 475 … … 513 503 g_cContexts = 0; 514 504 515 #ifdef CHROMIUM_THREADSAFE516 505 if (!__isContextTLSInited) 517 506 { … … 525 514 __isContextTLSInited = 1; 526 515 } 527 #endif528 516 529 517 if (defaultContext) { 530 518 /* Free the default/NULL context. 531 519 * Ensures context bits are reset */ 532 #ifdef CHROMIUM_THREADSAFE533 520 SetCurrentContext(NULL); 534 521 VBoxTlsRefRelease(defaultContext); 535 #else536 crStateFreeContext(defaultContext);537 __currentContext = NULL;538 #endif539 522 } 540 523 … … 550 533 CRASSERT(g_pAvailableContexts[0] == defaultContext); 551 534 CRASSERT(g_cContexts == 1); 552 #ifdef CHROMIUM_THREADSAFE553 535 SetCurrentContext(defaultContext); 554 #else555 __currentContext = defaultContext;556 #endif557 536 } 558 537 … … 574 553 if (g_pAvailableContexts[i]) 575 554 { 576 #ifdef CHROMIUM_THREADSAFE577 555 if (VBoxTlsRefIsFunctional(g_pAvailableContexts[i])) 578 556 VBoxTlsRefRelease(g_pAvailableContexts[i]); 579 #else580 crStateFreeContext(g_pAvailableContexts[i]);581 #endif582 557 } 583 558 } … … 587 562 588 563 589 #ifdef CHROMIUM_THREADSAFE590 564 crFreeTSD(&__contextTSD); 591 565 __isContextTLSInited = 0; 592 #endif593 566 } 594 567 … … 692 665 if (diff_api.AlphaFunc) 693 666 crStateSwitchContext(current, defaultContext); 694 #ifdef CHROMIUM_THREADSAFE 667 695 668 SetCurrentContext(defaultContext); 696 #else697 __currentContext = defaultContext;698 #endif699 669 /* ensure matrix state is also current */ 700 670 crStateMatrixMode(defaultContext->transform.matrixMode); 701 671 } 702 672 703 #ifdef CHROMIUM_THREADSAFE704 673 VBoxTlsRefMarkDestroy(ctx); 705 674 # ifdef IN_GUEST … … 712 681 # endif 713 682 VBoxTlsRefRelease(ctx); 714 #else715 crStateFreeContext(ctx);716 #endif717 683 } 718 684 … … 744 710 } 745 711 746 #ifdef CHROMIUM_THREADSAFE747 712 SetCurrentContext(pLocalCtx); 748 #else749 __currentContext = pLocalCtx;750 #endif751 713 752 714 /* ensure matrix state is also current */ … … 769 731 return; /* no-op */ 770 732 771 #ifdef CHROMIUM_THREADSAFE772 733 SetCurrentContext(pLocalCtx); 773 #else774 __currentContext = pLocalCtx;775 #endif776 777 734 if (pLocalCtx) 778 735 { -
trunk/src/VBox/GuestHost/OpenGL/util/hash.c
r63199 r78341 37 37 38 38 struct CRHashTable { 39 unsigned int num_elements; 40 CRHashNode *buckets[CR_NUM_BUCKETS]; 41 CRHashIdPool *idPool; 42 #ifdef CHROMIUM_THREADSAFE 39 unsigned int num_elements; 40 CRHashNode *buckets[CR_NUM_BUCKETS]; 41 CRHashIdPool *idPool; 43 42 CRmutex mutex; 44 #endif45 43 }; 46 44 … … 382 380 } 383 381 hash->idPool = crAllocHashIdPoolEx( min, max ); 384 #ifdef CHROMIUM_THREADSAFE385 382 crInitMutex(&hash->mutex); 386 #endif387 383 return hash; 388 384 } … … 400 396 if ( !hash) return; 401 397 402 #ifdef CHROMIUM_THREADSAFE403 398 crLockMutex(&hash->mutex); 404 #endif405 406 399 for ( i = 0; i < CR_NUM_BUCKETS; i++ ) 407 400 { … … 424 417 } 425 418 crFreeHashIdPool( hash->idPool ); 426 427 #ifdef CHROMIUM_THREADSAFE428 419 crUnlockMutex(&hash->mutex); 429 420 crFreeMutex(&hash->mutex); 430 #endif431 432 421 crFree( hash ); 433 422 } … … 440 429 if (!hash) return; 441 430 442 #ifdef CHROMIUM_THREADSAFE443 431 crLockMutex(&hash->mutex); 444 #endif445 446 432 for (i = 0; i < CR_NUM_BUCKETS; i++) 447 433 { … … 465 451 crFreeHashIdPool(hash->idPool); 466 452 467 #ifdef CHROMIUM_THREADSAFE468 453 crUnlockMutex(&hash->mutex); 469 454 crFreeMutex(&hash->mutex); 470 #endif471 472 455 crFree(hash); 473 456 } … … 476 459 void crHashtableLock(CRHashTable *h) 477 460 { 478 #ifdef CHROMIUM_THREADSAFE 479 crLockMutex(&h->mutex); 480 #endif 461 crLockMutex(&h->mutex); 481 462 } 482 463 483 464 void crHashtableUnlock(CRHashTable *h) 484 465 { 485 #ifdef CHROMIUM_THREADSAFE 486 crUnlockMutex(&h->mutex); 487 #endif 466 crUnlockMutex(&h->mutex); 488 467 } 489 468 … … 513 492 return; 514 493 515 #ifdef CHROMIUM_THREADSAFE516 494 crLockMutex(&hash->mutex); 517 #endif518 495 crHashtableWalkUnlocked(hash, walkFunc , dataPtr2); 519 #ifdef CHROMIUM_THREADSAFE520 496 crUnlockMutex(&hash->mutex); 521 #endif522 497 } 523 498 … … 531 506 unsigned int index = crHash(key); 532 507 CRHashNode *node = (CRHashNode *) crCalloc( sizeof( CRHashNode ) ); 533 #ifdef CHROMIUM_THREADSAFE 534 crLockMutex(&h->mutex); 535 #endif 508 509 crLockMutex(&h->mutex); 536 510 node->key = key; 537 511 node->data = data; … … 540 514 h->num_elements++; 541 515 crHashIdPoolAllocId (h->idPool, key); 542 #ifdef CHROMIUM_THREADSAFE 543 crUnlockMutex(&h->mutex); 544 #endif 516 crUnlockMutex(&h->mutex); 545 517 } 546 518 … … 548 520 { 549 521 GLboolean fAllocated; 550 #ifdef CHROMIUM_THREADSAFE 551 crLockMutex(&h->mutex); 552 #endif 522 523 crLockMutex(&h->mutex); 553 524 fAllocated = crHashIdPoolAllocId (h->idPool, key); 554 #ifdef CHROMIUM_THREADSAFE 555 crUnlockMutex(&h->mutex); 556 #endif 525 crUnlockMutex(&h->mutex); 557 526 return fAllocated; 558 527 } … … 560 529 void crHashtableWalkKeys( CRHashTable *h, CRHashIdWalkKeys walkFunc , void *data) 561 530 { 562 #ifdef CHROMIUM_THREADSAFE 563 crLockMutex(&h->mutex); 564 #endif 531 crLockMutex(&h->mutex); 565 532 crHashIdWalkKeys(h->idPool, walkFunc , data); 566 #ifdef CHROMIUM_THREADSAFE 567 crUnlockMutex(&h->mutex); 568 #endif 533 crUnlockMutex(&h->mutex); 569 534 } 570 535 … … 573 538 GLuint res; 574 539 575 #ifdef CHROMIUM_THREADSAFE 576 crLockMutex(&h->mutex); 577 #endif 540 crLockMutex(&h->mutex); 578 541 res = crHashIdPoolAllocBlock (h->idPool, range); 579 542 #ifdef DEBUG_misha … … 588 551 } 589 552 #endif 590 #ifdef CHROMIUM_THREADSAFE 591 crUnlockMutex(&h->mutex); 592 #endif 553 crUnlockMutex(&h->mutex); 593 554 return res; 594 555 } … … 599 560 CRHashNode *temp, *beftemp = NULL; 600 561 601 #ifdef CHROMIUM_THREADSAFE 602 crLockMutex(&h->mutex); 603 #endif 562 crLockMutex(&h->mutex); 604 563 for ( temp = h->buckets[index]; temp; temp = temp->next ) 605 564 { … … 623 582 624 583 crHashIdPoolFreeBlock( h->idPool, key, 1 ); 625 #ifdef CHROMIUM_THREADSAFE 626 crUnlockMutex(&h->mutex); 627 #endif 584 crUnlockMutex(&h->mutex); 628 585 } 629 586 … … 633 590 CRHashNode *temp, *beftemp = NULL; 634 591 635 #ifdef CHROMIUM_THREADSAFE 636 crLockMutex(&h->mutex); 637 #endif 592 crLockMutex(&h->mutex); 638 593 for (temp = h->buckets[index]; temp; temp = temp->next) 639 594 { … … 657 612 658 613 crHashIdPoolFreeBlock(h->idPool, key, 1); 659 #ifdef CHROMIUM_THREADSAFE 660 crUnlockMutex(&h->mutex); 661 #endif 614 crUnlockMutex(&h->mutex); 662 615 } 663 616 … … 676 629 unsigned int index = crHash( key ); 677 630 CRHashNode *temp; 678 #ifdef CHROMIUM_THREADSAFE 631 679 632 crLockMutex((CRmutex *)&h->mutex); 680 #endif681 633 for ( temp = h->buckets[index]; temp; temp = temp->next ) 682 634 { … … 684 636 break; 685 637 } 686 #ifdef CHROMIUM_THREADSAFE687 638 crUnlockMutex((CRmutex *)&h->mutex); 688 #endif689 639 if ( !temp ) 690 640 { … … 699 649 unsigned int index = crHash( key ); 700 650 CRHashNode *temp; 701 #ifdef CHROMIUM_THREADSAFE 702 crLockMutex(&h->mutex); 703 #endif 651 652 crLockMutex(&h->mutex); 704 653 for ( temp = h->buckets[index]; temp; temp = temp->next ) 705 654 { … … 707 656 break; 708 657 } 709 #ifdef CHROMIUM_THREADSAFE 710 crUnlockMutex(&h->mutex); 711 #endif 658 crUnlockMutex(&h->mutex); 712 659 if ( !temp ) 713 660 { … … 715 662 return; 716 663 } 717 #ifdef CHROMIUM_THREADSAFE 718 crLockMutex(&h->mutex); 719 #endif 664 crLockMutex(&h->mutex); 720 665 if ( temp->data && deleteFunc ) 721 666 { … … 723 668 } 724 669 temp->data = data; 725 #ifdef CHROMIUM_THREADSAFE 726 crUnlockMutex(&h->mutex); 727 #endif 670 crUnlockMutex(&h->mutex); 728 671 } 729 672 … … 753 696 return rc; 754 697 755 #ifdef CHROMIUM_THREADSAFE756 698 crLockMutex(&pHash->mutex); 757 #endif758 699 for (i = 0; i<CR_NUM_BUCKETS && !rc; i++) 759 700 { … … 770 711 } 771 712 } 772 #ifdef CHROMIUM_THREADSAFE 713 773 714 crUnlockMutex(&pHash->mutex); 774 #endif775 776 715 return rc; 777 716 } -
trunk/src/VBox/GuestHost/OpenGL/util/net.c
r78190 r78341 48 48 int num_clients; /* total number of clients (unused?) */ 49 49 50 #ifdef CHROMIUM_THREADSAFE51 50 CRmutex mutex; 52 #endif53 51 } cr_net; 54 52 … … 134 132 { 135 133 crDebug("crNetConnectToServer() failed, freeing the connection"); 136 #ifdef CHROMIUM_THREADSAFE 137 crFreeMutex( &conn->messageList.lock ); 138 #endif 134 crFreeMutex( &conn->messageList.lock ); 139 135 conn->Disconnect(conn); 140 136 crFree( conn ); … … 219 215 { 220 216 conn->Disconnect(conn); 221 #ifdef CHROMIUM_THREADSAFE 222 crFreeMutex( &conn->messageList.lock ); 223 #endif 217 crFreeMutex( &conn->messageList.lock ); 224 218 crFree(conn); 225 219 } … … 244 238 cr_net.use_hgcm = 0; 245 239 cr_net.num_clients = 0; 246 #ifdef CHROMIUM_THREADSAFE247 240 crInitMutex(&cr_net.mutex); 248 #endif249 241 250 242 cr_net.initialized = 1; … … 305 297 if (!cr_net.initialized) return; 306 298 307 #ifdef CHROMIUM_THREADSAFE308 299 crLockMutex(&cr_net.mutex); 309 #endif310 300 311 301 /* Note, other protocols used by chromium should free up stuff too, … … 329 319 cr_net.initialized = 0; 330 320 331 #ifdef CHROMIUM_THREADSAFE332 321 crUnlockMutex(&cr_net.mutex); 333 322 crFreeMutex(&cr_net.mutex); 334 #endif335 323 } 336 324 … … 380 368 list->head = list->tail = NULL; 381 369 list->numMessages = 0; 382 #ifdef CHROMIUM_THREADSAFE383 370 crInitMutex(&list->lock); 384 371 crInitCondition(&list->nonEmpty); 385 #endif386 372 } 387 373 … … 400 386 CRMessageListNode *node; 401 387 402 #ifdef CHROMIUM_THREADSAFE403 388 crLockMutex(&list->lock); 404 #endif405 389 406 390 node = (CRMessageListNode *) crAlloc(sizeof(CRMessageListNode)); … … 419 403 list->numMessages++; 420 404 421 #ifdef CHROMIUM_THREADSAFE422 405 crSignalCondition(&list->nonEmpty); 423 406 crUnlockMutex(&list->lock); 424 #endif425 407 } 426 408 … … 437 419 int retval; 438 420 439 #ifdef CHROMIUM_THREADSAFE440 421 crLockMutex(&list->lock); 441 #endif442 422 443 423 if (list->head) { … … 467 447 } 468 448 469 #ifdef CHROMIUM_THREADSAFE470 449 crUnlockMutex(&list->lock); 471 #endif472 473 450 return retval; 474 451 } … … 488 465 CRMessageListNode *node; 489 466 490 #ifdef CHROMIUM_THREADSAFE491 467 crLockMutex(&list->lock); 492 #endif 493 494 #ifdef CHROMIUM_THREADSAFE 468 495 469 while (!list->head) { 496 470 crWaitCondition(&list->nonEmpty, &list->lock); 497 471 } 498 #else499 CRASSERT(list->head);500 #endif501 472 502 473 node = list->head; … … 518 489 519 490 crFree(node); 520 521 #ifdef CHROMIUM_THREADSAFE522 491 crUnlockMutex(&list->lock); 523 #endif524 492 } 525 493 … … 653 621 { 654 622 conn->Disconnect( conn ); 655 #ifdef CHROMIUM_THREADSAFE656 623 crFreeMutex( &conn->messageList.lock ); 657 #endif658 624 crFree( conn ); 659 625 } -
trunk/src/VBox/GuestHost/OpenGL/util/vboxhgcm.c
r78263 r78341 169 169 CRConnection **conns; 170 170 CRBufferPool *bufpool; 171 #ifdef CHROMIUM_THREADSAFE172 171 CRmutex mutex; 173 172 CRmutex recvmutex; 174 #endif175 173 CRNetReceiveFuncList *recv_list; 176 174 CRNetCloseFuncList *close_list; … … 637 635 CRVBOXHGCMBUFFER *buf; 638 636 639 #ifdef CHROMIUM_THREADSAFE640 637 crLockMutex(&g_crvboxhgcm.mutex); 641 #endif642 643 638 buf = (CRVBOXHGCMBUFFER *) crBufferPoolPop(g_crvboxhgcm.bufpool, conn->buffer_size); 644 639 … … 661 656 } 662 657 663 #ifdef CHROMIUM_THREADSAFE664 658 crUnlockMutex(&g_crvboxhgcm.mutex); 665 #endif666 667 659 return (void *)( buf + 1 ); 668 660 … … 673 665 void *pvBuff; 674 666 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 675 #ifdef CHROMIUM_THREADSAFE676 667 crLockMutex(&g_crvboxhgcm.mutex); 677 #endif678 668 pvBuff = _crVBoxHGCMAlloc(conn); 679 #ifdef CHROMIUM_THREADSAFE680 669 crUnlockMutex(&g_crvboxhgcm.mutex); 681 #endif682 670 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 683 671 return pvBuff; … … 730 718 { 731 719 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 732 #ifdef CHROMIUM_THREADSAFE 720 733 721 crLockMutex(&g_crvboxhgcm.mutex); 734 #endif735 722 _crVBoxHGCMWriteExact(conn, buf, len); 736 #ifdef CHROMIUM_THREADSAFE737 723 crUnlockMutex(&g_crvboxhgcm.mutex); 738 #endif739 724 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 740 725 } … … 908 893 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 909 894 910 #ifdef CHROMIUM_THREADSAFE911 895 crLockMutex(&g_crvboxhgcm.mutex); 912 #endif913 914 896 if (!bufp) /* We're sending a user-allocated buffer. */ 915 897 { … … 923 905 crVBoxHGCMWriteReadExact(conn, start, len, CR_VBOXHGCM_USERALLOCATED); 924 906 #endif 925 #ifdef CHROMIUM_THREADSAFE926 907 crUnlockMutex(&g_crvboxhgcm.mutex); 927 #endif928 908 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 929 909 return; … … 951 931 952 932 /* Reclaim this pointer for reuse */ 953 #ifdef CHROMIUM_THREADSAFE954 933 crLockMutex(&g_crvboxhgcm.mutex); 955 #endif956 934 crBufferPoolPush(g_crvboxhgcm.bufpool, hgcm_buffer, hgcm_buffer->allocated); 957 #ifdef CHROMIUM_THREADSAFE958 935 crUnlockMutex(&g_crvboxhgcm.mutex); 959 #endif960 936 961 937 /* Since the buffer's now in the 'free' buffer pool, the caller can't … … 965 941 *bufp = NULL; 966 942 967 #ifdef CHROMIUM_THREADSAFE968 943 crUnlockMutex(&g_crvboxhgcm.mutex); 969 #endif970 971 944 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 972 945 } … … 1006 979 { 1007 980 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 1008 #ifdef CHROMIUM_THREADSAFE1009 981 crLockMutex(&g_crvboxhgcm.mutex); 1010 #endif1011 982 crVBoxHGCMReadExact(conn, buf, len); 1012 #ifdef CHROMIUM_THREADSAFE1013 983 crUnlockMutex(&g_crvboxhgcm.mutex); 1014 #endif1015 984 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 1016 985 } … … 1028 997 { 1029 998 case CR_VBOXHGCM_MEMORY: 1030 #ifdef CHROMIUM_THREADSAFE1031 999 crLockMutex(&g_crvboxhgcm.mutex); 1032 #endif1033 1000 if (g_crvboxhgcm.bufpool) { 1034 1001 /** @todo o'rly? */ … … 1038 1005 crBufferPoolPush(g_crvboxhgcm.bufpool, hgcm_buffer, hgcm_buffer->allocated); 1039 1006 } 1040 #ifdef CHROMIUM_THREADSAFE1041 1007 crUnlockMutex(&g_crvboxhgcm.mutex); 1042 #endif1043 1008 break; 1044 1009 … … 1055 1020 { 1056 1021 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 1057 #ifdef CHROMIUM_THREADSAFE1058 1022 crLockMutex(&g_crvboxhgcm.mutex); 1059 #endif1060 1023 _crVBoxHGCMFree(conn, buf); 1061 #ifdef CHROMIUM_THREADSAFE1062 1024 crUnlockMutex(&g_crvboxhgcm.mutex); 1063 #endif1064 1025 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 1065 1026 } … … 1170 1131 { 1171 1132 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 1172 #ifdef CHROMIUM_THREADSAFE1173 1133 crLockMutex(&g_crvboxhgcm.mutex); 1174 #endif1175 1134 _crVBoxHGCMReceiveMessage(conn); 1176 #ifdef CHROMIUM_THREADSAFE1177 1135 crUnlockMutex(&g_crvboxhgcm.mutex); 1178 #endif1179 1136 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 1180 1137 } … … 1402 1359 if (!g_crvboxhgcm.initialized) return; 1403 1360 1404 #ifdef CHROMIUM_THREADSAFE1405 1361 crLockMutex(&g_crvboxhgcm.mutex); 1406 #endif1407 1408 1362 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 1409 1363 … … 1425 1379 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 1426 1380 1427 #ifdef CHROMIUM_THREADSAFE1428 1381 crUnlockMutex(&g_crvboxhgcm.mutex); 1429 #endif1430 1382 } 1431 1383 … … 1433 1385 { 1434 1386 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 1435 #ifdef CHROMIUM_THREADSAFE1436 1387 crLockMutex(&g_crvboxhgcm.mutex); 1437 #endif1438 1388 _crVBoxHGCMFree(conn, mess); 1439 1389 CRASSERT(FALSE); 1440 #ifdef CHROMIUM_THREADSAFE1441 1390 crUnlockMutex(&g_crvboxhgcm.mutex); 1442 #endif1443 1391 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 1444 1392 } … … 1543 1491 1544 1492 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 1545 1546 #ifdef CHROMIUM_THREADSAFE1547 1493 crLockMutex(&g_crvboxhgcm.mutex); 1548 #endif1549 1550 1494 pClient = _crVBoxHGSMIClientGet(conn); 1551 1495 if (pClient) … … 1559 1503 } 1560 1504 1561 #ifdef CHROMIUM_THREADSAFE1562 1505 crUnlockMutex(&g_crvboxhgcm.mutex); 1563 #endif1564 1565 1506 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 1566 1507 … … 1571 1512 { 1572 1513 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 1573 #ifdef CHROMIUM_THREADSAFE1574 1514 crLockMutex(&g_crvboxhgcm.mutex); 1575 #endif1576 1515 _crVBoxHGSMIFree(conn, buf); 1577 #ifdef CHROMIUM_THREADSAFE1578 1516 crUnlockMutex(&g_crvboxhgcm.mutex); 1579 #endif1580 1517 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 1581 1518 } … … 1921 1858 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 1922 1859 1923 #ifdef CHROMIUM_THREADSAFE1924 1860 crLockMutex(&g_crvboxhgcm.mutex); 1925 #endif1926 1927 1861 if (!bufp) /* We're sending a user-allocated buffer. */ 1928 1862 { … … 1939 1873 _crVBoxHGSMIWriteReadExact(conn, pClient, (void*)start, 0, len, false); 1940 1874 #endif 1941 #ifdef CHROMIUM_THREADSAFE1942 1875 crUnlockMutex(&g_crvboxhgcm.mutex); 1943 #endif1944 1876 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 1945 1877 return; … … 1948 1880 /* fallback */ 1949 1881 crVBoxHGCMSend(conn, bufp, start, len); 1950 #ifdef CHROMIUM_THREADSAFE1951 1882 crUnlockMutex(&g_crvboxhgcm.mutex); 1952 #endif1953 1883 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 1954 1884 return; … … 1967 1897 /* fallback */ 1968 1898 crVBoxHGCMSend(conn, bufp, start, len); 1969 #ifdef CHROMIUM_THREADSAFE1970 1899 crUnlockMutex(&g_crvboxhgcm.mutex); 1971 #endif1972 1900 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 1973 1901 return; … … 1984 1912 { 1985 1913 crVBoxHGCMSend(conn, bufp, start, len); 1986 #ifdef CHROMIUM_THREADSAFE1987 1914 crUnlockMutex(&g_crvboxhgcm.mutex); 1988 #endif1989 1915 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 1990 1916 return; … … 2019 1945 *bufp = NULL; 2020 1946 2021 #ifdef CHROMIUM_THREADSAFE2022 1947 crUnlockMutex(&g_crvboxhgcm.mutex); 2023 #endif2024 2025 1948 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 2026 1949 } … … 2048 1971 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 2049 1972 2050 #ifdef CHROMIUM_THREADSAFE2051 1973 crLockMutex(&g_crvboxhgcm.mutex); 2052 #endif2053 2054 1974 CRASSERT(0); 2055 1975 2056 1976 _crVBoxHGCMReceiveMessage(conn); 2057 1977 2058 #ifdef CHROMIUM_THREADSAFE2059 1978 crUnlockMutex(&g_crvboxhgcm.mutex); 2060 #endif2061 2062 1979 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 2063 1980 } … … 2083 2000 int rc = VINF_SUCCESS; 2084 2001 2085 #ifdef CHROMIUM_THREADSAFE2086 2002 crLockMutex(&g_crvboxhgcm.mutex); 2087 #endif2088 2089 2003 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 2090 2004 … … 2119 2033 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 2120 2034 2121 #ifdef CHROMIUM_THREADSAFE2122 2035 crUnlockMutex(&g_crvboxhgcm.mutex); 2123 #endif2124 2036 return RT_SUCCESS(rc); 2125 2037 } … … 2133 2045 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 2134 2046 2135 #ifdef CHROMIUM_THREADSAFE2136 2047 crLockMutex(&g_crvboxhgcm.mutex); 2137 #endif2138 2139 2048 fHasActiveCons = _crVBoxCommonDoDisconnectLocked(conn); 2140 2049 … … 2153 2062 2154 2063 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 2155 2156 #ifdef CHROMIUM_THREADSAFE2157 2064 crUnlockMutex(&g_crvboxhgcm.mutex); 2158 #endif2159 2065 } 2160 2066 … … 2162 2068 { 2163 2069 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 2164 #ifdef CHROMIUM_THREADSAFE2165 2070 crLockMutex(&g_crvboxhgcm.mutex); 2166 #endif2167 2071 CRASSERT(0); 2168 2072 2169 2073 _crVBoxHGSMIFree(conn, mess); 2170 2074 2171 #ifdef CHROMIUM_THREADSAFE2172 2075 crUnlockMutex(&g_crvboxhgcm.mutex); 2173 #endif2174 2076 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 2175 2077 } … … 2212 2114 #endif 2213 2115 2214 #ifdef CHROMIUM_THREADSAFE2215 2116 crInitMutex(&g_crvboxhgcm.mutex); 2216 2117 crInitMutex(&g_crvboxhgcm.recvmutex); 2217 #endif2218 2118 g_crvboxhgcm.bufpool = crBufferPoolInit(16); 2219 2119 … … 2253 2153 if (!g_crvboxhgcm.initialized) return; 2254 2154 2255 #ifdef CHROMIUM_THREADSAFE2256 2155 crLockMutex(&g_crvboxhgcm.mutex); 2257 #endif2258 2156 2259 2157 /* Connection count would be changed in calls to crNetDisconnect, so we have to store original value. … … 2275 2173 g_crvboxhgcm.bufpool = NULL; 2276 2174 2277 #ifdef CHROMIUM_THREADSAFE2278 2175 crUnlockMutex(&g_crvboxhgcm.mutex); 2279 2176 crFreeMutex(&g_crvboxhgcm.mutex); 2280 2177 crFreeMutex(&g_crvboxhgcm.recvmutex); 2281 #endif2282 2178 2283 2179 crFree(g_crvboxhgcm.conns); … … 2364 2260 #endif 2365 2261 2366 #ifdef CHROMIUM_THREADSAFE2367 2262 crLockMutex(&g_crvboxhgcm.mutex); 2368 #endif 2263 2369 2264 /* Find a free slot */ 2370 2265 for (i = 0; i < g_crvboxhgcm.num_conns; i++) { … … 2384 2279 g_crvboxhgcm.conns[g_crvboxhgcm.num_conns++] = conn; 2385 2280 } 2386 #ifdef CHROMIUM_THREADSAFE2387 2281 crUnlockMutex(&g_crvboxhgcm.mutex); 2388 #endif2389 2282 } 2390 2283 … … 2443 2336 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 2444 2337 2445 #ifdef CHROMIUM_THREADSAFE2446 2338 crLockMutex(&g_crvboxhgcm.mutex); 2447 #endif2448 2339 2449 2340 #ifdef IN_GUEST … … 2479 2370 } 2480 2371 2481 #ifdef CHROMIUM_THREADSAFE2482 2372 crUnlockMutex(&g_crvboxhgcm.mutex); 2483 #endif2484 2485 2373 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 2486 2374 -
trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu.c
r78263 r78341 466 466 if (window && context) 467 467 { 468 #ifdef CHROMIUM_THREADSAFE469 468 crSetTSD(&_RenderTSD, context); 470 #else471 render_spu.currentContext = context;472 #endif473 469 context->currentWindow = window; 474 470 … … 509 505 { 510 506 renderspu_SystemMakeCurrent( NULL, 0, NULL ); 511 #ifdef CHROMIUM_THREADSAFE512 507 crSetTSD(&_RenderTSD, NULL); 513 #else514 render_spu.currentContext = NULL;515 #endif516 508 } 517 509 else -
trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu.h
r78263 r78341 232 232 ContextInfo *defaultSharedContext; 233 233 234 #ifndef CHROMIUM_THREADSAFE235 ContextInfo *currentContext;236 #endif237 238 234 crOpenGLInterface ws; /**< Window System interface */ 239 235 … … 306 302 extern uint64_t render_spu_parent_window_id; 307 303 308 #ifdef CHROMIUM_THREADSAFE309 304 extern CRtsd _RenderTSD; 310 305 #define GET_CONTEXT_VAL() ((ContextInfo *) crGetTSD(&_RenderTSD)) … … 312 307 crSetTSD(&_RenderTSD, (_v)); \ 313 308 } while (0) 314 #else315 #define GET_CONTEXT_VAL() (render_spu.currentContext)316 #define SET_CONTEXT_VAL(_v) do { \317 render_spu.currentContext = (_v); \318 } while (0)319 320 #endif321 309 322 310 #define GET_CONTEXT(T) ContextInfo *T = GET_CONTEXT_VAL() -
trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_glx.c
r78251 r78341 1572 1572 if (window->BltInfo.width != w || window->BltInfo.height != h) { 1573 1573 /* Only resize if the new dimensions really are different */ 1574 #ifdef CHROMIUM_THREADSAFE1575 1574 ContextInfo *currentContext = (ContextInfo *) crGetTSD(&_RenderTSD); 1576 #else1577 ContextInfo *currentContext = render_spu.currentContext;1578 #endif1579 1575 /* Can't resize pbuffers, so destroy it and make a new one */ 1580 1576 render_spu.ws.glXDestroyPbuffer(window->visual->dpy, window->window); -
trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_init.c
r78263 r78341 28 28 RenderSPU render_spu; 29 29 uint64_t render_spu_parent_window_id = 0; 30 31 #ifdef CHROMIUM_THREADSAFE32 30 CRtsd _RenderTSD; 33 #endif34 31 35 32 #ifdef RT_OS_WINDOWS … … 151 148 self->privatePtr = (void *) &render_spu; 152 149 153 #ifdef CHROMIUM_THREADSAFE154 150 crDebug("Render SPU: thread-safe"); 155 151 crInitTSD(&_RenderTSD); 156 #endif157 152 158 153 crMemZero(&render_spu, sizeof(render_spu)); … … 498 493 crUnloadOpenGL(); 499 494 500 #ifdef CHROMIUM_THREADSAFE501 495 crFreeTSD(&_RenderTSD); 502 #endif503 504 496 return 1; 505 497 }
Note:
See TracChangeset
for help on using the changeset viewer.