VirtualBox

Changeset 51349 in vbox


Ignore:
Timestamp:
May 22, 2014 11:42:21 AM (11 years ago)
Author:
vboxsync
Message:

crOpenGL: saved state fixes, misc fixes

Location:
trunk/src/VBox
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Graphics/DevVGA.cpp

    r51237 r51349  
    55505550    PVGASTATE pThis = PDMINS_2_DATA(pDevIns, PVGASTATE);
    55515551    VBVAPause(pThis, (pThis->vbe_regs[VBE_DISPI_INDEX_ENABLE] & VBE_DISPI_ENABLED) == 0);
    5552     return vboxVBVALoadStateDone(pDevIns, pSSM);
     5552    int rc = vboxVBVALoadStateDone(pDevIns, pSSM);
     5553    AssertRCReturn(rc, rc);
     5554# ifdef VBOX_WITH_VDMA
     5555    rc = vboxVDMASaveLoadDone(pThis->pVdma);
     5556    AssertRCReturn(rc, rc);
     5557# endif
     5558    return VINF_SUCCESS;
    55535559#else
    55545560    return VINF_SUCCESS;
  • trunk/src/VBox/Devices/Graphics/DevVGA.h

    r51260 r51349  
    662662int vboxVDMASaveStateExecPerform(struct VBOXVDMAHOST *pVdma, PSSMHANDLE pSSM);
    663663int vboxVDMASaveLoadExecPerform(struct VBOXVDMAHOST *pVdma, PSSMHANDLE pSSM, uint32_t u32Version);
     664int vboxVDMASaveLoadDone(struct VBOXVDMAHOST *pVdma);
    664665# endif /* VBOX_WITH_VDMA */
    665666
     
    669670void vboxCmdVBVACmdTimer(PVGASTATE pVGAState);
    670671int vboxCmdVBVACmdCtl(PVGASTATE pVGAState, VBOXCMDVBVA_CTL *pCtl, uint32_t cbCtl);
     672bool vboxCmdVBVAIsEnabled(PVGASTATE pVGAState);
    671673# endif /* VBOX_WITH_CRHGSMI */
    672674#endif /* VBOX_WITH_HGSMI */
  • trunk/src/VBox/Devices/Graphics/DevVGA_VBVA.cpp

    r51324 r51349  
    18671867            if (pView->pVBVA)
    18681868            {
     1869                Assert(!vboxCmdVBVAIsEnabled(pVGAState));
    18691870                vbvaEnable (iView, pVGAState, pCtx, pView->pVBVA, pView->u32VBVAOffset, true /* fRestored */);
    18701871                vbvaResize (pVGAState, pView, &pView->screen);
     
    21362137        case VBVA_INFO_VIEW:
    21372138        {
     2139            if (vboxCmdVBVAIsEnabled(pVGAState))
     2140            {
     2141                AssertMsgFailed(("VBVA_INFO_VIEW is not acceptible for CmdVbva\n"));
     2142                rc = VERR_INVALID_PARAMETER;
     2143                break;
     2144            }
     2145
    21382146            if (cbBuffer < sizeof (VBVAINFOVIEW))
    21392147            {
     
    21942202            }
    21952203
     2204            if (vboxCmdVBVAIsEnabled(pVGAState))
     2205            {
     2206                AssertMsgFailed(("VBVA_INFO_SCREEN is not acceptible for CmdVbva\n"));
     2207                rc = VERR_INVALID_PARAMETER;
     2208                break;
     2209            }
     2210
    21962211            VBVAINFOSCREEN *pScreen = (VBVAINFOSCREEN *)pvBuffer;
    21972212            VBVAINFOSCREEN Screen = *pScreen;
     
    22012216        case VBVA_ENABLE:
    22022217        {
     2218            if (vboxCmdVBVAIsEnabled(pVGAState))
     2219            {
     2220                AssertMsgFailed(("VBVA_ENABLE is not acceptible for CmdVbva\n"));
     2221                rc = VERR_INVALID_PARAMETER;
     2222                break;
     2223            }
     2224
    22032225            if (cbBuffer < sizeof (VBVAENABLE))
    22042226            {
  • trunk/src/VBox/Devices/Graphics/DevVGA_VDMA.cpp

    r51260 r51349  
    103103    VBVAEXHOSTCTL_TYPE_HH_SAVESTATE,
    104104    VBVAEXHOSTCTL_TYPE_HH_LOADSTATE,
     105    VBVAEXHOSTCTL_TYPE_HH_LOADSTATE_DONE,
    105106    VBVAEXHOSTCTL_TYPE_HH_BE_OPAQUE,
    106107    VBVAEXHOSTCTL_TYPE_HH_ON_HGCM_UNLOAD,
     
    13071308    switch (pCmd->enmType)
    13081309    {
     1310        case VBVAEXHOSTCTL_TYPE_GHH_BE_OPAQUE:
     1311        {
     1312            if (!VBoxVBVAExHSIsEnabled(&pVdma->CmdVbva))
     1313            {
     1314                WARN(("VBVAEXHOSTCTL_TYPE_GHH_BE_OPAQUE for disabled vdma VBVA\n"));
     1315                return VERR_INVALID_STATE;
     1316            }
     1317            return pVdma->CrSrvInfo.pfnHostCtl(pVdma->CrSrvInfo.hSvr, pCmd->u.cmd.pu8Cmd, pCmd->u.cmd.cbCmd);
     1318        }
     1319        case VBVAEXHOSTCTL_TYPE_GHH_DISABLE:
     1320        {
     1321            int rc = vdmaVBVADisableProcess(pVdma, true);
     1322            if (RT_FAILURE(rc))
     1323            {
     1324                WARN(("vdmaVBVADisableProcess failed %d\n", rc));
     1325                return rc;
     1326            }
     1327
     1328            return VBoxVDMAThreadTerm(&pVdma->Thread, NULL, NULL, false);
     1329        }
     1330        case VBVAEXHOSTCTL_TYPE_HH_ON_HGCM_UNLOAD:
     1331        {
     1332            int rc = vdmaVBVADisableProcess(pVdma, false);
     1333            if (RT_FAILURE(rc))
     1334            {
     1335                WARN(("vdmaVBVADisableProcess failed %d\n", rc));
     1336                return rc;
     1337            }
     1338
     1339            rc = VBoxVDMAThreadTerm(&pVdma->Thread, NULL, NULL, true);
     1340            if (RT_FAILURE(rc))
     1341            {
     1342                WARN(("VBoxVDMAThreadTerm failed %d\n", rc));
     1343                return rc;
     1344            }
     1345
     1346            *pfContinue = false;
     1347            return VINF_SUCCESS;
     1348        }
    13091349        case VBVAEXHOSTCTL_TYPE_HH_SAVESTATE:
    13101350        {
     
    13231363            PVGASTATE pVGAState = pVdma->pVGAState;
    13241364            uint8_t * pu8VramBase = pVGAState->vram_ptrR3;
     1365
    13251366            int rc = VBoxVBVAExHSLoadState(&pVdma->CmdVbva, pu8VramBase, pCmd->u.state.pSSM, pCmd->u.state.u32Version);
    13261367            if (RT_FAILURE(rc))
     
    13291370                return rc;
    13301371            }
    1331             return pVdma->CrSrvInfo.pfnLoadState(pVdma->CrSrvInfo.hSvr, pCmd->u.state.pSSM, pCmd->u.state.u32Version);
    1332         }
    1333         case VBVAEXHOSTCTL_TYPE_GHH_BE_OPAQUE:
    1334         {
    1335             if (!VBoxVBVAExHSIsEnabled(&pVdma->CmdVbva))
    1336             {
    1337                 WARN(("VBVAEXHOSTCTL_TYPE_GHH_BE_OPAQUE for disabled vdma VBVA\n"));
    1338                 return VERR_INVALID_STATE;
    1339             }
    1340             return pVdma->CrSrvInfo.pfnHostCtl(pVdma->CrSrvInfo.hSvr, pCmd->u.cmd.pu8Cmd, pCmd->u.cmd.cbCmd);
    1341         }
    1342         case VBVAEXHOSTCTL_TYPE_GHH_DISABLE:
    1343         {
    1344             int rc = vdmaVBVADisableProcess(pVdma, true);
     1372
     1373            rc = pVdma->CrSrvInfo.pfnLoadState(pVdma->CrSrvInfo.hSvr, pCmd->u.state.pSSM, pCmd->u.state.u32Version);
    13451374            if (RT_FAILURE(rc))
    13461375            {
    1347                 WARN(("vdmaVBVADisableProcess failed %d\n", rc));
     1376                WARN(("pfnLoadState failed %d\n", rc));
    13481377                return rc;
    13491378            }
    13501379
    1351             return VBoxVDMAThreadTerm(&pVdma->Thread, NULL, NULL, false);
    1352         }
    1353         case VBVAEXHOSTCTL_TYPE_HH_ON_HGCM_UNLOAD:
    1354         {
    1355             int rc = vdmaVBVADisableProcess(pVdma, false);
    1356             if (RT_FAILURE(rc))
    1357             {
    1358                 WARN(("vdmaVBVADisableProcess failed %d\n", rc));
    1359                 return rc;
    1360             }
    1361 
    1362             rc = VBoxVDMAThreadTerm(&pVdma->Thread, NULL, NULL, true);
    1363             if (RT_FAILURE(rc))
    1364             {
    1365                 WARN(("VBoxVDMAThreadTerm failed %d\n", rc));
    1366                 return rc;
    1367             }
    1368 
    1369             *pfContinue = false;
     1380            return VINF_SUCCESS;
     1381        }
     1382        case VBVAEXHOSTCTL_TYPE_HH_LOADSTATE_DONE:
     1383        {
     1384            PVGASTATE pVGAState = pVdma->pVGAState;
     1385
     1386            for (uint32_t i = 0; i < pVGAState->cMonitors; ++i)
     1387            {
     1388                VBVAINFOSCREEN CurScreen;
     1389                VBVAINFOVIEW CurView;
     1390
     1391                int rc = VBVAGetInfoViewAndScreen(pVGAState, i, &CurView, &CurScreen);
     1392                if (RT_FAILURE(rc))
     1393                {
     1394                    WARN(("VBVAGetInfoViewAndScreen failed %d\n", rc));
     1395                    return rc;
     1396                }
     1397
     1398                rc = VBVAInfoScreen(pVGAState, &CurScreen);
     1399                if (RT_FAILURE(rc))
     1400                {
     1401                    WARN(("VBVAInfoScreen failed %d\n", rc));
     1402                    return rc;
     1403                }
     1404            }
     1405
    13701406            return VINF_SUCCESS;
    13711407        }
     
    32203256}
    32213257
     3258bool vboxCmdVBVAIsEnabled(PVGASTATE pVGAState)
     3259{
     3260    return VBoxVBVAExHSIsEnabled(&pVGAState->pVdma->CmdVbva);
     3261}
    32223262#endif
    32233263
     
    33593399    return VINF_SUCCESS;
    33603400}
     3401
     3402int vboxVDMASaveLoadDone(struct VBOXVDMAHOST *pVdma)
     3403{
     3404    VBVAEXHOSTCTL* pHCtl = VBoxVBVAExHCtlCreate(&pVdma->CmdVbva, VBVAEXHOSTCTL_TYPE_HH_LOADSTATE_DONE);
     3405    if (!pHCtl)
     3406    {
     3407        WARN(("VBoxVBVAExHCtlCreate failed\n"));
     3408        return VERR_NO_MEMORY;
     3409    }
     3410
     3411    /* sanity */
     3412    pHCtl->u.cmd.pu8Cmd = NULL;
     3413    pHCtl->u.cmd.cbCmd = 0;
     3414
     3415    /* NULL completion will just free the ctl up */
     3416    int rc = vdmaVBVACtlSubmit(pVdma, pHCtl, VBVAEXHOSTCTL_SOURCE_HOST, NULL, NULL);
     3417    if (RT_FAILURE(rc))
     3418    {
     3419        Log(("vdmaVBVACtlSubmit failed rc %d\n", rc));
     3420        VBoxVBVAExHCtlFree(&pVdma->CmdVbva, pHCtl);
     3421        return rc;
     3422    }
     3423
     3424    return VINF_SUCCESS;
     3425}
  • trunk/src/VBox/GuestHost/OpenGL/include/cr_version.h

    r51260 r51349  
    4343#define SHCROGL_SSM_VERSION_CRCMD                                   44
    4444#define SHCROGL_SSM_VERSION_WITH_SCREEN_MAP                         45
    45 #define SHCROGL_SSM_VERSION                                         45
     45#define SHCROGL_SSM_VERSION_WITH_SCREEN_MAP_REORDERED               46
     46#define SHCROGL_SSM_VERSION                                         46
    4647
    4748/* These define the Chromium release number.
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_presenter.cpp

    r51335 r51349  
    49204920    int rc;
    49214921    int cDisplays = 0, i;
     4922
    49224923    for (i = 0; i < cr_server.screenCount; ++i)
    49234924    {
     
    49684969            AssertRCReturn(rc, rc);
    49694970
    4970             rc = SSMR3PutU32(pSSM, 0xffffffff);
    4971             AssertRCReturn(rc, rc);
    4972 
    4973             rc = CrFbSaveState(hFb, pSSM);
     4971            rc = SSMR3PutU32(pSSM, hFb->ScreenInfo.u32StartOffset);
    49744972            AssertRCReturn(rc, rc);
    49754973
    49764974            CR_FB_INFO *pFbInfo = &g_CrPresenter.aFbInfos[hFb->ScreenInfo.u32ViewIndex];
    49774975            rc = SSMR3PutMem(pSSM, pFbInfo->aTargetMap, sizeof (pFbInfo->aTargetMap));
     4976            AssertRCReturn(rc, rc);
     4977
     4978            rc = CrFbSaveState(hFb, pSSM);
    49784979            AssertRCReturn(rc, rc);
    49794980        }
     
    51545155            AssertRCReturn(rc, rc);
    51555156
    5156             uint32_t offVram = 0;
    5157             rc = SSMR3GetU32(pSSM, &offVram);
     5157            rc = SSMR3GetU32(pSSM, &Screen.u32StartOffset);
    51585158            AssertRCReturn(rc, rc);
    5159             if (offVram != 0xffffffff)
     5159            if (Screen.u32StartOffset == 0xffffffff)
    51605160            {
    51615161                WARN(("not expected offVram"));
    5162                 Screen.u32StartOffset = offVram;
     5162                Screen.u32StartOffset = 0;
    51635163            }
    51645164
    5165             rc = CrFbLoadState(pFb, pSSM, version);
    5166             AssertRCReturn(rc, rc);
    5167 
    5168             if (version >= SHCROGL_SSM_VERSION_WITH_SCREEN_MAP)
     5165            if (version >= SHCROGL_SSM_VERSION_WITH_SCREEN_MAP_REORDERED)
    51695166            {
    51705167                rc = SSMR3GetMem(pSSM, aTargetMap, sizeof (aTargetMap));
    51715168                AssertRCReturn(rc, rc);
    51725169            }
     5170
     5171            if (version == SHCROGL_SSM_VERSION_WITH_SCREEN_MAP)
     5172            {
     5173                VBOXCMDVBVA_SCREENMAP_DECL(uint32_t, aEmptyTargetMap);
     5174
     5175                memset(aEmptyTargetMap, 0, sizeof (aEmptyTargetMap));
     5176
     5177                rc = CrPMgrResize(&Screen, cr_server.fCrCmdEnabled ? NULL : CrFbGetVRAM(pFb), aEmptyTargetMap);
     5178                AssertRCReturn(rc, rc);
     5179
     5180                rc = CrFbLoadState(pFb, pSSM, version);
     5181                AssertRCReturn(rc, rc);
     5182
     5183                rc = SSMR3GetMem(pSSM, aTargetMap, sizeof (aTargetMap));
     5184                AssertRCReturn(rc, rc);
     5185            }
    51735186        }
    51745187
    51755188        rc = CrPMgrResize(&Screen, cr_server.fCrCmdEnabled ? NULL : CrFbGetVRAM(pFb), aTargetMap);
    51765189        AssertRCReturn(rc, rc);
     5190
     5191        if (version >= SHCROGL_SSM_VERSION_WITH_FB_INFO && version != SHCROGL_SSM_VERSION_WITH_SCREEN_MAP)
     5192        {
     5193            rc = CrFbLoadState(pFb, pSSM, version);
     5194            AssertRCReturn(rc, rc);
     5195        }
    51775196    }
    51785197
  • trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu.c

    r51082 r51349  
    946946}
    947947
    948 PCR_BLITTER renderspuVBoxPresentBlitterGetAndEnter( WindowInfo *window, int32_t i32MakeCurrentUserData )
    949 {
    950     PCR_BLITTER pBlitter = renderspuVBoxPresentBlitterGet(window);
     948PCR_BLITTER renderspuVBoxPresentBlitterGetAndEnter( WindowInfo *window, int32_t i32MakeCurrentUserData, bool fRedraw )
     949{
     950    PCR_BLITTER pBlitter = fRedraw ? window->pBlitter : renderspuVBoxPresentBlitterGet(window);
    951951    if (pBlitter)
    952952    {
     
    10011001}
    10021002
    1003 void renderspuVBoxPresentCompositionGeneric( WindowInfo *window, const struct VBOXVR_SCR_COMPOSITOR * pCompositor, const struct VBOXVR_SCR_COMPOSITOR_ENTRY *pChangedEntry, int32_t i32MakeCurrentUserData )
    1004 {
    1005     PCR_BLITTER pBlitter = renderspuVBoxPresentBlitterGetAndEnter(window, i32MakeCurrentUserData);
     1003void renderspuVBoxPresentCompositionGeneric( WindowInfo *window, const struct VBOXVR_SCR_COMPOSITOR * pCompositor,
     1004        const struct VBOXVR_SCR_COMPOSITOR_ENTRY *pChangedEntry, int32_t i32MakeCurrentUserData,
     1005        bool fRedraw )
     1006{
     1007    PCR_BLITTER pBlitter = renderspuVBoxPresentBlitterGetAndEnter(window, i32MakeCurrentUserData, fRedraw);
    10061008    if (!pBlitter)
    10071009        return;
  • trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu.h

    r51064 r51349  
    418418extern int renderspuVBoxCompositorTryAcquire(WindowInfo *window, const struct VBOXVR_SCR_COMPOSITOR **ppCompositor);
    419419extern void renderspuVBoxCompositorRelease( WindowInfo *window);
    420 extern void renderspuVBoxPresentCompositionGeneric( WindowInfo *window, const struct VBOXVR_SCR_COMPOSITOR * pCompositor, const struct VBOXVR_SCR_COMPOSITOR_ENTRY *pChangedEntry, int32_t i32MakeCurrentUserData );
     420extern void renderspuVBoxPresentCompositionGeneric( WindowInfo *window, const struct VBOXVR_SCR_COMPOSITOR * pCompositor,
     421        const struct VBOXVR_SCR_COMPOSITOR_ENTRY *pChangedEntry, int32_t i32MakeCurrentUserData,
     422        bool fRedraw);
    421423extern PCR_BLITTER renderspuVBoxPresentBlitterGet( WindowInfo *window );
    422424void renderspuVBoxPresentBlitterCleanup( WindowInfo *window );
    423425extern int renderspuVBoxPresentBlitterEnter( PCR_BLITTER pBlitter, int32_t i32MakeCurrentUserData );
    424 extern PCR_BLITTER renderspuVBoxPresentBlitterGetAndEnter( WindowInfo *window, int32_t i32MakeCurrentUserData );
     426extern PCR_BLITTER renderspuVBoxPresentBlitterGetAndEnter( WindowInfo *window, int32_t i32MakeCurrentUserData, bool fRedraw );
    425427extern PCR_BLITTER renderspuVBoxPresentBlitterEnsureCreated( WindowInfo *window, int32_t i32MakeCurrentUserData );
    426428void renderspuWindowTermBase( WindowInfo *window );
  • trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_agl.c

    r50095 r51349  
    610610void renderspu_SystemVBoxPresentComposition( WindowInfo *window, const struct VBOXVR_SCR_COMPOSITOR * pCompositor, const struct VBOXVR_SCR_COMPOSITOR_ENTRY *pChangedEntry )
    611611{
    612     renderspuVBoxPresentCompositionGeneric(window, pCompositor, pChangedEntry, 0);
     612    renderspuVBoxPresentCompositionGeneric(window, pCompositor, pChangedEntry, 0, false);
    613613}
    614614
  • trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_glx.c

    r51064 r51349  
    584584                        if (pCompositor)
    585585                        {
    586                             renderspuVBoxPresentCompositionGeneric(pWindow, pCompositor, NULL, 0);
     586                            renderspuVBoxPresentCompositionGeneric(pWindow, pCompositor, NULL, 0, true);
    587587                            renderspuVBoxCompositorRelease(pWindow);
    588588                        }
     
    19811981    if (RT_SUCCESS(rc))
    19821982    {
    1983         renderspuVBoxPresentCompositionGeneric(window, pCompositor, pChangedEntry, 0);
     1983        renderspuVBoxPresentCompositionGeneric(window, pCompositor, pChangedEntry, 0, false);
    19841984        renderspuVBoxCompositorRelease(window);
    19851985    }
  • trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_wgl.c

    r50626 r51349  
    446446                        pWindow->redraw_device_context = hDC;
    447447
    448                         renderspuVBoxPresentCompositionGeneric(pWindow, pCompositor, NULL, 1);
     448                        renderspuVBoxPresentCompositionGeneric(pWindow, pCompositor, NULL, 1, true);
    449449
    450450                        bRc = EndPaint(pWindow->hWnd, &Paint);
     
    12951295    if (RT_SUCCESS(rc))
    12961296    {
    1297         renderspuVBoxPresentCompositionGeneric(window, pCompositor, pChangedEntry, 0);
     1297        renderspuVBoxPresentCompositionGeneric(window, pCompositor, pChangedEntry, 0, false);
    12981298        renderspuVBoxCompositorRelease(window);
    12991299    }
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