]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg/QemuVideoDxe: Frame buffer config size may change in new mode
authorRuiyu Ni <ruiyu.ni@intel.com>
Mon, 23 Jan 2017 06:07:42 +0000 (14:07 +0800)
committerRuiyu Ni <ruiyu.ni@intel.com>
Tue, 24 Jan 2017 07:06:39 +0000 (15:06 +0800)
https://bugzilla.tianocore.org/show_bug.cgi?id=339

The patch removes the assumption in QemuVideoDxe driver that it
wrongly assumes the frame buffer configure size is the same in
different video modes.
The assumption is true in old FrameBufferBltLib but is false in
new implementation.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
OvmfPkg/QemuVideoDxe/Gop.c

index 5485ba3c28716c524be53b291e6804492fad62ed..359e9217d3d143fbbe90c6a742cd15b9e74cd73b 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Graphics Output Protocol functions for the QEMU video controller.\r
 \r
-  Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
@@ -189,30 +189,35 @@ Routine Description:
   QemuVideoCompleteModeData (Private, This->Mode);\r
 \r
   //\r
-  // Allocate when using first time.\r
+  // Re-initialize the frame buffer configure when mode changes.\r
   //\r
-  if (Private->FrameBufferBltConfigure == NULL) {\r
-    Status = FrameBufferBltConfigure (\r
-               (VOID*) (UINTN) This->Mode->FrameBufferBase,\r
-               This->Mode->Info,\r
-               Private->FrameBufferBltConfigure,\r
-               &Private->FrameBufferBltConfigureSize\r
-               );\r
-    ASSERT (Status == RETURN_BUFFER_TOO_SMALL);\r
+  Status = FrameBufferBltConfigure (\r
+             (VOID*) (UINTN) This->Mode->FrameBufferBase,\r
+             This->Mode->Info,\r
+             Private->FrameBufferBltConfigure,\r
+             &Private->FrameBufferBltConfigureSize\r
+             );\r
+  if (Status == RETURN_BUFFER_TOO_SMALL) {\r
+    //\r
+    // Frame buffer configure may be larger in new mode.\r
+    //\r
+    if (Private->FrameBufferBltConfigure != NULL) {\r
+      FreePool (Private->FrameBufferBltConfigure);\r
+    }\r
     Private->FrameBufferBltConfigure =\r
       AllocatePool (Private->FrameBufferBltConfigureSize);\r
-  }\r
+    ASSERT (Private->FrameBufferBltConfigure != NULL);\r
 \r
-  //\r
-  // Create the configuration for FrameBufferBltLib\r
-  //\r
-  ASSERT (Private->FrameBufferBltConfigure != NULL);\r
-  Status = FrameBufferBltConfigure (\r
-              (VOID*) (UINTN) This->Mode->FrameBufferBase,\r
-              This->Mode->Info,\r
-              Private->FrameBufferBltConfigure,\r
-              &Private->FrameBufferBltConfigureSize\r
-              );\r
+    //\r
+    // Create the configuration for FrameBufferBltLib\r
+    //\r
+    Status = FrameBufferBltConfigure (\r
+                (VOID*) (UINTN) This->Mode->FrameBufferBase,\r
+                This->Mode->Info,\r
+                Private->FrameBufferBltConfigure,\r
+                &Private->FrameBufferBltConfigureSize\r
+                );\r
+  }\r
   ASSERT (Status == RETURN_SUCCESS);\r
 \r
   return EFI_SUCCESS;\r