public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Kinney, Michael D" <michael.d.kinney@intel.com>
To: edk2-devel@lists.01.org
Cc: Sean Brogan <sean.brogan@microsoft.com>,
	Bret Barkelew <Bret.Barkelew@microsoft.com>,
	Jiewen Yao <jiewen.yao@intel.com>,
	Star Zeng <star.zeng@intel.com>, Eric Dong <eric.dong@intel.com>,
	Michael D Kinney <michael.d.kinney@intel.com>
Subject: [Patch v2 3/3] MdeModulePkg/BootLogoLib: Use Boot Logo 2 Protocol
Date: Thu, 15 Feb 2018 14:52:05 -0800	[thread overview]
Message-ID: <20180215225205.16856-4-michael.d.kinney@intel.com> (raw)
In-Reply-To: <20180215225205.16856-1-michael.d.kinney@intel.com>

https://bugzilla.tianocore.org/show_bug.cgi?id=799

Based on content from the following branch/commit:
https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport
https://github.com/Microsoft/MS_UEFI/commit/33bab4031a417d7d5a7d356c15a14c2e60302b2d

Add check to see if the Boot Logo 2 Protocol is available
and attempt to set the location and size of the boot logo
using both the Boot Logo Protocol and the Boot Logo 2
Protocol.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
---
 MdeModulePkg/Library/BootLogoLib/BootLogoLib.c   | 32 ++++++++++++++++++++++--
 MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf |  2 ++
 2 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Library/BootLogoLib/BootLogoLib.c b/MdeModulePkg/Library/BootLogoLib/BootLogoLib.c
index 8bd9985cb2..659f29ec66 100644
--- a/MdeModulePkg/Library/BootLogoLib/BootLogoLib.c
+++ b/MdeModulePkg/Library/BootLogoLib/BootLogoLib.c
@@ -3,6 +3,7 @@
   to show progress bar and LOGO.
 
 Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2016, Microsoft Corporation<BR>
 This program and the accompanying materials are licensed and made available under
 the terms and conditions of the BSD License that accompanies this distribution.
 The full text of the license may be found at
@@ -19,6 +20,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Protocol/PlatformLogo.h>
 #include <Protocol/UgaDraw.h>
 #include <Protocol/BootLogo.h>
+#include <Protocol/BootLogo2.h>
 #include <Library/BaseLib.h>
 #include <Library/UefiLib.h>
 #include <Library/BaseMemoryLib.h>
@@ -56,6 +58,7 @@ BootLogoEnableLogo (
   UINT32                                RefreshRate;
   EFI_GRAPHICS_OUTPUT_PROTOCOL          *GraphicsOutput;
   EFI_BOOT_LOGO_PROTOCOL                *BootLogo;
+  EDKII_BOOT_LOGO2_PROTOCOL             *BootLogo2;
   UINTN                                 NumberOfLogos;
   EFI_GRAPHICS_OUTPUT_BLT_PIXEL         *LogoBlt;
   UINTN                                 LogoDestX;
@@ -98,6 +101,14 @@ BootLogoEnableLogo (
     BootLogo = NULL;
   }
 
+  //
+  // Try to open Boot Logo 2 Protocol.
+  //
+  Status = gBS->LocateProtocol (&gEdkiiBootLogo2ProtocolGuid, NULL, (VOID **) &BootLogo2);
+  if (EFI_ERROR (Status)) {
+    BootLogo2 = NULL;
+  }
+
   //
   // Erase Cursor from screen
   //
@@ -259,7 +270,7 @@ BootLogoEnableLogo (
     }
   }
 
-  if (BootLogo == NULL || NumberOfLogos == 0) {
+  if ((BootLogo == NULL && BootLogo2 == NULL) || NumberOfLogos == 0) {
     //
     // No logo displayed.
     //
@@ -330,7 +341,24 @@ BootLogoEnableLogo (
   }
 
   if (!EFI_ERROR (Status)) {
-    BootLogo->SetBootLogo (BootLogo, LogoBlt, LogoDestX, LogoDestY, LogoWidth, LogoHeight);
+    //
+    // Attempt to register logo with Boot Logo 2 Protocol first
+    //
+    if (BootLogo2 != NULL) {
+      Status = BootLogo2->SetBootLogo (BootLogo2, LogoBlt, LogoDestX, LogoDestY, LogoWidth, LogoHeight);
+    }
+    //
+    // If Boot Logo 2 Protocol is not available or registration with Boot Logo 2
+    // Protocol failed, then attempt to register logo with Boot Logo Protocol
+    //
+    if (EFI_ERROR (Status) && BootLogo != NULL) {
+      Status = BootLogo->SetBootLogo (BootLogo, LogoBlt, LogoDestX, LogoDestY, LogoWidth, LogoHeight);
+    }
+    //
+    // Status of this functionm is EFI_SUCCESS even if registration with Boot
+    // Logo 2 Protocol or Boot Logo Protocol fails.
+    //
+    Status = EFI_SUCCESS;
   }
   FreePool (LogoBlt);
 
diff --git a/MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf b/MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
index 79b5fc511a..47969cc05a 100644
--- a/MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
+++ b/MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
@@ -3,6 +3,7 @@
 #  to show progress bar and logo.
 #  
 #  Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2016, Microsoft Corporation<BR>
 #  This program and the accompanying materials are licensed and made available under
 #  the terms and conditions of the BSD License that accompanies this distribution.
 #  The full text of the license may be found at
@@ -49,6 +50,7 @@ [Protocols]
   gEfiGraphicsOutputProtocolGuid                ## SOMETIMES_CONSUMES
   gEfiUgaDrawProtocolGuid |PcdUgaConsumeSupport ## SOMETIMES_CONSUMES
   gEfiBootLogoProtocolGuid                      ## SOMETIMES_CONSUMES  
+  gEdkiiBootLogo2ProtocolGuid                   ## SOMETIMES_CONSUMES
   gEfiUserManagerProtocolGuid                   ## CONSUMES
   gEdkiiPlatformLogoProtocolGuid                ## CONSUMES
 
-- 
2.14.2.windows.3



  parent reply	other threads:[~2018-02-15 22:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-15 22:52 [Patch v2 0/3] MdeModulePkg: Add Boot Logo 2 Protocol Kinney, Michael D
2018-02-15 22:52 ` [Patch v2 1/3] " Kinney, Michael D
2018-02-15 22:52 ` [Patch v2 2/3] MdeModulePkg/BootGraphicsResourceDxe: " Kinney, Michael D
2018-02-15 22:52 ` Kinney, Michael D [this message]
2018-02-23  3:24 ` [Patch v2 0/3] MdeModulePkg: " Zeng, Star
2018-02-27 19:16 ` Sean Brogan

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=20180215225205.16856-4-michael.d.kinney@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