]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/BootLogoLib&PlatformLogo: Use HII data types in parameters
authorRuiyu Ni <ruiyu.ni@intel.com>
Fri, 23 Sep 2016 07:54:01 +0000 (15:54 +0800)
committerRuiyu Ni <ruiyu.ni@intel.com>
Wed, 28 Sep 2016 08:22:20 +0000 (16:22 +0800)
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
Reviewed-by: 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
MdeModulePkg/Include/Protocol/PlatformLogo.h
MdeModulePkg/Library/BootLogoLib/BootLogoLib.c
MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
MdeModulePkg/MdeModulePkg.dec

index 55fe4b11cc4e2fde27f25ac3aeeedc5d3d1dd1ac..cacdd29ded942797a49a8f77f8fde179f2ac4b4d 100644 (file)
@@ -2,7 +2,7 @@
   This library is only intended to be used by PlatformBootManagerLib\r
   to show progress bar and LOGO.\r
 \r
-Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials are licensed and made available under\r
 the terms and conditions of the BSD License that accompanies this distribution.\r
 The full text of the license may be found at\r
@@ -20,25 +20,12 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Protocol/GraphicsOutput.h>\r
 \r
 /**\r
-  Show LOGO on all consoles.\r
-\r
-  @param[in]  ImageFormat Format of the image file.\r
-  @param[in]  LogoFile    The file name of logo to display.\r
-  @param[in]  Attribute   The display attributes of the image returned.\r
-  @param[in]  OffsetX     The X offset of the image regarding the Attribute.\r
-  @param[in]  OffsetY     The Y offset of the image regarding the Attribute.\r
-\r
-  @retval EFI_SUCCESS     Logo was displayed.\r
-  @retval EFI_UNSUPPORTED Logo was not found or cannot be displayed.\r
+  Show LOGO returned from Edkii Platform Logo protocol on all consoles.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 BootLogoEnableLogo (\r
-  IN  IMAGE_FORMAT                          ImageFormat,\r
-  IN  EFI_GUID                              *Logo,\r
-  IN  EDKII_PLATFORM_LOGO_DISPLAY_ATTRIBUTE Attribute,\r
-  IN  INTN                                  OffsetX,\r
-  IN  INTN                                  OffsetY\r
+  VOID\r
   );\r
 \r
 \r
index 8c1d3cad40f7885a41cd195ad232ed1774869dea..477317388933864df3559b6f59fa38bec5bbbe17 100644 (file)
@@ -2,7 +2,7 @@
   The Platform Logo Protocol defines the interface to get the Platform logo\r
   image with the display attribute.\r
 \r
-Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials are licensed and made available under \r
 the terms and conditions of the BSD License that accompanies this distribution.  \r
 The full text of the license may be found at\r
@@ -16,22 +16,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #ifndef __PLATFORM_LOGO_H__\r
 #define __PLATFORM_LOGO_H__\r
 \r
+#include <Protocol/HiiImage.h>\r
+\r
 //\r
 // GUID for EDKII Platform Logo Protocol\r
 //\r
 #define EDKII_PLATFORM_LOGO_PROTOCOL_GUID \\r
-  { 0x9b517978, 0xeba1, 0x44e7, { 0xba, 0x65, 0x7c, 0x2c, 0xd0, 0x8b, 0xf8, 0xe9 } }\r
+  { 0x53cd299f, 0x2bc1, 0x40c0, { 0x8c, 0x07, 0x23, 0xf6, 0x4f, 0xdb, 0x30, 0xe0 } }\r
 \r
 typedef struct _EDKII_PLATFORM_LOGO_PROTOCOL EDKII_PLATFORM_LOGO_PROTOCOL;\r
 \r
-typedef enum {\r
-  ImageFormatUnknown,\r
-  ImageFormatBmp,\r
-  ImageFormatJpeg,\r
-  ImageFormatTiff,\r
-  ImageFormatGif\r
-} IMAGE_FORMAT;\r
-\r
 typedef enum {\r
   EdkiiPlatformLogoDisplayAttributeLeftTop,\r
   EdkiiPlatformLogoDisplayAttributeCenterTop,\r
@@ -67,13 +61,11 @@ EFI_STATUS
 (EFIAPI *EDKII_PLATFORM_LOGO_GET_IMAGE)(\r
   IN     EDKII_PLATFORM_LOGO_PROTOCOL          *This,\r
   IN OUT UINT32                                *Instance,\r
-     OUT IMAGE_FORMAT                          *Format,\r
-     OUT UINT8                                 **ImageData,\r
-     OUT UINTN                                 *ImageSize,\r
+     OUT EFI_IMAGE_INPUT                       *Image,\r
      OUT EDKII_PLATFORM_LOGO_DISPLAY_ATTRIBUTE *Attribute,\r
      OUT INTN                                  *OffsetX,\r
      OUT INTN                                  *OffsetY\r
-);\r
+  );\r
 \r
 \r
 struct _EDKII_PLATFORM_LOGO_PROTOCOL {\r
index 7cb3bcba46f58edf1545e97f6a978e84944f06e8..2c1e8ea5b4f2a83bb7f16acfe3c4cacb503ef334 100644 (file)
@@ -2,7 +2,7 @@
   This library is only intended to be used by PlatformBootManagerLib\r
   to show progress bar and LOGO.\r
 \r
-Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials are licensed and made available under\r
 the terms and conditions of the BSD License that accompanies this distribution.\r
 The full text of the license may be found at\r
@@ -13,30 +13,22 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 **/\r
 \r
