VirtualBox

Changeset 48726 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Sep 27, 2013 10:19:54 AM (11 years ago)
Author:
vboxsync
Message:

crOpenGL: seamless fixes

Location:
trunk/src/VBox
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/GuestHost/OpenGL/include/cr_vreg.h

    r48325 r48726  
    156156VBOXVREGDECL(void) VBoxVrListClear(PVBOXVR_LIST pList);
    157157
     158/* moves list data to pDstList and empties the pList */
     159VBOXVREGDECL(void) VBoxVrListMoveTo(PVBOXVR_LIST pList, PVBOXVR_LIST pDstList);
     160
    158161VBOXVREGDECL(void) VBoxVrListTranslate(PVBOXVR_LIST pList, int32_t x, int32_t y);
    159162
     
    265268
    266269VBOXVREGDECL(bool) VBoxVrCompositorEntryRemove(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry);
     270VBOXVREGDECL(bool) VBoxVrCompositorEntryReplace(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, PVBOXVR_COMPOSITOR_ENTRY pNewEntry);
    267271VBOXVREGDECL(int) VBoxVrCompositorEntryRegionsAdd(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, uint32_t cRegions, const RTRECT *paRegions, PVBOXVR_COMPOSITOR_ENTRY *ppReplacedEntry, uint32_t *pfChangeFlags);
    268272VBOXVREGDECL(int) VBoxVrCompositorEntryRegionsSubst(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, uint32_t cRegions, const RTRECT *paRegions, bool *pfChanged);
     
    417421VBOXVREGDECL(int) CrVrScrCompositorEntryRegionsGet(PVBOXVR_SCR_COMPOSITOR pCompositor, PVBOXVR_SCR_COMPOSITOR_ENTRY pEntry, uint32_t *pcRegions, const RTRECT **ppaSrcRegions, const RTRECT **ppaDstRegions, const RTRECT **ppaDstUnstretchedRects);
    418422VBOXVREGDECL(int) CrVrScrCompositorEntryRemove(PVBOXVR_SCR_COMPOSITOR pCompositor, PVBOXVR_SCR_COMPOSITOR_ENTRY pEntry);
     423VBOXVREGDECL(bool) CrVrScrCompositorEntryReplace(PVBOXVR_SCR_COMPOSITOR pCompositor, PVBOXVR_SCR_COMPOSITOR_ENTRY pEntry, PVBOXVR_SCR_COMPOSITOR_ENTRY pNewEntry);
    419424VBOXVREGDECL(void) CrVrScrCompositorEntryFlagsSet(PVBOXVR_SCR_COMPOSITOR_ENTRY pEntry, uint32_t fFlags);
    420425VBOXVREGDECL(uint32_t) CrVrScrCompositorEntryFlagsCombinedGet(PVBOXVR_SCR_COMPOSITOR pCompositor, PVBOXVR_SCR_COMPOSITOR_ENTRY pEntry);
  • trunk/src/VBox/GuestHost/OpenGL/util/vreg.cpp

    r47623 r48726  
    161161}
    162162
     163/* moves list data to pDstList and empties the pList */
     164VBOXVREGDECL(void) VBoxVrListMoveTo(PVBOXVR_LIST pList, PVBOXVR_LIST pDstList)
     165{
     166    *pDstList = *pList;
     167    pDstList->ListHead.pNext->pPrev = &pDstList->ListHead;
     168    pDstList->ListHead.pPrev->pNext = &pDstList->ListHead;
     169    VBoxVrListInit(pList);
     170}
     171
    163172#define VBOXVR_MEMTAG 'vDBV'
    164173
     
    12211230}
    12221231
     1232static void vboxVrCompositorEntryReplace(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, PVBOXVR_COMPOSITOR_ENTRY pReplacingEntry)
     1233{
     1234    VBoxVrListMoveTo(&pEntry->Vr, &pReplacingEntry->Vr);
     1235
     1236    pReplacingEntry->Node = pEntry->Node;
     1237    pReplacingEntry->Node.pNext->pPrev = &pReplacingEntry->Node;
     1238    pReplacingEntry->Node.pPrev->pNext = &pReplacingEntry->Node;
     1239    pEntry->Node.pNext = NULL;
     1240    pEntry->Node.pPrev = NULL;
     1241
     1242    vboxVrCompositorEntryAcquire(pReplacingEntry);
     1243    vboxVrCompositorEntryRelease(pCompositor, pEntry, pReplacingEntry);
     1244}
     1245
     1246
     1247
    12231248VBOXVREGDECL(void) VBoxVrCompositorEntryInit(PVBOXVR_COMPOSITOR_ENTRY pEntry)
    12241249{
     
    12291254VBOXVREGDECL(bool) VBoxVrCompositorEntryRemove(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry)
    12301255{
     1256    if (!VBoxVrCompositorEntryIsInList(pEntry))
     1257        return false;
     1258
    12311259    vboxVrCompositorEntryAcquire(pEntry);
    12321260
    1233     if (!VBoxVrCompositorEntryIsInList(pEntry))
    1234     {
    1235         vboxVrCompositorEntryRelease(pCompositor, pEntry, NULL);
    1236         return false;
    1237     }
    12381261    VBoxVrListClear(&pEntry->Vr);
    12391262    vboxVrCompositorEntryRemove(pCompositor, pEntry, NULL);
    12401263    vboxVrCompositorEntryRelease(pCompositor, pEntry, NULL);
     1264    return true;
     1265}
     1266
     1267VBOXVREGDECL(bool) VBoxVrCompositorEntryReplace(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, PVBOXVR_COMPOSITOR_ENTRY pNewEntry)
     1268{
     1269    if (!VBoxVrCompositorEntryIsInList(pEntry))
     1270        return false;
     1271
     1272    vboxVrCompositorEntryReplace(pCompositor, pEntry, pNewEntry);
     1273
    12411274    return true;
    12421275}
     
    23182351}
    23192352
    2320 VBOXVREGDECL(int) CrVrScrCompositorEntryRemove(PVBOXVR_SCR_COMPOSITOR pCompositor, PVBOXVR_SCR_COMPOSITOR_ENTRY pEntry)
    2321 {
    2322     if (!VBoxVrCompositorEntryRemove(&pCompositor->Compositor, &pEntry->Ce))
    2323         return VINF_SUCCESS;
    2324 
    2325     CrVrScrCompositorEntrySetChanged(pEntry, true);
     2353static void crVrScrCompositorEntryDataCleanup(PVBOXVR_SCR_COMPOSITOR_ENTRY pEntry)
     2354{
    23262355    pEntry->cRects = 0;
    23272356    pEntry->paSrcRects = NULL;
    23282357    pEntry->paDstRects = NULL;
    23292358    pEntry->paDstUnstretchedRects = NULL;
     2359}
     2360
     2361static void crVrScrCompositorEntryDataCopy(PVBOXVR_SCR_COMPOSITOR_ENTRY pEntry, PVBOXVR_SCR_COMPOSITOR_ENTRY pToEntry)
     2362{
     2363    pToEntry->cRects = pEntry->cRects;
     2364    pToEntry->paSrcRects = pEntry->paSrcRects;
     2365    pToEntry->paDstRects = pEntry->paDstRects;
     2366    pToEntry->paDstUnstretchedRects = pEntry->paDstUnstretchedRects;
     2367    crVrScrCompositorEntryDataCleanup(pEntry);
     2368}
     2369
     2370VBOXVREGDECL(int) CrVrScrCompositorEntryRemove(PVBOXVR_SCR_COMPOSITOR pCompositor, PVBOXVR_SCR_COMPOSITOR_ENTRY pEntry)
     2371{
     2372    if (!VBoxVrCompositorEntryRemove(&pCompositor->Compositor, &pEntry->Ce))
     2373        return VINF_SUCCESS;
     2374
     2375    CrVrScrCompositorEntrySetChanged(pEntry, true);
     2376    crVrScrCompositorEntryDataCleanup(pEntry);
    23302377
    23312378    crVrScrCompositorRectsInvalidate(pCompositor);
    23322379    return VINF_SUCCESS;
     2380}
     2381
     2382VBOXVREGDECL(bool) CrVrScrCompositorEntryReplace(PVBOXVR_SCR_COMPOSITOR pCompositor, PVBOXVR_SCR_COMPOSITOR_ENTRY pEntry, PVBOXVR_SCR_COMPOSITOR_ENTRY pNewEntry)
     2383{
     2384    Assert(!CrVrScrCompositorEntryIsUsed(pNewEntry));
     2385
     2386    if (!VBoxVrCompositorEntryReplace(&pCompositor->Compositor, &pEntry->Ce, &pNewEntry->Ce))
     2387        return false;
     2388
     2389    CrVrScrCompositorEntrySetChanged(pEntry, true);
     2390    crVrScrCompositorEntryDataCopy(pEntry, pNewEntry);
     2391    CrVrScrCompositorEntrySetChanged(pNewEntry, true);
     2392
     2393    return true;
    23332394}
    23342395
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server.h

    r48719 r48726  
    119119void crServerMuralVisibleRegion( CRMuralInfo *mural, GLint cRects, const GLint *pRects );
    120120void crServerMuralShow( CRMuralInfo *mural, GLint state );
    121 int crServerMuralSynchRootVr(CRMuralInfo *mural);
     121int crServerMuralSynchRootVr(CRMuralInfo *mural, bool *pfChanged);
    122122
    123123GLint crServerGenerateID(GLint *pCounter);
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_main.c

    r48719 r48726  
    332332#endif
    333333
    334     cr_server.bUseMultipleContexts = (crGetenv( "CR_SERVER_ENABLE_MULTIPLE_CONTEXTS" ) != NULL);
     334//    cr_server.bUseMultipleContexts = (crGetenv( "CR_SERVER_ENABLE_MULTIPLE_CONTEXTS" ) != NULL);
    335335
    336336    if (cr_server.bUseMultipleContexts)
     
    443443#endif
    444444
    445     cr_server.bUseMultipleContexts = (crGetenv( "CR_SERVER_ENABLE_MULTIPLE_CONTEXTS" ) != NULL);
     445//    cr_server.bUseMultipleContexts = (crGetenv( "CR_SERVER_ENABLE_MULTIPLE_CONTEXTS" ) != NULL);
    446446
    447447    if (cr_server.bUseMultipleContexts)
     
    28492849        }
    28502850
    2851         rc = crServerMuralSynchRootVr(pMI);
     2851        rc = crServerMuralSynchRootVr(pMI, NULL);
    28522852        if (!RT_SUCCESS(rc))
    28532853        {
     
    29132913
    29142914    crHashtableWalk(cr_server.muralTable, crVBoxServerSetRootVisibleRegionCB, NULL);
    2915 #if 0
     2915
    29162916    for (i = 0; i < cr_server.screenCount; ++i)
    29172917    {
     
    29222922        CrDpRootUpdate(pDisplay);
    29232923    }
    2924 #endif
     2924
    29252925    return VINF_SUCCESS;
    29262926}
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_presenter.cpp

    r48719 r48726  
    4747    }
    4848
    49     crServerMuralVisibleRegion(&pDisplay->Mural, 0, NULL);
     49    crServerWindowVisibleRegion(&pDisplay->Mural);
     50    crServerDEntryAllVibleRegions(&pDisplay->Mural);
     51
    5052    crServerMuralShow(&pDisplay->Mural, GL_TRUE);
    5153
     
    226228            uint32_t cRects;
    227229            const RTRECT *pRects;
    228             rc = CrVrScrCompositorRegionsGet(&pDisplay->Mural.Compositor, &cRects, NULL, &pRects, NULL);
    229             if (RT_SUCCESS(rc))
    230                 crServerMuralVisibleRegion(&pDisplay->Mural, cRects, (GLint *)pRects);
     230            bool fChanged = true;
     231            if (pDisplay->Mural.fRootVrOn)
     232            {
     233                int rc = crServerMuralSynchRootVr(&pDisplay->Mural, &fChanged);
     234                if (!RT_SUCCESS(rc))
     235                {
     236                    crWarning("crServerMuralSynchRootVr failed, rc %d", rc);
     237                    fChanged = false;
     238                }
     239            }
     240
     241            if (fChanged)
     242                crServerWindowVisibleRegion(&pDisplay->Mural);
     243
     244            crServerDEntryAllVibleRegions(&pDisplay->Mural);
     245
     246            Assert(!pReplacedScrEntry);
     247        }
     248        else if (fChangeFlags & VBOXVR_COMPOSITOR_CF_ENTRY_REGIONS_CHANGED)
     249        {
     250            if (fChangeFlags & VBOXVR_COMPOSITOR_CF_ENTRY_REPLACED)
     251            {
     252                Assert(pReplacedScrEntry);
     253                Assert(pEntry);
     254                if (pDisplay->Mural.fRootVrOn)
     255                {
     256                    CR_DISPLAY_ENTRY *pReplacedDEntry = CR_DENTRY_FROM_CENTRY(pReplacedScrEntry);
     257                    Assert(CrVrScrCompositorEntryIsUsed(&pReplacedDEntry->RootVrCEntry));
     258                    Assert(!CrVrScrCompositorEntryIsUsed(&pEntry->RootVrCEntry));
     259                    CrVrScrCompositorEntryInit(&pEntry->RootVrCEntry, CrVrScrCompositorEntryTexGet(&pEntry->CEntry), NULL);
     260                    CrVrScrCompositorEntryFlagsSet(&pEntry->RootVrCEntry, CrVrScrCompositorEntryFlagsGet(&pEntry->CEntry));
     261                    CrVrScrCompositorEntryReplace(&pDisplay->Mural.RootVrCompositor, &pReplacedDEntry->RootVrCEntry, &pEntry->RootVrCEntry);
     262                }
     263            }
    231264            else
    232                 crWarning("CrVrScrCompositorRegionsGet failed, rc %d", rc);
    233 
    234             Assert(!pReplacedScrEntry);
    235         }
    236         else if (fChangeFlags & VBOXVR_COMPOSITOR_CF_ENTRY_REPLACED)
    237         {
    238             Assert(pReplacedScrEntry);
     265            {
     266                Assert(!pReplacedScrEntry);
     267                if (pDisplay->Mural.fRootVrOn)
     268                {
     269                    bool fChanged = false;
     270                    int rc = crServerMuralSynchRootVr(&pDisplay->Mural, &fChanged);
     271                    if (RT_SUCCESS(rc))
     272                    {
     273                        if (fChanged)
     274                            crServerWindowVisibleRegion(&pDisplay->Mural);
     275                    }
     276                    else
     277                        crWarning("crServerMuralSynchRootVr failed, rc %d", rc);
     278                }
     279            }
    239280        }
    240281        else
    241282        {
     283            Assert(!(fChangeFlags & VBOXVR_COMPOSITOR_CF_ENTRY_REPLACED));
    242284            Assert(!pReplacedScrEntry);
    243285        }
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_window.c

    r48095 r48726  
    216216        uint32_t cRects;
    217217        const RTRECT *pRects;
    218         int rc = crServerMuralSynchRootVr(mural);
     218        int rc = crServerMuralSynchRootVr(mural, NULL);
    219219        if (RT_SUCCESS(rc))
    220220        {
     
    504504    Assert(!CrVrScrCompositorEntryIsUsed(&pDEntry->RootVrCEntry));
    505505    CrVrScrCompositorEntryInit(&pDEntry->RootVrCEntry, CrVrScrCompositorEntryTexGet(pEntry), NULL);
     506    CrVrScrCompositorEntryFlagsSet(&pDEntry->RootVrCEntry, CrVrScrCompositorEntryFlagsGet(pEntry));
    506507    return &pDEntry->RootVrCEntry;
    507508}
    508509
    509 int crServerMuralSynchRootVr(CRMuralInfo *mural)
     510int crServerMuralSynchRootVr(CRMuralInfo *mural, bool *pfChanged)
    510511{
    511512    int rc;
     
    517518    CrVrScrCompositorClear(&mural->RootVrCompositor);
    518519
    519     rc = CrVrScrCompositorIntersectedList(&mural->Compositor, &cr_server.RootVr, &mural->RootVrCompositor, crServerMuralGetRootVrCEntry, NULL, NULL);
     520    rc = CrVrScrCompositorIntersectedList(&mural->Compositor, &cr_server.RootVr, &mural->RootVrCompositor, crServerMuralGetRootVrCEntry, NULL, pfChanged);
    520521    if (!RT_SUCCESS(rc))
    521522    {
     
    609610    if (mural->fRootVrOn)
    610611    {
    611         rc = crServerMuralSynchRootVr(mural);
     612        rc = crServerMuralSynchRootVr(mural, NULL);
    612613        if (!RT_SUCCESS(rc))
    613614        {
     
    693694            if (mural->fRootVrOn)
    694695            {
    695                 int rc = crServerMuralSynchRootVr(mural);
     696                int rc = crServerMuralSynchRootVr(mural, NULL);
    696697                if (RT_SUCCESS(rc))
    697698                {
     
    764765    }
    765766
    766     if (mural->fUseDefaultDEntry)
    767     {
    768         /* 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 */
    769         /* the compositor lock is not needed actually since we have prevented renderspu from using the compositor */
    770         /* CrVrScrCompositorLock(&mural->Compositor); */
    771         rc = CrVrScrCompositorEntryRegionsSet(&mural->Compositor, &mural->DefaultDEntry.CEntry, NULL, cRects, (const RTRECT *)pRects, false, &fRegionsChanged);
    772         /*CrVrScrCompositorUnlock(&mural->Compositor);*/
    773         if (!RT_SUCCESS(rc))
    774         {
    775             crWarning("CrVrScrCompositorEntryRegionsSet failed, rc %d", rc);
    776             goto end;
    777         }
    778     }
    779     else
    780     {
    781         fRegionsChanged = true;
     767    Assert(mural->fUseDefaultDEntry);
     768    /* 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 */
     769    /* the compositor lock is not needed actually since we have prevented renderspu from using the compositor */
     770    /* CrVrScrCompositorLock(&mural->Compositor); */
     771    rc = CrVrScrCompositorEntryRegionsSet(&mural->Compositor, &mural->DefaultDEntry.CEntry, NULL, cRects, (const RTRECT *)pRects, false, &fRegionsChanged);
     772    /*CrVrScrCompositorUnlock(&mural->Compositor);*/
     773    if (!RT_SUCCESS(rc))
     774    {
     775        crWarning("CrVrScrCompositorEntryRegionsSet failed, rc %d", rc);
     776        goto end;
    782777    }
    783778
     
    786781        if (mural->fRootVrOn)
    787782        {
    788             rc = crServerMuralSynchRootVr(mural);
     783            rc = crServerMuralSynchRootVr(mural, NULL);
    789784            if (!RT_SUCCESS(rc))
    790785            {
  • trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu.c

    r48356 r48726  
    698698}
    699699
     700#ifdef DEBUG_misha
     701# define CR_DBG_DUMP_VISIBLE_REGIONS
     702#endif
     703
     704#ifdef CR_DBG_DUMP_VISIBLE_REGIONS
     705static void renderspuDbgDumpVisibleRegion(GLint win, GLint cRects, const GLint *pRects)
     706{
     707    GLint i;
     708    const RTRECT *pRtRects = (const RTRECT *)((const void*)pRects);
     709
     710    crInfo("Window %d, Vidible Regions%d", win, cRects);
     711    for (i = 0; i < cRects; ++i)
     712    {
     713        crInfo("%d: (%d,%d), (%d,%d)", i, pRtRects[i].xLeft, pRtRects[i].yTop, pRtRects[i].xRight, pRtRects[i].yBottom);
     714    }
     715    crInfo("======");
     716}
     717#endif
     718
    700719static void RENDER_APIENTRY
    701720renderspuWindowVisibleRegion(GLint win, GLint cRects, const GLint *pRects)
     
    703722    WindowInfo *window;
    704723    CRASSERT(win >= 0);
     724
     725#ifdef CR_DBG_DUMP_VISIBLE_REGIONS
     726    renderspuDbgDumpVisibleRegion(win, cRects, pRects);
     727#endif
     728
    705729    window = (WindowInfo *) crHashtableSearch(render_spu.windowTable, win);
    706730    if (window) {
     
    708732    }
    709733    else {
    710         crDebug("Render SPU: Attempt to set VisibleRegion for invalid window (%d)", win);
     734        crWarning("Render SPU: Attempt to set VisibleRegion for invalid window (%d)", win);
    711735    }
    712736}
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