VirtualBox

Changeset 44000 in vbox


Ignore:
Timestamp:
Nov 30, 2012 10:03:19 AM (12 years ago)
Author:
vboxsync
Message:

dev/vga/crOpenGL: saved state fix (not tested yet)

Location:
trunk/src/VBox/Devices/Graphics
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Graphics/DevVGASavedState.h

    r37770 r44000  
    2323#define Graphics_DevVGASavedState_h
    2424
    25 #define VGA_SAVEDSTATE_VERSION              8
     25#define VGA_SAVEDSTATE_VERSION              9
     26#define VGA_SAVEDSTATE_VERSION_INV_GCMDFIFO 8 /* <- states upto and including this version may contain invalid completed Guest Commands fifo entries */
    2627#define VGA_SAVEDSTATE_VERSION_INV_VHEIGHT  8 /* <- states upto and including this version may contain invalid vbe_regs[VBE_DISPI_INDEX_VIRT_HEIGHT] value */
    2728#define VGA_SAVEDSTATE_VERSION_WDDM         7
  • trunk/src/VBox/Devices/Graphics/HGSMI/HGSMIHost.cpp

    r43086 r44000  
    11931193}
    11941194
     1195static int hgsmiHostSaveGuestCmdCompletedFifoEntryLocked (HGSMIGUESTCOMPLENTRY *pEntry, PSSMHANDLE pSSM)
     1196{
     1197    return SSMR3PutU32 (pSSM, pEntry->offBuffer);
     1198}
     1199
     1200static int hgsmiHostSaveGuestCmdCompletedFifoLocked (HGSMILIST * pFifo, PSSMHANDLE pSSM)
     1201{
     1202    VBOXHGSMI_SAVE_FIFOSTART(pSSM);
     1203    uint32_t size = 0;
     1204    for(HGSMILISTENTRY * pEntry = pFifo->pHead; pEntry; pEntry = pEntry->pNext)
     1205    {
     1206        ++size;
     1207    }
     1208    int rc = SSMR3PutU32 (pSSM, size);
     1209
     1210    for(HGSMILISTENTRY * pEntry = pFifo->pHead; pEntry && RT_SUCCESS(rc); pEntry = pEntry->pNext)
     1211    {
     1212        HGSMIGUESTCOMPLENTRY *pFifoEntry = HGSMILISTENTRY_2_HGSMIGUESTCOMPLENTRY(pEntry);
     1213        rc = hgsmiHostSaveGuestCmdCompletedFifoEntryLocked (pFifoEntry, pSSM);
     1214    }
     1215
     1216    VBOXHGSMI_SAVE_FIFOSTOP(pSSM);
     1217
     1218    return rc;
     1219}
     1220
    11951221static int hgsmiHostLoadFifoEntryLocked (PHGSMIINSTANCE pIns, HGSMIHOSTFIFOENTRY **ppEntry, PSSMHANDLE pSSM)
    11961222{
     
    12351261}
    12361262
     1263static int hgsmiHostLoadGuestCmdCompletedFifoEntryLocked (PHGSMIINSTANCE pIns, HGSMIGUESTCOMPLENTRY **ppEntry, PSSMHANDLE pSSM)
     1264{
     1265    HGSMIGUESTCOMPLENTRY *pEntry;
     1266    int rc = hgsmiGuestCompletionFIFOAlloc (pIns, &pEntry); AssertRC(rc);
     1267    if (RT_SUCCESS (rc))
     1268    {
     1269        rc = SSMR3GetU32 (pSSM, &pEntry->offBuffer); AssertRC(rc);
     1270        if (RT_SUCCESS (rc))
     1271            *ppEntry = pEntry;
     1272        else
     1273            hgsmiGuestCompletionFIFOFree (pIns, pEntry);
     1274    }
     1275    return rc;
     1276}
     1277
     1278static int hgsmiHostLoadGuestCmdCompletedFifoLocked (PHGSMIINSTANCE pIns, HGSMILIST * pFifo, PSSMHANDLE pSSM, uint32_t u32Version)
     1279{
     1280    VBOXHGSMI_LOAD_FIFOSTART(pSSM);
     1281
     1282    uint32_t size;
     1283    int rc = SSMR3GetU32 (pSSM, &size); AssertRC(rc);
     1284    if(RT_SUCCESS(rc) && size)
     1285    {
     1286        if (u32Version > VGA_SAVEDSTATE_VERSION_INV_GCMDFIFO)
     1287        {
     1288            for(uint32_t i = 0; i < size; ++i)
     1289            {
     1290                HGSMIGUESTCOMPLENTRY *pFifoEntry = NULL;  /* initialized to shut up gcc */
     1291                rc = hgsmiHostLoadGuestCmdCompletedFifoEntryLocked (pIns, &pFifoEntry, pSSM);
     1292                AssertRCBreak(rc);
     1293                hgsmiListAppend (pFifo, &pFifoEntry->entry);
     1294            }
     1295        }
     1296        else
     1297        {
     1298            LogRel(("WARNING: the current saved state version has some 3D support data missing, "
     1299                    "which may lead to some guest applications function unproperly"));
     1300            /* just read out all invalid data and discard it */
     1301            for(uint32_t i = 0; i < size; ++i)
     1302            {
     1303                HGSMIHOSTFIFOENTRY *pFifoEntry = NULL;  /* initialized to shut up gcc */
     1304                rc = hgsmiHostLoadFifoEntryLocked (pIns, &pFifoEntry, pSSM);
     1305                AssertRCBreak(rc);
     1306                hgsmiHostFIFOFree (pIns, pFifoEntry);
     1307            }
     1308        }
     1309    }
     1310
     1311    VBOXHGSMI_LOAD_FIFOSTOP(pSSM);
     1312
     1313    return rc;
     1314}
     1315
    12371316int HGSMIHostSaveStateExec (PHGSMIINSTANCE pIns, PSSMHANDLE pSSM)
    12381317{
     
    12401319
    12411320    int rc;
    1242 
    12431321
    12441322    HGSMIOFFSET off = pIns->pHGFlags ? HGSMIPointerToOffset(&pIns->area, (const HGSMIBUFFERHEADER *)pIns->pHGFlags) : HGSMIOFFSET_VOID;
     
    12601338            rc = hgsmiHostSaveFifoLocked (&pIns->hostFIFOProcessed, pSSM); AssertRC(rc);
    12611339#ifdef VBOX_WITH_WDDM
    1262             rc = hgsmiHostSaveFifoLocked (&pIns->guestCmdCompleted, pSSM); AssertRC(rc);
     1340            rc = hgsmiHostSaveGuestCmdCompletedFifoLocked (&pIns->guestCmdCompleted, pSSM); AssertRC(rc);
    12631341#endif
    12641342
     
    13271405#ifdef VBOX_WITH_WDDM
    13281406                if (RT_SUCCESS(rc) && u32Version > VGA_SAVEDSTATE_VERSION_PRE_WDDM)
    1329                     rc = hgsmiHostLoadFifoLocked (pIns, &pIns->hostFIFOProcessed, pSSM);
     1407                    rc = hgsmiHostLoadGuestCmdCompletedFifoLocked (pIns, &pIns->guestCmdCompleted, pSSM, u32Version);
    13301408#endif
    13311409
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