From a637802c2f8765549cf41a5694f53860b24601c9 Mon Sep 17 00:00:00 2001 From: xdu2 Date: Fri, 4 Nov 2011 08:28:09 +0000 Subject: IntelFrameworkModulePkg: Update GenericBdsLib to use BootLogo protocol to report logo information after logo is drawn to screen; update BdsDxe to notify logo is corrupted when user is going to enter setup. Signed-off-by: xdu2 Reviewed-by: mdkinney Reviewed-by: lgao4 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12664 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Library/GenericBdsLib/BdsConsole.c | 138 ++++++++++++++++++++- .../Library/GenericBdsLib/Bmp.h | 48 ------- .../Library/GenericBdsLib/GenericBdsLib.inf | 2 +- IntelFrameworkModulePkg/Universal/BdsDxe/Bds.h | 1 + .../Universal/BdsDxe/BdsDxe.inf | 1 + .../Universal/BdsDxe/FrontPage.c | 9 ++ 6 files changed, 145 insertions(+), 54 deletions(-) delete mode 100644 IntelFrameworkModulePkg/Library/GenericBdsLib/Bmp.h (limited to 'IntelFrameworkModulePkg') diff --git a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c index f86cadf25b..f29c624223 100644 --- a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c +++ b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c @@ -13,7 +13,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #include "InternalBdsLib.h" -#include "Bmp.h" +#include + +#include /** Check if we need to save the EFI variable with "ConVarName" as name @@ -786,6 +788,17 @@ EnableQuietBoot ( UINT32 ColorDepth; UINT32 RefreshRate; EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput; + EFI_BOOT_LOGO_PROTOCOL *BootLogo; + UINTN NumberOfLogos; + EFI_GRAPHICS_OUTPUT_BLT_PIXEL *LogoBlt; + UINTN LogoDestX; + UINTN LogoDestY; + UINTN LogoHeight; + UINTN LogoWidth; + UINTN NewDestX; + UINTN NewDestY; + UINTN NewHeight; + UINTN NewWidth; UgaDraw = NULL; // @@ -803,6 +816,12 @@ EnableQuietBoot ( return EFI_UNSUPPORTED; } + // + // Try to open Boot Logo Protocol. + // + BootLogo = NULL; + gBS->LocateProtocol (&gEfiBootLogoProtocolGuid, NULL, (VOID **) &BootLogo); + // // Erase Cursor from screen // @@ -824,6 +843,16 @@ EnableQuietBoot ( return EFI_UNSUPPORTED; } + Blt = NULL; + NumberOfLogos = 0; + LogoDestX = 0; + LogoDestY = 0; + LogoHeight = 0; + LogoWidth = 0; + NewDestX = 0; + NewDestY = 0; + NewHeight = 0; + NewWidth = 0; Instance = 0; while (1) { ImageData = NULL; @@ -844,7 +873,7 @@ EnableQuietBoot ( &CoordinateY ); if (EFI_ERROR (Status)) { - return Status; + goto Done; } // @@ -870,6 +899,9 @@ EnableQuietBoot ( Attribute = EfiBadgingDisplayAttributeCenter; } + if (Blt != NULL) { + FreePool (Blt); + } Blt = NULL; Status = ConvertBmpToGopBlt ( ImageData, @@ -972,21 +1004,117 @@ EnableQuietBoot ( Width * sizeof (EFI_UGA_PIXEL) ); } else { - Status = EFI_UNSUPPORTED; + Status = EFI_UNSUPPORTED; + } + + // + // Report displayed Logo information. + // + if (!EFI_ERROR (Status)) { + NumberOfLogos++; + + if (LogoWidth == 0) { + // + // The first Logo. + // + LogoDestX = DestX; + LogoDestY = DestY; + LogoWidth = Width; + LogoHeight = Height; + } else { + // + // Merge new logo with old one. + // + NewDestX = MIN ((UINTN) DestX, LogoDestX); + NewDestY = MIN ((UINTN) DestY, LogoDestY); + NewWidth = MAX ((UINTN) DestX + Width, LogoDestX + LogoWidth) - NewDestX; + NewHeight = MAX ((UINTN) DestY + Height, LogoDestY + LogoHeight) - NewDestY; + + LogoDestX = NewDestX; + LogoDestY = NewDestY; + LogoWidth = NewWidth; + LogoHeight = NewHeight; + } } } FreePool (ImageData); + if (Badging == NULL) { + break; + } + } + +Done: + if (BootLogo == NULL || NumberOfLogos == 0) { + // + // No logo displayed. + // if (Blt != NULL) { FreePool (Blt); } - if (Badging == NULL) { - break; + return Status; + } + + // + // Advertise displayed Logo information. + // + if (NumberOfLogos == 1) { + // + // Only one logo displayed, use its Blt buffer directly for BootLogo protocol. + // + LogoBlt = Blt; + Status = EFI_SUCCESS; + } else { + // + // More than one Logo displayed, get merged BltBuffer using VideoToBuffer operation. + // + if (Blt != NULL) { + FreePool (Blt); + } + + LogoBlt = AllocateZeroPool (LogoWidth * LogoHeight * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)); + if (LogoBlt == NULL) { + return EFI_OUT_OF_RESOURCES; + } + + if (GraphicsOutput != NULL) { + Status = GraphicsOutput->Blt ( + GraphicsOutput, + LogoBlt, + EfiBltVideoToBltBuffer, + LogoDestX, + LogoDestY, + 0, + 0, + LogoWidth, + LogoHeight, + LogoWidth * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) + ); + } else if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) { + Status = UgaDraw->Blt ( + UgaDraw, + (EFI_UGA_PIXEL *) LogoBlt, + EfiUgaVideoToBltBuffer, + LogoDestX, + LogoDestY, + 0, + 0, + LogoWidth, + LogoHeight, + LogoWidth * sizeof (EFI_UGA_PIXEL) + ); + } else { + Status = EFI_UNSUPPORTED; } } + if (!EFI_ERROR (Status)) { + BootLogo->SetBootLogo (BootLogo, LogoBlt, LogoDestX, LogoDestY, LogoWidth, LogoHeight); + } + FreePool (LogoBlt); + return Status; } diff --git a/IntelFrameworkModulePkg/Library/GenericBdsLib/Bmp.h b/IntelFrameworkModulePkg/Library/GenericBdsLib/Bmp.h deleted file mode 100644 index d2b75b28fe..0000000000 --- a/IntelFrameworkModulePkg/Library/GenericBdsLib/Bmp.h +++ /dev/null @@ -1,48 +0,0 @@ -/** @file - This file defines BMP file header data structures. - -Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-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 -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _GENERIC_BDS_BMP_H__ -#define _GENERIC_BDS_BMP_H__ - -#pragma pack(1) - -typedef struct { - UINT8 Blue; - UINT8 Green; - UINT8 Red; - UINT8 Reserved; -} BMP_COLOR_MAP; - -typedef struct { - CHAR8 CharB; - CHAR8 CharM; - UINT32 Size; - UINT16 Reserved[2]; - UINT32 ImageOffset; - UINT32 HeaderSize; - UINT32 PixelWidth; - UINT32 PixelHeight; - UINT16 Planes; ///< Must be 1 - UINT16 BitPerPixel; ///< 1, 4, 8, or 24 - UINT32 CompressionType; - UINT32 ImageSize; ///< Compressed image size in bytes - UINT32 XPixelsPerMeter; - UINT32 YPixelsPerMeter; - UINT32 NumberOfColors; - UINT32 ImportantColors; -} BMP_IMAGE_HEADER; - -#pragma pack() - -#endif diff --git a/IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf b/IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf index 3557444b93..5d3aa5fb6c 100644 --- a/IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf +++ b/IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf @@ -39,7 +39,6 @@ BdsConsole.c BdsBoot.c InternalBdsLib.h - Bmp.h String.h String.c GenericBdsStrings.uni @@ -115,6 +114,7 @@ gEfiHiiFontProtocolGuid # PROTOCOL CONSUMES gEfiUserManagerProtocolGuid # PROTOCOL CONSUMES gEfiUsbIoProtocolGuid # PROTOCOL SOMETIMES_CONSUMES + gEfiBootLogoProtocolGuid # PROTOCOL SOMETIMES_CONSUMES [FeaturePcd] gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/Bds.h b/IntelFrameworkModulePkg/Universal/BdsDxe/Bds.h index 1f2d64d2cf..008d13e41b 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/Bds.h +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/Bds.h @@ -45,6 +45,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include +#include #include #include diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf b/IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf index 916d2af454..bb9775343f 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf @@ -159,6 +159,7 @@ gEfiDevicePathProtocolGuid ## PROTOCOL CONSUMES gEfiDriverHealthProtocolGuid ## PROTOCOL SOMETIMES_CONSUMES gEfiPciIoProtocolGuid ## PROTOCOL CONSUMES + gEfiBootLogoProtocolGuid ## PROTOCOL SOMETIMES_CONSUMES [FeaturePcd] gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLangDeprecate diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c index 63c14964bf..4cd0691b91 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c @@ -958,6 +958,7 @@ PlatformBdsEnterFrontPage ( ) { EFI_STATUS Status; + EFI_BOOT_LOGO_PROTOCOL *BootLogo; PERF_START (NULL, "BdsTimeOut", "BDS", 0); // @@ -986,6 +987,14 @@ PlatformBdsEnterFrontPage ( } } + // + // Boot Logo is corrupted, report it using Boot Logo protocol. + // + Status = gBS->LocateProtocol (&gEfiBootLogoProtocolGuid, NULL, (VOID **) &BootLogo); + if (!EFI_ERROR (Status) && (BootLogo != NULL)) { + BootLogo->SetBootLogo (BootLogo, NULL, 0, 0, 0, 0); + } + do { InitializeFrontPage (FALSE); -- cgit v1.2.3