VirtualBox

Ignore:
Timestamp:
Mar 12, 2013 5:27:04 PM (12 years ago)
Author:
vboxsync
Message:

crOpenGL: offscreen rendering & VRDP+3D-related fixes

Location:
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server.h

    r44740 r45009  
    142142void crServerMuralFBOSwapBuffers(CRMuralInfo *mural);
    143143
     144void crServerVBoxCompositionReenable(CRMuralInfo *mural);
     145void crServerVBoxCompositionDisable(CRMuralInfo *mural);
     146void crServerVBoxCompositionPresent(CRMuralInfo *mural);
     147
    144148#define CR_SERVER_FBO_BB_IDX(_mural) ((_mural)->iBbBuffer)
    145149#define CR_SERVER_FBO_FB_IDX(_mural) (((_mural)->iBbBuffer + 1) % ((_mural)->cBuffers))
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_context.c

    r44860 r45009  
    287287    CRASSERT(ctx);
    288288
    289     oldMural = (CRMuralInfo *) crHashtableSearch(cr_server.muralTable, cr_server.currentWindow);
     289    oldMural = cr_server.currentMural;
    290290
    291291    /* Ubuntu 11.04 hosts misbehave if context window switch is
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_muralfbo.c

    r44951 r45009  
    265265        }
    266266
    267         if (!crStateGetCurrent()->framebufferobject.drawFB)
    268         {
    269             cr_server.head_spu->dispatch_table.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, mural->aidFBOs[mural->iCurDrawBuffer]);
    270         }
    271         if (!crStateGetCurrent()->framebufferobject.readFB)
    272         {
    273             cr_server.head_spu->dispatch_table.BindFramebufferEXT(GL_READ_FRAMEBUFFER, mural->aidFBOs[mural->iCurReadBuffer]);
    274         }
    275 
    276         if (cr_server.curClient && cr_server.curClient->currentMural == mural)
    277         {
     267        if (cr_server.currentMural == mural)
     268        {
     269            if (!crStateGetCurrent()->framebufferobject.drawFB)
     270            {
     271                cr_server.head_spu->dispatch_table.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, mural->aidFBOs[mural->iCurDrawBuffer]);
     272            }
     273            if (!crStateGetCurrent()->framebufferobject.readFB)
     274            {
     275                cr_server.head_spu->dispatch_table.BindFramebufferEXT(GL_READ_FRAMEBUFFER, mural->aidFBOs[mural->iCurReadBuffer]);
     276            }
     277
    278278            crStateGetCurrent()->buffer.width = 0;
    279279            crStateGetCurrent()->buffer.height = 0;
     
    286286            /* tell renderspu we do not want compositor presentation anymore
    287287             * renderspu will ensure its redraw thread is done with using the compositor, etc. */
    288             cr_server.head_spu->dispatch_table.VBoxPresentComposition(mural->spuWindow, NULL, NULL);
     288            crServerVBoxCompositionDisable(mural);
    289289        }
    290290
     
    292292            cr_server.head_spu->dispatch_table.WindowShow(mural->spuWindow, mural->bVisible);
    293293
    294         if (mural->fUseFBO && crServerSupportRedirMuralFBO())
     294        if (cr_server.currentMural == mural)
    295295        {
    296296            if (!crStateGetCurrent()->framebufferobject.drawFB)
     
    302302                cr_server.head_spu->dispatch_table.BindFramebufferEXT(GL_READ_FRAMEBUFFER, 0);
    303303            }
    304         }
    305 
    306         if (cr_server.curClient && cr_server.curClient->currentMural == mural)
    307         {
     304
    308305            crStateGetCurrent()->buffer.width = mural->width;
    309306            crStateGetCurrent()->buffer.height = mural->height;
     
    512509}
    513510
     511void crServerVBoxCompositionPresent(CRMuralInfo *mural)
     512{
     513    CRMuralInfo *currentMural = cr_server.currentMural;
     514    CRContextInfo *curCtxInfo = cr_server.currentCtxInfo;
     515    GLuint idDrawFBO, idReadFBO;
     516    CRContext *curCtx = curCtxInfo->pContext;
     517
     518    CRASSERT(curCtx == crStateGetCurrent());
     519
     520    if (!mural->bVisible)
     521    {
     522        return;
     523    }
     524
     525    if (!mural->width || !mural->height)
     526    {
     527        return;
     528    }
     529
     530    if (!CrVrScrCompositorEntryIsInList(&mural->CEntry))
     531        return;
     532
     533    if (currentMural)
     534    {
     535        idDrawFBO = currentMural->aidFBOs[currentMural->iCurDrawBuffer];
     536        idReadFBO = currentMural->aidFBOs[currentMural->iCurReadBuffer];
     537    }
     538    else
     539    {
     540        idDrawFBO = 0;
     541        idReadFBO = 0;
     542    }
     543
     544    crStateSwitchPrepare(NULL, curCtx, idDrawFBO, idReadFBO);
     545
     546    cr_server.head_spu->dispatch_table.VBoxPresentComposition(mural->spuWindow, &mural->Compositor, &mural->CEntry);
     547
     548    crStateSwitchPostprocess(curCtx, NULL, idDrawFBO, idReadFBO);
     549
     550    mural->fCompositorPresented = GL_TRUE;
     551}
     552
     553void crServerVBoxCompositionReenable(CRMuralInfo *mural)
     554{
     555    if (!mural->fCompositorPresented)
     556        return;
     557
     558    crServerVBoxCompositionPresent(mural);
     559}
     560
     561void crServerVBoxCompositionDisable(CRMuralInfo *mural)
     562{
     563    cr_server.head_spu->dispatch_table.VBoxPresentComposition(mural->spuWindow, NULL, NULL);
     564}
     565
    514566void crServerPresentFBO(CRMuralInfo *mural)
    515567{
     
    539591    if (mural->fUseFBO == CR_SERVER_REDIR_FBO_BLT)
    540592    {
    541         GLuint idDrawFBO, idReadFBO;
    542 
    543         idDrawFBO = mural->aidFBOs[mural->iCurDrawBuffer];
    544         idReadFBO = mural->aidFBOs[mural->iCurReadBuffer];
    545 
    546         crStateSwitchPrepare(NULL, ctx, idDrawFBO, idReadFBO);
    547 
    548         cr_server.head_spu->dispatch_table.VBoxPresentComposition(mural->spuWindow, &mural->Compositor, &mural->CEntry);
    549 
    550         crStateSwitchPostprocess(ctx, NULL, idDrawFBO, idReadFBO);
    551 
     593        crServerVBoxCompositionPresent(mural);
    552594        return;
    553595    }
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_window.c

    r44951 r45009  
    3131        return -1;
    3232    }
     33
     34    mural->fCompositorPresented = GL_FALSE;
    3335
    3436    /*
     
    339341
    340342            /* 1. tell renderspu to stop using the current compositor (see above comment) */
    341             cr_server.head_spu->dispatch_table.VBoxPresentComposition(mural->spuWindow, NULL, NULL);
    342         }
     343            crServerVBoxCompositionDisable(mural);
     344        }
     345
     346        mural->fCompositorPresented = GL_FALSE;
    343347
    344348        /* 2. do necessary modifications (see above comment) */
     
    359363        mural->height = height;
    360364
    361         if (cr_server.curClient && cr_server.curClient->currentMural == mural)
     365        if (cr_server.currentMural == mural)
    362366        {
    363367            crStateGetCurrent()->buffer.width = mural->width;
     
    370374
    371375        /* 3. (so far not needed for resize, but in case it is in the future) re-set the compositor (see above comment) */
    372         /*
     376        /* uncomment when needed */
     377        /* NOTE: !!! we have mural->fCompositorPresented set to GL_FALSE above, so crServerVBoxCompositionReenable will have no effect in any way
    373378        if (mural->fUseFBO != CR_SERVER_REDIR_NONE)
    374379        {
    375             cr_server.head_spu->dispatch_table.VBoxPresentComposition(mural->spuWindow, &mural->Compositor, &mural->CEntry);
     380            crServerVBoxCompositionReenable(mural);
    376381        }
    377382        */
     
    395400    crServerMuralSize(mural, width, height);
    396401
    397     /* Work-around Intel driver bug */
    398     CRASSERT(!cr_server.curClient
    399             || !cr_server.curClient->currentMural
    400             || cr_server.curClient->currentMural == mural);
    401     if (cr_server.curClient && cr_server.curClient->currentMural == mural)
    402     {
    403         CRContextInfo * ctxInfo = cr_server.currentCtxInfo;
    404         CRASSERT(ctxInfo);
    405         crServerDispatchMakeCurrent(window, 0, ctxInfo->CreateInfo.externalID);
     402    if (cr_server.currentMural == mural)
     403    {
     404        crServerPerformMakeCurrent( mural, cr_server.currentCtxInfo );
    406405    }
    407406}
     
    433432
    434433            /* 1. tell renderspu to stop using the current compositor (see above comment) */
    435             cr_server.head_spu->dispatch_table.VBoxPresentComposition(mural->spuWindow, NULL, NULL);
     434            crServerVBoxCompositionDisable(mural);
    436435        }
    437436
     
    443442        /* the compositor lock is not needed actually since we have prevented renderspu from using the compositor */
    444443        /* CrVrScrCompositorLock(&mural->Compositor); */
    445         CrVrScrCompositorEntryPosSet(&mural->Compositor, &mural->CEntry, &Pos);
     444        /* no need to set position because the position is relative to window */
     445        /*CrVrScrCompositorEntryPosSet(&mural->Compositor, &mural->CEntry, &Pos);*/
    446446        /*CrVrScrCompositorUnlock(&mural->Compositor);*/
    447447
     
    454454        if (mural->fUseFBO != CR_SERVER_REDIR_NONE)
    455455        {
    456             cr_server.head_spu->dispatch_table.VBoxPresentComposition(mural->spuWindow, &mural->Compositor, &mural->CEntry);
     456            crServerVBoxCompositionReenable(mural);
    457457        }
    458458    }
     
    481481
    482482        /* 1. tell renderspu to stop using the current compositor (see above comment) */
    483         cr_server.head_spu->dispatch_table.VBoxPresentComposition(mural->spuWindow, NULL, NULL);
     483        crServerVBoxCompositionDisable(mural);
    484484    }
    485485
     
    521521    if (mural->fUseFBO != CR_SERVER_REDIR_NONE)
    522522    {
    523         cr_server.head_spu->dispatch_table.VBoxPresentComposition(mural->spuWindow, &mural->Compositor, &mural->CEntry);
     523        crServerVBoxCompositionReenable(mural);
    524524    }
    525525}
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