-#include <PiDxe.h>\r
+#include <Uefi.h>\r
+#include <Protocol/GraphicsOutput.h>\r
 #include <Protocol/SimpleTextOut.h>\r
 #include <Protocol/PlatformLogo.h>\r
-#include <Protocol/GraphicsOutput.h>\r
 #include <Protocol/UgaDraw.h>\r
 #include <Protocol/BootLogo.h>\r
 #include <Library/BaseLib.h>\r
 #include <Library/UefiLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
-#include <Library/DxeServicesLib.h>\r
 #include <Library/PcdLib.h>\r
 #include <Library/MemoryAllocationLib.h>\r
 #include <Library/DebugLib.h>\r
-#include <Library/ImageDecoderLib.h>\r
 \r
 /**\r
-  Show LOGO on all consoles.\r
-\r
-  @param[in]  ImageFormat Format of the image file.\r
-  @param[in]  LogoFile    The file name of logo to display.\r
-  @param[in]  Attribute   The display attributes of the image returned.\r
-  @param[in]  OffsetX     The X offset of the image regarding the Attribute.\r
-  @param[in]  OffsetY     The Y offset of the image regarding the Attribute.\r
+  Show LOGO returned from Edkii Platform Logo protocol on all consoles.\r
 \r
   @retval EFI_SUCCESS     Logo was displayed.\r
   @retval EFI_UNSUPPORTED Logo was not found or cannot be displayed.\r
@@ -44,42 +36,40 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 EFI_STATUS\r
 EFIAPI\r
 BootLogoEnableLogo (\r
-  IN  IMAGE_FORMAT                          ImageFormat,\r
-  IN  EFI_GUID                              *Logo,\r
-  IN  EDKII_PLATFORM_LOGO_DISPLAY_ATTRIBUTE Attribute,\r
-  IN  INTN                                  OffsetX,\r
-  IN  INTN                                  OffsetY\r
+  VOID\r
   )\r
 {\r
-  EFI_STATUS                    Status;\r
-  EDKII_PLATFORM_LOGO_PROTOCOL  *PlatformLogo;\r
-  UINT32                        SizeOfX;\r
-  UINT32                        SizeOfY;\r
-  INTN                          DestX;\r
-  INTN                          DestY;\r
-  UINT8                         *ImageData;\r
-  UINTN                         ImageSize;\r
-  UINTN                         BltSize;\r
-  UINT32                        Instance;\r
-  UINTN                         Height;\r
-  UINTN                         Width;\r
-  EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Blt;\r
-  EFI_UGA_DRAW_PROTOCOL         *UgaDraw;\r
-  UINT32                        ColorDepth;\r
-  UINT32                        RefreshRate;\r
-  EFI_GRAPHICS_OUTPUT_PROTOCOL  *GraphicsOutput;\r
-  EFI_BOOT_LOGO_PROTOCOL        *BootLogo;\r
-  UINTN                         NumberOfLogos;\r
-  EFI_GRAPHICS_OUTPUT_BLT_PIXEL *LogoBlt;\r
-  UINTN                         LogoDestX;\r
-  UINTN                         LogoDestY;\r
-  UINTN                         LogoHeight;\r
-  UINTN                         LogoWidth;\r
-  UINTN                         NewDestX;\r
-  UINTN                         NewDestY;\r
-  UINTN                         NewHeight;\r
-  UINTN                         NewWidth;\r
-  UINTN                         BufferSize;\r
+  EFI_STATUS                            Status;\r
+  EDKII_PLATFORM_LOGO_PROTOCOL          *PlatformLogo;\r
+  EDKII_PLATFORM_LOGO_DISPLAY_ATTRIBUTE Attribute;\r
+  INTN                                  OffsetX;\r
+  INTN                                  OffsetY;\r
+  UINT32                                SizeOfX;\r
+  UINT32                                SizeOfY;\r
+  INTN                                  DestX;\r
+  INTN                                  DestY;\r
+  UINT32                                Instance;\r
+  EFI_IMAGE_INPUT                       Image;\r
+  EFI_GRAPHICS_OUTPUT_BLT_PIXEL         *Blt;\r
+  EFI_UGA_DRAW_PROTOCOL                 *UgaDraw;\r
+  UINT32                                ColorDepth;\r
+  UINT32                                RefreshRate;\r
+  EFI_GRAPHICS_OUTPUT_PROTOCOL          *GraphicsOutput;\r
+  EFI_BOOT_LOGO_PROTOCOL                *BootLogo;\r
+  UINTN                                 NumberOfLogos;\r
+  EFI_GRAPHICS_OUTPUT_BLT_PIXEL         *LogoBlt;\r
+  UINTN                                 LogoDestX;\r
+  UINTN                                 LogoDestY;\r
+  UINTN                                 LogoHeight;\r
+  UINTN                                 LogoWidth;\r
+  UINTN                                 NewDestX;\r
+  UINTN                                 NewDestY;\r
+  UINTN                                 BufferSize;\r
+\r
+  Status  = gBS->LocateProtocol (&gEdkiiPlatformLogoProtocolGuid, NULL, (VOID **) &PlatformLogo);\r
+  if (EFI_ERROR (Status)) {\r
+    return EFI_UNSUPPORTED;\r
+  }\r
 \r
   UgaDraw = NULL;\r
   //\r
@@ -100,15 +90,6 @@ BootLogoEnableLogo (
     return EFI_UNSUPPORTED;\r
   }\r
 \r
-  Status  = gBS->LocateProtocol (&gEdkiiPlatformLogoProtocolGuid, NULL, (VOID **) &PlatformLogo);\r
-  if (EFI_ERROR (Status)) {\r
-    PlatformLogo = NULL;\r
-  }\r
-\r
-  if ((Logo == NULL) && (PlatformLogo == NULL)) {\r
-    return EFI_UNSUPPORTED;\r
-  }\r
-\r
   //\r
   // Try to open Boot Logo Protocol.\r
   //\r
@@ -142,59 +123,33 @@ BootLogoEnableLogo (
   LogoWidth = 0;\r
   NewDestX = 0;\r
   NewDestY = 0;\r
-  NewHeight = 0;\r
-  NewWidth = 0;\r
   Instance = 0;\r
   DestX = 0;\r
   DestY = 0;\r
   while (TRUE) {\r
-    ImageData = NULL;\r
-    ImageSize = 0;\r
-\r
-    if (PlatformLogo != NULL) {\r
-      //\r
-      // Get image from OEMBadging protocol.\r
-      //\r
-      Status = PlatformLogo->GetImage (\r
-                               PlatformLogo,\r
-                               &Instance,\r
-                               &ImageFormat,\r
-                               &ImageData,\r
-                               &ImageSize,\r
-                               &Attribute,\r
-                               &OffsetX,\r
-                               &OffsetY\r
-                               );\r
-      if (EFI_ERROR (Status)) {\r
-        break;\r
-      }\r
+    //\r
+    // Get image from PlatformLogo protocol.\r
+    //\r
+    Status = PlatformLogo->GetImage (\r
+                             PlatformLogo,\r
+                             &Instance,\r
+                             &Image,\r
+                             &Attribute,\r
+                             &OffsetX,\r
+                             &OffsetY\r
+                             );\r
+    if (EFI_ERROR (Status)) {\r
+      break;\r
+    }\r
 \r
-    } else {\r
-      //\r
-      // Get the specified image from FV.\r
-      //\r
-      Status = GetSectionFromAnyFv (Logo, EFI_SECTION_RAW, 0, (VOID **) &ImageData, &ImageSize);\r
-      if (EFI_ERROR (Status)) {\r
-        return EFI_UNSUPPORTED;\r
-      }\r
+    if (EFI_ERROR (Status)) {\r
+      continue;\r
     }\r
 \r
     if (Blt != NULL) {\r
       FreePool (Blt);\r
     }\r
-\r
-    Status = DecodeImage (ImageFormat, ImageData, ImageSize, &Blt, &BltSize, &Width, &Height);\r
-    FreePool (ImageData);\r
-    if (EFI_ERROR (Status)) {\r
-      if (Logo != NULL) {\r
-        //\r
-        // Directly return failure for single LOGO\r
-        //\r
-        return Status;\r
-      } else {\r
-        continue;\r
-      }\r
-    }\r
+    Blt = Image.Bitmap;\r
 \r
     //\r
     // Calculate the display position according to Attribute.\r
@@ -205,42 +160,43 @@ BootLogoEnableLogo (
       DestY = 0;\r
       break;\r
     case EdkiiPlatformLogoDisplayAttributeCenterTop:\r
-      DestX = (SizeOfX - Width) / 2;\r
+      DestX = (SizeOfX - Image.Width) / 2;\r
       DestY = 0;\r
       break;\r
     case EdkiiPlatformLogoDisplayAttributeRightTop:\r
-      DestX = SizeOfX - Width;\r
+      DestX = SizeOfX - Image.Width;\r
       DestY = 0;\r
       break;\r
 \r
     case EdkiiPlatformLogoDisplayAttributeCenterLeft:\r
       DestX = 0;\r
-      DestY = (SizeOfY - Height) / 2;\r
+      DestY = (SizeOfY - Image.Height) / 2;\r
       break;\r
     case EdkiiPlatformLogoDisplayAttributeCenter:\r
-      DestX = (SizeOfX - Width) / 2;\r
-      DestY = (SizeOfY - Height) / 2;\r
+      DestX = (SizeOfX - Image.Width) / 2;\r
+      DestY = (SizeOfY - Image.Height) / 2;\r
       break;\r
     case EdkiiPlatformLogoDisplayAttributeCenterRight:\r
-      DestX = SizeOfX - Width;\r
-      DestY = (SizeOfY - Height) / 2;\r
+      DestX = SizeOfX - Image.Width;\r
+      DestY = (SizeOfY - Image.Height) / 2;\r
       break;\r
 \r
     case EdkiiPlatformLogoDisplayAttributeLeftBottom:\r
       DestX = 0;\r
-      DestY = SizeOfY - Height;\r
+      DestY = SizeOfY - Image.Height;\r
       break;\r
     case EdkiiPlatformLogoDisplayAttributeCenterBottom:\r
-      DestX = (SizeOfX - Width) / 2;\r
-      DestY = SizeOfY - Height;\r
+      DestX = (SizeOfX - Image.Width) / 2;\r
+      DestY = SizeOfY - Image.Height;\r
       break;\r
     case EdkiiPlatformLogoDisplayAttributeRightBottom:\r
-      DestX = SizeOfX - Width;\r
-      DestY = SizeOfY - Height;\r
+      DestX = SizeOfX - Image.Width;\r
+      DestY = SizeOfY - Image.Height;\r
       break;\r
 \r
     default:\r
       ASSERT (FALSE);\r
+      continue;\r
       break;\r
     }\r
 \r
@@ -257,9 +213,9 @@ BootLogoEnableLogo (
                                    0,\r
                                    (UINTN) DestX,\r
                                    (UINTN) DestY,\r
-                                   Width,\r
-                                   Height,\r
-                                   Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)\r
+                                   Image.Width,\r
+                                   Image.Height,\r
+                                   Image.Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)\r
                                    );\r
       } else {\r
         ASSERT (UgaDraw != NULL);\r
@@ -271,9 +227,9 @@ BootLogoEnableLogo (
                             0,\r
                             (UINTN) DestX,\r
                             (UINTN) DestY,\r
-                            Width,\r
-                            Height,\r
-                            Width * sizeof (EFI_UGA_PIXEL)\r
+                            Image.Width,\r
+                            Image.Height,\r
+                            Image.Width * sizeof (EFI_UGA_PIXEL)\r
                             );\r
       }\r
 \r
@@ -283,34 +239,28 @@ BootLogoEnableLogo (
       if (!EFI_ERROR (Status)) {\r
         NumberOfLogos++;\r
 \r
-        if (LogoWidth == 0) {\r
+        if (NumberOfLogos == 1) {\r
           //\r
           // The first Logo.\r
           //\r
           LogoDestX = (UINTN) DestX;\r
           LogoDestY = (UINTN) DestY;\r
-          LogoWidth = Width;\r
-          LogoHeight = Height;\r
+          LogoWidth = Image.Width;\r
+          LogoHeight = Image.Height;\r
         } else {\r
           //\r
           // Merge new logo with old one.\r
           //\r
           NewDestX = MIN ((UINTN) DestX, LogoDestX);\r
           NewDestY = MIN ((UINTN) DestY, LogoDestY);\r
-          NewWidth = MAX ((UINTN) DestX + Width, LogoDestX + LogoWidth) - NewDestX;\r
-          NewHeight = MAX ((UINTN) DestY + Height, LogoDestY + LogoHeight) - NewDestY;\r
+          LogoWidth = MAX ((UINTN) DestX + Image.Width, LogoDestX + LogoWidth) - NewDestX;\r
+          LogoHeight = MAX ((UINTN) DestY + Image.Height, LogoDestY + LogoHeight) - NewDestY;\r
 \r
           LogoDestX = NewDestX;\r
           LogoDestY = NewDestY;\r
-          LogoWidth = NewWidth;\r
-          LogoHeight = NewHeight;\r
         }\r
       }\r
     }\r
-\r
-    if (PlatformLogo == NULL) {\r
-      break;\r
-    }\r
   }\r
 \r
   if (BootLogo == NULL || NumberOfLogos == 0) {\r
index 8698f26fc4a987b07888185e9743673b120b2e84..79b5fc511a8b822fc9083f4cfb5edb7c0f96c0c9 100644 (file)
@@ -2,7 +2,7 @@
 #  This library is only intended to be used by PlatformBootManagerLib\r
 #  to show progress bar and logo.\r
 #  \r
-#  Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.<BR>\r
 #  This program and the accompanying materials are licensed and made available under\r
 #  the terms and conditions of the BSD License that accompanies this distribution.\r
 #  The full text of the license may be found at\r
@@ -17,7 +17,7 @@
   INF_VERSION                    = 0x00010005\r
   BASE_NAME                      = BootLogoLib\r
   MODULE_UNI_FILE                = BootLogoLib.uni\r
-  FILE_GUID                      = F5AE5B5C-42E8-4A9B-829D-5B631CD5367A\r
+  FILE_GUID                      = 85CDAFAD-13BE-422A-A8E5-55A249600DC3\r
   MODULE_TYPE                    = DXE_DRIVER\r
   VERSION_STRING                 = 1.0\r
   LIBRARY_CLASS                  = BootLogoLib|DXE_DRIVER UEFI_APPLICATION\r
   DebugLib\r
   PrintLib\r
   PcdLib\r
-  DxeServicesLib\r
-  ImageDecoderLib\r
-\r
-[Guids]\r
 \r
 [Protocols]\r
   gEfiGraphicsOutputProtocolGuid                ## SOMETIMES_CONSUMES\r
index bd375f40467086e58c71cf951178af216513d3ec..b28677b2df333b8b4ede2b2310e80d7c92c85b2a 100644 (file)
   gEdkiiSmmReadyToBootProtocolGuid = { 0x6e057ecf, 0xfa99, 0x4f39, { 0x95, 0xbc, 0x59, 0xf9, 0x92, 0x1d, 0x17, 0xe4 } }\r
 \r
   ## Include/Protocol/PlatformLogo.h\r
-  gEdkiiPlatformLogoProtocolGuid = { 0x9b517978, 0xeba1, 0x44e7, { 0xba, 0x65, 0x7c, 0x2c, 0xd0, 0x8b, 0xf8, 0xe9 } }\r
+  gEdkiiPlatformLogoProtocolGuid = { 0x53cd299f, 0x2bc1, 0x40c0, { 0x8c, 0x07, 0x23, 0xf6, 0x4f, 0xdb, 0x30, 0xe0 } }\r
 \r
   ## Include/Protocol/FileExplorer.h\r
   gEfiFileExplorerProtocolGuid = { 0x2C03C536, 0x4594, 0x4515, { 0x9E, 0x7A, 0xD3, 0xD2, 0x04, 0xFE, 0x13, 0x63 } }\r