VirtualBox

Ignore:
Timestamp:
Jul 15, 2011 3:14:35 PM (13 years ago)
Author:
vboxsync
Message:

Wddm/3d: fix thread sync issues

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_misc.c

    r37760 r37986  
    104104}
    105105
     106#define PACK_FORCED_SYNC
     107
    106108void PACKSPU_APIENTRY packspu_Flush( void )
    107109{
    108110    GET_THREAD(thread);
    109111    int writeback = 1;
     112    int found=0;
    110113
    111114    if (!thread->bInjectThread)
     
    126129        crLockMutex(&_PackMutex);
    127130
    128         /*Make sure we process commands in order they should appear, so flush thread being injected first*/
     131        /*Make sure we process commands in order they should appear, so flush other threads first*/
    129132        for (i=0; i<MAX_THREADS; ++i)
    130133        {
    131134            if (pack_spu.thread[i].inUse
    132135                && (thread != &pack_spu.thread[i]) && pack_spu.thread[i].netServer.conn
    133                 && (pack_spu.thread[i].netServer.conn->u32ClientID == thread->netServer.conn->u32InjectClientID)
    134136                && pack_spu.thread[i].packer && pack_spu.thread[i].packer->currentBuffer)
    135137            {
     138#ifdef PACK_FORCED_SYNC
     139                CRPackContext *pc = pack_spu.thread[i].packer;
     140                unsigned char *data_ptr;
     141
     142                CR_GET_BUFFERED_POINTER( pc, 16 );
     143                WRITE_DATA( 0, GLint, 16 );
     144                WRITE_DATA( 4, GLenum, CR_WRITEBACK_EXTEND_OPCODE );
     145                WRITE_NETWORK_POINTER( 8, (void *) &writeback );
     146                WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
     147                CR_UNLOCK_PACKER_CONTEXT(pc);
     148#endif
    136149                packspuFlush((void *) &pack_spu.thread[i]);
    137                 break;
     150
     151                if (pack_spu.thread[i].netServer.conn->u32ClientID == thread->netServer.conn->u32InjectClientID)
     152                {
     153                    found=1;
     154                }
     155
     156#ifdef PACK_FORCED_SYNC
     157                while (writeback)
     158                    crNetRecv();
     159#endif
    138160            }
    139161        }
    140162
    141         if (i>=MAX_THREADS)
     163        if (!found)
    142164        {
    143165            /*Thread we're supposed to inject commands for has been detached,
     
    147169        }
    148170
     171#ifdef PACK_FORCED_SYNC
     172        writeback = 1;
     173        crPackWriteback(&writeback);
     174#endif
     175        packspuFlush((void *) thread);
     176
     177#ifdef PACK_FORCED_SYNC
     178        while (writeback)
     179            crNetRecv();
     180#endif
    149181        crUnlockMutex(&_PackMutex);
    150 
    151         packspuFlush((void *) thread);
    152182    }
    153183}
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