From 62a5715c0af49b62b331c2538025a8ab5ce6c6e5 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 5 Aug 2024 11:23:15 +0200 Subject: Merging upstream version 7.0.20-dfsg. Signed-off-by: Daniel Baumann --- src/VBox/Devices/Graphics/DevVGA-SVGA-cmd.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'src/VBox/Devices/Graphics/DevVGA-SVGA-cmd.cpp') 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); } -- cgit v1.2.3