VirtualBox

Changeset 38143 in vbox for trunk/src


Ignore:
Timestamp:
Jul 25, 2011 10:59:42 AM (13 years ago)
Author:
vboxsync
Message:

crogl: auto-flush on thread switch functionality

Location:
trunk/src/VBox
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/crOpenGL/pack/packspu.h

    r33988 r38143  
    4242    CRContext *clientState;  /* used to store client-side GL state */
    4343    GLint serverCtx;         /* context ID returned by server */
     44    GLboolean  fAutoFlush;
     45    ThreadInfo *currentThread;
    4446    GLubyte glVersion[100];     /* GL_VERSION string */
    4547    GLubyte pszRealVendor[100];
  • trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_context.c

    r33988 r38143  
    213213}
    214214
     215#define PACK_FORCED_SYNC
    215216
    216217void PACKSPU_APIENTRY packspu_MakeCurrent( GLint window, GLint nativeWindow, GLint ctx )
     
    234235        newCtx = &pack_spu.context[slot];
    235236        CRASSERT(newCtx->clientState);  /* verify valid */
     237
     238        if (newCtx->fAutoFlush)
     239        {
     240            if (newCtx->currentThread && newCtx->currentThread != thread)
     241            {
     242                int writeback = 1;
     243                crLockMutex(&_PackMutex);
     244                /* do a flush for the previusly assigned thread
     245                 * to ensure all commands issued there are submitted */
     246                if (newCtx->currentThread
     247                    && newCtx->currentThread->inUse
     248                    && newCtx->currentThread->netServer.conn
     249                    && newCtx->currentThread->packer && newCtx->currentThread->packer->currentBuffer)
     250                {
     251#ifdef PACK_FORCED_SYNC
     252                    CRPackContext *pc = newCtx->currentThread->packer;
     253                    unsigned char *data_ptr;
     254
     255                    CR_GET_BUFFERED_POINTER( pc, 16 );
     256                    WRITE_DATA( 0, GLint, 16 );
     257                    WRITE_DATA( 4, GLenum, CR_WRITEBACK_EXTEND_OPCODE );
     258                    WRITE_NETWORK_POINTER( 8, (void *) &writeback );
     259                    WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
     260                    CR_UNLOCK_PACKER_CONTEXT(pc);
     261#endif
     262                    packspuFlush((void *) newCtx->currentThread);
     263
     264#ifdef PACK_FORCED_SYNC
     265                    while (writeback)
     266                        crNetRecv();
     267#endif
     268                }
     269                crUnlockMutex(&_PackMutex);
     270            }
     271            newCtx->currentThread = thread;
     272        }
    236273
    237274        thread->currentContext = newCtx;
  • trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_misc.c

    r37986 r38143  
    401401}
    402402
     403static void packspuFluchOnThreadSwitch(GLboolean fEnable)
     404{
     405    GET_THREAD(thread);
     406    if (thread->currentContext->fAutoFlush == fEnable)
     407        return;
     408
     409    thread->currentContext->fAutoFlush = fEnable;
     410    thread->currentContext->currentThread = fEnable ? thread : NULL;
     411}
     412
    403413void PACKSPU_APIENTRY packspu_ChromiumParameteriCR(GLenum target, GLint value)
    404414{
     415    if (GL_FLUSH_ON_THREAD_SWITCH_CR==target)
     416    {
     417        /* this is a pure packspu state, don't propagate it any further */
     418        packspuFluchOnThreadSwitch(value);
     419        return;
     420    }
    405421    if (GL_SHARE_CONTEXT_RESOURCES_CR==target)
    406422    {
     
    555571        }
    556572
     573        for (i=0; i<CR_MAX_CONTEXTS; ++i)
     574        {
     575            ContextInfo *ctx = &pack_spu.context[i];
     576            if (ctx->currentThread == thread)
     577            {
     578                CRASSERT(ctx->fAutoFlush);
     579                ctx->currentThread = NULL;
     580            }
     581        }
     582
    557583        crUnlockMutex(&_PackMutex);
    558584    }
  • trunk/src/VBox/GuestHost/OpenGL/include/chromium.h

    r32060 r38143  
    688688/*Global resource ids sharing*/
    689689#define GL_SHARE_CONTEXT_RESOURCES_CR 0x8B27
     690#define GL_FLUSH_ON_THREAD_SWITCH_CR  0x8B28
    690691
    691692/**********************************************************************/
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