Changeset 23985 in vbox for trunk/src/VBox
- Timestamp:
- Oct 22, 2009 2:19:37 PM (15 years ago)
- Location:
- trunk/src/VBox/Devices/Graphics
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA.cpp
r23793 r23985 2636 2636 uint32_t u32Dummy; 2637 2637 2638 #ifndef VBOX /* checked by the caller. */ 2638 2639 if (version_id > VGA_SAVEDSTATE_VERSION) 2639 #ifndef VBOX2640 2640 return -EINVAL; 2641 #else /* VBOX */2642 {2643 Log(("vga_load: version_id=%d - UNKNOWN\n", version_id));2644 return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;2645 }2646 2641 #endif /* VBOX */ 2647 2642 … … 4607 4602 4608 4603 src = pThis->vram_ptrR3; 4609 if (src) { 4610 for (col = 0; col < num_cols; ++col) pHlp->pfnPrintf(pHlp, "-"); pHlp->pfnPrintf(pHlp, "\n"); 4604 if (src) 4605 { 4606 for (col = 0; col < num_cols; ++col) 4607 pHlp->pfnPrintf(pHlp, "-"); 4608 pHlp->pfnPrintf(pHlp, "\n"); 4611 4609 for (row = 0; row < num_rows; ++row) 4612 4610 { … … 4618 4616 pHlp->pfnPrintf(pHlp, "\n"); 4619 4617 } 4620 for (col = 0; col < num_cols; ++col) pHlp->pfnPrintf(pHlp, "-"); pHlp->pfnPrintf(pHlp, "\n"); 4618 for (col = 0; col < num_cols; ++col) 4619 pHlp->pfnPrintf(pHlp, "-"); 4620 pHlp->pfnPrintf(pHlp, "\n"); 4621 4621 } 4622 4622 else … … 5344 5344 5345 5345 5346 /* -=-=-=-=-=- Ring3: Misc Wrappers -=-=-=-=-=- */5346 /* -=-=-=-=-=- Ring3: Misc Wrappers & Sidekicks -=-=-=-=-=- */ 5347 5347 5348 5348 /** 5349 * Saves a state of the VGA device. 5350 * 5351 * @returns VBox status code. 5352 * @param pDevIns The device instance. 5353 * @param pSSMHandle The handle to save the state to. 5349 * Saves a important bits of the VGA device config. 5350 * 5351 * @param pThis The VGA instance data. 5352 * @param pSSM The saved state handle. 5354 5353 */ 5355 static DECLCALLBACK(int) vgaR3SaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle) 5356 { 5357 vga_save(pSSMHandle, PDMINS_2_DATA(pDevIns, PVGASTATE)); 5358 #ifdef VBOX_WITH_HGSMI 5359 return vboxVBVASaveStateExec(pDevIns, pSSMHandle); 5354 static void vgaR3SaveConfig(PVGASTATE pThis, PSSMHANDLE pSSM) 5355 { 5356 SSMR3PutU32(pSSM, pThis->vram_size); 5357 SSMR3PutU32(pSSM, pThis->cMonitors); 5358 } 5359 5360 5361 /** 5362 * @copydoc FNSSMDEVLIVEEXEC 5363 */ 5364 static DECLCALLBACK(int) vgaR3LiveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uPass) 5365 { 5366 PVGASTATE pThis = PDMINS_2_DATA(pDevIns, PVGASTATE); 5367 Assert(uPass == 0); NOREF(uPass); 5368 vgaR3SaveConfig(pThis, pSSM); 5369 return VINF_SSM_DONT_CALL_AGAIN; 5370 } 5371 5372 5373 /** 5374 * @copydoc FNSSMDEVSAVEPREP 5375 */ 5376 static DECLCALLBACK(int) vgaR3SavePrep(PPDMDEVINS pDevIns, PSSMHANDLE pSSM) 5377 { 5378 #ifdef VBOX_WITH_VIDEOHWACCEL 5379 return vboxVBVASaveStatePrep(pDevIns, pSSM); 5360 5380 #else 5361 5381 return VINF_SUCCESS; … … 5363 5383 } 5364 5384 5365 #ifdef VBOX_WITH_VIDEOHWACCEL5366 static DECLCALLBACK(int) vgaR3SavePrep(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)5367 {5368 return vboxVBVASaveStatePrep(pDevIns, pSSM);5369 }5370 #endif5371 5385 5372 5386 /** 5373 * Loads a saved VGA device state. 5374 * 5375 * @returns VBox status code. 5376 * @param pDevIns The device instance. 5377 * @param pSSMHandle The handle to the saved state. 5378 * @param uVersion The data unit version number. 5379 * @param uPass The data pass. 5387 * @copydoc FNSSMDEVSAVEEXEC 5380 5388 */ 5381 static DECLCALLBACK(int) vgaR3LoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle, uint32_t uVersion, uint32_t uPass) 5382 { 5383 Assert(uPass == SSM_PASS_FINAL); NOREF(uPass); 5384 int rc = vga_load(pSSMHandle, PDMINS_2_DATA(pDevIns, PVGASTATE), uVersion); 5385 if (RT_FAILURE(rc)) 5386 return rc; 5389 static DECLCALLBACK(int) vgaR3SaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM) 5390 { 5391 PVGASTATE pThis = PDMINS_2_DATA(pDevIns, PVGASTATE); 5392 vgaR3SaveConfig(pThis, pSSM); 5393 vga_save(pSSM, PDMINS_2_DATA(pDevIns, PVGASTATE)); 5387 5394 #ifdef VBOX_WITH_HGSMI 5388 return vboxVBVALoadStateExec(pDevIns, pSSMHandle, uVersion); 5395 SSMR3PutBool(pSSM, true); 5396 return vboxVBVASaveStateExec(pDevIns, pSSM); 5397 #else 5398 SSMR3PutBool(pSSM, false); 5399 return VINF_SUCCESS; 5400 #endif 5401 } 5402 5403 5404 /** 5405 * @copydoc FNSSMDEVSAVEEXEC 5406 */ 5407 static DECLCALLBACK(int) vgaR3LoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass) 5408 { 5409 PVGASTATE pThis = PDMINS_2_DATA(pDevIns, PVGASTATE); 5410 int rc; 5411 5412 if ( uVersion != VGA_SAVEDSTATE_VERSION 5413 && uVersion != VGA_SAVEDSTATE_VERSION_HGSMI 5414 && uVersion != VGA_SAVEDSTATE_VERSION_PRE_HGSMI) 5415 return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION; 5416 5417 if (uVersion > VGA_SAVEDSTATE_VERSION_HGSMI) 5418 { 5419 /* Check the config */ 5420 uint32_t cbVRam; 5421 rc = SSMR3GetU32(pSSM, &cbVRam); 5422 AssertRCReturn(rc, rc); 5423 if (pThis->vram_size != cbVRam) 5424 { 5425 LogRel(("DevVGA: VRAM size changed: config=%#x state=%#x\n", pThis->vram_size, cbVRam)); 5426 return VERR_SSM_LOAD_CONFIG_MISMATCH; 5427 } 5428 5429 uint32_t cMonitors; 5430 rc = SSMR3GetU32(pSSM, &cMonitors); 5431 AssertRCReturn(rc, rc); 5432 if (pThis->cMonitors != cMonitors) 5433 { 5434 LogRel(("DevVGA: Monitor count changed: config=%u state=%u\n", pThis->cMonitors, cMonitors)); 5435 return VERR_SSM_LOAD_CONFIG_MISMATCH; 5436 } 5437 } 5438 5439 if (uPass == SSM_PASS_FINAL) 5440 { 5441 rc = vga_load(pSSM, pThis, uVersion); 5442 if (RT_FAILURE(rc)) 5443 return rc; 5444 bool fWithHgsmi = uVersion == VGA_SAVEDSTATE_VERSION_HGSMI; 5445 if (uVersion > VGA_SAVEDSTATE_VERSION_HGSMI) 5446 { 5447 rc = SSMR3GetBool(pSSM, &fWithHgsmi); 5448 AssertRCReturn(rc, rc); 5449 } 5450 if (fWithHgsmi) 5451 { 5452 #ifdef VBOX_WITH_HGSMI 5453 rc = vboxVBVALoadStateExec(pDevIns, pSSM, uVersion); 5454 AssertRCReturn(rc, rc); 5455 #else 5456 AssertLogRelFailedReturn(VERR_SSM_LOAD_CONFIG_MISMATCH); 5457 #endif 5458 } 5459 } 5460 return VINF_SUCCESS; 5461 } 5462 5463 5464 /** 5465 * @copydoc FNSSMDEVLOADDONE 5466 */ 5467 static DECLCALLBACK(int) vgaR3LoadDone(PPDMDEVINS pDevIns, PSSMHANDLE pSSM) 5468 { 5469 #ifdef VBOX_WITH_HGSMI 5470 return vboxVBVALoadStateDone(pDevIns, pSSM); 5389 5471 #else 5390 5472 return VINF_SUCCESS; 5391 #endif5392 }5393 5394 /** @copydoc FNSSMDEVLOADDONE */5395 static DECLCALLBACK(int) vgaR3LoadDone(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)5396 {5397 #ifndef VBOX_WITH_HGSMI5398 return VINF_SUCCESS;5399 #else5400 return vboxVBVALoadStateDone(pDevIns, pSSM);5401 5473 #endif 5402 5474 } … … 6037 6109 /* save */ 6038 6110 rc = PDMDevHlpSSMRegisterEx(pDevIns, VGA_SAVEDSTATE_VERSION, sizeof(*pThis), NULL, 6039 NULL, NULL, NULL, 6040 #ifdef VBOX_WITH_VIDEOHWACCEL 6111 NULL, vgaR3LiveExec, NULL, 6041 6112 vgaR3SavePrep, vgaR3SaveExec, NULL, 6042 #else 6043 NULL, vgaR3SaveExec, NULL, 6044 #endif 6045 NULL, vgaR3LoadExec, vgaR3LoadDone); 6113 NULL, vgaR3LoadExec, vgaR3LoadDone); 6046 6114 if (RT_FAILURE(rc)) 6047 6115 return rc; -
trunk/src/VBox/Devices/Graphics/DevVGA.h
r23793 r23985 49 49 #endif /* VBOX_WITH_HGSMI */ 50 50 51 #ifdef VBOX_WITH_HGSMI 52 # define VGA_SAVEDSTATE_VERSION 3 53 #else 54 # define VGA_SAVEDSTATE_VERSION 2 55 #endif 51 #define VGA_SAVEDSTATE_VERSION 4 52 #define VGA_SAVEDSTATE_VERSION_HGSMI 3 53 #define VGA_SAVEDSTATE_VERSION_PRE_HGSMI 2 56 54 57 55 #define MSR_COLOR_EMULATION 0x01
Note:
See TracChangeset
for help on using the changeset viewer.