VirtualBox

Changeset 51356 in vbox


Ignore:
Timestamp:
May 22, 2014 1:08:14 PM (11 years ago)
Author:
vboxsync
Message:

crOpenGL: save state for pended command blocks

Location:
trunk/src/VBox
Files:
4 edited

Legend:

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

    r51349 r51356  
    4444#define SHCROGL_SSM_VERSION_WITH_SCREEN_MAP                         45
    4545#define SHCROGL_SSM_VERSION_WITH_SCREEN_MAP_REORDERED               46
    46 #define SHCROGL_SSM_VERSION                                         46
     46#define SHCROGL_SSM_VERSION_WITH_PEND_CMD_INFO                      47
     47#define SHCROGL_SSM_VERSION                                         47
    4748
    4849/* These define the Chromium release number.
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server.h

    r51320 r51356  
    476476int8_t crVBoxServerCrCmdFlipProcess(const VBOXCMDVBVA_FLIP *pFlip);
    477477
     478
     479int32_t crVBoxServerClientGet(uint32_t u32ClientID, CRClient **ppClient);
     480
     481int crServerPendSaveState(PSSMHANDLE pSSM);
     482int crServerPendLoadState(PSSMHANDLE pSSM, uint32_t u32Version);
     483
    478484//#define VBOX_WITH_CRSERVER_DUMPER
    479485#ifdef VBOX_WITH_CRSERVER_DUMPER
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_main.c

    r51330 r51356  
    8383}
    8484
    85 DECLINLINE(int32_t) crVBoxServerClientGet(uint32_t u32ClientID, CRClient **ppClient)
     85int32_t crVBoxServerClientGet(uint32_t u32ClientID, CRClient **ppClient)
    8686{
    8787    CRClient *pClient = NULL;
     
    18381838    }
    18391839
     1840    rc = crServerPendSaveState(pSSM);
     1841    AssertRCReturn(rc, rc);
     1842
    18401843    rc = CrPMgrSaveState(pSSM);
    18411844    AssertRCReturn(rc, rc);
     
    27332736    cr_server.curClient = NULL;
    27342737
     2738    rc = crServerPendLoadState(pSSM, version);
     2739    AssertRCReturn(rc, rc);
     2740
    27352741    if (version >= SHCROGL_SSM_VERSION_WITH_SCREEN_INFO)
    27362742    {
     
    36463652    return VINF_SUCCESS;
    36473653}
    3648 
    36493654
    36503655static DECLCALLBACK(int) crVBoxCrCmdSaveState(HVBOXCRCMDSVR hSvr, PSSMHANDLE pSSM)
     
    43114316    Assert(!cr_server.fCrCmdEnabled);
    43124317
    4313     if (cr_server.numClients)
    4314     {
    4315         WARN(("cr_server.numClients(%d) is not NULL", cr_server.numClients));
    4316         return VERR_INVALID_STATE;
    4317     }
     4318    Assert(!cr_server.numClients);
     4319
     4320    crVBoxServerRemoveAllClients();
     4321
     4322    CRASSERT(!cr_server.numClients);
    43184323
    43194324    crVBoxServerDefaultContextClear();
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_stream.c

    r50973 r51356  
    419419{
    420420    RTLISTNODE Node;
     421    uint32_t cbMsg;
    421422    CRMessage Msg;
    422423} CR_SERVER_PENDING_MSG;
     
    424425static int crServerPendMsg(CRConnection *conn, const CRMessage *msg, int cbMsg)
    425426{
    426     CR_SERVER_PENDING_MSG *pMsg = (CR_SERVER_PENDING_MSG*)RTMemAlloc(cbMsg + RT_OFFSETOF(CR_SERVER_PENDING_MSG, Msg));
     427    CR_SERVER_PENDING_MSG *pMsg;
     428
     429    if (!cbMsg)
     430    {
     431        WARN(("cbMsg is null!"));
     432        return VERR_INVALID_PARAMETER;
     433    }
     434
     435    pMsg = (CR_SERVER_PENDING_MSG*)RTMemAlloc(cbMsg + RT_OFFSETOF(CR_SERVER_PENDING_MSG, Msg));
    427436    if (!pMsg)
    428437    {
     
    431440    }
    432441
     442    pMsg->cbMsg = cbMsg;
     443
    433444    memcpy(&pMsg->Msg, msg, cbMsg);
    434445
    435446    RTListAppend(&conn->PendingMsgList, &pMsg->Node);
     447
     448    return VINF_SUCCESS;
     449}
     450
     451int crServerPendSaveState(PSSMHANDLE pSSM)
     452{
     453    int i, rc;
     454
     455    for (i = 0; i < cr_server.numClients; i++)
     456    {
     457        CR_SERVER_PENDING_MSG *pIter;
     458        CRClient *pClient = cr_server.clients[i];
     459        CRConnection *pConn;
     460        if (!pClient || !pClient->conn)
     461        {
     462            WARN(("invalid client state"));
     463            continue;
     464        }
     465
     466        pConn = pClient->conn;
     467
     468        if (RTListIsEmpty(&pConn->PendingMsgList))
     469            continue;
     470
     471        CRASSERT(pConn->u32ClientID);
     472
     473        rc = SSMR3PutU32(pSSM, pConn->u32ClientID);
     474        AssertRCReturn(rc, rc);
     475
     476        RTListForEach(&pConn->PendingMsgList, pIter, CR_SERVER_PENDING_MSG, Node)
     477        {
     478            CRASSERT(pIter->cbMsg);
     479
     480            rc = SSMR3PutU32(pSSM, pIter->cbMsg);
     481            AssertRCReturn(rc, rc);
     482
     483            rc = SSMR3PutMem(pSSM, &pIter->Msg, pIter->cbMsg);
     484            AssertRCReturn(rc, rc);
     485        }
     486
     487        rc = SSMR3PutU32(pSSM, 0);
     488        AssertRCReturn(rc, rc);
     489    }
     490
     491    rc = SSMR3PutU32(pSSM, 0);
     492    AssertRCReturn(rc, rc);
     493
     494    return VINF_SUCCESS;
     495}
     496
     497int crServerPendLoadState(PSSMHANDLE pSSM, uint32_t u32Version)
     498{
     499    int rc;
     500    uint32_t u32;
     501    CRClient *pClient;
     502
     503    if (u32Version < SHCROGL_SSM_VERSION_WITH_PEND_CMD_INFO)
     504        return VINF_SUCCESS;
     505
     506    rc = SSMR3GetU32(pSSM, &u32);
     507    AssertRCReturn(rc, rc);
     508
     509    if (!u32)
     510        return VINF_SUCCESS;
     511
     512    do {
     513        rc = crVBoxServerClientGet(u32, &pClient);
     514        AssertRCReturn(rc, rc);
     515
     516        for(;;)
     517        {
     518            CR_SERVER_PENDING_MSG *pMsg;
     519
     520            rc = SSMR3GetU32(pSSM, &u32);
     521            AssertRCReturn(rc, rc);
     522
     523            if (!u32)
     524                break;
     525
     526            pMsg = (CR_SERVER_PENDING_MSG*)RTMemAlloc(u32 + RT_OFFSETOF(CR_SERVER_PENDING_MSG, Msg));
     527            if (!pMsg)
     528            {
     529                WARN(("RTMemAlloc failed"));
     530                return VERR_NO_MEMORY;
     531            }
     532
     533            pMsg->cbMsg = u32;
     534            rc = SSMR3GetMem(pSSM, &pMsg->Msg, u32);
     535            AssertRCReturn(rc, rc);
     536
     537            RTListAppend(&pClient->conn->PendingMsgList, &pMsg->Node);
     538        }
     539
     540        rc = SSMR3GetU32(pSSM, &u32);
     541        AssertRCReturn(rc, rc);
     542    } while (u32);
     543
     544    rc = SSMR3GetU32(pSSM, &u32);
     545    AssertRCReturn(rc, rc);
    436546
    437547    return VINF_SUCCESS;
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