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: Jordan Justen <jordan.l.justen@intel.com>,
	Laszlo Ersek <lersek@redhat.com>
Subject: [PATCH 3/3] OvmfPkg/QemuVideoDxe: Frame buffer config size may change in new mode
Date: Mon, 23 Jan 2017 14:11:49 +0800	[thread overview]
Message-ID: <20170123061149.279944-4-ruiyu.ni@intel.com> (raw)
In-Reply-To: <20170123061149.279944-1-ruiyu.ni@intel.com>

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>
Cc: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/QemuVideoDxe/Gop.c | 47 +++++++++++++++++++++++++---------------------
 1 file changed, 26 insertions(+), 21 deletions(-)

diff --git a/OvmfPkg/QemuVideoDxe/Gop.c b/OvmfPkg/QemuVideoDxe/Gop.c
index 5485ba3..359e921 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;
-- 
2.9.0.windows.1



  parent reply	other threads:[~2017-01-23  6:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-23  6:11 [PATCH 0/3] MdeModulePkg/FrameBufferBltLib: Use dynamic allocated line buffer Ruiyu Ni
2017-01-23  6:11 ` [PATCH 1/3] MdeModulePkg/FrameBufferBltLib: Refine ConfigurePixelBitMaskFormat Ruiyu Ni
2017-01-23  8:36   ` Tian, Feng
2017-01-23  6:11 ` [PATCH 2/3] MdeModulePkg/FrameBufferBltLib: Use dynamic allocated line buffer Ruiyu Ni
2017-01-23  8:36   ` Tian, Feng
2017-01-23  6:11 ` Ruiyu Ni [this message]
2017-01-23 10:45   ` [PATCH 3/3] OvmfPkg/QemuVideoDxe: Frame buffer config size may change in new mode 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=20170123061149.279944-4-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