VirtualBox

Ignore:
Timestamp:
Mar 22, 2013 9:28:29 PM (12 years ago)
Author:
vboxsync
Message:

crOpenGL: misc bugxifes

Location:
trunk/src/VBox/HostServices/SharedOpenGL
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedOpenGL/crserver/crservice.cpp

    r45132 r45148  
    991991                    CHECK_ERROR_BREAK(pConsole, COMGETTER(Display)(pDisplay.asOutParam()));
    992992
     993                    crServerVBoxCompositionSetEnableStateGlobal(GL_FALSE);
     994
    993995                    rc = crVBoxServerSetScreenCount(monitorCount);
    994996                    AssertRCReturn(rc, rc);
     
    10161018                    g_pConsole = pConsole;
    10171019
     1020                    crServerVBoxCompositionSetEnableStateGlobal(GL_TRUE);
     1021
    10181022                    rc = VINF_SUCCESS;
    10191023                }
     
    11051109                CHECK_ERROR_RET(g_pConsole, COMGETTER(Display)(pDisplay.asOutParam()), rc);
    11061110                CHECK_ERROR_RET(pDisplay, GetFramebuffer(screenId, pFramebuffer.asOutParam(), &xo, &yo), rc);
     1111
     1112                crServerVBoxCompositionSetEnableStateGlobal(GL_FALSE);
    11071113
    11081114                if (!pFramebuffer)
     
    11301136                    }
    11311137                }
     1138
     1139                crServerVBoxCompositionSetEnableStateGlobal(GL_TRUE);
    11321140
    11331141                rc = VINF_SUCCESS;
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server.h

    r45132 r45148  
    143143void crServerMuralFBOSwapBuffers(CRMuralInfo *mural);
    144144
    145 void crServerVBoxCompositionReenable(CRMuralInfo *mural, GLboolean fForcePresent);
    146 void crServerVBoxCompositionDisable(CRMuralInfo *mural);
     145void crServerVBoxCompositionDisableEnter(CRMuralInfo *mural);
     146void crServerVBoxCompositionDisableLeave(CRMuralInfo *mural, GLboolean fForcePresentOnEnabled);
    147147void crServerVBoxCompositionPresent(CRMuralInfo *mural);
    148148DECLINLINE(GLboolean) crServerVBoxCompositionPresentNeeded(CRMuralInfo *mural)
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_clear.c

    r43980 r45148  
    428428        ctx = crStateGetCurrent();
    429429
     430        CRASSERT(cr_server.curClient && cr_server.curClient->currentMural == mural);
     431
    430432    if (ctx->framebufferobject.drawFB
    431433            || (ctx->buffer.drawBuffer != GL_FRONT && ctx->buffer.drawBuffer != GL_FRONT_LEFT))
    432         cr_server.curClient->currentMural->bFbDraw = GL_FALSE;
     434        mural->bFbDraw = GL_FALSE;
    433435
    434436    if (crServerIsRedirectedToFBO())
     
    440442    {
    441443        cr_server.head_spu->dispatch_table.SwapBuffers( mural->spuWindow, flags );
     444        if (crServerVBoxCompositionPresentNeeded(mural))
     445            mural->fDataPresented = GL_TRUE;
    442446    }
    443447}
     
    449453    cr_server.head_spu->dispatch_table.Flush();
    450454
    451     if (!cr_server.curClient->currentMural) /* <- on window destroy this will be zero */
    452         return;
    453 
    454     if (cr_server.curClient->currentMural->bFbDraw && crServerIsRedirectedToFBO())
    455     {
    456         crServerPresentFBO(cr_server.curClient->currentMural);
    457     }
    458 
    459     if (ctx->framebufferobject.drawFB
    460             || (ctx->buffer.drawBuffer != GL_FRONT && ctx->buffer.drawBuffer != GL_FRONT_LEFT))
    461         cr_server.curClient->currentMural->bFbDraw = GL_FALSE;
     455    if (cr_server.curClient && cr_server.curClient->currentMural)
     456    {
     457        CRMuralInfo *mural = cr_server.curClient->currentMural;
     458        if (mural->bFbDraw)
     459        {
     460            if (crServerIsRedirectedToFBO())
     461                crServerPresentFBO(mural);
     462            else if (crServerVBoxCompositionPresentNeeded(mural))
     463                mural->fDataPresented = GL_TRUE;
     464        }
     465
     466        if (ctx->framebufferobject.drawFB
     467                || (ctx->buffer.drawBuffer != GL_FRONT && ctx->buffer.drawBuffer != GL_FRONT_LEFT))
     468            mural->bFbDraw = GL_FALSE;
     469    }
    462470}
    463471
     
    469477    cr_server.head_spu->dispatch_table.Finish();
    470478
    471     if (cr_server.curClient->currentMural->bFbDraw && crServerIsRedirectedToFBO())
    472     {
    473         crServerPresentFBO(cr_server.curClient->currentMural);
    474     }
    475 
    476     if (ctx->framebufferobject.drawFB
    477             || (ctx->buffer.drawBuffer != GL_FRONT && ctx->buffer.drawBuffer != GL_FRONT_LEFT))
    478         cr_server.curClient->currentMural->bFbDraw = GL_FALSE;
    479 }
     479    if (cr_server.curClient && cr_server.curClient->currentMural)
     480    {
     481        CRMuralInfo *mural = cr_server.curClient->currentMural;
     482        if (mural->bFbDraw)
     483        {
     484            if (crServerIsRedirectedToFBO())
     485                crServerPresentFBO(mural);
     486            else if (crServerVBoxCompositionPresentNeeded(mural))
     487                mural->fDataPresented = GL_TRUE;
     488        }
     489
     490        if (ctx->framebufferobject.drawFB
     491                || (ctx->buffer.drawBuffer != GL_FRONT && ctx->buffer.drawBuffer != GL_FRONT_LEFT))
     492            mural->bFbDraw = GL_FALSE;
     493    }
     494}
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_main.c

    r45132 r45148  
    18141814        crVBoxServerFBImageDataTerm(&Data.data);
    18151815
    1816         if (pMural->fUseFBO && crServerVBoxCompositionPresentNeeded(pMural))
     1816        if (pMural->fUseFBO && pMural->fDataPresented && crServerVBoxCompositionPresentNeeded(pMural))
    18171817        {
    18181818            crServerPresentFBO(pMural);
     
    22072207    int *sIndex = (int*) data2;
    22082208
     2209    Assert(pMI->cDisabled);
     2210
    22092211    if (pMI->screenId == *sIndex)
    22102212    {
     2213        crServerVBoxCompositionDisableEnter(pMI);
     2214
    22112215        renderspuReparentWindow(pMI->spuWindow);
     2216
     2217        crServerVBoxCompositionDisableLeave(pMI, GL_FALSE);
    22122218    }
    22132219}
     
    23452351    fForcePresent = crServerVBoxCompositionPresentNeeded(pMI);
    23462352
    2347     crServerVBoxCompositionDisable(pMI);
     2353    crServerVBoxCompositionDisableEnter(pMI);
    23482354
    23492355    if (cr_server.fRootVrOn)
     
    24032409    pMI->fRootVrOn = cr_server.fRootVrOn;
    24042410
    2405     crServerVBoxCompositionReenable(pMI, fForcePresent);
     2411    crServerVBoxCompositionDisableLeave(pMI, fForcePresent);
    24062412
    24072413    return rc;
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_muralfbo.c

    r45132 r45148  
    112112    }
    113113
     114    crServerVBoxCompositionDisableEnter(mural);
     115
    114116    if (cr_server.screenCount<2 && !cr_server.bForceOffscreenRendering)
    115117    {
     
    122124
    123125        cr_server.head_spu->dispatch_table.WindowPosition(mural->spuWindow, mural->hX - pVieport->x, mural->hY - pVieport->y);
     126
     127        crServerVBoxCompositionDisableLeave(mural, GL_FALSE);
    124128
    125129        return;
     
    222226                                              mural->width, mural->height);
    223227    }
     228
     229    crServerVBoxCompositionDisableLeave(mural, GL_FALSE);
    224230}
    225231
     
    251257    }
    252258
    253     crServerVBoxCompositionDisable(mural);
     259    crServerVBoxCompositionDisableEnter(mural);
    254260
    255261    if (redir)
     
    258264        {
    259265            crWarning("FBO not supported, can't redirect window output");
     266            crServerVBoxCompositionDisableLeave(mural, GL_FALSE);
    260267            return;
    261268        }
     
    288295    else
    289296    {
    290         if (redir == CR_SERVER_REDIR_NONE)
    291         {
    292             /* tell renderspu we do not want compositor presentation anymore
    293              * renderspu will ensure its redraw thread is done with using the compositor, etc. */
    294             crServerVBoxCompositionDisable(mural);
    295         }
    296 
    297297        if (mural->fUseFBO == CR_SERVER_REDIR_FBO_RAM)
    298298            cr_server.head_spu->dispatch_table.WindowShow(mural->spuWindow, mural->bVisible);
     
    315315
    316316    mural->fUseFBO = redir;
    317     crServerVBoxCompositionReenable(mural, GL_FALSE);
     317    crServerVBoxCompositionDisableLeave(mural, GL_FALSE);
    318318}
    319319
     
    535535    CRASSERT(curCtx == crStateGetCurrent());
    536536
     537    mural->fDataPresented = GL_TRUE;
     538
    537539    if (currentMural)
    538540    {
     
    563565}
    564566
    565 void crServerVBoxCompositionReenable(CRMuralInfo *mural, GLboolean fForcePresent)
    566 {
    567     if (mural->fUseFBO != CR_SERVER_REDIR_FBO_BLT ||
    568             (!fForcePresent
     567static void crServerVBoxCompositionReenable(CRMuralInfo *mural, GLboolean fForcePresent)
     568{
     569    if (mural->fUseFBO != CR_SERVER_REDIR_FBO_BLT
     570            || !mural->fDataPresented
     571            || (!fForcePresent
    569572                    && !crServerVBoxCompositionPresentNeeded(mural)))
    570573        return;
     
    573576}
    574577
    575 void crServerVBoxCompositionDisable(CRMuralInfo *mural)
    576 {
    577     if (mural->fUseFBO != CR_SERVER_REDIR_FBO_BLT)
     578static void crServerVBoxCompositionDisable(CRMuralInfo *mural)
     579{
     580    if (mural->fUseFBO != CR_SERVER_REDIR_FBO_BLT
     581            || !mural->fDataPresented)
    578582        return;
    579583    cr_server.head_spu->dispatch_table.VBoxPresentComposition(mural->spuWindow, NULL, NULL);
     584}
     585
     586void crServerVBoxCompositionDisableEnter(CRMuralInfo *mural)
     587{
     588    ++mural->cDisabled;
     589    Assert(mural->cDisabled);
     590    if (mural->cDisabled == 1)
     591    {
     592        crServerVBoxCompositionDisable(mural);
     593    }
     594}
     595
     596void crServerVBoxCompositionDisableLeave(CRMuralInfo *mural, GLboolean fForcePresentOnEnabled)
     597{
     598    mural->fForcePresentState = fForcePresentOnEnabled;
     599    --mural->cDisabled;
     600    Assert(mural->cDisabled < UINT32_MAX/2);
     601    if (!mural->cDisabled)
     602    {
     603        crServerVBoxCompositionReenable(mural, mural->fForcePresentState);
     604        mural->fForcePresentState = GL_FALSE;
     605    }
     606}
     607
     608static void crServerVBoxCompositionSetEnableStateGlobalCB(unsigned long key, void *data1, void *data2)
     609{
     610    CRMuralInfo *mural = (CRMuralInfo *)data1;
     611
     612    if (data2)
     613        crServerVBoxCompositionDisableLeave(mural, GL_FALSE);
     614    else
     615        crServerVBoxCompositionDisableEnter(mural);
     616}
     617
     618DECLEXPORT(void) crServerVBoxCompositionSetEnableStateGlobal(GLboolean fEnable)
     619{
     620    crHashtableWalk(cr_server.muralTable, crServerVBoxCompositionSetEnableStateGlobalCB, (void*)fEnable);
     621
     622    crHashtableWalk(cr_server.dummyMuralTable, crServerVBoxCompositionSetEnableStateGlobalCB, (void*)fEnable);
    580623}
    581624
     
    600643    if (!crServerVBoxCompositionPresentNeeded(mural))
    601644        return;
     645
     646    mural->fDataPresented = GL_TRUE;
    602647
    603648    Tex.width = mural->width;
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_window.c

    r45132 r45148  
    466466
    467467        /* 1. tell renderspu to stop using the current compositor (see above comment) */
    468         crServerVBoxCompositionDisable(mural);
     468        crServerVBoxCompositionDisableEnter(mural);
    469469
    470470        /* 2. do necessary modifications (see above comment) */
     
    495495        mural->height = height;
    496496
     497        mural->fDataPresented = GL_FALSE;
     498
    497499        if (cr_server.currentMural == mural)
    498500        {
     
    564566        /* uncomment when needed */
    565567        /* NOTE: !!! we have mural->fHasPresentationData set to GL_FALSE above, so crServerVBoxCompositionReenable will have no effect in any way
    566         crServerVBoxCompositionReenable(mural);
     568
    567569        */
     570        crServerVBoxCompositionDisableLeave(mural, GL_FALSE);
    568571    }
    569572}
     
    615618
    616619        /* 1. tell renderspu to stop using the current compositor (see above comment) */
    617         crServerVBoxCompositionDisable(mural);
     620        crServerVBoxCompositionDisableEnter(mural);
    618621
    619622        /* 2. do necessary modifications (see above comment) */
     
    663666
    664667        /* 3. re-set the compositor (see above comment) */
    665         crServerVBoxCompositionReenable(mural, fForcePresent);
     668        crServerVBoxCompositionDisableLeave(mural, fForcePresent);
    666669    }
    667670}
     
    690693
    691694    /* 1. tell renderspu to stop using the current compositor (see above comment) */
    692     crServerVBoxCompositionDisable(mural);
     695    crServerVBoxCompositionDisableEnter(mural);
    693696
    694697    /* 2. do necessary modifications (see above comment) */
     
    769772
    770773    /* 3. re-set the compositor (see above comment) */
    771     crServerVBoxCompositionReenable(mural, fForcePresent);
     774    crServerVBoxCompositionDisableLeave(mural, fForcePresent);
    772775}
    773776
  • trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu.c

    r45132 r45148  
    656656        {
    657657            renderspu_SystemVBoxPresentComposition(window, pChangedEntry);
    658             if (CrVrScrCompositorIsEmpty(pCompositor))
    659                 renderspuVBoxCompositorSet( window, NULL);
    660658        }
    661659    }
     
    978976    int rc;
    979977    Assert(window->pCompositor);
    980     if (CrVrScrCompositorIsEmpty(window->pCompositor))
     978    if (CrVrScrCompositorIsEmpty(window->pCompositor) && RTCritSectGetRecursion(&window->CompositorLock) == 1)
    981979        window->pCompositor = NULL;
    982980    rc = RTCritSectLeave(&window->CompositorLock);
  • trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_cocoa_helper.m

    r45132 r45148  
    10861086#ifdef CR_RENDER_FORCE_PRESENT_MAIN_THREAD
    10871087                                renderspuVBoxCompositorRelease(m_pWinInfo);
     1088                                pCompositor = NULL;
    10881089#endif
    10891090                    }
     
    11051106                            {
    11061107                                glFlush();
     1108                                   
    11071109                                /* issue to the gui thread */
    11081110                                [self setNeedsDisplay:YES];
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