VirtualBox

Ignore:
Timestamp:
Mar 29, 2013 2:57:24 PM (12 years ago)
Author:
vboxsync
Message:

crOpenGL/VRDP: always show 3D window unles in Headles mode

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_window.c

    r45201 r45248  
    8383    mural->spuWindow = spuWindow;
    8484    mural->screenId = 0;
     85    mural->fHasParentWindow = !!cr_server.screen[0].winID;
    8586    mural->bVisible = !!dims[0];
    86     mural->fUseFBO = CR_SERVER_REDIR_NONE;
     87    mural->fPresentMode = CR_SERVER_REDIR_F_NONE;
    8788
    8889    mural->cVisibleRects = 0;
     
    266267    }
    267268
    268     crServerRedirMuralFBO(mural, CR_SERVER_REDIR_NONE);
     269    crServerRedirMuralFBO(mural, CR_SERVER_REDIR_F_NONE);
    269270    crServerDeleteMuralFBO(mural);
    270271
     
    437438void crServerMuralSize(CRMuralInfo *mural, GLint width, GLint height)
    438439{
    439     if (mural->width != width || mural->height != height)
    440     {
    441         uint32_t cRects;
    442         const RTRECT *pRects;
    443         RTRECT Rect;
    444         VBOXVR_TEXTURE Tex;
    445         int rc = VINF_SUCCESS;
    446         Tex.width = width;
    447         Tex.height = height;
    448         Tex.target = GL_TEXTURE_2D;
    449         Tex.hwid = 0;
    450 
    451 
    452         /* since we're going to change the current compositor & the window we need to avoid
    453          * renderspu fron dealing with inconsistent data, i.e. modified compositor and
    454          * still unmodified window.
    455          * So what we do is:
    456          * 1. tell renderspu to stop using the current compositor -> renderspu would do necessary synchronization with its redraw thread to ensure compositor is no longer used
    457          * 2. do necessary modifications
    458          * 3. (so far not needed for resize, but in case it is in the future) re-set the compositor */
    459 
    460         /* 1. tell renderspu to stop using the current compositor (see above comment) */
    461         crServerVBoxCompositionDisableEnter(mural);
    462 
    463         /* 2. do necessary modifications (see above comment) */
    464         /* NOTE: we can do it even if mural->fUseFBO == CR_SERVER_REDIR_NONE to make sure the compositor data is always up to date */
    465         /* the compositor lock is not needed actually since we have prevented renderspu from using the compositor */
    466         /* CrVrScrCompositorLock(&mural->Compositor); */
    467         rc = CrVrScrCompositorEntryRemove(&mural->Compositor, &mural->CEntry);
     440    uint32_t cRects;
     441    const RTRECT *pRects;
     442    RTRECT Rect;
     443    VBOXVR_TEXTURE Tex;
     444    int rc = VINF_SUCCESS;
     445    Tex.width = width;
     446    Tex.height = height;
     447    Tex.target = GL_TEXTURE_2D;
     448    Tex.hwid = 0;
     449
     450    if (mural->width == width && mural->height == height)
     451        return;
     452
     453
     454    /* since we're going to change the current compositor & the window we need to avoid
     455     * renderspu fron dealing with inconsistent data, i.e. modified compositor and
     456     * still unmodified window.
     457     * So what we do is:
     458     * 1. tell renderspu to stop using the current compositor -> renderspu would do necessary synchronization with its redraw thread to ensure compositor is no longer used
     459     * 2. do necessary modifications
     460     * 3. (so far not needed for resize, but in case it is in the future) re-set the compositor */
     461
     462    /* 1. tell renderspu to stop using the current compositor (see above comment) */
     463    crServerVBoxCompositionDisableEnter(mural);
     464
     465    /* 2. do necessary modifications (see above comment) */
     466    /* NOTE: we can do it even if mural->fPresentMode == CR_SERVER_REDIR_F_NONE to make sure the compositor data is always up to date */
     467    /* the compositor lock is not needed actually since we have prevented renderspu from using the compositor */
     468    /* CrVrScrCompositorLock(&mural->Compositor); */
     469    rc = CrVrScrCompositorEntryRemove(&mural->Compositor, &mural->CEntry);
     470    if (!RT_SUCCESS(rc))
     471    {
     472        crWarning("CrVrScrCompositorEntryRemove failed, rc %d", rc);
     473        goto end;
     474    }
     475    CrVrScrCompositorEntryInit(&mural->CEntry, &Tex);
     476    /* initially set regions to all visible since this is what some guest assume
     477     * and will not post any more visible regions command */
     478    Rect.xLeft = 0;
     479    Rect.xRight = width;
     480    Rect.yTop = 0;
     481    Rect.yBottom = height;
     482    rc = CrVrScrCompositorEntryRegionsSet(&mural->Compositor, &mural->CEntry, NULL, 1, &Rect, NULL);
     483    if (!RT_SUCCESS(rc))
     484    {
     485        crWarning("CrVrScrCompositorEntryRegionsSet failed, rc %d", rc);
     486        goto end;
     487    }
     488    /* CrVrScrCompositorUnlock(&mural->Compositor); */
     489    mural->width = width;
     490    mural->height = height;
     491
     492    mural->fDataPresented = GL_FALSE;
     493
     494    if (cr_server.currentMural == mural)
     495    {
     496        crStateGetCurrent()->buffer.width = mural->width;
     497        crStateGetCurrent()->buffer.height = mural->height;
     498    }
     499
     500    if (mural->fRootVrOn)
     501    {
     502        rc = CrVrScrCompositorEntryRemove(&mural->RootVrCompositor, &mural->RootVrCEntry);
    468503        if (!RT_SUCCESS(rc))
    469504        {
    470505            crWarning("CrVrScrCompositorEntryRemove failed, rc %d", rc);
    471             return;
    472         }
    473         CrVrScrCompositorEntryInit(&mural->CEntry, &Tex);
     506            goto end;
     507        }
     508        CrVrScrCompositorEntryInit(&mural->RootVrCEntry, &Tex);
    474509        /* initially set regions to all visible since this is what some guest assume
    475510         * and will not post any more visible regions command */
     
    478513        Rect.yTop = 0;
    479514        Rect.yBottom = height;
    480         rc = CrVrScrCompositorEntryRegionsSet(&mural->Compositor, &mural->CEntry, NULL, 1, &Rect, NULL);
     515        rc = CrVrScrCompositorEntryRegionsSet(&mural->RootVrCompositor, &mural->RootVrCEntry, NULL, 1, &Rect, NULL);
    481516        if (!RT_SUCCESS(rc))
    482517        {
    483518            crWarning("CrVrScrCompositorEntryRegionsSet failed, rc %d", rc);
    484             return;
    485         }
    486         /* CrVrScrCompositorUnlock(&mural->Compositor); */
    487         mural->width = width;
    488         mural->height = height;
    489 
    490         mural->fDataPresented = GL_FALSE;
    491 
    492         if (cr_server.currentMural == mural)
    493         {
    494             crStateGetCurrent()->buffer.width = mural->width;
    495             crStateGetCurrent()->buffer.height = mural->height;
    496         }
    497 
     519            goto end;
     520        }
     521
     522        crServerVBoxRootVrTranslateForMural(mural);
     523        rc = CrVrScrCompositorEntryListIntersect(&mural->RootVrCompositor, &mural->RootVrCEntry, &cr_server.RootVr, NULL);
     524        if (!RT_SUCCESS(rc))
     525        {
     526            crWarning("CrVrScrCompositorEntryRegionsSet failed, rc %d", rc);
     527            goto end;
     528        }
     529
     530        rc = CrVrScrCompositorEntryRegionsGet(&mural->RootVrCompositor, &mural->RootVrCEntry, &cRects, NULL, &pRects);
     531        if (!RT_SUCCESS(rc))
     532        {
     533            crWarning("CrVrScrCompositorEntryRegionsGet failed, rc %d", rc);
     534            goto end;
     535        }
     536    }
     537    else
     538    {
     539        rc = CrVrScrCompositorEntryRegionsGet(&mural->Compositor, &mural->CEntry, &cRects, NULL, &pRects);
     540        if (!RT_SUCCESS(rc))
     541        {
     542            crWarning("CrVrScrCompositorEntryRegionsGet failed, rc %d", rc);
     543            goto end;
     544        }
     545    }
     546
     547    crServerCheckMuralGeometry(mural);
     548
     549    cr_server.head_spu->dispatch_table.WindowSize(mural->spuWindow, width, height);
     550
     551    cr_server.head_spu->dispatch_table.WindowVisibleRegion(mural->spuWindow, cRects, pRects);
     552
     553    if (mural->pvOutputRedirectInstance)
     554    {
    498555        if (mural->fRootVrOn)
    499         {
    500             rc = CrVrScrCompositorEntryRemove(&mural->RootVrCompositor, &mural->RootVrCEntry);
    501             if (!RT_SUCCESS(rc))
    502             {
    503                 crWarning("CrVrScrCompositorEntryRemove failed, rc %d", rc);
    504                 return;
    505             }
    506             CrVrScrCompositorEntryInit(&mural->RootVrCEntry, &Tex);
    507             /* initially set regions to all visible since this is what some guest assume
    508              * and will not post any more visible regions command */
    509             Rect.xLeft = 0;
    510             Rect.xRight = width;
    511             Rect.yTop = 0;
    512             Rect.yBottom = height;
    513             rc = CrVrScrCompositorEntryRegionsSet(&mural->RootVrCompositor, &mural->RootVrCEntry, NULL, 1, &Rect, NULL);
    514             if (!RT_SUCCESS(rc))
    515             {
    516                 crWarning("CrVrScrCompositorEntryRegionsSet failed, rc %d", rc);
    517                 return;
    518             }
    519 
    520             crServerVBoxRootVrTranslateForMural(mural);
    521             rc = CrVrScrCompositorEntryListIntersect(&mural->RootVrCompositor, &mural->RootVrCEntry, &cr_server.RootVr, NULL);
    522             if (!RT_SUCCESS(rc))
    523             {
    524                 crWarning("CrVrScrCompositorEntryRegionsSet failed, rc %d", rc);
    525                 return;
    526             }
    527 
    528             rc = CrVrScrCompositorEntryRegionsGet(&mural->RootVrCompositor, &mural->RootVrCEntry, &cRects, NULL, &pRects);
    529             if (!RT_SUCCESS(rc))
    530             {
    531                 crWarning("CrVrScrCompositorEntryRegionsGet failed, rc %d", rc);
    532                 return;
    533             }
    534         }
    535         else
    536556        {
    537557            rc = CrVrScrCompositorEntryRegionsGet(&mural->Compositor, &mural->CEntry, &cRects, NULL, &pRects);
     
    539559            {
    540560                crWarning("CrVrScrCompositorEntryRegionsGet failed, rc %d", rc);
    541                 return;
    542             }
    543         }
    544 
    545         crServerCheckMuralGeometry(mural);
    546 
    547         cr_server.head_spu->dispatch_table.WindowSize(mural->spuWindow, width, height);
    548 
    549         cr_server.head_spu->dispatch_table.WindowVisibleRegion(mural->spuWindow, cRects, pRects);
    550 
    551         if (mural->pvOutputRedirectInstance)
    552         {
    553             if (mural->fRootVrOn)
    554             {
    555                 rc = CrVrScrCompositorEntryRegionsGet(&mural->Compositor, &mural->CEntry, &cRects, NULL, &pRects);
    556                 if (!RT_SUCCESS(rc))
    557                 {
    558                     crWarning("CrVrScrCompositorEntryRegionsGet failed, rc %d", rc);
    559                     return;
    560                 }
    561             }
    562             /* @todo the code assumes that RTRECT == four GLInts. */
    563             cr_server.outputRedirect.CRORVisibleRegion(mural->pvOutputRedirectInstance,
    564                     cRects, pRects);
    565         }
    566 
    567         /* 3. (so far not needed for resize, but in case it is in the future) re-set the compositor (see above comment) */
    568         /* uncomment when needed */
    569         /* NOTE: !!! we have mural->fHasPresentationData set to GL_FALSE above, so crServerVBoxCompositionReenable will have no effect in any way
    570 
    571         */
    572         crServerVBoxCompositionDisableLeave(mural, GL_FALSE);
    573     }
     561                goto end;
     562            }
     563        }
     564        /* @todo the code assumes that RTRECT == four GLInts. */
     565        cr_server.outputRedirect.CRORVisibleRegion(mural->pvOutputRedirectInstance,
     566                cRects, pRects);
     567    }
     568
     569end:
     570    /* 3. (so far not needed for resize, but in case it is in the future) re-set the compositor (see above comment) */
     571    /* uncomment when needed */
     572    /* NOTE: !!! we have mural->fHasPresentationData set to GL_FALSE above, so crServerVBoxCompositionReenable will have no effect in any way
     573
     574    */
     575    crServerVBoxCompositionDisableLeave(mural, GL_FALSE);
     576
    574577}
    575578
     
    623626
    624627        /* 2. do necessary modifications (see above comment) */
    625         /* NOTE: we can do it even if mural->fUseFBO == CR_SERVER_REDIR_NONE to make sure the compositor data is always up to date */
     628        /* NOTE: we can do it even if !(mural->fPresentMode & CR_SERVER_REDIR_F_DISPLAY) to make sure the compositor data is always up to date */
    626629
    627630        if (mural->gX != x || mural->gY != y)
     
    709712    }
    710713
    711     /* NOTE: we can do it even if mural->fUseFBO = CR_SERVER_REDIR_NONE to make sure the compositor data is always up to date */
     714    /* NOTE: we can do it even if !(mural->fPresentMode & CR_SERVER_REDIR_F_DISPLAY) to make sure the compositor data is always up to date */
    712715    /* the compositor lock is not needed actually since we have prevented renderspu from using the compositor */
    713716    /* CrVrScrCompositorLock(&mural->Compositor); */
     
    717720    {
    718721        crWarning("CrVrScrCompositorEntryRegionsSet failed, rc %d", rc);
    719         return;
     722        goto end;
    720723    }
    721724
     
    731734            {
    732735                crWarning("CrVrScrCompositorEntryRegionsSet failed, rc %d", rc);
    733                 return;
     736                goto end;
    734737            }
    735738
     
    739742            {
    740743                crWarning("CrVrScrCompositorEntryRegionsSet failed, rc %d", rc);
    741                 return;
     744                goto end;
    742745            }
    743746
     
    746749            {
    747750                crWarning("CrVrScrCompositorEntryRegionsGet failed, rc %d", rc);
    748                 return;
     751                goto end;
    749752            }
    750753        }
     
    755758            {
    756759                crWarning("CrVrScrCompositorEntryRegionsGet failed, rc %d", rc);
    757                 return;
     760                goto end;
    758761            }
    759762        }
     
    769772                {
    770773                    crWarning("CrVrScrCompositorEntryRegionsGet failed, rc %d", rc);
    771                     return;
     774                    goto end;
    772775                }
    773776            }
     
    776779        }
    777780    }
    778 
     781end:
    779782    /* 3. re-set the compositor (see above comment) */
    780783    crServerVBoxCompositionDisableLeave(mural, fForcePresent);
     
    792795    }
    793796
    794     if (mural->fUseFBO != CR_SERVER_REDIR_FBO_RAM)
     797    if (mural->fPresentMode && CR_SERVER_REDIR_F_DISPLAY)
    795798    {
    796799        cr_server.head_spu->dispatch_table.WindowShow(mural->spuWindow, state);
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