VirtualBox

Changeset 20021 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
May 26, 2009 10:31:44 AM (16 years ago)
Author:
vboxsync
Message:

Main/Display: properly save/restore some important members, see xtracker 3927

Location:
trunk/src/VBox/Main
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/ConsoleImpl.cpp

    r19750 r20021  
    64186418                    break;
    64196419
     6420                vrc = static_cast <Console *>(console)->getDisplay()->registerSSM(pVM);
     6421                AssertRC (vrc);
     6422                if (VBOX_FAILURE (vrc))
     6423                    break;
     6424
    64206425                /*
    64216426                 * Synchronize debugger settings
  • trunk/src/VBox/Main/DisplayImpl.cpp

    r19844 r20021  
    110110/////////////////////////////////////////////////////////////////////////////
    111111
     112#define sSSMDisplayVer 0x00010001
     113
     114/**
     115 * Save/Load some important guest state
     116 */
     117DECLCALLBACK(void)
     118Display::displaySSMSave (PSSMHANDLE pSSM, void *pvUser)
     119{
     120    Display *that = static_cast<Display*>(pvUser);
     121
     122    int rc = SSMR3PutU32 (pSSM, that->mcMonitors);
     123    AssertRC(rc);
     124
     125    for (unsigned i = 0; i < that->mcMonitors; i++)
     126    {
     127        rc = SSMR3PutU32 (pSSM, that->maFramebuffers[i].u32Offset);
     128        AssertRC(rc);
     129        rc = SSMR3PutU32 (pSSM, that->maFramebuffers[i].u32MaxFramebufferSize);
     130        AssertRC(rc);
     131        rc = SSMR3PutU32 (pSSM, that->maFramebuffers[i].u32InformationSize);
     132        AssertRC(rc);
     133    }
     134}
     135
     136DECLCALLBACK(int)
     137Display::displaySSMLoad (PSSMHANDLE pSSM, void *pvUser, uint32_t u32Version)
     138{
     139    Display *that = static_cast<Display*>(pvUser);
     140    uint32_t cMonitors;
     141
     142    if (u32Version != sSSMDisplayVer)
     143        return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
     144
     145    int rc = SSMR3GetU32 (pSSM, &cMonitors);
     146    if (cMonitors != that->mcMonitors)
     147    {
     148        LogRel(("Display: Number of monitors changed (%d->%d)!\n",
     149                 cMonitors, that->mcMonitors));
     150        return VERR_SSM_LOAD_CONFIG_MISMATCH;
     151    }
     152
     153    for (unsigned i = 0; i < cMonitors; i++)
     154    {
     155        rc = SSMR3GetU32 (pSSM, &that->maFramebuffers[i].u32Offset);
     156        AssertRC(rc);
     157        rc = SSMR3GetU32 (pSSM, &that->maFramebuffers[i].u32MaxFramebufferSize);
     158        AssertRC(rc);
     159        rc = SSMR3GetU32 (pSSM, &that->maFramebuffers[i].u32InformationSize);
     160        AssertRC(rc);
     161    }
     162
     163    return VINF_SUCCESS;
     164}
     165
    112166/**
    113167 * Initializes the display object.
     
    197251    mpVMMDev = NULL;
    198252    mfVMMDevInited = true;
     253}
     254
     255/**
     256 * Register the SSM methods. Called by the power up thread to be able to
     257 * pass pVM
     258 */
     259int Display::registerSSM(PVM pVM)
     260{
     261    return SSMR3RegisterExternal(pVM, "DisplayData", 3*sizeof(uint32_t*),
     262                                 sSSMDisplayVer, 0,
     263                                 NULL, displaySSMSave, NULL,
     264                                 NULL, displaySSMLoad, NULL, this);
    199265}
    200266
     
    23662432     * Init Interfaces.
    23672433     */
    2368     pDrvIns->IBase.pfnQueryInterface    = Display::drvQueryInterface;
    2369 
    2370     pData->Connector.pfnResize          = Display::displayResizeCallback;
    2371     pData->Connector.pfnUpdateRect      = Display::displayUpdateCallback;
    2372     pData->Connector.pfnRefresh         = Display::displayRefreshCallback;
    2373     pData->Connector.pfnReset           = Display::displayResetCallback;
    2374     pData->Connector.pfnLFBModeChange   = Display::displayLFBModeChangeCallback;
     2434    pDrvIns->IBase.pfnQueryInterface       = Display::drvQueryInterface;
     2435
     2436    pData->Connector.pfnResize             = Display::displayResizeCallback;
     2437    pData->Connector.pfnUpdateRect         = Display::displayUpdateCallback;
     2438    pData->Connector.pfnRefresh            = Display::displayRefreshCallback;
     2439    pData->Connector.pfnReset              = Display::displayResetCallback;
     2440    pData->Connector.pfnLFBModeChange      = Display::displayLFBModeChangeCallback;
    23752441    pData->Connector.pfnProcessAdapterData = Display::displayProcessAdapterDataCallback;
    23762442    pData->Connector.pfnProcessDisplayData = Display::displayProcessDisplayDataCallback;
  • trunk/src/VBox/Main/include/DisplayImpl.h

    r19844 r20021  
    114114    HRESULT init (Console *aParent);
    115115    void uninit();
     116    int  registerSSM(PVM pVM);
    116117
    117118    // public methods only for internal purposes
     
    275276#endif
    276277
     278    static DECLCALLBACK(void)   displaySSMSave (PSSMHANDLE pSSM, void *pvUser);
     279    static DECLCALLBACK(int)    displaySSMLoad (PSSMHANDLE pSSM, void *pvUser, uint32_t u32Version);
     280
    277281    const ComObjPtr <Console, ComWeakRef> mParent;
    278282    /** Pointer to the associated display driver. */
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