VirtualBox

Changeset 78341 in vbox for trunk/src/VBox/GuestHost/OpenGL


Ignore:
Timestamp:
Apr 28, 2019 4:47:51 PM (6 years ago)
Author:
vboxsync
Message:

Config.kmk,Additions/common/crOpenGL,VBox/GuestHost/OpenGL,HostServices/SharedOpenGL: Remove CHROMIUM_THREADSAFE define and apply the current default

Location:
trunk/src/VBox/GuestHost/OpenGL
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/GuestHost/OpenGL/include/cr_glstate.h

    r69474 r78341  
    4646#include "spu_dispatch_table.h"
    4747
    48 #ifdef CHROMIUM_THREADSAFE
    49 # include <cr_threads.h>
    50 #endif
     48#include "cr_threads.h"
    5149
    5250#include <iprt/cdefs.h>
     
    132130    int id;
    133131
    134 #ifdef CHROMIUM_THREADSAFE
    135132    /* we keep reference counting of context's makeCurrent for different threads
    136133     * this is primarily needed to avoid having an invalid memory reference in the TLS
     
    143140     * */
    144141    VBOXTLSREFDATA
    145 #endif
    146142
    147143    CRbitvalue bitid[CR_MAX_BITARRAY];
  • trunk/src/VBox/GuestHost/OpenGL/include/cr_pack.h

    r78190 r78341  
    1515#include "state/cr_currentpointers.h"
    1616#include "state/cr_client.h"
    17 #ifdef CHROMIUM_THREADSAFE
    1817#include "cr_threads.h"
    19 #endif
    2018
    2119#include <iprt/types.h>
     
    8482    int updateBBOX;
    8583    CRPackBuffer *currentBuffer;
    86 #ifdef CHROMIUM_THREADSAFE
    8784    CRmutex mutex;
    88 #endif
    8985    char *file;  /**< for debugging only */
    9086    int line;    /**< for debugging only */
     
    9793# define CR_PACKER_CONTEXT_ARG_NOREF()  do {} while (0)
    9894# define CR_PACKER_CONTEXT_ARGCTX(C)
    99 # ifdef CHROMIUM_THREADSAFE
    10095extern 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))
    11099extern uint32_t cr_packer_cmd_blocks_enabled;
    111100#else /* if defined IN_RING0 */
  • trunk/src/VBox/GuestHost/OpenGL/packer/pack_buffer.c

    r78190 r78341  
    374374    CR_UNLOCK_PACKER_CONTEXT(pc);
    375375}
    376 
    377 
    378 #ifndef CHROMIUM_THREADSAFE
    379 static unsigned char *sanityCheckPointer = NULL;
    380 #endif
    381376
    382377
     
    452447
    453448        *((unsigned int *) data_ptr) = size;
    454 #ifndef CHROMIUM_THREADSAFE
    455         sanityCheckPointer = data_ptr + 4;
    456 #endif
    457449        return data_ptr + 4;
    458450}
     
    469461{
    470462        CR_GET_PACKER_CONTEXT(pc);
    471 #ifndef CHROMIUM_THREADSAFE
    472         CRASSERT(sanityCheckPointer == packet);
    473         sanityCheckPointer = NULL;
    474 #endif
    475463
    476464        if ( IS_BUFFERED( packet ) )
  • trunk/src/VBox/GuestHost/OpenGL/packer/pack_init.c

    r78190 r78341  
    1010#include <stdio.h>
    1111
    12 #ifdef CHROMIUM_THREADSAFE
    1312CRtsd _PackerTSD;
    1413int cr_packer_globals;  /* dummy - for the sake of packer.def */
    15 #else
    16 int _PackerTSD;         /* dummy - for the sake of packer.def */  /* drm1 */
    17 DLLDATA(CRPackContext) cr_packer_globals;
    18 #endif
    19 
    2014uint32_t cr_packer_cmd_blocks_enabled = 0;
    2115
    2216CRPackContext *crPackNewContext(void)
    2317{
    24 #ifdef CHROMIUM_THREADSAFE
    2518    CRPackContext *pc = crCalloc(sizeof(CRPackContext));
    2619    if (!pc)
    2720        return NULL;
    2821    crInitMutex(&pc->mutex);
    29 #else
    30     GET_PACKER_CONTEXT(pc);
    31         crMemZero( pc, sizeof(CRPackContext));
    32 #endif
    3322    pc->u32CmdBlockState = 0;
    3423    pc->Flush = NULL;
     
    4029void crPackDeleteContext(CRPackContext *pc)
    4130{
    42 #ifdef CHROMIUM_THREADSAFE
    4331    crFreeMutex(&pc->mutex);
    4432    crFree(pc);
    45 #endif
    4633}
    4734
     
    4936void crPackSetContext( CRPackContext *pc )
    5037{
    51 #ifdef CHROMIUM_THREADSAFE
    5238    crSetTSD( &_PackerTSD, pc );
    53 #else
    54     CRASSERT( pc == &cr_packer_globals );
    55     (void)pc;
    56 #endif
    5739}
    5840
     
    6143CRPackContext *crPackGetContext( void )
    6244{
    63 #ifdef CHROMIUM_THREADSAFE
    6445    return (CRPackContext *) crGetTSD( &_PackerTSD );
    65 #else
    66     return &cr_packer_globals;
    67 #endif
    6846}
    6947
  • trunk/src/VBox/GuestHost/OpenGL/state_tracker/state.h

    r69474 r78341  
    2929#define GetCurrentBits() __currentBits
    3030
    31 #ifdef CHROMIUM_THREADSAFE
    3231#include <cr_threads.h>
    3332
     
    3938 * (i.e. state_glsl.c) is using it */
    4039#define SetCurrentContext(_ctx) VBoxTlsRefSetCurrent(CRContext, &__contextTSD, _ctx)
    41 #else
    42 extern CRContext *__currentContext;
    43 #define GetCurrentContext() __currentContext
    44 #endif
    4540
    4641extern GLboolean g_bVBoxEnableDiffOnMakeCurrent;
  • trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_glsl.c

    r78263 r78341  
    192192    /** @todo hack to allow crStateFreeGLSLProgram to work correctly,
    193193      as the current context isn't the one being destroyed*/
    194 #ifdef CHROMIUM_THREADSAFE
    195194    CRASSERT(g != ctx);
    196195    VBoxTlsRefAddRef(ctx); /* <- this is a hack to avoid subsequent SetCurrentContext(g) do recursive Destroy for ctx */
     
    198197        VBoxTlsRefAddRef(g); /* <- ensure the g is not destroyed by the following SetCurrentContext call */
    199198    SetCurrentContext(ctx);
    200 #else
    201     __currentContext = ctx;
    202 #endif
    203199
    204200    crFreeHashtable(ctx->glsl.programs, crStateFreeGLSLProgram);
    205201    crFreeHashtable(ctx->glsl.shaders, crStateFreeGLSLShader);
    206202
    207 #ifdef CHROMIUM_THREADSAFE
    208203    SetCurrentContext(g);
    209204    if (g)
    210205        VBoxTlsRefRelease(g);
    211206    VBoxTlsRefRelease(ctx); /* <- restore back the cRefs (see above) */
    212 #else
    213     __currentContext = g;
    214 #endif
    215 
    216207}
    217208
  • trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_init.c

    r78263 r78341  
    1212#include <iprt/asm.h>
    1313
    14 #ifdef CHROMIUM_THREADSAFE
    1514static bool __isContextTLSInited = false;
    1615CRtsd __contextTSD;
    17 #else
    18 CRContext *__currentContext = NULL;
    19 #endif
    2016
    2117CRStateBits *__currentBits = NULL;
     
    297293}
    298294
    299 #ifdef CHROMIUM_THREADSAFE
    300 static void
    301 crStateFreeContext(CRContext *ctx);
     295static void crStateFreeContext(CRContext *ctx);
     296
    302297static DECLCALLBACK(void) crStateContextDtor(void *pvCtx)
    303298{
    304299    crStateFreeContext((CRContext*)pvCtx);
    305300}
    306 #endif
    307301
    308302/*
     
    334328    CRASSERT(g_cContexts < RT_ELEMENTS(g_pAvailableContexts));
    335329    ctx->id = i;
    336 #ifdef CHROMIUM_THREADSAFE
    337330    VBoxTlsRefInit(ctx, crStateContextDtor);
    338 #endif
    339331    ctx->flush_func = NULL;
    340332    for (j=0;j<CR_MAX_BITARRAY;j++){
     
    474466}
    475467
    476 #ifdef CHROMIUM_THREADSAFE
    477 # ifndef RT_OS_WINDOWS
     468#ifndef RT_OS_WINDOWS
    478469static void crStateThreadTlsDtor(void *pvValue)
    479470{
     
    481472    VBoxTlsRefRelease(pCtx);
    482473}
    483 # endif
    484474#endif
    485475
     
    513503    g_cContexts = 0;
    514504
    515 #ifdef CHROMIUM_THREADSAFE
    516505    if (!__isContextTLSInited)
    517506    {
     
    525514        __isContextTLSInited = 1;
    526515    }
    527 #endif
    528516
    529517    if (defaultContext) {
    530518        /* Free the default/NULL context.
    531519         * Ensures context bits are reset */
    532 #ifdef CHROMIUM_THREADSAFE
    533520        SetCurrentContext(NULL);
    534521        VBoxTlsRefRelease(defaultContext);
    535 #else
    536         crStateFreeContext(defaultContext);
    537         __currentContext = NULL;
    538 #endif
    539522    }
    540523
     
    550533    CRASSERT(g_pAvailableContexts[0] == defaultContext);
    551534    CRASSERT(g_cContexts == 1);
    552 #ifdef CHROMIUM_THREADSAFE
    553535    SetCurrentContext(defaultContext);
    554 #else
    555     __currentContext = defaultContext;
    556 #endif
    557536}
    558537
     
    574553        if (g_pAvailableContexts[i])
    575554        {
    576 #ifdef CHROMIUM_THREADSAFE
    577555            if (VBoxTlsRefIsFunctional(g_pAvailableContexts[i]))
    578556                VBoxTlsRefRelease(g_pAvailableContexts[i]);
    579 #else
    580             crStateFreeContext(g_pAvailableContexts[i]);
    581 #endif
    582557        }
    583558    }
     
    587562
    588563
    589 #ifdef CHROMIUM_THREADSAFE
    590564    crFreeTSD(&__contextTSD);
    591565    __isContextTLSInited = 0;
    592 #endif
    593566}
    594567
     
    692665        if (diff_api.AlphaFunc)
    693666            crStateSwitchContext(current, defaultContext);
    694 #ifdef CHROMIUM_THREADSAFE
     667
    695668        SetCurrentContext(defaultContext);
    696 #else
    697         __currentContext = defaultContext;
    698 #endif
    699669        /* ensure matrix state is also current */
    700670        crStateMatrixMode(defaultContext->transform.matrixMode);
    701671    }
    702672
    703 #ifdef CHROMIUM_THREADSAFE
    704673    VBoxTlsRefMarkDestroy(ctx);
    705674# ifdef IN_GUEST
     
    712681# endif
    713682    VBoxTlsRefRelease(ctx);
    714 #else
    715     crStateFreeContext(ctx);
    716 #endif
    717683}
    718684
     
    744710    }
    745711
    746 #ifdef CHROMIUM_THREADSAFE
    747712    SetCurrentContext(pLocalCtx);
    748 #else
    749     __currentContext = pLocalCtx;
    750 #endif
    751713
    752714    /* ensure matrix state is also current */
     
    769731        return; /* no-op */
    770732
    771 #ifdef CHROMIUM_THREADSAFE
    772733    SetCurrentContext(pLocalCtx);
    773 #else
    774     __currentContext = pLocalCtx;
    775 #endif
    776 
    777734    if (pLocalCtx)
    778735    {
  • trunk/src/VBox/GuestHost/OpenGL/util/hash.c

    r63199 r78341  
    3737
    3838struct 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;
    4342    CRmutex mutex;
    44 #endif
    4543};
    4644
     
    382380    }
    383381    hash->idPool = crAllocHashIdPoolEx( min, max );
    384 #ifdef CHROMIUM_THREADSAFE
    385382    crInitMutex(&hash->mutex);
    386 #endif
    387383    return hash;
    388384}
     
    400396    if ( !hash) return;
    401397
    402 #ifdef CHROMIUM_THREADSAFE
    403398    crLockMutex(&hash->mutex);
    404 #endif
    405 
    406399    for ( i = 0; i < CR_NUM_BUCKETS; i++ )
    407400    {
     
    424417    }
    425418    crFreeHashIdPool( hash->idPool );
    426 
    427 #ifdef CHROMIUM_THREADSAFE
    428419    crUnlockMutex(&hash->mutex);
    429420    crFreeMutex(&hash->mutex);
    430 #endif
    431 
    432421    crFree( hash );
    433422}
     
    440429    if (!hash) return;
    441430
    442 #ifdef CHROMIUM_THREADSAFE
    443431    crLockMutex(&hash->mutex);
    444 #endif
    445 
    446432    for (i = 0; i < CR_NUM_BUCKETS; i++)
    447433    {
     
    465451    crFreeHashIdPool(hash->idPool);
    466452
    467 #ifdef CHROMIUM_THREADSAFE
    468453    crUnlockMutex(&hash->mutex);
    469454    crFreeMutex(&hash->mutex);
    470 #endif
    471 
    472455    crFree(hash);
    473456}
     
    476459void crHashtableLock(CRHashTable *h)
    477460{
    478 #ifdef CHROMIUM_THREADSAFE
    479     crLockMutex(&h->mutex);
    480 #endif
     461    crLockMutex(&h->mutex);
    481462}
    482463
    483464void crHashtableUnlock(CRHashTable *h)
    484465{
    485 #ifdef CHROMIUM_THREADSAFE
    486     crUnlockMutex(&h->mutex);
    487 #endif
     466    crUnlockMutex(&h->mutex);
    488467}
    489468
     
    513492        return;
    514493
    515 #ifdef CHROMIUM_THREADSAFE
    516494    crLockMutex(&hash->mutex);
    517 #endif
    518495    crHashtableWalkUnlocked(hash, walkFunc , dataPtr2);
    519 #ifdef CHROMIUM_THREADSAFE
    520496    crUnlockMutex(&hash->mutex);
    521 #endif
    522497}
    523498
     
    531506    unsigned int index = crHash(key);
    532507    CRHashNode *node = (CRHashNode *) crCalloc( sizeof( CRHashNode ) );
    533 #ifdef CHROMIUM_THREADSAFE
    534     crLockMutex(&h->mutex);
    535 #endif
     508
     509    crLockMutex(&h->mutex);
    536510    node->key = key;
    537511    node->data = data;
     
    540514    h->num_elements++;
    541515    crHashIdPoolAllocId (h->idPool, key);
    542 #ifdef CHROMIUM_THREADSAFE
    543     crUnlockMutex(&h->mutex);
    544 #endif
     516    crUnlockMutex(&h->mutex);
    545517}
    546518
     
    548520{
    549521    GLboolean fAllocated;
    550 #ifdef CHROMIUM_THREADSAFE
    551     crLockMutex(&h->mutex);
    552 #endif
     522
     523    crLockMutex(&h->mutex);
    553524    fAllocated = crHashIdPoolAllocId (h->idPool, key);
    554 #ifdef CHROMIUM_THREADSAFE
    555     crUnlockMutex(&h->mutex);
    556 #endif
     525    crUnlockMutex(&h->mutex);
    557526    return fAllocated;
    558527}
     
    560529void crHashtableWalkKeys( CRHashTable *h, CRHashIdWalkKeys walkFunc , void *data)
    561530{
    562 #ifdef CHROMIUM_THREADSAFE
    563     crLockMutex(&h->mutex);
    564 #endif
     531    crLockMutex(&h->mutex);
    565532    crHashIdWalkKeys(h->idPool, walkFunc , data);
    566 #ifdef CHROMIUM_THREADSAFE
    567     crUnlockMutex(&h->mutex);
    568 #endif
     533    crUnlockMutex(&h->mutex);
    569534}
    570535
     
    573538    GLuint res;
    574539
    575 #ifdef CHROMIUM_THREADSAFE
    576     crLockMutex(&h->mutex);
    577 #endif
     540    crLockMutex(&h->mutex);
    578541    res = crHashIdPoolAllocBlock (h->idPool, range);
    579542#ifdef DEBUG_misha
     
    588551    }
    589552#endif
    590 #ifdef CHROMIUM_THREADSAFE
    591     crUnlockMutex(&h->mutex);
    592 #endif
     553    crUnlockMutex(&h->mutex);
    593554    return res;
    594555}
     
    599560    CRHashNode *temp, *beftemp = NULL;
    600561
    601 #ifdef CHROMIUM_THREADSAFE
    602     crLockMutex(&h->mutex);
    603 #endif
     562    crLockMutex(&h->mutex);
    604563    for ( temp = h->buckets[index]; temp; temp = temp->next )
    605564    {
     
    623582   
    624583    crHashIdPoolFreeBlock( h->idPool, key, 1 );
    625 #ifdef CHROMIUM_THREADSAFE
    626     crUnlockMutex(&h->mutex);
    627 #endif
     584    crUnlockMutex(&h->mutex);
    628585}
    629586
     
    633590    CRHashNode *temp, *beftemp = NULL;
    634591
    635 #ifdef CHROMIUM_THREADSAFE
    636     crLockMutex(&h->mutex);
    637 #endif
     592    crLockMutex(&h->mutex);
    638593    for (temp = h->buckets[index]; temp; temp = temp->next)
    639594    {
     
    657612
    658613    crHashIdPoolFreeBlock(h->idPool, key, 1);
    659 #ifdef CHROMIUM_THREADSAFE
    660     crUnlockMutex(&h->mutex);
    661 #endif
     614    crUnlockMutex(&h->mutex);
    662615}
    663616
     
    676629    unsigned int index = crHash( key );
    677630    CRHashNode *temp;
    678 #ifdef CHROMIUM_THREADSAFE
     631
    679632    crLockMutex((CRmutex *)&h->mutex);
    680 #endif
    681633    for ( temp = h->buckets[index]; temp; temp = temp->next )
    682634    {
     
    684636            break;
    685637    }
    686 #ifdef CHROMIUM_THREADSAFE
    687638    crUnlockMutex((CRmutex *)&h->mutex);
    688 #endif
    689639    if ( !temp )
    690640    {
     
    699649    unsigned int index = crHash( key );
    700650    CRHashNode *temp;
    701 #ifdef CHROMIUM_THREADSAFE
    702     crLockMutex(&h->mutex);
    703 #endif
     651
     652    crLockMutex(&h->mutex);
    704653    for ( temp = h->buckets[index]; temp; temp = temp->next )
    705654    {
     
    707656            break;
    708657    }
    709 #ifdef CHROMIUM_THREADSAFE
    710     crUnlockMutex(&h->mutex);
    711 #endif
     658    crUnlockMutex(&h->mutex);
    712659    if ( !temp )
    713660    {
     
    715662        return;
    716663    }
    717 #ifdef CHROMIUM_THREADSAFE
    718     crLockMutex(&h->mutex);
    719 #endif
     664    crLockMutex(&h->mutex);
    720665    if ( temp->data && deleteFunc )
    721666    {
     
    723668    }
    724669    temp->data = data;
    725 #ifdef CHROMIUM_THREADSAFE
    726     crUnlockMutex(&h->mutex);
    727 #endif
     670    crUnlockMutex(&h->mutex);
    728671}
    729672
     
    753696        return rc;
    754697
    755 #ifdef CHROMIUM_THREADSAFE
    756698    crLockMutex(&pHash->mutex);
    757 #endif
    758699    for (i = 0; i<CR_NUM_BUCKETS && !rc; i++)
    759700    {
     
    770711        }
    771712    }
    772 #ifdef CHROMIUM_THREADSAFE
     713
    773714    crUnlockMutex(&pHash->mutex);
    774 #endif
    775 
    776715    return rc;
    777716}
  • trunk/src/VBox/GuestHost/OpenGL/util/net.c

    r78190 r78341  
    4848    int                  num_clients; /* total number of clients (unused?) */
    4949
    50 #ifdef CHROMIUM_THREADSAFE
    5150    CRmutex              mutex;
    52 #endif
    5351} cr_net;
    5452
     
    134132    {
    135133        crDebug("crNetConnectToServer() failed, freeing the connection");
    136         #ifdef CHROMIUM_THREADSAFE
    137             crFreeMutex( &conn->messageList.lock );
    138         #endif
     134        crFreeMutex( &conn->messageList.lock );
    139135        conn->Disconnect(conn);
    140136        crFree( conn );
     
    219215{
    220216    conn->Disconnect(conn);
    221     #ifdef CHROMIUM_THREADSAFE
    222         crFreeMutex( &conn->messageList.lock );
    223     #endif
     217    crFreeMutex( &conn->messageList.lock );
    224218    crFree(conn);
    225219}
     
    244238        cr_net.use_hgcm    = 0;
    245239        cr_net.num_clients = 0;
    246 #ifdef CHROMIUM_THREADSAFE
    247240        crInitMutex(&cr_net.mutex);
    248 #endif
    249241
    250242        cr_net.initialized = 1;
     
    305297    if (!cr_net.initialized) return;
    306298
    307 #ifdef CHROMIUM_THREADSAFE
    308299    crLockMutex(&cr_net.mutex);
    309 #endif
    310300
    311301    /* Note, other protocols used by chromium should free up stuff too,
     
    329319    cr_net.initialized = 0;
    330320
    331 #ifdef CHROMIUM_THREADSAFE
    332321    crUnlockMutex(&cr_net.mutex);
    333322    crFreeMutex(&cr_net.mutex);
    334 #endif
    335323}
    336324
     
    380368    list->head = list->tail = NULL;
    381369    list->numMessages = 0;
    382 #ifdef CHROMIUM_THREADSAFE
    383370    crInitMutex(&list->lock);
    384371    crInitCondition(&list->nonEmpty);
    385 #endif
    386372}
    387373
     
    400386    CRMessageListNode *node;
    401387
    402 #ifdef CHROMIUM_THREADSAFE
    403388    crLockMutex(&list->lock);
    404 #endif
    405389
    406390    node = (CRMessageListNode *) crAlloc(sizeof(CRMessageListNode));
     
    419403    list->numMessages++;
    420404
    421 #ifdef CHROMIUM_THREADSAFE
    422405    crSignalCondition(&list->nonEmpty);
    423406    crUnlockMutex(&list->lock);
    424 #endif
    425407}
    426408
     
    437419    int retval;
    438420
    439 #ifdef CHROMIUM_THREADSAFE
    440421    crLockMutex(&list->lock);
    441 #endif
    442422
    443423    if (list->head) {
     
    467447    }
    468448
    469 #ifdef CHROMIUM_THREADSAFE
    470449    crUnlockMutex(&list->lock);
    471 #endif
    472 
    473450    return retval;
    474451}
     
    488465    CRMessageListNode *node;
    489466
    490 #ifdef CHROMIUM_THREADSAFE
    491467    crLockMutex(&list->lock);
    492 #endif
    493 
    494 #ifdef CHROMIUM_THREADSAFE
     468
    495469    while (!list->head) {
    496470        crWaitCondition(&list->nonEmpty, &list->lock);
    497471    }
    498 #else
    499     CRASSERT(list->head);
    500 #endif
    501472
    502473    node = list->head;
     
    518489
    519490    crFree(node);
    520 
    521 #ifdef CHROMIUM_THREADSAFE
    522491    crUnlockMutex(&list->lock);
    523 #endif
    524492}
    525493
     
    653621{
    654622    conn->Disconnect( conn );
    655 #ifdef CHROMIUM_THREADSAFE
    656623    crFreeMutex( &conn->messageList.lock );
    657 #endif
    658624    crFree( conn );
    659625}
  • trunk/src/VBox/GuestHost/OpenGL/util/vboxhgcm.c

    r78263 r78341  
    169169    CRConnection         **conns;
    170170    CRBufferPool         *bufpool;
    171 #ifdef CHROMIUM_THREADSAFE
    172171    CRmutex              mutex;
    173172    CRmutex              recvmutex;
    174 #endif
    175173    CRNetReceiveFuncList *recv_list;
    176174    CRNetCloseFuncList   *close_list;
     
    637635    CRVBOXHGCMBUFFER *buf;
    638636
    639 #ifdef CHROMIUM_THREADSAFE
    640637    crLockMutex(&g_crvboxhgcm.mutex);
    641 #endif
    642 
    643638    buf = (CRVBOXHGCMBUFFER *) crBufferPoolPop(g_crvboxhgcm.bufpool, conn->buffer_size);
    644639
     
    661656    }
    662657
    663 #ifdef CHROMIUM_THREADSAFE
    664658    crUnlockMutex(&g_crvboxhgcm.mutex);
    665 #endif
    666 
    667659    return (void *)( buf + 1 );
    668660
     
    673665    void *pvBuff;
    674666    VBOXCRHGSMIPROFILE_FUNC_PROLOGUE();
    675 #ifdef CHROMIUM_THREADSAFE
    676667    crLockMutex(&g_crvboxhgcm.mutex);
    677 #endif
    678668    pvBuff = _crVBoxHGCMAlloc(conn);
    679 #ifdef CHROMIUM_THREADSAFE
    680669    crUnlockMutex(&g_crvboxhgcm.mutex);
    681 #endif
    682670    VBOXCRHGSMIPROFILE_FUNC_EPILOGUE();
    683671    return pvBuff;
     
    730718{
    731719    VBOXCRHGSMIPROFILE_FUNC_PROLOGUE();
    732 #ifdef CHROMIUM_THREADSAFE
     720
    733721    crLockMutex(&g_crvboxhgcm.mutex);
    734 #endif
    735722    _crVBoxHGCMWriteExact(conn, buf, len);
    736 #ifdef CHROMIUM_THREADSAFE
    737723    crUnlockMutex(&g_crvboxhgcm.mutex);
    738 #endif
    739724    VBOXCRHGSMIPROFILE_FUNC_EPILOGUE();
    740725}
     
    908893    VBOXCRHGSMIPROFILE_FUNC_PROLOGUE();
    909894
    910 #ifdef CHROMIUM_THREADSAFE
    911895    crLockMutex(&g_crvboxhgcm.mutex);
    912 #endif
    913 
    914896    if (!bufp) /* We're sending a user-allocated buffer. */
    915897    {
     
    923905            crVBoxHGCMWriteReadExact(conn, start, len, CR_VBOXHGCM_USERALLOCATED);
    924906#endif
    925 #ifdef CHROMIUM_THREADSAFE
    926907            crUnlockMutex(&g_crvboxhgcm.mutex);
    927 #endif
    928908            VBOXCRHGSMIPROFILE_FUNC_EPILOGUE();
    929909        return;
     
    951931
    952932    /* Reclaim this pointer for reuse */
    953 #ifdef CHROMIUM_THREADSAFE
    954933    crLockMutex(&g_crvboxhgcm.mutex);
    955 #endif
    956934    crBufferPoolPush(g_crvboxhgcm.bufpool, hgcm_buffer, hgcm_buffer->allocated);
    957 #ifdef CHROMIUM_THREADSAFE
    958935    crUnlockMutex(&g_crvboxhgcm.mutex);
    959 #endif
    960936
    961937    /* Since the buffer's now in the 'free' buffer pool, the caller can't
     
    965941    *bufp = NULL;
    966942
    967 #ifdef CHROMIUM_THREADSAFE
    968943    crUnlockMutex(&g_crvboxhgcm.mutex);
    969 #endif
    970 
    971944    VBOXCRHGSMIPROFILE_FUNC_EPILOGUE();
    972945}
     
    1006979{
    1007980    VBOXCRHGSMIPROFILE_FUNC_PROLOGUE();
    1008 #ifdef CHROMIUM_THREADSAFE
    1009981    crLockMutex(&g_crvboxhgcm.mutex);
    1010 #endif
    1011982    crVBoxHGCMReadExact(conn, buf, len);
    1012 #ifdef CHROMIUM_THREADSAFE
    1013983    crUnlockMutex(&g_crvboxhgcm.mutex);
    1014 #endif
    1015984    VBOXCRHGSMIPROFILE_FUNC_EPILOGUE();
    1016985}
     
    1028997    {
    1029998        case CR_VBOXHGCM_MEMORY:
    1030 #ifdef CHROMIUM_THREADSAFE
    1031999            crLockMutex(&g_crvboxhgcm.mutex);
    1032 #endif
    10331000            if (g_crvboxhgcm.bufpool) {
    10341001                /** @todo o'rly? */
     
    10381005                crBufferPoolPush(g_crvboxhgcm.bufpool, hgcm_buffer, hgcm_buffer->allocated);
    10391006            }
    1040 #ifdef CHROMIUM_THREADSAFE
    10411007            crUnlockMutex(&g_crvboxhgcm.mutex);
    1042 #endif
    10431008            break;
    10441009
     
    10551020{
    10561021    VBOXCRHGSMIPROFILE_FUNC_PROLOGUE();
    1057 #ifdef CHROMIUM_THREADSAFE
    10581022    crLockMutex(&g_crvboxhgcm.mutex);
    1059 #endif
    10601023    _crVBoxHGCMFree(conn, buf);
    1061 #ifdef CHROMIUM_THREADSAFE
    10621024    crUnlockMutex(&g_crvboxhgcm.mutex);
    1063 #endif
    10641025    VBOXCRHGSMIPROFILE_FUNC_EPILOGUE();
    10651026}
     
    11701131{
    11711132    VBOXCRHGSMIPROFILE_FUNC_PROLOGUE();
    1172 #ifdef CHROMIUM_THREADSAFE
    11731133    crLockMutex(&g_crvboxhgcm.mutex);
    1174 #endif
    11751134    _crVBoxHGCMReceiveMessage(conn);
    1176 #ifdef CHROMIUM_THREADSAFE
    11771135    crUnlockMutex(&g_crvboxhgcm.mutex);
    1178 #endif
    11791136    VBOXCRHGSMIPROFILE_FUNC_EPILOGUE();
    11801137}
     
    14021359    if (!g_crvboxhgcm.initialized) return;
    14031360
    1404 #ifdef CHROMIUM_THREADSAFE
    14051361    crLockMutex(&g_crvboxhgcm.mutex);
    1406 #endif
    1407 
    14081362    VBOXCRHGSMIPROFILE_FUNC_PROLOGUE();
    14091363
     
    14251379    VBOXCRHGSMIPROFILE_FUNC_EPILOGUE();
    14261380
    1427 #ifdef CHROMIUM_THREADSAFE
    14281381    crUnlockMutex(&g_crvboxhgcm.mutex);
    1429 #endif
    14301382}
    14311383
     
    14331385{
    14341386    VBOXCRHGSMIPROFILE_FUNC_PROLOGUE();
    1435 #ifdef CHROMIUM_THREADSAFE
    14361387    crLockMutex(&g_crvboxhgcm.mutex);
    1437 #endif
    14381388    _crVBoxHGCMFree(conn, mess);
    14391389    CRASSERT(FALSE);
    1440 #ifdef CHROMIUM_THREADSAFE
    14411390    crUnlockMutex(&g_crvboxhgcm.mutex);
    1442 #endif
    14431391    VBOXCRHGSMIPROFILE_FUNC_EPILOGUE();
    14441392}
     
    15431491
    15441492    VBOXCRHGSMIPROFILE_FUNC_PROLOGUE();
    1545 
    1546 #ifdef CHROMIUM_THREADSAFE
    15471493    crLockMutex(&g_crvboxhgcm.mutex);
    1548 #endif
    1549 
    15501494    pClient = _crVBoxHGSMIClientGet(conn);
    15511495    if (pClient)
     
    15591503    }
    15601504
    1561 #ifdef CHROMIUM_THREADSAFE
    15621505    crUnlockMutex(&g_crvboxhgcm.mutex);
    1563 #endif
    1564 
    15651506    VBOXCRHGSMIPROFILE_FUNC_EPILOGUE();
    15661507
     
    15711512{
    15721513    VBOXCRHGSMIPROFILE_FUNC_PROLOGUE();
    1573 #ifdef CHROMIUM_THREADSAFE
    15741514    crLockMutex(&g_crvboxhgcm.mutex);
    1575 #endif
    15761515    _crVBoxHGSMIFree(conn, buf);
    1577 #ifdef CHROMIUM_THREADSAFE
    15781516    crUnlockMutex(&g_crvboxhgcm.mutex);
    1579 #endif
    15801517    VBOXCRHGSMIPROFILE_FUNC_EPILOGUE();
    15811518}
     
    19211858    VBOXCRHGSMIPROFILE_FUNC_PROLOGUE();
    19221859
    1923 #ifdef CHROMIUM_THREADSAFE
    19241860    crLockMutex(&g_crvboxhgcm.mutex);
    1925 #endif
    1926 
    19271861    if (!bufp) /* We're sending a user-allocated buffer. */
    19281862    {
     
    19391873            _crVBoxHGSMIWriteReadExact(conn, pClient, (void*)start, 0, len, false);
    19401874#endif
    1941 #ifdef CHROMIUM_THREADSAFE
    19421875            crUnlockMutex(&g_crvboxhgcm.mutex);
    1943 #endif
    19441876            VBOXCRHGSMIPROFILE_FUNC_EPILOGUE();
    19451877            return;
     
    19481880        /* fallback */
    19491881        crVBoxHGCMSend(conn, bufp, start, len);
    1950 #ifdef CHROMIUM_THREADSAFE
    19511882        crUnlockMutex(&g_crvboxhgcm.mutex);
    1952 #endif
    19531883        VBOXCRHGSMIPROFILE_FUNC_EPILOGUE();
    19541884        return;
     
    19671897        /* fallback */
    19681898        crVBoxHGCMSend(conn, bufp, start, len);
    1969 #ifdef CHROMIUM_THREADSAFE
    19701899        crUnlockMutex(&g_crvboxhgcm.mutex);
    1971 #endif
    19721900        VBOXCRHGSMIPROFILE_FUNC_EPILOGUE();
    19731901        return;
     
    19841912    {
    19851913        crVBoxHGCMSend(conn, bufp, start, len);
    1986 #ifdef CHROMIUM_THREADSAFE
    19871914        crUnlockMutex(&g_crvboxhgcm.mutex);
    1988 #endif
    19891915        VBOXCRHGSMIPROFILE_FUNC_EPILOGUE();
    19901916        return;
     
    20191945    *bufp = NULL;
    20201946
    2021 #ifdef CHROMIUM_THREADSAFE
    20221947    crUnlockMutex(&g_crvboxhgcm.mutex);
    2023 #endif
    2024 
    20251948    VBOXCRHGSMIPROFILE_FUNC_EPILOGUE();
    20261949}
     
    20481971    VBOXCRHGSMIPROFILE_FUNC_PROLOGUE();
    20491972
    2050 #ifdef CHROMIUM_THREADSAFE
    20511973    crLockMutex(&g_crvboxhgcm.mutex);
    2052 #endif
    2053 
    20541974    CRASSERT(0);
    20551975
    20561976    _crVBoxHGCMReceiveMessage(conn);
    20571977
    2058 #ifdef CHROMIUM_THREADSAFE
    20591978    crUnlockMutex(&g_crvboxhgcm.mutex);
    2060 #endif
    2061 
    20621979    VBOXCRHGSMIPROFILE_FUNC_EPILOGUE();
    20631980}
     
    20832000    int rc = VINF_SUCCESS;
    20842001
    2085 #ifdef CHROMIUM_THREADSAFE
    20862002    crLockMutex(&g_crvboxhgcm.mutex);
    2087 #endif
    2088 
    20892003    VBOXCRHGSMIPROFILE_FUNC_PROLOGUE();
    20902004
     
    21192033    VBOXCRHGSMIPROFILE_FUNC_EPILOGUE();
    21202034
    2121 #ifdef CHROMIUM_THREADSAFE
    21222035    crUnlockMutex(&g_crvboxhgcm.mutex);
    2123 #endif
    21242036    return RT_SUCCESS(rc);
    21252037}
     
    21332045    VBOXCRHGSMIPROFILE_FUNC_PROLOGUE();
    21342046
    2135 #ifdef CHROMIUM_THREADSAFE
    21362047    crLockMutex(&g_crvboxhgcm.mutex);
    2137 #endif
    2138 
    21392048    fHasActiveCons = _crVBoxCommonDoDisconnectLocked(conn);
    21402049
     
    21532062
    21542063    VBOXCRHGSMIPROFILE_FUNC_EPILOGUE();
    2155 
    2156 #ifdef CHROMIUM_THREADSAFE
    21572064    crUnlockMutex(&g_crvboxhgcm.mutex);
    2158 #endif
    21592065}
    21602066
     
    21622068{
    21632069    VBOXCRHGSMIPROFILE_FUNC_PROLOGUE();
    2164 #ifdef CHROMIUM_THREADSAFE
    21652070    crLockMutex(&g_crvboxhgcm.mutex);
    2166 #endif
    21672071    CRASSERT(0);
    21682072
    21692073    _crVBoxHGSMIFree(conn, mess);
    21702074
    2171 #ifdef CHROMIUM_THREADSAFE
    21722075    crUnlockMutex(&g_crvboxhgcm.mutex);
    2173 #endif
    21742076    VBOXCRHGSMIPROFILE_FUNC_EPILOGUE();
    21752077}
     
    22122114#endif
    22132115
    2214 #ifdef CHROMIUM_THREADSAFE
    22152116    crInitMutex(&g_crvboxhgcm.mutex);
    22162117    crInitMutex(&g_crvboxhgcm.recvmutex);
    2217 #endif
    22182118    g_crvboxhgcm.bufpool = crBufferPoolInit(16);
    22192119
     
    22532153    if (!g_crvboxhgcm.initialized) return;
    22542154
    2255 #ifdef CHROMIUM_THREADSAFE
    22562155    crLockMutex(&g_crvboxhgcm.mutex);
    2257 #endif
    22582156
    22592157    /* Connection count would be changed in calls to crNetDisconnect, so we have to store original value.
     
    22752173    g_crvboxhgcm.bufpool = NULL;
    22762174
    2277 #ifdef CHROMIUM_THREADSAFE
    22782175    crUnlockMutex(&g_crvboxhgcm.mutex);
    22792176    crFreeMutex(&g_crvboxhgcm.mutex);
    22802177    crFreeMutex(&g_crvboxhgcm.recvmutex);
    2281 #endif
    22822178
    22832179    crFree(g_crvboxhgcm.conns);
     
    23642260#endif
    23652261
    2366 #ifdef CHROMIUM_THREADSAFE
    23672262    crLockMutex(&g_crvboxhgcm.mutex);
    2368 #endif
     2263
    23692264    /* Find a free slot */
    23702265    for (i = 0; i < g_crvboxhgcm.num_conns; i++) {
     
    23842279        g_crvboxhgcm.conns[g_crvboxhgcm.num_conns++] = conn;
    23852280    }
    2386 #ifdef CHROMIUM_THREADSAFE
    23872281    crUnlockMutex(&g_crvboxhgcm.mutex);
    2388 #endif
    23892282}
    23902283
     
    24432336    VBOXCRHGSMIPROFILE_FUNC_PROLOGUE();
    24442337
    2445 #ifdef CHROMIUM_THREADSAFE
    24462338    crLockMutex(&g_crvboxhgcm.mutex);
    2447 #endif
    24482339
    24492340#ifdef IN_GUEST
     
    24792370    }
    24802371
    2481 #ifdef CHROMIUM_THREADSAFE
    24822372    crUnlockMutex(&g_crvboxhgcm.mutex);
    2483 #endif
    2484 
    24852373    VBOXCRHGSMIPROFILE_FUNC_EPILOGUE();
    24862374
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette