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