public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ruiyu Ni <ruiyu.ni@intel.com>
To: edk2-devel@lists.01.org
Cc: Laszlo Ersek <lersek@redhat.com>,
	Jordan Justen <jordan.l.justen@intel.com>
Subject: [PATCH v4 6/8] OvmfPkg: QemuVideoDxe uses MdeModulePkg/FrameBufferLib
Date: Tue, 11 Oct 2016 13:50:46 +0800	[thread overview]
Message-ID: <20161011055048.217588-7-ruiyu.ni@intel.com> (raw)
In-Reply-To: <20161011055048.217588-1-ruiyu.ni@intel.com>

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
---
 OvmfPkg/QemuVideoDxe/Gop.c            | 47 ++++++++++++++++++++++++++++-------
 OvmfPkg/QemuVideoDxe/Qemu.h           |  6 ++++-
 OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf |  5 ++--
 3 files changed, 46 insertions(+), 12 deletions(-)

diff --git a/OvmfPkg/QemuVideoDxe/Gop.c b/OvmfPkg/QemuVideoDxe/Gop.c
index 18d0779..532f20e 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
@@ -14,8 +14,6 @@
 **/
 
 #include "Qemu.h"
-#include <IndustryStandard/Acpi.h>
-#include <Library/BltLib.h>
 
 STATIC
 VOID
@@ -159,7 +157,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 +199,32 @@ Routine Description:
 
   QemuVideoCompleteModeData (Private, This->Mode);
 
-  BltLibConfigure (
-    (VOID*)(UINTN) This->Mode->FrameBufferBase,
-    This->Mode->Info
-    );
+  //
+  // Allocate when using first time.
+  //
+  if (Private->FrameBufferBltConfigure == NULL) {
+    Status = FrameBufferBltConfigure (
+               (VOID*) (UINTN) This->Mode->FrameBufferBase,
+               This->Mode->Info,
+               Private->FrameBufferBltConfigure,
+               &Private->FrameBufferBltConfigureSize
+               );
+    ASSERT (Status == RETURN_BUFFER_TOO_SMALL);
+    Private->FrameBufferBltConfigure =
+      AllocatePool (Private->FrameBufferBltConfigureSize);
+  }
+
+  //
+  // Create the configuration for FrameBufferBltLib
+  //
+  ASSERT (Private->FrameBufferBltConfigure != NULL);
+  Status = FrameBufferBltConfigure (
+              (VOID*) (UINTN) This->Mode->FrameBufferBase,
+              This->Mode->Info,
+              Private->FrameBufferBltConfigure,
+              &Private->FrameBufferBltConfigureSize
+              );
+  ASSERT (Status == RETURN_SUCCESS);
 
   return EFI_SUCCESS;
 }
@@ -254,7 +274,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 +289,8 @@ Returns:
   case EfiBltBufferToVideo:
   case EfiBltVideoFill:
   case EfiBltVideoToVideo:
-    Status = BltLibGopBlt (
+    Status = FrameBufferBlt (
+      Private->FrameBufferBltConfigure,
       BltBuffer,
       BltOperation,
       SourceX,
@@ -327,6 +350,8 @@ QemuVideoGraphicsOutputConstructor (
   Private->GraphicsOutput.Mode->MaxMode = (UINT32) Private->MaxMode;
   Private->GraphicsOutput.Mode->Mode    = GRAPHICS_OUTPUT_INVALIDE_MODE_NUMBER;
   Private->LineBuffer                   = NULL;
+  Private->FrameBufferBltConfigure      = NULL;
+  Private->FrameBufferBltConfigureSize  = 0;
 
   //
   // Initialize the hardware
@@ -374,6 +399,10 @@ Returns:
     FreePool (Private->LineBuffer);
   }
 
+  if (Private->FrameBufferBltConfigure != NULL) {
+    FreePool (Private->FrameBufferBltConfigure);
+  }
+
   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..5844bc4 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
@@ -35,8 +35,10 @@
 #include <Library/BaseMemoryLib.h>
 #include <Library/DevicePathLib.h>
 #include <Library/TimerLib.h>
+#include <Library/FrameBufferBltLib.h>
 
 #include <IndustryStandard/Pci.h>
+#include <IndustryStandard/Acpi.h>
 
 //
 // QEMU Video PCI Configuration Header values
@@ -119,6 +121,8 @@ typedef struct {
 
   UINT8                                 *LineBuffer;
   QEMU_VIDEO_VARIANT                    Variant;
+  FRAME_BUFFER_CONFIGURE                *FrameBufferBltConfigure;
+  UINTN                                 FrameBufferBltConfigureSize;
 } 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.9.0.windows.1



  parent reply	other threads:[~2016-10-11  5:50 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-11  5:50 [PATCH v4 0/8] Add FrameBufferBltLib and GraphicsOutputDxe Ruiyu Ni
2016-10-11  5:50 ` [PATCH v4 1/8] MdeModulePkg: Add FrameBufferBltLib library class Ruiyu Ni
2016-10-11  5:50 ` [PATCH v4 2/8] MdeModulePkg: Add FrameBufferBltLib library instance Ruiyu Ni
2016-10-11 14:13   ` Laszlo Ersek
2016-10-11 14:51   ` Laszlo Ersek
2016-10-11  5:50 ` [PATCH v4 3/8] MdeModulePkg: Add GraphicsOutputDxe driver Ruiyu Ni
2016-10-11  5:50 ` [PATCH v4 4/8] OvmfPkg: Include MdeModulePkg/FrameBufferLib in OvmfPkg Ruiyu Ni
2016-10-11 14:23   ` Laszlo Ersek
2016-10-11  5:50 ` [PATCH v4 5/8] ArmVirtPkg: Include MdeModulePkg/FrameBufferLib in ArmVirtPkg Ruiyu Ni
2016-10-11 14:25   ` Laszlo Ersek
2016-10-11  5:50 ` Ruiyu Ni [this message]
2016-10-11 14:29   ` [PATCH v4 6/8] OvmfPkg: QemuVideoDxe uses MdeModulePkg/FrameBufferLib Laszlo Ersek
2016-10-11  5:50 ` [PATCH v4 7/8] OvmfPkg: Remove unused BltLib reference Ruiyu Ni
2016-10-11 14:31   ` Laszlo Ersek
2016-10-11  5:50 ` [PATCH v4 8/8] ArmVirtPkg: " Ruiyu Ni
2016-10-11 14:32   ` Laszlo Ersek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161011055048.217588-7-ruiyu.ni@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox