summaryrefslogtreecommitdiffstats
path: root/src/VBox/Devices/Graphics/DevVGA-SVGA-cmd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/VBox/Devices/Graphics/DevVGA-SVGA-cmd.cpp')
-rw-r--r--src/VBox/Devices/Graphics/DevVGA-SVGA-cmd.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/VBox/Devices/Graphics/DevVGA-SVGA-cmd.cpp b/src/VBox/Devices/Graphics/DevVGA-SVGA-cmd.cpp
index cc4f0f1b..c84b93c5 100644
--- a/src/VBox/Devices/Graphics/DevVGA-SVGA-cmd.cpp
+++ b/src/VBox/Devices/Graphics/DevVGA-SVGA-cmd.cpp
@@ -1857,6 +1857,11 @@ static void vmsvga3dCmdDefineGBScreenTarget(PVGASTATE pThis, PVGASTATECC pThisCC
pScreen->offVRAM = 0; /* Not applicable for screen targets, they use either a separate memory buffer or a host window. */
pScreen->cbPitch = pCmd->width * 4;
pScreen->cBpp = 32;
+ pScreen->cDpi = pCmd->dpi;
+
+ /* The screen bitmap must be deallocated after 'vmsvgaR3ChangeMode'. */
+ void *pvOldScreenBitmap = pScreen->pvScreenBitmap;
+ pScreen->pvScreenBitmap = 0;
if (RT_LIKELY(pThis->svga.f3DEnabled))
vmsvga3dDefineScreen(pThis, pThisCC, pScreen);
@@ -1869,6 +1874,8 @@ static void vmsvga3dCmdDefineGBScreenTarget(PVGASTATE pThis, PVGASTATECC pThisCC
pThis->svga.fGFBRegisters = false;
vmsvgaR3ChangeMode(pThis, pThisCC);
+
+ RTMemFree(pvOldScreenBitmap);
}
}
@@ -6757,6 +6764,12 @@ void vmsvgaR3CmdDefineScreen(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdDe
VMSVGASCREENOBJECT *pScreen = &pSvgaR3State->aScreens[idScreen];
Assert(pScreen->idScreen == idScreen);
+ pScreen->cDpi = 0; /* SVGAFifoCmdDefineScreen does not support dpi. */
+
+ /* SVGAFifoCmdDefineScreen uses the guest VRAM. The screen bitmap must be deallocated after 'vmsvgaR3ChangeMode'. */
+ void *pvOldScreenBitmap = pScreen->pvScreenBitmap;
+ pScreen->pvScreenBitmap = 0;
+
pScreen->fDefined = true;
pScreen->fModified = true;
pScreen->fuScreen = pCmd->screen.flags;
@@ -6779,13 +6792,15 @@ void vmsvgaR3CmdDefineScreen(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdDe
/* Screen blanked. Keep old values. */
}
- pThis->svga.fGFBRegisters = false;
- vmsvgaR3ChangeMode(pThis, pThisCC);
-
#ifdef VBOX_WITH_VMSVGA3D
if (RT_LIKELY(pThis->svga.f3DEnabled))
vmsvga3dDefineScreen(pThis, pThisCC, pScreen);
#endif
+
+ pThis->svga.fGFBRegisters = false;
+ vmsvgaR3ChangeMode(pThis, pThisCC);
+
+ RTMemFree(pvOldScreenBitmap);
}