Changeset 78341 in vbox for trunk/src/VBox/Additions/common
- Timestamp:
- Apr 28, 2019 4:47:51 PM (6 years ago)
- Location:
- trunk/src/VBox/Additions/common/crOpenGL
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
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;
Note:
See TracChangeset
for help on using the changeset viewer.