summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/QemuVideoDxe
diff options
context:
space:
mode:
authorRuiyu Ni <ruiyu.ni@intel.com>2017-01-23 14:07:42 +0800
committerRuiyu Ni <ruiyu.ni@intel.com>2017-01-24 15:06:39 +0800
commit6a12538657f885ac9249dfb942d16ec89df2244a (patch)
treee815e9c7b555846f828b8d8b53337d2b21307483 /OvmfPkg/QemuVideoDxe
parent1d71d0c777a2d1fe0bba7ed6d0a25b7b4c777dca (diff)
downloadedk2-6a12538657f885ac9249dfb942d16ec89df2244a.tar.gz
edk2-6a12538657f885ac9249dfb942d16ec89df2244a.tar.bz2
edk2-6a12538657f885ac9249dfb942d16ec89df2244a.zip
OvmfPkg/QemuVideoDxe: Frame buffer config size may change in new mode
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>
Diffstat (limited to 'OvmfPkg/QemuVideoDxe')
-rw-r--r--OvmfPkg/QemuVideoDxe/Gop.c47
1 files changed, 26 insertions, 21 deletions
diff --git a/OvmfPkg/QemuVideoDxe/Gop.c b/OvmfPkg/QemuVideoDxe/Gop.c
index 5485ba3c28..359e9217d3 100644
--- a/OvmfPkg/QemuVideoDxe/Gop.c
+++ b/OvmfPkg/QemuVideoDxe/Gop.c
@@ -1,7 +1,7 @@
/** @file
Graphics Output Protocol functions for the QEMU video controller.
- Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -189,30 +189,35 @@ Routine Description:
QemuVideoCompleteModeData (Private, This->Mode);
//
- // Allocate when using first time.
+ // Re-initialize the frame buffer configure when mode changes.
//
- if (Private->FrameBufferBltConfigure == NULL) {
- Status = FrameBufferBltConfigure (
- (VOID*) (UINTN) This->Mode->FrameBufferBase,
- This->Mode->Info,
- Private->FrameBufferBltConfigure,
- &Private->FrameBufferBltConfigureSize
- );
- ASSERT (Status == RETURN_BUFFER_TOO_SMALL);
+ Status = FrameBufferBltConfigure (
+ (VOID*) (UINTN) This->Mode->FrameBufferBase,
+ This->Mode->Info,
+ Private->FrameBufferBltConfigure,
+ &Private->FrameBufferBltConfigureSize
+ );
+ if (Status == RETURN_BUFFER_TOO_SMALL) {
+ //
+ // Frame buffer configure may be larger in new mode.
+ //
+ if (Private->FrameBufferBltConfigure != NULL) {
+ FreePool (Private->FrameBufferBltConfigure);
+ }
Private->FrameBufferBltConfigure =
AllocatePool (Private->FrameBufferBltConfigureSize);
- }
+ ASSERT (Private->FrameBufferBltConfigure != NULL);
- //
- // Create the configuration for FrameBufferBltLib
- //
- ASSERT (Private->FrameBufferBltConfigure != NULL);
- Status = FrameBufferBltConfigure (
- (VOID*) (UINTN) This->Mode->FrameBufferBase,
- This->Mode->Info,
- Private->FrameBufferBltConfigure,
- &Private->FrameBufferBltConfigureSize
- );
+ //
+ // Create the configuration for FrameBufferBltLib
+ //
+ Status = FrameBufferBltConfigure (
+ (VOID*) (UINTN) This->Mode->FrameBufferBase,
+ This->Mode->Info,
+ Private->FrameBufferBltConfigure,
+ &Private->FrameBufferBltConfigureSize
+ );
+ }
ASSERT (Status == RETURN_SUCCESS);
return EFI_SUCCESS;