From: Ruiyu Ni <ruiyu.ni@intel.com>
To: edk2-devel@lists.01.org
Cc: Liming Gao <liming.gao@intel.com>,
Eric Dong <eric.dong@intel.com>, Dandan Bi <dandan.bi@intel.com>
Subject: [PATCH 11/13] MdeModulePkg/BootLogoLib&PlatformLogo: Use HII data types in parameters
Date: Fri, 23 Sep 2016 16:25:19 +0800 [thread overview]
Message-ID: <20160923082521.99872-12-ruiyu.ni@intel.com> (raw)
In-Reply-To: <20160923082521.99872-1-ruiyu.ni@intel.com>
1. Change PlatformLogo protocol to return EFI_IMAGE_INPUT instead of
RAW image data. PlatformLogo implementation can use HiiImageEx to
decode the image if it's JPEG or PNG format.
2. Change BootLogoLib to consume the new PlatformLogo protocol.
3. Change BootLogoEnableLogo() to only use images returned from
PlatformLogo protocol.
Contributed-under: TianoCore Contribution Agreement 1.0
Cc: Liming Gao <liming.gao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
---
MdeModulePkg/Include/Library/BootLogoLib.h | 19 +--
MdeModulePkg/Include/Protocol/PlatformLogo.h | 18 +-
MdeModulePkg/Library/BootLogoLib/BootLogoLib.c | 204 +++++++++--------------
MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf | 6 +-
4 files changed, 86 insertions(+), 161 deletions(-)
diff --git a/MdeModulePkg/Include/Library/BootLogoLib.h b/MdeModulePkg/Include/Library/BootLogoLib.h
index 55fe4b1..cacdd29 100644
--- a/MdeModulePkg/Include/Library/BootLogoLib.h
+++ b/MdeModulePkg/Include/Library/BootLogoLib.h
@@ -2,7 +2,7 @@
This library is only intended to be used by PlatformBootManagerLib
to show progress bar and LOGO.
-Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2011 - 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 that accompanies this distribution.
The full text of the license may be found at
@@ -20,25 +20,12 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Protocol/GraphicsOutput.h>
/**
- Show LOGO on all consoles.
-
- @param[in] ImageFormat Format of the image file.
- @param[in] LogoFile The file name of logo to display.
- @param[in] Attribute The display attributes of the image returned.
- @param[in] OffsetX The X offset of the image regarding the Attribute.
- @param[in] OffsetY The Y offset of the image regarding the Attribute.
-
- @retval EFI_SUCCESS Logo was displayed.
- @retval EFI_UNSUPPORTED Logo was not found or cannot be displayed.
+ Show LOGO returned from Edkii Platform Logo protocol on all consoles.
**/
EFI_STATUS
EFIAPI
BootLogoEnableLogo (
- IN IMAGE_FORMAT ImageFormat,
- IN EFI_GUID *Logo,
- IN EDKII_PLATFORM_LOGO_DISPLAY_ATTRIBUTE Attribute,
- IN INTN OffsetX,
- IN INTN OffsetY
+ VOID
);
diff --git a/MdeModulePkg/Include/Protocol/PlatformLogo.h b/MdeModulePkg/Include/Protocol/PlatformLogo.h
index 8c1d3ca..bb98c56 100644
--- a/MdeModulePkg/Include/Protocol/PlatformLogo.h
+++ b/MdeModulePkg/Include/Protocol/PlatformLogo.h
@@ -2,7 +2,7 @@
The Platform Logo Protocol defines the interface to get the Platform logo
image with the display attribute.
-Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2015 - 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 that accompanies this distribution.
The full text of the license may be found at
@@ -16,6 +16,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#ifndef __PLATFORM_LOGO_H__
#define __PLATFORM_LOGO_H__
+#include <Protocol/HiiImage.h>
+
//
// GUID for EDKII Platform Logo Protocol
//
@@ -25,14 +27,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
typedef struct _EDKII_PLATFORM_LOGO_PROTOCOL EDKII_PLATFORM_LOGO_PROTOCOL;
typedef enum {
- ImageFormatUnknown,
- ImageFormatBmp,
- ImageFormatJpeg,
- ImageFormatTiff,
- ImageFormatGif
-} IMAGE_FORMAT;
-
-typedef enum {
EdkiiPlatformLogoDisplayAttributeLeftTop,
EdkiiPlatformLogoDisplayAttributeCenterTop,
EdkiiPlatformLogoDisplayAttributeRightTop,
@@ -67,13 +61,11 @@ EFI_STATUS
(EFIAPI *EDKII_PLATFORM_LOGO_GET_IMAGE)(
IN EDKII_PLATFORM_LOGO_PROTOCOL *This,
IN OUT UINT32 *Instance,
- OUT IMAGE_FORMAT *Format,
- OUT UINT8 **ImageData,
- OUT UINTN *ImageSize,
+ OUT EFI_IMAGE_INPUT *Image,
OUT EDKII_PLATFORM_LOGO_DISPLAY_ATTRIBUTE *Attribute,
OUT INTN *OffsetX,
OUT INTN *OffsetY
-);
+ );
struct _EDKII_PLATFORM_LOGO_PROTOCOL {
diff --git a/MdeModulePkg/Library/BootLogoLib/BootLogoLib.c b/MdeModulePkg/Library/BootLogoLib/BootLogoLib.c
index 7cb3bcb..2c1e8ea 100644
--- a/MdeModulePkg/Library/BootLogoLib/BootLogoLib.c
+++ b/MdeModulePkg/Library/BootLogoLib/BootLogoLib.c
@@ -2,7 +2,7 @@
This library is only intended to be used by PlatformBootManagerLib
to show progress bar and LOGO.
-Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2011 - 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 that accompanies this distribution.
The full text of the license may be found at
@@ -13,30 +13,22 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
-#include <PiDxe.h>
+#include <Uefi.h>
+#include <Protocol/GraphicsOutput.h>
#include <Protocol/SimpleTextOut.h>
#include <Protocol/PlatformLogo.h>
-#include <Protocol/GraphicsOutput.h>
#include <Protocol/UgaDraw.h>
#include <Protocol/BootLogo.h>
#include <Library/BaseLib.h>
#include <Library/UefiLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/UefiBootServicesTableLib.h>
-#include <Library/DxeServicesLib.h>
#include <Library/PcdLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/DebugLib.h>
-#include <Library/ImageDecoderLib.h>
/**
- Show LOGO on all consoles.
-
- @param[in] ImageFormat Format of the image file.
- @param[in] LogoFile The file name of logo to display.
- @param[in] Attribute The display attributes of the image returned.
- @param[in] OffsetX The X offset of the image regarding the Attribute.
- @param[in] OffsetY The Y offset of the image regarding the Attribute.
+ Show LOGO returned from Edkii Platform Logo protocol on all consoles.
@retval EFI_SUCCESS Logo was displayed.
@retval EFI_UNSUPPORTED Logo was not found or cannot be displayed.
@@ -44,42 +36,40 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
EFI_STATUS
EFIAPI
BootLogoEnableLogo (
- IN IMAGE_FORMAT ImageFormat,
- IN EFI_GUID *Logo,
- IN EDKII_PLATFORM_LOGO_DISPLAY_ATTRIBUTE Attribute,
- IN INTN OffsetX,
- IN INTN OffsetY
+ VOID
)
{
- EFI_STATUS Status;
- EDKII_PLATFORM_LOGO_PROTOCOL *PlatformLogo;
- UINT32 SizeOfX;
- UINT32 SizeOfY;
- INTN DestX;
- INTN DestY;
- UINT8 *ImageData;
- UINTN ImageSize;
- UINTN BltSize;
- UINT32 Instance;
- UINTN Height;
- UINTN Width;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Blt;
- EFI_UGA_DRAW_PROTOCOL *UgaDraw;
- 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;
- UINTN BufferSize;
+ EFI_STATUS Status;
+ EDKII_PLATFORM_LOGO_PROTOCOL *PlatformLogo;
+ EDKII_PLATFORM_LOGO_DISPLAY_ATTRIBUTE Attribute;
+ INTN OffsetX;
+ INTN OffsetY;
+ UINT32 SizeOfX;
+ UINT32 SizeOfY;
+ INTN DestX;
+ INTN DestY;
+ UINT32 Instance;
+ EFI_IMAGE_INPUT Image;
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Blt;
+ EFI_UGA_DRAW_PROTOCOL *UgaDraw;
+ 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 BufferSize;
+
+ Status = gBS->LocateProtocol (&gEdkiiPlatformLogoProtocolGuid, NULL, (VOID **) &PlatformLogo);
+ if (EFI_ERROR (Status)) {
+ return EFI_UNSUPPORTED;
+ }
UgaDraw = NULL;
//
@@ -100,15 +90,6 @@ BootLogoEnableLogo (
return EFI_UNSUPPORTED;
}
- Status = gBS->LocateProtocol (&gEdkiiPlatformLogoProtocolGuid, NULL, (VOID **) &PlatformLogo);
- if (EFI_ERROR (Status)) {
- PlatformLogo = NULL;
- }
-
- if ((Logo == NULL) && (PlatformLogo == NULL)) {
- return EFI_UNSUPPORTED;
- }
-
//
// Try to open Boot Logo Protocol.
//
@@ -142,59 +123,33 @@ BootLogoEnableLogo (
LogoWidth = 0;
NewDestX = 0;
NewDestY = 0;
- NewHeight = 0;
- NewWidth = 0;
Instance = 0;
DestX = 0;
DestY = 0;
while (TRUE) {
- ImageData = NULL;
- ImageSize = 0;
-
- if (PlatformLogo != NULL) {
- //
- // Get image from OEMBadging protocol.
- //
- Status = PlatformLogo->GetImage (
- PlatformLogo,
- &Instance,
- &ImageFormat,
- &ImageData,
- &ImageSize,
- &Attribute,
- &OffsetX,
- &OffsetY
- );
- if (EFI_ERROR (Status)) {
- break;
- }
+ //
+ // Get image from PlatformLogo protocol.
+ //
+ Status = PlatformLogo->GetImage (
+ PlatformLogo,
+ &Instance,
+ &Image,
+ &Attribute,
+ &OffsetX,
+ &OffsetY
+ );
+ if (EFI_ERROR (Status)) {
+ break;
+ }
- } else {
- //
- // Get the specified image from FV.
- //
- Status = GetSectionFromAnyFv (Logo, EFI_SECTION_RAW, 0, (VOID **) &ImageData, &ImageSize);
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
+ if (EFI_ERROR (Status)) {
+ continue;
}
if (Blt != NULL) {
FreePool (Blt);
}
-
- Status = DecodeImage (ImageFormat, ImageData, ImageSize, &Blt, &BltSize, &Width, &Height);
- FreePool (ImageData);
- if (EFI_ERROR (Status)) {
- if (Logo != NULL) {
- //
- // Directly return failure for single LOGO
- //
- return Status;
- } else {
- continue;
- }
- }
+ Blt = Image.Bitmap;
//
// Calculate the display position according to Attribute.
@@ -205,42 +160,43 @@ BootLogoEnableLogo (
DestY = 0;
break;
case EdkiiPlatformLogoDisplayAttributeCenterTop:
- DestX = (SizeOfX - Width) / 2;
+ DestX = (SizeOfX - Image.Width) / 2;
DestY = 0;
break;
case EdkiiPlatformLogoDisplayAttributeRightTop:
- DestX = SizeOfX - Width;
+ DestX = SizeOfX - Image.Width;
DestY = 0;
break;
case EdkiiPlatformLogoDisplayAttributeCenterLeft:
DestX = 0;
- DestY = (SizeOfY - Height) / 2;
+ DestY = (SizeOfY - Image.Height) / 2;
break;
case EdkiiPlatformLogoDisplayAttributeCenter:
- DestX = (SizeOfX - Width) / 2;
- DestY = (SizeOfY - Height) / 2;
+ DestX = (SizeOfX - Image.Width) / 2;
+ DestY = (SizeOfY - Image.Height) / 2;
break;
case EdkiiPlatformLogoDisplayAttributeCenterRight:
- DestX = SizeOfX - Width;
- DestY = (SizeOfY - Height) / 2;
+ DestX = SizeOfX - Image.Width;
+ DestY = (SizeOfY - Image.Height) / 2;
break;
case EdkiiPlatformLogoDisplayAttributeLeftBottom:
DestX = 0;
- DestY = SizeOfY - Height;
+ DestY = SizeOfY - Image.Height;
break;
case EdkiiPlatformLogoDisplayAttributeCenterBottom:
- DestX = (SizeOfX - Width) / 2;
- DestY = SizeOfY - Height;
+ DestX = (SizeOfX - Image.Width) / 2;
+ DestY = SizeOfY - Image.Height;
break;
case EdkiiPlatformLogoDisplayAttributeRightBottom:
- DestX = SizeOfX - Width;
- DestY = SizeOfY - Height;
+ DestX = SizeOfX - Image.Width;
+ DestY = SizeOfY - Image.Height;
break;
default:
ASSERT (FALSE);
+ continue;
break;
}
@@ -257,9 +213,9 @@ BootLogoEnableLogo (
0,
(UINTN) DestX,
(UINTN) DestY,
- Width,
- Height,
- Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
+ Image.Width,
+ Image.Height,
+ Image.Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
);
} else {
ASSERT (UgaDraw != NULL);
@@ -271,9 +227,9 @@ BootLogoEnableLogo (
0,
(UINTN) DestX,
(UINTN) DestY,
- Width,
- Height,
- Width * sizeof (EFI_UGA_PIXEL)
+ Image.Width,
+ Image.Height,
+ Image.Width * sizeof (EFI_UGA_PIXEL)
);
}
@@ -283,34 +239,28 @@ BootLogoEnableLogo (
if (!EFI_ERROR (Status)) {
NumberOfLogos++;
- if (LogoWidth == 0) {
+ if (NumberOfLogos == 1) {
//
// The first Logo.
//
LogoDestX = (UINTN) DestX;
LogoDestY = (UINTN) DestY;
- LogoWidth = Width;
- LogoHeight = Height;
+ LogoWidth = Image.Width;
+ LogoHeight = Image.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;
+ LogoWidth = MAX ((UINTN) DestX + Image.Width, LogoDestX + LogoWidth) - NewDestX;
+ LogoHeight = MAX ((UINTN) DestY + Image.Height, LogoDestY + LogoHeight) - NewDestY;
LogoDestX = NewDestX;
LogoDestY = NewDestY;
- LogoWidth = NewWidth;
- LogoHeight = NewHeight;
}
}
}
-
- if (PlatformLogo == NULL) {
- break;
- }
}
if (BootLogo == NULL || NumberOfLogos == 0) {
diff --git a/MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf b/MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
index 8698f26..8fa0b46 100644
--- a/MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
+++ b/MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
@@ -2,7 +2,7 @@
# This library is only intended to be used by PlatformBootManagerLib
# to show progress bar and logo.
#
-# Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2011 - 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 that accompanies this distribution.
# The full text of the license may be found at
@@ -44,10 +44,6 @@ [LibraryClasses]
DebugLib
PrintLib
PcdLib
- DxeServicesLib
- ImageDecoderLib
-
-[Guids]
[Protocols]
gEfiGraphicsOutputProtocolGuid ## SOMETIMES_CONSUMES
--
2.9.0.windows.1
next prev parent reply other threads:[~2016-09-23 8:25 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-23 8:25 [PATCH 00/13] Add HiiImageEx implementation and demonstrate in Nt32 Ruiyu Ni
2016-09-23 8:25 ` [PATCH 01/13] MdeModulePkg/HiiDatabase: Refine GetImageIdOrAddress Ruiyu Ni
2016-09-23 8:25 ` [PATCH 02/13] MdeModulePkg/HiiDatabase: Move common code to LocatePackageList() Ruiyu Ni
2016-09-23 8:25 ` [PATCH 03/13] MdeModulePkg/HiiDatabase: Refine HiiNewImage() Ruiyu Ni
2016-09-23 8:25 ` [PATCH 04/13] MdeModulePkg/HiiDatabase: Refine HiiGetImage() Ruiyu Ni
2016-09-23 8:25 ` [PATCH 05/13] MdeModulePkg/HiiDatabase: Refine HiiSetImage() Ruiyu Ni
2016-09-23 8:25 ` [PATCH 06/13] MdeModulePkg/HiiDatabase: Refine HiiDrawImage() Ruiyu Ni
2016-09-23 8:25 ` [PATCH 07/13] MdemodulePkg/HiiDatabase: Correct typo in comments Ruiyu Ni
2016-09-23 8:25 ` [PATCH 08/13] MdeModulePkg/HiiDatabase: Update HiiImage to support PNG/JPEG Ruiyu Ni
2016-09-23 8:25 ` [PATCH 09/13] MdeModulePkg/HiiDatabase: Add HiiImageEx implementation Ruiyu Ni
2016-09-23 8:25 ` [PATCH 10/13] Nt32Pkg/PlatformBds: Do not call BootLogoEnableLogo Ruiyu Ni
2016-09-23 8:25 ` Ruiyu Ni [this message]
2016-09-23 8:25 ` [PATCH 12/13] MdeModulePkg/Logo: Add LogoDxe module Ruiyu Ni
2016-09-23 8:25 ` [PATCH 13/13] Nt32Pkg: Use the new LogoDxe driver Ruiyu Ni
2016-09-26 2:55 ` [PATCH 00/13] Add HiiImageEx implementation and demonstrate in Nt32 Gao, Liming
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=20160923082521.99872-12-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