summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/VirtioGpuDxe/Commands.c
diff options
context:
space:
mode:
Diffstat (limited to 'OvmfPkg/VirtioGpuDxe/Commands.c')
-rw-r--r--OvmfPkg/VirtioGpuDxe/Commands.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/OvmfPkg/VirtioGpuDxe/Commands.c b/OvmfPkg/VirtioGpuDxe/Commands.c
index 595a3717d9..db5bdbca4b 100644
--- a/OvmfPkg/VirtioGpuDxe/Commands.c
+++ b/OvmfPkg/VirtioGpuDxe/Commands.c
@@ -355,6 +355,27 @@ VirtioGpuExitBoot (
VgpuDev = Context;
VgpuDev->VirtIo->SetDeviceStatus (VgpuDev->VirtIo, 0);
+
+ //
+ // If VirtioGpuDriverBindingStart() and VirtioGpuDriverBindingStop() have
+ // been called thus far in such a sequence that right now our (sole) child
+ // handle exists -- with the GOP on it standing for head (scanout) #0 --,
+ // then we have to unmap the current video mode's backing store.
+ //
+ if (VgpuDev->Child != NULL) {
+ //
+ // The current video mode is guaranteed to have a valid and mapped backing
+ // store, due to the first Gop.SetMode() call, made internally in
+ // InitVgpuGop().
+ //
+ ASSERT (VgpuDev->Child->BackingStore != NULL);
+
+ VgpuDev->VirtIo->UnmapSharedBuffer (
+ VgpuDev->VirtIo,
+ VgpuDev->Child->BackingStoreMap
+ );
+ }
+
VgpuDev->VirtIo->UnmapSharedBuffer (VgpuDev->VirtIo, VgpuDev->RingMap);
}