]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg: QemuVideoDxe uses MdeModulePkg/FrameBufferLib
authorRuiyu Ni <ruiyu.ni@intel.com>
Tue, 11 Oct 2016 05:26:27 +0000 (13:26 +0800)
committerRuiyu Ni <ruiyu.ni@intel.com>
Wed, 12 Oct 2016 02:42:17 +0000 (10:42 +0800)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Laszlo Ersek <lersek at redhat.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
OvmfPkg/QemuVideoDxe/Gop.c
OvmfPkg/QemuVideoDxe/Qemu.h
OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf

index 18d0779896ca494c1765577cfede6ad428710a29..532f20e6446ca383c5acf8fbd8ca4966cd2734fe 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Graphics Output Protocol functions for the QEMU video controller.\r
 \r
-  Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2007 - 2016, 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
@@ -14,8 +14,6 @@
 **/\r
 \r
 #include "Qemu.h"\r
-#include <IndustryStandard/Acpi.h>\r
-#include <Library/BltLib.h>\r
 \r
 STATIC\r
 VOID\r
@@ -159,7 +157,7 @@ Routine Description:
 {\r
   QEMU_VIDEO_PRIVATE_DATA    *Private;\r
   QEMU_VIDEO_MODE_DATA       *ModeData;\r
-//  UINTN                             Count;\r
+  RETURN_STATUS              Status;\r
 \r
   Private = QEMU_VIDEO_PRIVATE_DATA_FROM_GRAPHICS_OUTPUT_THIS (This);\r
 \r
@@ -201,10 +199,32 @@ Routine Description:
 \r
   QemuVideoCompleteModeData (Private, This->Mode);\r
 \r
-  BltLibConfigure (\r
-    (VOID*)(UINTN) This->Mode->FrameBufferBase,\r
-    This->Mode->Info\r
-    );\r
+  //\r
+  // Allocate when using first time.\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
+    Private->FrameBufferBltConfigure =\r
+      AllocatePool (Private->FrameBufferBltConfigureSize);\r
+  }\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
+  ASSERT (Status == RETURN_SUCCESS);\r
 \r
   return EFI_SUCCESS;\r
 }\r
@@ -254,7 +274,9 @@ Returns:
 {\r
   EFI_STATUS                      Status;\r
   EFI_TPL                         OriginalTPL;\r
+  QEMU_VIDEO_PRIVATE_DATA         *Private;\r
 \r
+  Private = QEMU_VIDEO_PRIVATE_DATA_FROM_GRAPHICS_OUTPUT_THIS (This);\r
   //\r
   // We have to raise to TPL Notify, so we make an atomic write the frame buffer.\r
   // We would not want a timer based event (Cursor, ...) to come in while we are\r
@@ -267,7 +289,8 @@ Returns:
   case EfiBltBufferToVideo:\r
   case EfiBltVideoFill:\r
   case EfiBltVideoToVideo:\r
-    Status = BltLibGopBlt (\r
+    Status = FrameBufferBlt (\r
+      Private->FrameBufferBltConfigure,\r
       BltBuffer,\r
       BltOperation,\r
       SourceX,\r
@@ -327,6 +350,8 @@ QemuVideoGraphicsOutputConstructor (
   Private->GraphicsOutput.Mode->MaxMode = (UINT32) Private->MaxMode;\r
   Private->GraphicsOutput.Mode->Mode    = GRAPHICS_OUTPUT_INVALIDE_MODE_NUMBER;\r
   Private->LineBuffer                   = NULL;\r
+  Private->FrameBufferBltConfigure      = NULL;\r
+  Private->FrameBufferBltConfigureSize  = 0;\r
 \r
   //\r
   // Initialize the hardware\r
@@ -374,6 +399,10 @@ Returns:
     FreePool (Private->LineBuffer);\r
   }\r
 \r
+  if (Private->FrameBufferBltConfigure != NULL) {\r
+    FreePool (Private->FrameBufferBltConfigure);\r
+  }\r
+\r
   if (Private->GraphicsOutput.Mode != NULL) {\r
     if (Private->GraphicsOutput.Mode->Info != NULL) {\r
       gBS->FreePool (Private->GraphicsOutput.Mode->Info);\r
index 52ee20d8ba973deb33f04471d32f6f4ccbf97b6c..5844bc404cef3d6f29744147c98247c99c96fd5c 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   QEMU Video Controller Driver\r
 \r
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
 #include <Library/BaseMemoryLib.h>\r
 #include <Library/DevicePathLib.h>\r
 #include <Library/TimerLib.h>\r
+#include <Library/FrameBufferBltLib.h>\r
 \r
 #include <IndustryStandard/Pci.h>\r
+#include <IndustryStandard/Acpi.h>\r
 \r
 //\r
 // QEMU Video PCI Configuration Header values\r
@@ -119,6 +121,8 @@ typedef struct {
 \r
   UINT8                                 *LineBuffer;\r
   QEMU_VIDEO_VARIANT                    Variant;\r
+  FRAME_BUFFER_CONFIGURE                *FrameBufferBltConfigure;\r
+  UINTN                                 FrameBufferBltConfigureSize;\r
 } QEMU_VIDEO_PRIVATE_DATA;\r
 \r
 ///\r
index ce1ff93d839de8117e78912ecd481098f931ed27..affb6ffd88e0781d99bfd951ca356b7ff8e774f6 100644 (file)
@@ -2,7 +2,7 @@
 #  This driver is a sample implementation of the Graphics Output Protocol for\r
 #  the QEMU (Cirrus Logic 5446) video controller.\r
 #\r
-#  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2006 - 2016, 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
 \r
 [Packages]\r
   MdePkg/MdePkg.dec\r
+  MdeModulePkg/MdeModulePkg.dec\r
   OptionRomPkg/OptionRomPkg.dec\r
   OvmfPkg/OvmfPkg.dec\r
 \r
 [LibraryClasses]\r
   BaseMemoryLib\r
-  BltLib\r
+  FrameBufferBltLib\r
   DebugLib\r
   DevicePathLib\r
   MemoryAllocationLib\r