Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <[email protected]>
Cc: Laszlo Ersek <[email protected]>
Cc: Jordan Justen <[email protected]>
---
 OvmfPkg/OvmfPkgIa32X64.dsc            |  6 ++----
 OvmfPkg/QemuVideoDxe/Gop.c            | 38 +++++++++++++++++++++++++++--------
 OvmfPkg/QemuVideoDxe/Qemu.h           |  4 +++-
 OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf |  5 +++--
 4 files changed, 38 insertions(+), 15 deletions(-)

diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 854cf6d..0fb4e20 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -120,6 +120,7 @@ [LibraryClasses]
   LockBoxLib|OvmfPkg/Library/LockBoxLib/LockBoxBaseLib.inf
 !endif
   
CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
+  
FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf
 
 !ifdef $(SOURCE_DEBUG_ENABLE)
   
PeCoffExtraActionLib|SourceLevelDebugPkg/Library/PeCoffExtraActionLibDebug/PeCoffExtraActionLibDebug.inf
@@ -631,10 +632,7 @@ [Components.X64]
   MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
   MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf
 
-  OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf {
-    <LibraryClasses>
-      BltLib|OptionRomPkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf
-  }
+  OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf
 
   #
   # ISA Support
diff --git a/OvmfPkg/QemuVideoDxe/Gop.c b/OvmfPkg/QemuVideoDxe/Gop.c
index 18d0779..012c3e7 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 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2007 - 2016, 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
@@ -15,7 +15,7 @@
 
 #include "Qemu.h"
 #include <IndustryStandard/Acpi.h>
-#include <Library/BltLib.h>
+#include <Library/FrameBufferBltLib.h>
 
 STATIC
 VOID
@@ -159,7 +159,7 @@ Routine Description:
 {
   QEMU_VIDEO_PRIVATE_DATA    *Private;
   QEMU_VIDEO_MODE_DATA       *ModeData;
-//  UINTN                             Count;
+  RETURN_STATUS              Status;
 
   Private = QEMU_VIDEO_PRIVATE_DATA_FROM_GRAPHICS_OUTPUT_THIS (This);
 
@@ -201,10 +201,23 @@ Routine Description:
 
   QemuVideoCompleteModeData (Private, This->Mode);
 
-  BltLibConfigure (
-    (VOID*)(UINTN) This->Mode->FrameBufferBase,
-    This->Mode->Info
-    );
+  Status = FrameBufferBltConfigure (
+             (VOID*) (UINTN) This->Mode->FrameBufferBase,
+             This->Mode->Info,
+             Private->Configure,
+             &Private->ConfigureSize
+             );
+  if (Status == RETURN_BUFFER_TOO_SMALL) {
+    Private->Configure = AllocatePool (Private->ConfigureSize);
+    ASSERT (Private->Configure != NULL);
+    Status = FrameBufferBltConfigure (
+               (VOID*) (UINTN) This->Mode->FrameBufferBase,
+               This->Mode->Info,
+               Private->Configure,
+               &Private->ConfigureSize
+               );
+  }
+  ASSERT (Status == RETURN_SUCCESS);
 
   return EFI_SUCCESS;
 }
@@ -254,7 +267,9 @@ Returns:
 {
   EFI_STATUS                      Status;
   EFI_TPL                         OriginalTPL;
+  QEMU_VIDEO_PRIVATE_DATA         *Private;
 
+  Private = QEMU_VIDEO_PRIVATE_DATA_FROM_GRAPHICS_OUTPUT_THIS (This);
   //
   // We have to raise to TPL Notify, so we make an atomic write the frame 
buffer.
   // We would not want a timer based event (Cursor, ...) to come in while we 
are
@@ -267,7 +282,8 @@ Returns:
   case EfiBltBufferToVideo:
   case EfiBltVideoFill:
   case EfiBltVideoToVideo:
-    Status = BltLibGopBlt (
+    Status = FrameBufferBlt (
+      Private->Configure,
       BltBuffer,
       BltOperation,
       SourceX,
@@ -327,6 +343,8 @@ QemuVideoGraphicsOutputConstructor (
   Private->GraphicsOutput.Mode->MaxMode = (UINT32) Private->MaxMode;
   Private->GraphicsOutput.Mode->Mode    = GRAPHICS_OUTPUT_INVALIDE_MODE_NUMBER;
   Private->LineBuffer                   = NULL;
+  Private->Configure                    = NULL;
+  Private->ConfigureSize                = 0;
 
   //
   // Initialize the hardware
@@ -374,6 +392,10 @@ Returns:
     FreePool (Private->LineBuffer);
   }
 
+  if (Private->Configure != NULL) {
+    FreePool (Private->Configure);
+  }
+
   if (Private->GraphicsOutput.Mode != NULL) {
     if (Private->GraphicsOutput.Mode->Info != NULL) {
       gBS->FreePool (Private->GraphicsOutput.Mode->Info);
diff --git a/OvmfPkg/QemuVideoDxe/Qemu.h b/OvmfPkg/QemuVideoDxe/Qemu.h
index 52ee20d..de3aed8 100644
--- a/OvmfPkg/QemuVideoDxe/Qemu.h
+++ b/OvmfPkg/QemuVideoDxe/Qemu.h
@@ -1,7 +1,7 @@
 /** @file
   QEMU Video Controller Driver
 
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2016, 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
   which accompanies this distribution.  The full text of the license may be 
found at
@@ -119,6 +119,8 @@ typedef struct {
 
   UINT8                                 *LineBuffer;
   QEMU_VIDEO_VARIANT                    Variant;
+  VOID                                  *Configure;
+  UINTN                                 ConfigureSize;
 } QEMU_VIDEO_PRIVATE_DATA;
 
 ///
diff --git a/OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf 
b/OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf
index ce1ff93..affb6ff 100644
--- a/OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf
+++ b/OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf
@@ -2,7 +2,7 @@
 #  This driver is a sample implementation of the Graphics Output Protocol for
 #  the QEMU (Cirrus Logic 5446) video controller.
 #
-#  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2006 - 2016, 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
@@ -44,12 +44,13 @@ [Sources.Ia32, Sources.X64]
 
 [Packages]
   MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
   OptionRomPkg/OptionRomPkg.dec
   OvmfPkg/OvmfPkg.dec
 
 [LibraryClasses]
   BaseMemoryLib
-  BltLib
+  FrameBufferBltLib
   DebugLib
   DevicePathLib
   MemoryAllocationLib
-- 
2.8.3.windows.1

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to