VirtualBox

Changeset 56969 in vbox for trunk/src/VBox/Devices/Graphics


Ignore:
Timestamp:
Jul 17, 2015 1:38:14 PM (10 years ago)
Author:
vboxsync
Message:

DevVGA: Added markers to the saved state that separates various parts so we can more easily pin down load troubles when reading the log file.

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

Legend:

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

    r56944 r56969  
    55195519    vga_save(pSSM, PDMINS_2_DATA(pDevIns, PVGASTATE));
    55205520
     5521    VGA_SAVED_STATE_PUT_MARKER(pSSM, 1);
    55215522#ifdef VBOX_WITH_HGSMI
    55225523    SSMR3PutBool(pSSM, true);
     
    55285529    AssertRCReturn(rc, rc);
    55295530
     5531    VGA_SAVED_STATE_PUT_MARKER(pSSM, 3);
    55305532#ifdef VBOX_WITH_VDMA
    55315533    rc = SSMR3PutU32(pSSM, 1);
     
    55415543#endif
    55425544
     5545    VGA_SAVED_STATE_PUT_MARKER(pSSM, 5);
    55435546#ifdef VBOX_WITH_VMSVGA
    55445547    if (pThis->fVMSVGAEnabled)
     
    55485551    }
    55495552#endif
     5553    VGA_SAVED_STATE_PUT_MARKER(pSSM, 6);
    55505554
    55515555    return rc;
     
    55855589        if (RT_FAILURE(rc))
    55865590            return rc;
     5591
     5592        /*
     5593         * Restore the HGSMI state, if present.
     5594         */
     5595        VGA_SAVED_STATE_GET_MARKER_RETURN_ON_MISMATCH(pSSM, uVersion, 1);
    55875596        bool fWithHgsmi = uVersion == VGA_SAVEDSTATE_VERSION_HGSMI;
    55885597        if (uVersion > VGA_SAVEDSTATE_VERSION_HGSMI)
     
    56015610        }
    56025611
     5612        VGA_SAVED_STATE_GET_MARKER_RETURN_ON_MISMATCH(pSSM, uVersion, 3);
    56035613        if (uVersion >= VGA_SAVEDSTATE_VERSION_3D)
    56045614        {
     
    56225632        }
    56235633
     5634        VGA_SAVED_STATE_GET_MARKER_RETURN_ON_MISMATCH(pSSM, uVersion, 5);
    56245635#ifdef VBOX_WITH_VMSVGA
    56255636        if (pThis->fVMSVGAEnabled)
     
    56295640        }
    56305641#endif
     5642        VGA_SAVED_STATE_GET_MARKER_RETURN_ON_MISMATCH(pSSM, uVersion, 6);
    56315643    }
    56325644    return VINF_SUCCESS;
  • trunk/src/VBox/Devices/Graphics/DevVGASavedState.h

    r56292 r56969  
    2020
    2121
    22 #ifndef Graphics_DevVGASavedState_h
    23 #define Graphics_DevVGASavedState_h
     22#ifndef ___Graphics_DevVGASavedState_h
     23#define ___Graphics_DevVGASavedState_h
    2424
    25 #define VGA_SAVEDSTATE_VERSION              15
     25/** Creates an eyecatching marker in the VGA saved state ("<uSub>Marker\n"). */
     26#define VGA_SAVED_STATE_MAKE_MARKER(uSub) (UINT64_C(0x0a72656b72614d30) + (uint64_t)(uSub))
     27
     28/** Puts a marker. Status code is not checked. */
     29#define VGA_SAVED_STATE_PUT_MARKER(pSSM, uSub) \
     30    do { SSMR3PutU64(pSSM, VGA_SAVED_STATE_MAKE_MARKER(uSub)); } while (0)
     31
     32/** Retrieves a VGA saved state marker and checks that it matches, if it
     33 *  doesn't assert/LogRel and return. */
     34#define VGA_SAVED_STATE_GET_MARKER_RETURN_ON_MISMATCH(pSSM, uVersion, uSub) \
     35    do { \
     36        if (uVersion >= VGA_SAVEDSTATE_VERSION_MARKERS) \
     37        { \
     38            uint64_t uMarker; \
     39            int rcMarker = SSMR3GetU64(pSSM, &uMarker); \
     40            AssertLogRelRCReturn(rc, rc); \
     41            AssertLogRelMsgReturn(uMarker == VGA_SAVED_STATE_MAKE_MARKER(uSub), \
     42                                  ("Bad VGA marker: expected %llx, got %llx\n", VGA_SAVED_STATE_MAKE_MARKER(uSub), uMarker), \
     43                                  VERR_SSM_DATA_UNIT_FORMAT_CHANGED); \
     44        } \
     45    } while (0)
     46
     47#define VGA_SAVEDSTATE_VERSION              16
     48#define VGA_SAVEDSTATE_VERSION_MARKERS      16
    2649#define VGA_SAVEDSTATE_VERSION_MODE_HINTS   15
    2750#define VGA_SAVEDSTATE_VERSION_FIXED_PENDVHWA 14
     
    4164
    4265#endif
     66
  • trunk/src/VBox/Devices/Graphics/DevVGA_VBVA.cpp

    r56814 r56969  
    16031603    if (RT_SUCCESS(rc))
    16041604    {
     1605        VGA_SAVED_STATE_PUT_MARKER(pSSM, 2);
     1606
    16051607        /* Save VBVACONTEXT. */
    16061608        VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext (pIns);
     
    17811783}
    17821784
    1783 int vboxVBVALoadStateExec (PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t u32Version)
    1784 {
    1785     if (u32Version < VGA_SAVEDSTATE_VERSION_HGSMI)
     1785int vboxVBVALoadStateExec (PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion)
     1786{
     1787    if (uVersion < VGA_SAVEDSTATE_VERSION_HGSMI)
    17861788    {
    17871789        /* Nothing was saved. */
     
    17911793    PVGASTATE pVGAState = PDMINS_2_DATA(pDevIns, PVGASTATE);
    17921794    PHGSMIINSTANCE pIns = pVGAState->pHGSMI;
    1793     int rc = HGSMIHostLoadStateExec (pIns, pSSM, u32Version);
     1795    int rc = HGSMIHostLoadStateExec (pIns, pSSM, uVersion);
    17941796    if (RT_SUCCESS(rc))
    17951797    {
     1798        VGA_SAVED_STATE_GET_MARKER_RETURN_ON_MISMATCH(pSSM, uVersion, 2);
     1799
    17961800        /* Load VBVACONTEXT. */
    17971801        VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext (pIns);
     
    18791883            }
    18801884
    1881             if (u32Version > VGA_SAVEDSTATE_VERSION_WITH_CONFIG)
     1885            if (uVersion > VGA_SAVEDSTATE_VERSION_WITH_CONFIG)
    18821886            {
    18831887                /* Read mouse pointer shape information. */
     
    19331937                }
    19341938
    1935                 if (u32Version >= VGA_SAVEDSTATE_VERSION_MODE_HINTS)
     1939                if (uVersion >= VGA_SAVEDSTATE_VERSION_MODE_HINTS)
    19361940                {
    19371941                    uint32_t cModeHints, cbModeHints;
     
    19581962            LogFlowFunc(("%d views loaded\n", pCtx->cViews));
    19591963
    1960             if (u32Version > VGA_SAVEDSTATE_VERSION_WDDM)
     1964            if (uVersion > VGA_SAVEDSTATE_VERSION_WDDM)
    19611965            {
    19621966                bool fLoadCommands;
    19631967
    1964                 if (u32Version < VGA_SAVEDSTATE_VERSION_FIXED_PENDVHWA)
     1968                if (uVersion < VGA_SAVEDSTATE_VERSION_FIXED_PENDVHWA)
    19651969                {
    19661970                    const char *pcszOsArch = SSMR3HandleHostOSAndArch(pSSM);
     
    19881992                    if (fLoadCommands)
    19891993                    {
    1990                         rc = vbvaVHWACommandLoadPending(pVGAState, pSSM, u32Version);
     1994                        rc = vbvaVHWACommandLoadPending(pVGAState, pSSM, uVersion);
    19911995                        AssertRCReturn(rc, rc);
    19921996                    }
  • trunk/src/VBox/Devices/Graphics/DevVGA_VDMA.cpp

    r56292 r56969  
    13821382                return rc;
    13831383            }
     1384            VGA_SAVED_STATE_PUT_MARKER(pCmd->u.state.pSSM, 4);
     1385
    13841386            return pVdma->CrSrvInfo.pfnSaveState(pVdma->CrSrvInfo.hSvr, pCmd->u.state.pSSM);
    13851387        }
     
    13961398            }
    13971399
     1400            VGA_SAVED_STATE_GET_MARKER_RETURN_ON_MISMATCH(pCmd->u.state.pSSM, pCmd->u.state.u32Version, 4);
    13981401            rc = pVdma->CrSrvInfo.pfnLoadState(pVdma->CrSrvInfo.hSvr, pCmd->u.state.pSSM, pCmd->u.state.u32Version);
    13991402            if (RT_FAILURE(rc))
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