Date   

Re: System hang when using SetMemoryAttributes

Michael Zimmermann
 

I'm thankful for the hint about _WC because it drastically improves the
speed on my other devices.
Unfortunately, it doesn't fix the device I have problems with. I tested all
possible attributes and only EFI_MEMORY_WB seems to be
working(even EFI_MEMORY_WT is broken).

The weird thing is that even if I disable accesses to the framebuffer by
disabling all code in the Blt function, it hangs during boot.
I really can't explain this behavior.

On Mon, Sep 26, 2016 at 12:23 PM, Ard Biesheuvel <ard.biesheuvel@linaro.org>
wrote:

On 26 September 2016 at 00:44, Michael Zimmermann
<sigmaepsilon92@gmail.com> wrote:
oh and in case it makes a difference: it's a 64bit ARM device running
32bit
code.
That shouldn't matter.

On Mon, Sep 26, 2016 at 9:13 AM, Michael Zimmermann
<sigmaepsilon92@gmail.com> wrote:

Ard,

I have to mark the framebuffer as uncached, because if writes to it are
cached, they don't instantly reach the underlying hardware. I'd have to
manually flush the cache for that region every time otherwise.

Isn't that the normal way? I don't think that any device would work
with a
write-cache framebuffer - I actually copied the code from the ArmVirt
LCD
drivers which do the same.
_WC means write-combining, and so these accesses are not cacheable,
but they do allow unaligned accesses, unlike _UC


Re: System hang when using SetMemoryAttributes

Ard Biesheuvel
 

On 26 September 2016 at 00:44, Michael Zimmermann
<sigmaepsilon92@gmail.com> wrote:
oh and in case it makes a difference: it's a 64bit ARM device running 32bit
code.
That shouldn't matter.

On Mon, Sep 26, 2016 at 9:13 AM, Michael Zimmermann
<sigmaepsilon92@gmail.com> wrote:

Ard,

I have to mark the framebuffer as uncached, because if writes to it are
cached, they don't instantly reach the underlying hardware. I'd have to
manually flush the cache for that region every time otherwise.

Isn't that the normal way? I don't think that any device would work with a
write-cache framebuffer - I actually copied the code from the ArmVirt LCD
drivers which do the same.
_WC means write-combining, and so these accesses are not cacheable,
but they do allow unaligned accesses, unlike _UC


Re: [PATCH v2 19/19] OvmfPkg: Use the new LogoDxe driver

Laszlo Ersek
 

On 09/26/16 11:30, Ruiyu Ni wrote:
Contributed-under: TianoCore Contribution Agreement 1.0
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
---
OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c | 8 +-------
OvmfPkg/OvmfPkgIa32.dsc | 3 +--
OvmfPkg/OvmfPkgIa32.fdf | 4 +---
OvmfPkg/OvmfPkgIa32X64.dsc | 3 +--
OvmfPkg/OvmfPkgIa32X64.fdf | 4 +---
OvmfPkg/OvmfPkgX64.dsc | 3 +--
OvmfPkg/OvmfPkgX64.fdf | 4 +---
7 files changed, 7 insertions(+), 22 deletions(-)

diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
index 4c5d259..74cb5a4 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
@@ -1445,13 +1445,7 @@ Routine Description:
//
// Logo show
//
- //BootLogoEnableLogo (
- // ImageFormatBmp, // ImageFormat
- // PcdGetPtr (PcdLogoFile), // Logo
- // EdkiiPlatformLogoDisplayAttributeCenter, // Attribute
- // 0, // OffsetX
- // 0 // OffsetY
- // );
+ BootLogoEnableLogo ();

//
// Perform some platform specific connect sequence
diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index d5bfa9f..7213197 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -79,7 +79,6 @@ [LibraryClasses]
SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
- ImageDecoderLib|MdeModulePkg/Library/ImageDecoderLib/ImageDecoderLib.inf
FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf
CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
@@ -577,12 +576,12 @@ [Components]
MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf
MdeModulePkg/Universal/BdsDxe/BdsDxe.inf {
<LibraryClasses>
- NULL|MdeModulePkg/Library/BmpImageDecoderLib/BmpImageDecoderLib.inf
!ifdef $(CSM_ENABLE)
NULL|OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf
NULL|IntelFrameworkModulePkg/Library/LegacyBootManagerLib/LegacyBootManagerLib.inf
!endif
}
+ MdeModulePkg/Logo/LogoDxe.inf
MdeModulePkg/Application/UiApp/UiApp.inf {
<LibraryClasses>
NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf
diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf
index c5e63a3..2a5b211 100644
--- a/OvmfPkg/OvmfPkgIa32.fdf
+++ b/OvmfPkg/OvmfPkgIa32.fdf
@@ -287,9 +287,7 @@ [FV.DXEFV]
INF RuleOverride = BINARY EdkShellBinPkg/FullShell/FullShell.inf
!endif

-FILE FREEFORM = PCD(gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile) {
- SECTION RAW = MdeModulePkg/Logo/Logo.bmp
-}
+INF MdeModulePkg/Logo/LogoDxe.inf

#
# Network modules
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 2a9a86f..c27024a 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -84,7 +84,6 @@ [LibraryClasses]
SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
- ImageDecoderLib|MdeModulePkg/Library/ImageDecoderLib/ImageDecoderLib.inf
FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf
CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
@@ -586,12 +585,12 @@ [Components.X64]
MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf
MdeModulePkg/Universal/BdsDxe/BdsDxe.inf {
<LibraryClasses>
- NULL|MdeModulePkg/Library/BmpImageDecoderLib/BmpImageDecoderLib.inf
!ifdef $(CSM_ENABLE)
NULL|OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf
NULL|IntelFrameworkModulePkg/Library/LegacyBootManagerLib/LegacyBootManagerLib.inf
!endif
}
+ MdeModulePkg/Logo/LogoDxe.inf
MdeModulePkg/Application/UiApp/UiApp.inf {
<LibraryClasses>
NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf
diff --git a/OvmfPkg/OvmfPkgIa32X64.fdf b/OvmfPkg/OvmfPkgIa32X64.fdf
index 11b623d..1c7df21 100644
--- a/OvmfPkg/OvmfPkgIa32X64.fdf
+++ b/OvmfPkg/OvmfPkgIa32X64.fdf
@@ -287,9 +287,7 @@ [FV.DXEFV]
INF RuleOverride = BINARY USE = X64 EdkShellBinPkg/FullShell/FullShell.inf
!endif

-FILE FREEFORM = PCD(gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile) {
- SECTION RAW = MdeModulePkg/Logo/Logo.bmp
-}
+INF MdeModulePkg/Logo/LogoDxe.inf

#
# Network modules
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index 50c7af3..c34b266 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -84,7 +84,6 @@ [LibraryClasses]
SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
- ImageDecoderLib|MdeModulePkg/Library/ImageDecoderLib/ImageDecoderLib.inf
FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf
CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
@@ -584,12 +583,12 @@ [Components]
MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf
MdeModulePkg/Universal/BdsDxe/BdsDxe.inf {
<LibraryClasses>
- NULL|MdeModulePkg/Library/BmpImageDecoderLib/BmpImageDecoderLib.inf
!ifdef $(CSM_ENABLE)
NULL|OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf
NULL|IntelFrameworkModulePkg/Library/LegacyBootManagerLib/LegacyBootManagerLib.inf
!endif
}
+ MdeModulePkg/Logo/LogoDxe.inf
MdeModulePkg/Application/UiApp/UiApp.inf {
<LibraryClasses>
NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf
diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf
index 784aea1..3bb11cb 100644
--- a/OvmfPkg/OvmfPkgX64.fdf
+++ b/OvmfPkg/OvmfPkgX64.fdf
@@ -287,9 +287,7 @@ [FV.DXEFV]
INF RuleOverride = BINARY EdkShellBinPkg/FullShell/FullShell.inf
!endif

-FILE FREEFORM = PCD(gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile) {
- SECTION RAW = MdeModulePkg/Logo/Logo.bmp
-}
+INF MdeModulePkg/Logo/LogoDxe.inf

#
# Network modules
Reviewed-by: Laszlo Ersek <lersek@redhat.com>


Re: [PATCH v2 18/19] ArmVirtPkg: Use the new LogoDxe driver

Laszlo Ersek
 

On 09/26/16 11:30, Ruiyu Ni wrote:
Contributed-under: TianoCore Contribution Agreement 1.0
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
---
ArmVirtPkg/ArmVirtQemu.dsc | 7 ++-----
ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc | 4 +---
ArmVirtPkg/ArmVirtQemuKernel.dsc | 7 ++-----
ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c | 8 +-------
4 files changed, 6 insertions(+), 20 deletions(-)

diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
index a3beb46..d4d9c0f 100644
--- a/ArmVirtPkg/ArmVirtQemu.dsc
+++ b/ArmVirtPkg/ArmVirtQemu.dsc
@@ -62,7 +62,6 @@ [LibraryClasses.common]
CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
- ImageDecoderLib|MdeModulePkg/Library/ImageDecoderLib/ImageDecoderLib.inf
PlatformBootManagerLib|ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
QemuBootOrderLib|OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.inf
@@ -331,10 +330,8 @@ [Components.common]
MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf
- MdeModulePkg/Universal/BdsDxe/BdsDxe.inf {
- <LibraryClasses>
- NULL|MdeModulePkg/Library/BmpImageDecoderLib/BmpImageDecoderLib.inf
- }
+ MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
+ MdeModulePkg/Logo/LogoDxe.inf
MdeModulePkg/Application/UiApp/UiApp.inf {
<LibraryClasses>
NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf
diff --git a/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc b/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
index 2571884..a2e82b3 100644
--- a/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
+++ b/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
@@ -181,9 +181,7 @@ [FV.FvMain]
#
# TianoCore logo (splash screen)
#
- FILE FREEFORM = PCD(gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile) {
- SECTION RAW = MdeModulePkg/Logo/Logo.bmp
- }
+ INF MdeModulePkg/Logo/LogoDxe.inf

#
# Ramdisk support
diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc b/ArmVirtPkg/ArmVirtQemuKernel.dsc
index e0dcf43..e483a27 100644
--- a/ArmVirtPkg/ArmVirtQemuKernel.dsc
+++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc
@@ -61,7 +61,6 @@ [LibraryClasses.common]
CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
- ImageDecoderLib|MdeModulePkg/Library/ImageDecoderLib/ImageDecoderLib.inf
PlatformBootManagerLib|ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
QemuBootOrderLib|OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.inf
@@ -320,10 +319,8 @@ [Components.common]
MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf
- MdeModulePkg/Universal/BdsDxe/BdsDxe.inf {
- <LibraryClasses>
- NULL|MdeModulePkg/Library/BmpImageDecoderLib/BmpImageDecoderLib.inf
- }
+ MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
+ MdeModulePkg/Logo/LogoDxe.inf
MdeModulePkg/Application/UiApp/UiApp.inf {
<LibraryClasses>
NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf
diff --git a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
index 5d7c2a4..aecad57 100644
--- a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
+++ b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
@@ -657,13 +657,7 @@ PlatformBootManagerAfterConsole (
//
// Show the splash screen.
//
- // BootLogoEnableLogo (
- // ImageFormatBmp, // ImageFormat
- // PcdGetPtr (PcdLogoFile), // Logo
- // EdkiiPlatformLogoDisplayAttributeCenter, // Attribute
- // 0, // OffsetX
- // 0 // OffsetY
- // );
+ BootLogoEnableLogo ();

//
// Connect the rest of the devices.
Reviewed-by: Laszlo Ersek <lersek@redhat.com>


Re: [PATCH v2 14/19] OvmfPkg/PlatformBds: Do not call BootLogoEnableLogo

Laszlo Ersek
 

On 09/26/16 11:30, Ruiyu Ni wrote:
Prototype of BootLogoEnableLogo will change in following patches, so
do not call BootLogoEnableLogo to avoid build failure.

Contributed-under: TianoCore Contribution Agreement 1.0
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
---
OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c | 14 +++++++-------
.../PlatformBootManagerLib/PlatformBootManagerLib.inf | 1 -
2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
index 7cd547e..4c5d259 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
@@ -1445,13 +1445,13 @@ Routine Description:
//
// Logo show
//
- BootLogoEnableLogo (
- ImageFormatBmp, // ImageFormat
- PcdGetPtr (PcdLogoFile), // Logo
- EdkiiPlatformLogoDisplayAttributeCenter, // Attribute
- 0, // OffsetX
- 0 // OffsetY
- );
+ //BootLogoEnableLogo (
+ // ImageFormatBmp, // ImageFormat
+ // PcdGetPtr (PcdLogoFile), // Logo
+ // EdkiiPlatformLogoDisplayAttributeCenter, // Attribute
+ // 0, // OffsetX
+ // 0 // OffsetY
+ // );

//
// Perform some platform specific connect sequence
diff --git a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
index f3303b9..4a6bece 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+++ b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
@@ -56,7 +56,6 @@ [LibraryClasses]
UefiLib

[Pcd]
- gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile
gUefiOvmfPkgTokenSpaceGuid.PcdEmuVariableEvent
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashVariablesEnable
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId
Reviewed-by: Laszlo Ersek <lersek@redhat.com>


Re: [PATCH v2 13/19] ArmVirtPkg/PlatformBds: Do not call BootLogoEnableLogo

Laszlo Ersek
 

On 09/26/16 11:30, Ruiyu Ni wrote:
Prototype of BootLogoEnableLogo will change in following patches, so
do not call BootLogoEnableLogo to avoid build failure.

Contributed-under: TianoCore Contribution Agreement 1.0
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
---
ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c | 14 +++++++-------
.../PlatformBootManagerLib/PlatformBootManagerLib.inf | 1 -
2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
index c11196a..5d7c2a4 100644
--- a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
+++ b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
@@ -657,13 +657,13 @@ PlatformBootManagerAfterConsole (
//
// Show the splash screen.
//
- BootLogoEnableLogo (
- ImageFormatBmp, // ImageFormat
- PcdGetPtr (PcdLogoFile), // Logo
- EdkiiPlatformLogoDisplayAttributeCenter, // Attribute
- 0, // OffsetX
- 0 // OffsetY
- );
+ // BootLogoEnableLogo (
+ // ImageFormatBmp, // ImageFormat
+ // PcdGetPtr (PcdLogoFile), // Logo
+ // EdkiiPlatformLogoDisplayAttributeCenter, // Attribute
+ // 0, // OffsetX
+ // 0 // OffsetY
+ // );

//
// Connect the rest of the devices.
diff --git a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
index bec7fab..1f162c6 100644
--- a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+++ b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
@@ -58,7 +58,6 @@ [LibraryClasses]
UefiRuntimeServicesTableLib

[FixedPcd]
- gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits
Reviewed-by: Laszlo Ersek <lersek@redhat.com>


[PATCH v2 19/19] OvmfPkg: Use the new LogoDxe driver

Ruiyu Ni <ruiyu.ni@...>
 

Contributed-under: TianoCore Contribution Agreement 1.0
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
---
OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c | 8 +-------
OvmfPkg/OvmfPkgIa32.dsc | 3 +--
OvmfPkg/OvmfPkgIa32.fdf | 4 +---
OvmfPkg/OvmfPkgIa32X64.dsc | 3 +--
OvmfPkg/OvmfPkgIa32X64.fdf | 4 +---
OvmfPkg/OvmfPkgX64.dsc | 3 +--
OvmfPkg/OvmfPkgX64.fdf | 4 +---
7 files changed, 7 insertions(+), 22 deletions(-)

diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
index 4c5d259..74cb5a4 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
@@ -1445,13 +1445,7 @@ Routine Description:
//
// Logo show
//
- //BootLogoEnableLogo (
- // ImageFormatBmp, // ImageFormat
- // PcdGetPtr (PcdLogoFile), // Logo
- // EdkiiPlatformLogoDisplayAttributeCenter, // Attribute
- // 0, // OffsetX
- // 0 // OffsetY
- // );
+ BootLogoEnableLogo ();

//
// Perform some platform specific connect sequence
diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index d5bfa9f..7213197 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -79,7 +79,6 @@ [LibraryClasses]
SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
- ImageDecoderLib|MdeModulePkg/Library/ImageDecoderLib/ImageDecoderLib.inf
FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf
CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
@@ -577,12 +576,12 @@ [Components]
MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf
MdeModulePkg/Universal/BdsDxe/BdsDxe.inf {
<LibraryClasses>
- NULL|MdeModulePkg/Library/BmpImageDecoderLib/BmpImageDecoderLib.inf
!ifdef $(CSM_ENABLE)
NULL|OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf
NULL|IntelFrameworkModulePkg/Library/LegacyBootManagerLib/LegacyBootManagerLib.inf
!endif
}
+ MdeModulePkg/Logo/LogoDxe.inf
MdeModulePkg/Application/UiApp/UiApp.inf {
<LibraryClasses>
NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf
diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf
index c5e63a3..2a5b211 100644
--- a/OvmfPkg/OvmfPkgIa32.fdf
+++ b/OvmfPkg/OvmfPkgIa32.fdf
@@ -287,9 +287,7 @@ [FV.DXEFV]
INF RuleOverride = BINARY EdkShellBinPkg/FullShell/FullShell.inf
!endif

-FILE FREEFORM = PCD(gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile) {
- SECTION RAW = MdeModulePkg/Logo/Logo.bmp
-}
+INF MdeModulePkg/Logo/LogoDxe.inf

#
# Network modules
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 2a9a86f..c27024a 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -84,7 +84,6 @@ [LibraryClasses]
SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
- ImageDecoderLib|MdeModulePkg/Library/ImageDecoderLib/ImageDecoderLib.inf
FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf
CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
@@ -586,12 +585,12 @@ [Components.X64]
MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf
MdeModulePkg/Universal/BdsDxe/BdsDxe.inf {
<LibraryClasses>
- NULL|MdeModulePkg/Library/BmpImageDecoderLib/BmpImageDecoderLib.inf
!ifdef $(CSM_ENABLE)
NULL|OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf
NULL|IntelFrameworkModulePkg/Library/LegacyBootManagerLib/LegacyBootManagerLib.inf
!endif
}
+ MdeModulePkg/Logo/LogoDxe.inf
MdeModulePkg/Application/UiApp/UiApp.inf {
<LibraryClasses>
NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf
diff --git a/OvmfPkg/OvmfPkgIa32X64.fdf b/OvmfPkg/OvmfPkgIa32X64.fdf
index 11b623d..1c7df21 100644
--- a/OvmfPkg/OvmfPkgIa32X64.fdf
+++ b/OvmfPkg/OvmfPkgIa32X64.fdf
@@ -287,9 +287,7 @@ [FV.DXEFV]
INF RuleOverride = BINARY USE = X64 EdkShellBinPkg/FullShell/FullShell.inf
!endif

-FILE FREEFORM = PCD(gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile) {
- SECTION RAW = MdeModulePkg/Logo/Logo.bmp
-}
+INF MdeModulePkg/Logo/LogoDxe.inf

#
# Network modules
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index 50c7af3..c34b266 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -84,7 +84,6 @@ [LibraryClasses]
SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
- ImageDecoderLib|MdeModulePkg/Library/ImageDecoderLib/ImageDecoderLib.inf
FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf
CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
@@ -584,12 +583,12 @@ [Components]
MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf
MdeModulePkg/Universal/BdsDxe/BdsDxe.inf {
<LibraryClasses>
- NULL|MdeModulePkg/Library/BmpImageDecoderLib/BmpImageDecoderLib.inf
!ifdef $(CSM_ENABLE)
NULL|OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf
NULL|IntelFrameworkModulePkg/Library/LegacyBootManagerLib/LegacyBootManagerLib.inf
!endif
}
+ MdeModulePkg/Logo/LogoDxe.inf
MdeModulePkg/Application/UiApp/UiApp.inf {
<LibraryClasses>
NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf
diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf
index 784aea1..3bb11cb 100644
--- a/OvmfPkg/OvmfPkgX64.fdf
+++ b/OvmfPkg/OvmfPkgX64.fdf
@@ -287,9 +287,7 @@ [FV.DXEFV]
INF RuleOverride = BINARY EdkShellBinPkg/FullShell/FullShell.inf
!endif

-FILE FREEFORM = PCD(gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile) {
- SECTION RAW = MdeModulePkg/Logo/Logo.bmp
-}
+INF MdeModulePkg/Logo/LogoDxe.inf

#
# Network modules
--
2.9.0.windows.1


[PATCH v2 18/19] ArmVirtPkg: Use the new LogoDxe driver

Ruiyu Ni <ruiyu.ni@...>
 

Contributed-under: TianoCore Contribution Agreement 1.0
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
---
ArmVirtPkg/ArmVirtQemu.dsc | 7 ++-----
ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc | 4 +---
ArmVirtPkg/ArmVirtQemuKernel.dsc | 7 ++-----
ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c | 8 +-------
4 files changed, 6 insertions(+), 20 deletions(-)

diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
index a3beb46..d4d9c0f 100644
--- a/ArmVirtPkg/ArmVirtQemu.dsc
+++ b/ArmVirtPkg/ArmVirtQemu.dsc
@@ -62,7 +62,6 @@ [LibraryClasses.common]
CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
- ImageDecoderLib|MdeModulePkg/Library/ImageDecoderLib/ImageDecoderLib.inf
PlatformBootManagerLib|ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
QemuBootOrderLib|OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.inf
@@ -331,10 +330,8 @@ [Components.common]
MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf
- MdeModulePkg/Universal/BdsDxe/BdsDxe.inf {
- <LibraryClasses>
- NULL|MdeModulePkg/Library/BmpImageDecoderLib/BmpImageDecoderLib.inf
- }
+ MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
+ MdeModulePkg/Logo/LogoDxe.inf
MdeModulePkg/Application/UiApp/UiApp.inf {
<LibraryClasses>
NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf
diff --git a/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc b/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
index 2571884..a2e82b3 100644
--- a/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
+++ b/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
@@ -181,9 +181,7 @@ [FV.FvMain]
#
# TianoCore logo (splash screen)
#
- FILE FREEFORM = PCD(gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile) {
- SECTION RAW = MdeModulePkg/Logo/Logo.bmp
- }
+ INF MdeModulePkg/Logo/LogoDxe.inf

#
# Ramdisk support
diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc b/ArmVirtPkg/ArmVirtQemuKernel.dsc
index e0dcf43..e483a27 100644
--- a/ArmVirtPkg/ArmVirtQemuKernel.dsc
+++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc
@@ -61,7 +61,6 @@ [LibraryClasses.common]
CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
- ImageDecoderLib|MdeModulePkg/Library/ImageDecoderLib/ImageDecoderLib.inf
PlatformBootManagerLib|ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
QemuBootOrderLib|OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.inf
@@ -320,10 +319,8 @@ [Components.common]
MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf
- MdeModulePkg/Universal/BdsDxe/BdsDxe.inf {
- <LibraryClasses>
- NULL|MdeModulePkg/Library/BmpImageDecoderLib/BmpImageDecoderLib.inf
- }
+ MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
+ MdeModulePkg/Logo/LogoDxe.inf
MdeModulePkg/Application/UiApp/UiApp.inf {
<LibraryClasses>
NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf
diff --git a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
index 5d7c2a4..aecad57 100644
--- a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
+++ b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
@@ -657,13 +657,7 @@ PlatformBootManagerAfterConsole (
//
// Show the splash screen.
//
- // BootLogoEnableLogo (
- // ImageFormatBmp, // ImageFormat
- // PcdGetPtr (PcdLogoFile), // Logo
- // EdkiiPlatformLogoDisplayAttributeCenter, // Attribute
- // 0, // OffsetX
- // 0 // OffsetY
- // );
+ BootLogoEnableLogo ();

//
// Connect the rest of the devices.
--
2.9.0.windows.1


[PATCH v2 17/19] Nt32Pkg: Use the new LogoDxe driver

Ruiyu Ni <ruiyu.ni@...>
 

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>
---
Nt32Pkg/Library/PlatformBootManagerLib/PlatformBootManager.c | 2 +-
Nt32Pkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf | 4 +---
Nt32Pkg/Nt32Pkg.dsc | 7 ++-----
Nt32Pkg/Nt32Pkg.fdf | 5 +----
4 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/Nt32Pkg/Library/PlatformBootManagerLib/PlatformBootManager.c b/Nt32Pkg/Library/PlatformBootManagerLib/PlatformBootManager.c
index 373442e..07068f9 100644
--- a/Nt32Pkg/Library/PlatformBootManagerLib/PlatformBootManager.c
+++ b/Nt32Pkg/Library/PlatformBootManagerLib/PlatformBootManager.c
@@ -42,7 +42,7 @@ PlatformBootManagerDiagnostics (
// from the graphic lib
//
if (QuietBoot) {
- // BootLogoEnableLogo (ImageFormatBmp, PcdGetPtr(PcdLogoFile), EdkiiPlatformLogoDisplayAttributeCenter, 0, 0);
+ BootLogoEnableLogo ();

//
// Perform system diagnostic
diff --git a/Nt32Pkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf b/Nt32Pkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
index c552f97..91fbcc8 100644
--- a/Nt32Pkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+++ b/Nt32Pkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
@@ -1,7 +1,7 @@
## @file
# Include all platform action which can be customized by IBV/OEM.
#
-# Copyright (c) 2012 - 2015, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2012 - 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
# which accompanies this distribution. The full text of the license may be found at
@@ -71,5 +71,3 @@ [Pcd]
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn
gEfiMdeModulePkgTokenSpaceGuid.PcdConInConnectOnDemand
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdBootlogoOnlyEnable
- gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile
- gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile
diff --git a/Nt32Pkg/Nt32Pkg.dsc b/Nt32Pkg/Nt32Pkg.dsc
index 408cc51..4458c02 100644
--- a/Nt32Pkg/Nt32Pkg.dsc
+++ b/Nt32Pkg/Nt32Pkg.dsc
@@ -119,7 +119,6 @@ [LibraryClasses]
TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.inf
CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
- ImageDecoderLib|MdeModulePkg/Library/ImageDecoderLib/ImageDecoderLib.inf
BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
#
# Platform
@@ -447,10 +446,7 @@ [Components]
NetworkPkg/HttpDxe/HttpDxe.inf
NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf

- MdeModulePkg/Universal/BdsDxe/BdsDxe.inf {
- <LibraryClasses>
- NULL|MdeModulePkg/Library/BmpImageDecoderLib/BmpImageDecoderLib.inf
- }
+ MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
MdeModulePkg/Application/UiApp/UiApp.inf{
<LibraryClasses>
NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf
@@ -474,6 +470,7 @@ [Components]
<LibraryClasses>
NULL|IntelFrameworkModulePkg/Library/LegacyBootManagerLib/LegacyBootManagerLib.inf
}
+ MdeModulePkg/Logo/LogoDxe.inf

###################################################################################################
#
diff --git a/Nt32Pkg/Nt32Pkg.fdf b/Nt32Pkg/Nt32Pkg.fdf
index bd9eeca..cf00a13 100644
--- a/Nt32Pkg/Nt32Pkg.fdf
+++ b/Nt32Pkg/Nt32Pkg.fdf
@@ -279,10 +279,7 @@ [FV.FvRecovery]

INF FatPkg/EnhancedFatDxe/Fat.inf

-FILE FREEFORM = PCD(gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile) {
- SECTION RAW = MdeModulePkg/Logo/Logo.bmp
- }
-
+INF MdeModulePkg/Logo/LogoDxe.inf
INF MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.inf
################################################################################
#
--
2.9.0.windows.1


[PATCH v2 16/19] MdeModulePkg/Logo: Add LogoDxe module

Ruiyu Ni <ruiyu.ni@...>
 

LogoDxe embeds the image resource in the PE resource section, then
it produces Platform Logo protocol which can return the images
in pixel format.
HiiImageEx protocol is responsible to decode the JPEG/PNG images
to pixel format. LogoDxe driver uses HiiImageEx 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/Logo/Logo.c | 156 +++++++++++++++++++++++++++++++++++++
MdeModulePkg/Logo/Logo.idf | 18 +++++
MdeModulePkg/Logo/LogoDxe.inf | 60 ++++++++++++++
MdeModulePkg/Logo/LogoDxe.uni | 21 +++++
MdeModulePkg/Logo/LogoDxeExtra.uni | 19 +++++
5 files changed, 274 insertions(+)
create mode 100644 MdeModulePkg/Logo/Logo.c
create mode 100644 MdeModulePkg/Logo/Logo.idf
create mode 100644 MdeModulePkg/Logo/LogoDxe.inf
create mode 100644 MdeModulePkg/Logo/LogoDxe.uni
create mode 100644 MdeModulePkg/Logo/LogoDxeExtra.uni

diff --git a/MdeModulePkg/Logo/Logo.c b/MdeModulePkg/Logo/Logo.c
new file mode 100644
index 0000000..f0792ad
--- /dev/null
+++ b/MdeModulePkg/Logo/Logo.c
@@ -0,0 +1,156 @@
+/** @file
+ Logo DXE Driver, install Edkii Platform Logo protocol.
+
+Copyright (c) 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
+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.
+
+**/
+#include <Uefi.h>
+#include <Protocol/HiiDatabase.h>
+#include <Protocol/GraphicsOutput.h>
+#include <Protocol/HiiImageEx.h>
+#include <Protocol/PlatformLogo.h>
+#include <Protocol/HiiPackageList.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/DebugLib.h>
+
+typedef struct {
+ EFI_IMAGE_ID ImageId;
+ EDKII_PLATFORM_LOGO_DISPLAY_ATTRIBUTE Attribute;
+ INTN OffsetX;
+ INTN OffsetY;
+} LOGO_ENTRY;
+
+EFI_HII_IMAGE_EX_PROTOCOL *mHiiImageEx;
+EFI_HII_HANDLE mHiiHandle;
+LOGO_ENTRY mLogos[] = {
+ {
+ IMAGE_TOKEN (IMG_LOGO),
+ EdkiiPlatformLogoDisplayAttributeCenter,
+ 0,
+ 0
+ }
+};
+
+/**
+ Load a platform logo image and return its data and attributes.
+
+ @param This The pointer to this protocol instance.
+ @param Instance The visible image instance is found.
+ @param Image Points to the image.
+ @param Attribute The display attributes of the image returned.
+ @param OffsetX The X offset of the image regarding the Attribute.
+ @param OffsetY The Y offset of the image regarding the Attribute.
+
+ @retval EFI_SUCCESS The image was fetched successfully.
+ @retval EFI_NOT_FOUND The specified image could not be found.
+**/
+EFI_STATUS
+EFIAPI
+GetImage (
+ IN EDKII_PLATFORM_LOGO_PROTOCOL *This,
+ IN OUT UINT32 *Instance,
+ OUT EFI_IMAGE_INPUT *Image,
+ OUT EDKII_PLATFORM_LOGO_DISPLAY_ATTRIBUTE *Attribute,
+ OUT INTN *OffsetX,
+ OUT INTN *OffsetY
+ )
+{
+ UINT32 Current;
+ if (Instance == NULL || Image == NULL ||
+ Attribute == NULL || OffsetX == NULL || OffsetY == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Current = *Instance;
+ if (Current >= sizeof (mLogos) / sizeof (mLogos[0])) {
+ return EFI_NOT_FOUND;
+ }
+
+ (*Instance)++;
+ *Attribute = mLogos[Current].Attribute;
+ *OffsetX = mLogos[Current].OffsetX;
+ *OffsetY = mLogos[Current].OffsetY;
+ return mHiiImageEx->GetImageEx (mHiiImageEx, mHiiHandle, mLogos[Current].ImageId, Image);
+}
+
+EDKII_PLATFORM_LOGO_PROTOCOL mPlatformLogo = {
+ GetImage
+};
+
+/**
+ Entrypoint of this module.
+
+ This function is the entrypoint of this module. It installs the Edkii
+ Platform Logo protocol.
+
+ @param ImageHandle The firmware allocated handle for the EFI image.
+ @param SystemTable A pointer to the EFI System Table.
+
+ @retval EFI_SUCCESS The entry point is executed successfully.
+
+**/
+EFI_STATUS
+EFIAPI
+InitializeLogo (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ EFI_HII_PACKAGE_LIST_HEADER *PackageList;
+ EFI_HII_DATABASE_PROTOCOL *HiiDatabase;
+ EFI_HANDLE Handle;
+
+ Status = gBS->LocateProtocol (
+ &gEfiHiiDatabaseProtocolGuid,
+ NULL,
+ (VOID **) &HiiDatabase
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ Status = gBS->LocateProtocol (
+ &gEfiHiiImageExProtocolGuid,
+ NULL,
+ (VOID **) &mHiiImageEx
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // Retrieve HII package list from ImageHandle
+ //
+ Status = gBS->OpenProtocol (
+ ImageHandle,
+ &gEfiHiiPackageListProtocolGuid,
+ (VOID **) &PackageList,
+ ImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // Publish HII package list to HII Database.
+ //
+ Status = HiiDatabase->NewPackageList (
+ HiiDatabase,
+ PackageList,
+ NULL,
+ &mHiiHandle
+ );
+ if (!EFI_ERROR (Status)) {
+ Handle = NULL;
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &Handle,
+ &gEdkiiPlatformLogoProtocolGuid, &mPlatformLogo,
+ NULL
+ );
+ }
+ return Status;
+}
diff --git a/MdeModulePkg/Logo/Logo.idf b/MdeModulePkg/Logo/Logo.idf
new file mode 100644
index 0000000..f4c39b7
--- /dev/null
+++ b/MdeModulePkg/Logo/Logo.idf
@@ -0,0 +1,18 @@
+// /** @file
+// Platform Logo image definition file.
+//
+// Console Platfrom DXE Driver that specifies whether device can be used as console
+// input/output device or error output device and update global variables accordingly.
+//
+// Copyright (c) 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
+// 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.
+//
+// **/
+
+#image IMG_LOGO Logo.bmp
diff --git a/MdeModulePkg/Logo/LogoDxe.inf b/MdeModulePkg/Logo/LogoDxe.inf
new file mode 100644
index 0000000..3ffc64b
--- /dev/null
+++ b/MdeModulePkg/Logo/LogoDxe.inf
@@ -0,0 +1,60 @@
+## @file
+# The default logo bitmap picture shown on setup screen.
+#
+# Copyright (c) 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
+# 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.
+#
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = LogoDxe
+ MODULE_UNI_FILE = LogoDxe.uni
+ FILE_GUID = F74D20EE-37E7-48FC-97F7-9B1047749C69
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+
+ ENTRY_POINT = InitializeLogo
+#
+# This flag specifies whether HII resource section is generated into PE image.
+#
+ UEFI_HII_RESOURCE_SECTION = TRUE
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64
+#
+
+[Sources]
+ Logo.bmp
+ Logo.c
+ Logo.idf
+
+[Packages]
+ MdeModulePkg/MdeModulePkg.dec
+ MdePkg/MdePkg.dec
+
+[LibraryClasses]
+ UefiBootServicesTableLib
+ UefiDriverEntryPoint
+ DebugLib
+
+[Protocols]
+ gEfiHiiDatabaseProtocolGuid ## CONSUMES
+ gEfiHiiImageExProtocolGuid ## CONSUMES
+ gEfiHiiPackageListProtocolGuid ## PRODUCES CONSUMES
+ gEdkiiPlatformLogoProtocolGuid ## PRODUCES
+
+[Depex]
+ gEfiHiiDatabaseProtocolGuid
+
+[UserExtensions.TianoCore."ExtraFiles"]
+ LogoDxeExtra.uni
diff --git a/MdeModulePkg/Logo/LogoDxe.uni b/MdeModulePkg/Logo/LogoDxe.uni
new file mode 100644
index 0000000..698776d
--- /dev/null
+++ b/MdeModulePkg/Logo/LogoDxe.uni
@@ -0,0 +1,21 @@
+// /** @file
+// The default logo bitmap picture shown on setup screen.
+//
+// This module provides the default logo bitmap picture shown on setup screen, through EDKII Platform Logo protocol.
+//
+// Copyright (c) 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
+// 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.
+//
+// **/
+
+
+#string STR_MODULE_ABSTRACT #language en-US "Provides the default logo bitmap picture shown on setup screen."
+
+#string STR_MODULE_DESCRIPTION #language en-US "This module provides the default logo bitmap picture shown on setup screen, through EDKII Platform Logo protocol."
+
diff --git a/MdeModulePkg/Logo/LogoDxeExtra.uni b/MdeModulePkg/Logo/LogoDxeExtra.uni
new file mode 100644
index 0000000..1aead5a
--- /dev/null
+++ b/MdeModulePkg/Logo/LogoDxeExtra.uni
@@ -0,0 +1,19 @@
+// /** @file
+// Logo Localized Strings and Content
+//
+// Copyright (c) 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
+// 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.
+//
+// **/
+
+#string STR_PROPERTIES_MODULE_NAME
+#language en-US
+"Logo Image File"
+
+
--
2.9.0.windows.1


[PATCH v2 15/19] MdeModulePkg/BootLogoLib&PlatformLogo: Use HII data types in parameters

Ruiyu Ni <ruiyu.ni@...>
 

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 | 20 +--
MdeModulePkg/Library/BootLogoLib/BootLogoLib.c | 204 +++++++++--------------
MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf | 8 +-
MdeModulePkg/MdeModulePkg.dec | 2 +-
5 files changed, 89 insertions(+), 164 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..4773173 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,23 +16,17 @@ 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
//
#define EDKII_PLATFORM_LOGO_PROTOCOL_GUID \
- { 0x9b517978, 0xeba1, 0x44e7, { 0xba, 0x65, 0x7c, 0x2c, 0xd0, 0x8b, 0xf8, 0xe9 } }
+ { 0x53cd299f, 0x2bc1, 0x40c0, { 0x8c, 0x07, 0x23, 0xf6, 0x4f, 0xdb, 0x30, 0xe0 } }

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..79b5fc5 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
@@ -17,7 +17,7 @@ [Defines]
INF_VERSION = 0x00010005
BASE_NAME = BootLogoLib
MODULE_UNI_FILE = BootLogoLib.uni
- FILE_GUID = F5AE5B5C-42E8-4A9B-829D-5B631CD5367A
+ FILE_GUID = 85CDAFAD-13BE-422A-A8E5-55A249600DC3
MODULE_TYPE = DXE_DRIVER
VERSION_STRING = 1.0
LIBRARY_CLASS = BootLogoLib|DXE_DRIVER UEFI_APPLICATION
@@ -44,10 +44,6 @@ [LibraryClasses]
DebugLib
PrintLib
PcdLib
- DxeServicesLib
- ImageDecoderLib
-
-[Guids]

[Protocols]
gEfiGraphicsOutputProtocolGuid ## SOMETIMES_CONSUMES
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 8d90f16..410c90a 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -491,7 +491,7 @@ [Protocols]
gEdkiiSmmReadyToBootProtocolGuid = { 0x6e057ecf, 0xfa99, 0x4f39, { 0x95, 0xbc, 0x59, 0xf9, 0x92, 0x1d, 0x17, 0xe4 } }

## Include/Protocol/PlatformLogo.h
- gEdkiiPlatformLogoProtocolGuid = { 0x9b517978, 0xeba1, 0x44e7, { 0xba, 0x65, 0x7c, 0x2c, 0xd0, 0x8b, 0xf8, 0xe9 } }
+ gEdkiiPlatformLogoProtocolGuid = { 0x53cd299f, 0x2bc1, 0x40c0, { 0x8c, 0x07, 0x23, 0xf6, 0x4f, 0xdb, 0x30, 0xe0 } }

## Include/Protocol/FileExplorer.h
gEfiFileExplorerProtocolGuid = { 0x2C03C536, 0x4594, 0x4515, { 0x9E, 0x7A, 0xD3, 0xD2, 0x04, 0xFE, 0x13, 0x63 } }
--
2.9.0.windows.1


[PATCH v2 14/19] OvmfPkg/PlatformBds: Do not call BootLogoEnableLogo

Ruiyu Ni <ruiyu.ni@...>
 

Prototype of BootLogoEnableLogo will change in following patches, so
do not call BootLogoEnableLogo to avoid build failure.

Contributed-under: TianoCore Contribution Agreement 1.0
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
---
OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c | 14 +++++++-------
.../PlatformBootManagerLib/PlatformBootManagerLib.inf | 1 -
2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
index 7cd547e..4c5d259 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
@@ -1445,13 +1445,13 @@ Routine Description:
//
// Logo show
//
- BootLogoEnableLogo (
- ImageFormatBmp, // ImageFormat
- PcdGetPtr (PcdLogoFile), // Logo
- EdkiiPlatformLogoDisplayAttributeCenter, // Attribute
- 0, // OffsetX
- 0 // OffsetY
- );
+ //BootLogoEnableLogo (
+ // ImageFormatBmp, // ImageFormat
+ // PcdGetPtr (PcdLogoFile), // Logo
+ // EdkiiPlatformLogoDisplayAttributeCenter, // Attribute
+ // 0, // OffsetX
+ // 0 // OffsetY
+ // );

//
// Perform some platform specific connect sequence
diff --git a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
index f3303b9..4a6bece 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+++ b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
@@ -56,7 +56,6 @@ [LibraryClasses]
UefiLib

[Pcd]
- gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile
gUefiOvmfPkgTokenSpaceGuid.PcdEmuVariableEvent
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashVariablesEnable
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId
--
2.9.0.windows.1


[PATCH v2 13/19] ArmVirtPkg/PlatformBds: Do not call BootLogoEnableLogo

Ruiyu Ni <ruiyu.ni@...>
 

Prototype of BootLogoEnableLogo will change in following patches, so
do not call BootLogoEnableLogo to avoid build failure.

Contributed-under: TianoCore Contribution Agreement 1.0
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
---
ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c | 14 +++++++-------
.../PlatformBootManagerLib/PlatformBootManagerLib.inf | 1 -
2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
index c11196a..5d7c2a4 100644
--- a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
+++ b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
@@ -657,13 +657,13 @@ PlatformBootManagerAfterConsole (
//
// Show the splash screen.
//
- BootLogoEnableLogo (
- ImageFormatBmp, // ImageFormat
- PcdGetPtr (PcdLogoFile), // Logo
- EdkiiPlatformLogoDisplayAttributeCenter, // Attribute
- 0, // OffsetX
- 0 // OffsetY
- );
+ // BootLogoEnableLogo (
+ // ImageFormatBmp, // ImageFormat
+ // PcdGetPtr (PcdLogoFile), // Logo
+ // EdkiiPlatformLogoDisplayAttributeCenter, // Attribute
+ // 0, // OffsetX
+ // 0 // OffsetY
+ // );

//
// Connect the rest of the devices.
diff --git a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
index bec7fab..1f162c6 100644
--- a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+++ b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
@@ -58,7 +58,6 @@ [LibraryClasses]
UefiRuntimeServicesTableLib

[FixedPcd]
- gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits
--
2.9.0.windows.1


[PATCH v2 12/19] Nt32Pkg/PlatformBds: Do not call BootLogoEnableLogo

Ruiyu Ni <ruiyu.ni@...>
 

Prototype of BootLogoEnableLogo will change in following patches, so
do not call BootLogoEnableLogo to avoid build failure.

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>
---
Nt32Pkg/Library/PlatformBootManagerLib/PlatformBootManager.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Nt32Pkg/Library/PlatformBootManagerLib/PlatformBootManager.c b/Nt32Pkg/Library/PlatformBootManagerLib/PlatformBootManager.c
index 76d926b..373442e 100644
--- a/Nt32Pkg/Library/PlatformBootManagerLib/PlatformBootManager.c
+++ b/Nt32Pkg/Library/PlatformBootManagerLib/PlatformBootManager.c
@@ -2,7 +2,7 @@
This file include all platform action which can be customized
by IBV/OEM.

-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
which accompanies this distribution. The full text of the license may be found at
@@ -42,7 +42,7 @@ PlatformBootManagerDiagnostics (
// from the graphic lib
//
if (QuietBoot) {
- BootLogoEnableLogo (ImageFormatBmp, PcdGetPtr(PcdLogoFile), EdkiiPlatformLogoDisplayAttributeCenter, 0, 0);
+ // BootLogoEnableLogo (ImageFormatBmp, PcdGetPtr(PcdLogoFile), EdkiiPlatformLogoDisplayAttributeCenter, 0, 0);

//
// Perform system diagnostic
--
2.9.0.windows.1


[PATCH v2 11/19] MdeModulePkg/HiiDatabase: Add HiiImageEx implementation.

Ruiyu Ni <ruiyu.ni@...>
 

According to UEFI spec, NewImageEx()/SetImageEx()/DrawImageEx()
implicitly call the non-Ex version interface
of HiiImage protocol.
GetImageEx()/DrawImageIdEx() are the enhanced version of
GetImage()/DrawImageId(), which can support decoding JPEG/PNG
through the help of HiiImageDecoder 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>
---
.../Universal/HiiDatabaseDxe/HiiDatabase.h | 293 +++++++++++++-
.../Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf | 7 +-
.../Universal/HiiDatabaseDxe/HiiDatabaseEntry.c | 32 +-
MdeModulePkg/Universal/HiiDatabaseDxe/Image.c | 120 ++++--
MdeModulePkg/Universal/HiiDatabaseDxe/ImageEx.c | 423 +++++++++++++++++++++
5 files changed, 822 insertions(+), 53 deletions(-)
create mode 100644 MdeModulePkg/Universal/HiiDatabaseDxe/ImageEx.c

diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
index 0ca2fba..ee49364 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
@@ -20,6 +20,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Protocol/DevicePath.h>
#include <Protocol/HiiFont.h>
#include <Protocol/HiiImage.h>
+#include <Protocol/HiiImageEx.h>
+#include <Protocol/HiiImageDecoder.h>
#include <Protocol/HiiString.h>
#include <Protocol/HiiDatabase.h>
#include <Protocol/HiiConfigRouting.h>
@@ -301,6 +303,7 @@ typedef struct _HII_DATABASE_PRIVATE_DATA {
LIST_ENTRY DatabaseNotifyList;
EFI_HII_FONT_PROTOCOL HiiFont;
EFI_HII_IMAGE_PROTOCOL HiiImage;
+ EFI_HII_IMAGE_EX_PROTOCOL HiiImageEx;
EFI_HII_STRING_PROTOCOL HiiString;
EFI_HII_DATABASE_PROTOCOL HiiDatabase;
EFI_HII_CONFIG_ROUTING_PROTOCOL ConfigRouting;
@@ -327,6 +330,13 @@ typedef struct _HII_DATABASE_PRIVATE_DATA {
HII_DATABASE_PRIVATE_DATA_SIGNATURE \
)

+#define HII_IMAGE_EX_DATABASE_PRIVATE_DATA_FROM_THIS(a) \
+ CR (a, \
+ HII_DATABASE_PRIVATE_DATA, \
+ HiiImageEx, \
+ HII_DATABASE_PRIVATE_DATA_SIGNATURE \
+ )
+
#define HII_STRING_DATABASE_PRIVATE_DATA_FROM_THIS(a) \
CR (a, \
HII_DATABASE_PRIVATE_DATA, \
@@ -813,6 +823,82 @@ HiiGetFontInfo (
// EFI_HII_IMAGE_PROTOCOL interfaces
//

+/**
+ Get the image id of last image block: EFI_HII_IIBT_END_BLOCK when input
+ ImageId is zero, otherwise return the address of the
+ corresponding image block with identifier specified by ImageId.
+
+ This is a internal function.
+
+ @param ImageBlocks Points to the beginning of a series of image blocks stored in order.
+ @param ImageId If input ImageId is 0, output the image id of the EFI_HII_IIBT_END_BLOCK;
+ else use this id to find its corresponding image block address.
+
+ @return The image block address when input ImageId is not zero; otherwise return NULL.
+
+**/
+EFI_HII_IMAGE_BLOCK *
+GetImageIdOrAddress (
+ IN EFI_HII_IMAGE_BLOCK *ImageBlocks,
+ IN OUT EFI_IMAGE_ID *ImageId
+ );
+
+/**
+ Return the HII package list identified by PackageList HII handle.
+
+ @param Database Pointer to HII database list header.
+ @param PackageList HII handle of the package list to locate.
+
+ @retval The HII package list instance.
+**/
+HII_DATABASE_PACKAGE_LIST_INSTANCE *
+LocatePackageList (
+ IN LIST_ENTRY *Database,
+ IN EFI_HII_HANDLE PackageList
+ );
+
+/**
+ This function retrieves the image specified by ImageId which is associated with
+ the specified PackageList and copies it into the buffer specified by Image.
+
+ @param Database A pointer to the database list header.
+ @param PackageList Handle of the package list where this image will
+ be searched.
+ @param ImageId The image's id,, which is unique within
+ PackageList.
+ @param Image Points to the image.
+ @param BitmapOnly TRUE to only return the bitmap type image.
+ FALSE to locate image decoder instance to decode image.
+
+ @retval EFI_SUCCESS The new image was returned successfully.
+ @retval EFI_NOT_FOUND The image specified by ImageId is not in the
+ database. The specified PackageList is not in the database.
+ @retval EFI_BUFFER_TOO_SMALL The buffer specified by ImageSize is too small to
+ hold the image.
+ @retval EFI_INVALID_PARAMETER The Image or ImageSize was NULL.
+ @retval EFI_OUT_OF_RESOURCES The bitmap could not be retrieved because there was not
+ enough memory.
+**/
+EFI_STATUS
+IGetImage (
+ IN LIST_ENTRY *Database,
+ IN EFI_HII_HANDLE PackageList,
+ IN EFI_IMAGE_ID ImageId,
+ OUT EFI_IMAGE_INPUT *Image,
+ IN BOOLEAN BitmapOnly
+ );
+
+/**
+ Return the first HII image decoder instance which supports the DecoderName.
+
+ @param BlockType The image block type.
+
+ @retval Pointer to the HII image decoder instance.
+**/
+EFI_HII_IMAGE_DECODER_PROTOCOL *
+LocateHiiImageDecoder (
+ UINT8 BlockType
+ );

/**
This function adds the image Image to the group of images owned by PackageList, and returns
@@ -984,10 +1070,213 @@ HiiDrawImageId (
IN OUT EFI_IMAGE_OUTPUT **Blt,
IN UINTN BltX,
IN UINTN BltY
- )
+ );

-;
+/**
+ The prototype of this extension function is the same with EFI_HII_IMAGE_PROTOCOL.NewImage().
+ This protocol invokes EFI_HII_IMAGE_PROTOCOL.NewImage() implicitly.
+
+ @param This A pointer to the EFI_HII_IMAGE_EX_PROTOCOL instance.
+ @param PackageList Handle of the package list where this image will
+ be added.
+ @param ImageId On return, contains the new image id, which is
+ unique within PackageList.
+ @param Image Points to the image.
+
+ @retval EFI_SUCCESS The new image was added successfully.
+ @retval EFI_NOT_FOUND The PackageList could not be found.
+ @retval EFI_OUT_OF_RESOURCES Could not add the image due to lack of resources.
+ @retval EFI_INVALID_PARAMETER Image is NULL or ImageId is NULL.
+**/
+EFI_STATUS
+EFIAPI
+HiiNewImageEx (
+ IN CONST EFI_HII_IMAGE_EX_PROTOCOL *This,
+ IN EFI_HII_HANDLE PackageList,
+ OUT EFI_IMAGE_ID *ImageId,
+ IN CONST EFI_IMAGE_INPUT *Image
+ );

+/**
+ Return the information about the image, associated with the package list.
+ The prototype of this extension function is the same with EFI_HII_IMAGE_PROTOCOL.GetImage().
+
+ This function is similar to EFI_HII_IMAGE_PROTOCOL.GetImage(). The difference is that
+ this function will locate all EFI_HII_IMAGE_DECODER_PROTOCOL instances installed in the
+ system if the decoder of the certain image type is not supported by the
+ EFI_HII_IMAGE_EX_PROTOCOL. The function will attempt to decode the image to the
+ EFI_IMAGE_INPUT using the first EFI_HII_IMAGE_DECODER_PROTOCOL instance that
+ supports the requested image type.
+
+ @param This A pointer to the EFI_HII_IMAGE_EX_PROTOCOL instance.
+ @param PackageList The package list in the HII database to search for the
+ specified image.
+ @param ImageId The image's id, which is unique within PackageList.
+ @param Image Points to the image.
+
+ @retval EFI_SUCCESS The new image was returned successfully.
+ @retval EFI_NOT_FOUND The image specified by ImageId is not available. The specified
+ PackageList is not in the Database.
+ @retval EFI_INVALID_PARAMETER Image was NULL or ImageId was 0.
+ @retval EFI_OUT_OF_RESOURCES The bitmap could not be retrieved because there
+ was not enough memory.
+
+**/
+EFI_STATUS
+EFIAPI
+HiiGetImageEx (
+ IN CONST EFI_HII_IMAGE_EX_PROTOCOL *This,
+ IN EFI_HII_HANDLE PackageList,
+ IN EFI_IMAGE_ID ImageId,
+ OUT EFI_IMAGE_INPUT *Image
+ );
+
+/**
+ Change the information about the image.
+
+ Same with EFI_HII_IMAGE_PROTOCOL.SetImage(), this protocol invokes
+ EFI_HII_IMAGE_PROTOCOL.SetImage()implicitly.
+
+ @param This A pointer to the EFI_HII_IMAGE_EX_PROTOCOL instance.
+ @param PackageList The package list containing the images.
+ @param ImageId The image's id, which is unique within PackageList.
+ @param Image Points to the image.
+
+ @retval EFI_SUCCESS The new image was successfully updated.
+ @retval EFI_NOT_FOUND The image specified by ImageId is not in the
+ database. The specified PackageList is not in
+ the database.
+ @retval EFI_INVALID_PARAMETER The Image was NULL, the ImageId was 0 or
+ the Image->Bitmap was NULL.
+
+**/
+EFI_STATUS
+EFIAPI
+HiiSetImageEx (
+ IN CONST EFI_HII_IMAGE_EX_PROTOCOL *This,
+ IN EFI_HII_HANDLE PackageList,
+ IN EFI_IMAGE_ID ImageId,
+ IN CONST EFI_IMAGE_INPUT *Image
+ );
+
+/**
+ Renders an image to a bitmap or to the display.
+
+ The prototype of this extension function is the same with
+ EFI_HII_IMAGE_PROTOCOL.DrawImage(). This protocol invokes
+ EFI_HII_IMAGE_PROTOCOL.DrawImage() implicitly.
+
+ @param This A pointer to the EFI_HII_IMAGE_EX_PROTOCOL instance.
+ @param Flags Describes how the image is to be drawn.
+ @param Image Points to the image to be displayed.
+ @param Blt If this points to a non-NULL on entry, this points
+ to the image, which is Width pixels wide and
+ Height pixels high. The image will be drawn onto
+ this image and EFI_HII_DRAW_FLAG_CLIP is implied.
+ If this points to a NULL on entry, then a buffer
+ will be allocated to hold the generated image and
+ the pointer updated on exit. It is the caller's
+ responsibility to free this buffer.
+ @param BltX Specifies the offset from the left and top edge of
+ the output image of the first pixel in the image.
+ @param BltY Specifies the offset from the left and top edge of
+ the output image of the first pixel in the image.
+
+ @retval EFI_SUCCESS The image was successfully drawn.
+ @retval EFI_OUT_OF_RESOURCES Unable to allocate an output buffer for Blt.
+ @retval EFI_INVALID_PARAMETER The Image or Blt was NULL.
+
+**/
+EFI_STATUS
+EFIAPI
+HiiDrawImageEx (
+ IN CONST EFI_HII_IMAGE_EX_PROTOCOL *This,
+ IN EFI_HII_DRAW_FLAGS Flags,
+ IN CONST EFI_IMAGE_INPUT *Image,
+ IN OUT EFI_IMAGE_OUTPUT **Blt,
+ IN UINTN BltX,
+ IN UINTN BltY
+ );
+
+/**
+ Renders an image to a bitmap or the screen containing the contents of the specified
+ image.
+
+ This function is similar to EFI_HII_IMAGE_PROTOCOL.DrawImageId(). The difference is that
+ this function will locate all EFI_HII_IMAGE_DECODER_PROTOCOL instances installed in the
+ system if the decoder of the certain image type is not supported by the
+ EFI_HII_IMAGE_EX_PROTOCOL. The function will attempt to decode the image to the
+ EFI_IMAGE_INPUT using the first EFI_HII_IMAGE_DECODER_PROTOCOL instance that
+ supports the requested image type.
+
+ @param This A pointer to the EFI_HII_IMAGE_EX_PROTOCOL instance.
+ @param Flags Describes how the image is to be drawn.
+ @param PackageList The package list in the HII database to search for
+ the specified image.
+ @param ImageId The image's id, which is unique within PackageList.
+ @param Blt If this points to a non-NULL on entry, this points
+ to the image, which is Width pixels wide and
+ Height pixels high. The image will be drawn onto
+ this image and EFI_HII_DRAW_FLAG_CLIP is implied.
+ If this points to a NULL on entry, then a buffer
+ will be allocated to hold the generated image
+ and the pointer updated on exit. It is the caller's
+ responsibility to free this buffer.
+ @param BltX Specifies the offset from the left and top edge of
+ the output image of the first pixel in the image.
+ @param BltY Specifies the offset from the left and top edge of
+ the output image of the first pixel in the image.
+
+ @retval EFI_SUCCESS The image was successfully drawn.
+ @retval EFI_OUT_OF_RESOURCES Unable to allocate an output buffer for Blt.
+ @retval EFI_INVALID_PARAMETER The Blt was NULL or ImageId was 0.
+ @retval EFI_NOT_FOUND The image specified by ImageId is not in the database.
+ The specified PackageList is not in the database.
+
+**/
+EFI_STATUS
+EFIAPI
+HiiDrawImageIdEx (
+ IN CONST EFI_HII_IMAGE_EX_PROTOCOL *This,
+ IN EFI_HII_DRAW_FLAGS Flags,
+ IN EFI_HII_HANDLE PackageList,
+ IN EFI_IMAGE_ID ImageId,
+ IN OUT EFI_IMAGE_OUTPUT **Blt,
+ IN UINTN BltX,
+ IN UINTN BltY
+ );
+
+/**
+ This function returns the image information to EFI_IMAGE_OUTPUT. Only the width
+ and height are returned to the EFI_IMAGE_OUTPUT instead of decoding the image
+ to the buffer. This function is used to get the geometry of the image. This function
+ will try to locate all of the EFI_HII_IMAGE_DECODER_PROTOCOL installed on the
+ system if the decoder of image type is not supported by the EFI_HII_IMAGE_EX_PROTOCOL.
+
+ @param This A pointer to the EFI_HII_IMAGE_EX_PROTOCOL instance.
+ @param PackageList Handle of the package list where this image will
+ be searched.
+ @param ImageId The image's id, which is unique within PackageList.
+ @param Image Points to the image.
+
+ @retval EFI_SUCCESS The new image was returned successfully.
+ @retval EFI_NOT_FOUND The image specified by ImageId is not in the
+ database. The specified PackageList is not in the database.
+ @retval EFI_BUFFER_TOO_SMALL The buffer specified by ImageSize is too small to
+ hold the image.
+ @retval EFI_INVALID_PARAMETER The Image was NULL or the ImageId was 0.
+ @retval EFI_OUT_OF_RESOURCES The bitmap could not be retrieved because there
+ was not enough memory.
+
+**/
+EFI_STATUS
+EFIAPI
+HiiGetImageInfo (
+ IN CONST EFI_HII_IMAGE_EX_PROTOCOL *This,
+ IN EFI_HII_HANDLE PackageList,
+ IN EFI_IMAGE_ID ImageId,
+ OUT EFI_IMAGE_OUTPUT *Image
+ );
//
// EFI_HII_STRING_PROTOCOL
//
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
index 2fb619e..f82a1f4 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
@@ -35,6 +35,7 @@ [Defines]
[Sources]
HiiDatabaseEntry.c
Image.c
+ ImageEx.c
HiiDatabase.h
ConfigRouting.c
String.c
@@ -63,7 +64,9 @@ [LibraryClasses]
[Protocols]
gEfiDevicePathProtocolGuid ## SOMETIMES_CONSUMES
gEfiHiiStringProtocolGuid ## PRODUCES
- gEfiHiiImageProtocolGuid |gEfiMdeModulePkgTokenSpaceGuid.PcdSupportHiiImageProtocol ## SOMETIMES_PRODUCES
+ gEfiHiiImageProtocolGuid |gEfiMdeModulePkgTokenSpaceGuid.PcdSupportHiiImageProtocol ## SOMETIMES_PRODUCES
+ gEfiHiiImageExProtocolGuid |gEfiMdeModulePkgTokenSpaceGuid.PcdSupportHiiImageProtocol ## SOMETIMES_PRODUCES
+ gEfiHiiImageDecoderProtocolGuid |gEfiMdeModulePkgTokenSpaceGuid.PcdSupportHiiImageProtocol ## SOMETIMES_CONSUMES
gEfiHiiConfigRoutingProtocolGuid ## PRODUCES
gEfiHiiDatabaseProtocolGuid ## PRODUCES
gEfiHiiFontProtocolGuid ## PRODUCES
@@ -85,6 +88,8 @@ [Guids]
## CONSUMES ## Event
## PRODUCES ## Event
gEfiHiiKeyBoardLayoutGuid
+ gEfiHiiImageDecoderNameJpegGuid |gEfiMdeModulePkgTokenSpaceGuid.PcdSupportHiiImageProtocol ## SOMETIMES_CONSUMES
+ gEfiHiiImageDecoderNamePngGuid |gEfiMdeModulePkgTokenSpaceGuid.PcdSupportHiiImageProtocol ## SOMETIMES_CONSUMES

[Depex]
TRUE
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseEntry.c b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseEntry.c
index b48254f..9d09c60 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseEntry.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseEntry.c
@@ -39,11 +39,19 @@ HII_DATABASE_PRIVATE_DATA mPrivate = {
HiiGetFontInfo
},
{
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
+ HiiNewImage,
+ HiiGetImage,
+ HiiSetImage,
+ HiiDrawImage,
+ HiiDrawImageId
+ },
+ {
+ HiiNewImageEx,
+ HiiGetImageEx,
+ HiiSetImageEx,
+ HiiDrawImageEx,
+ HiiDrawImageIdEx,
+ HiiGetImageInfo
},
{
HiiNewString,
@@ -96,14 +104,6 @@ HII_DATABASE_PRIVATE_DATA mPrivate = {
NULL
};

-GLOBAL_REMOVE_IF_UNREFERENCED CONST EFI_HII_IMAGE_PROTOCOL mImageProtocol = {
- HiiNewImage,
- HiiGetImage,
- HiiSetImage,
- HiiDrawImage,
- HiiDrawImageId
-};
-
/**
The default event handler for gHiiKeyboardLayoutChanged
event group.
@@ -230,12 +230,10 @@ InitializeHiiDatabase (
}

if (FeaturePcdGet (PcdSupportHiiImageProtocol)) {
- CopyMem (&mPrivate.HiiImage, &mImageProtocol, sizeof (mImageProtocol));
-
Status = gBS->InstallMultipleProtocolInterfaces (
&Handle,
- &gEfiHiiImageProtocolGuid,
- &mPrivate.HiiImage,
+ &gEfiHiiImageProtocolGuid, &mPrivate.HiiImage,
+ &gEfiHiiImageExProtocolGuid, &mPrivate.HiiImageEx,
NULL
);

diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c b/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c
index c8e9258..1668828 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c
@@ -643,10 +643,6 @@ HiiNewImage (
return EFI_INVALID_PARAMETER;
}

- if (!IsHiiHandleValid (PackageList)) {
- return EFI_NOT_FOUND;
- }
-
Private = HII_IMAGE_DATABASE_PRIVATE_DATA_FROM_THIS (This);
PackageListNode = LocatePackageList (&Private->DatabaseList, PackageList);
if (PackageListNode == NULL) {
@@ -781,33 +777,34 @@ HiiNewImage (
This function retrieves the image specified by ImageId which is associated with
the specified PackageList and copies it into the buffer specified by Image.

- @param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.
+ @param Database A pointer to the database list header.
@param PackageList Handle of the package list where this image will
be searched.
@param ImageId The image's id,, which is unique within
PackageList.
@param Image Points to the image.
+ @param BitmapOnly TRUE to only return the bitmap type image.
+ FALSE to locate image decoder instance to decode image.

@retval EFI_SUCCESS The new image was returned successfully.
- @retval EFI_NOT_FOUND The image specified by ImageId is not in the
- database. The specified PackageList is not in the database.
+ @retval EFI_NOT_FOUND The image specified by ImageId is not in the
+ database. The specified PackageList is not in the database.
@retval EFI_BUFFER_TOO_SMALL The buffer specified by ImageSize is too small to
hold the image.
@retval EFI_INVALID_PARAMETER The Image or ImageSize was NULL.
@retval EFI_OUT_OF_RESOURCES The bitmap could not be retrieved because there was not
- enough memory.
-
+ enough memory.
**/
EFI_STATUS
-EFIAPI
-HiiGetImage (
- IN CONST EFI_HII_IMAGE_PROTOCOL *This,
+IGetImage (
+ IN LIST_ENTRY *Database,
IN EFI_HII_HANDLE PackageList,
IN EFI_IMAGE_ID ImageId,
- OUT EFI_IMAGE_INPUT *Image
+ OUT EFI_IMAGE_INPUT *Image,
+ IN BOOLEAN BitmapOnly
)
{
- HII_DATABASE_PRIVATE_DATA *Private;
+ EFI_STATUS Status;
HII_DATABASE_PACKAGE_LIST_INSTANCE *PackageListNode;
HII_IMAGE_PACKAGE_INSTANCE *ImagePackage;
EFI_HII_IMAGE_BLOCK *CurrentImageBlock;
@@ -818,17 +815,14 @@ HiiGetImage (
UINT8 *PaletteInfo;
UINT8 PaletteIndex;
UINT16 PaletteSize;
+ EFI_HII_IMAGE_DECODER_PROTOCOL *Decoder;
+ EFI_IMAGE_OUTPUT *ImageOut;

- if (This == NULL || Image == NULL || ImageId == 0) {
+ if (Image == NULL || ImageId == 0) {
return EFI_INVALID_PARAMETER;
}

- if (!IsHiiHandleValid (PackageList)) {
- return EFI_NOT_FOUND;
- }
-
- Private = HII_IMAGE_DATABASE_PRIVATE_DATA_FROM_THIS (This);
- PackageListNode = LocatePackageList (&Private->DatabaseList, PackageList);
+ PackageListNode = LocatePackageList (Database, PackageList);
if (PackageListNode == NULL) {
return EFI_NOT_FOUND;
}
@@ -845,14 +839,47 @@ HiiGetImage (
return EFI_NOT_FOUND;
}

+ Image->Flags = 0;
switch (CurrentImageBlock->BlockType) {
case EFI_HII_IIBT_IMAGE_JPEG:
case EFI_HII_IIBT_IMAGE_PNG:
+ if (BitmapOnly) {
+ return EFI_UNSUPPORTED;
+ }
+
+ ImageOut = NULL;
+ Decoder = LocateHiiImageDecoder (CurrentImageBlock->BlockType);
+ if (Decoder == NULL) {
+ return EFI_UNSUPPORTED;
+ }
//
- // HiiImage protocol doesn't support return JPEG/PNG.
- // Use HiiImageEx instead.
+ // Use the common block code since the definition of two structures is the same.
//
- return EFI_UNSUPPORTED;
+ ASSERT (OFFSET_OF (EFI_HII_IIBT_JPEG_BLOCK, Data) == OFFSET_OF (EFI_HII_IIBT_PNG_BLOCK, Data));
+ ASSERT (sizeof (((EFI_HII_IIBT_JPEG_BLOCK *) CurrentImageBlock)->Data) ==
+ sizeof (((EFI_HII_IIBT_PNG_BLOCK *) CurrentImageBlock)->Data));
+ ASSERT (OFFSET_OF (EFI_HII_IIBT_JPEG_BLOCK, Size) == OFFSET_OF (EFI_HII_IIBT_PNG_BLOCK, Size));
+ ASSERT (sizeof (((EFI_HII_IIBT_JPEG_BLOCK *) CurrentImageBlock)->Size) ==
+ sizeof (((EFI_HII_IIBT_PNG_BLOCK *) CurrentImageBlock)->Size));
+ Status = Decoder->DecodeImage (
+ Decoder,
+ ((EFI_HII_IIBT_JPEG_BLOCK *) CurrentImageBlock)->Data,
+ ((EFI_HII_IIBT_JPEG_BLOCK *) CurrentImageBlock)->Size,
+ &ImageOut,
+ FALSE
+ );
+
+ //
+ // Spec requires to use the first capable image decoder instance.
+ // The first image decoder instance may fail to decode the image.
+ //
+ if (!EFI_ERROR (Status)) {
+ Image->Bitmap = ImageOut->Image.Bitmap;
+ Image->Height = ImageOut->Height;
+ Image->Width = ImageOut->Width;
+ FreePool (ImageOut);
+ }
+ return Status;

case EFI_HII_IIBT_IMAGE_1BIT_TRANS:
case EFI_HII_IIBT_IMAGE_4BIT_TRANS:
@@ -870,7 +897,7 @@ HiiGetImage (
CopyMem (&Iibt1bit, CurrentImageBlock, sizeof (EFI_HII_IIBT_IMAGE_1BIT_BLOCK));
ImageLength = sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) *
(Iibt1bit.Bitmap.Width * Iibt1bit.Bitmap.Height);
- Image->Bitmap = (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) AllocateZeroPool (ImageLength);
+ Image->Bitmap = AllocateZeroPool (ImageLength);
if (Image->Bitmap == NULL) {
return EFI_OUT_OF_RESOURCES;
}
@@ -943,6 +970,41 @@ HiiGetImage (
}
}

+/**
+ This function retrieves the image specified by ImageId which is associated with
+ the specified PackageList and copies it into the buffer specified by Image.
+
+ @param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.
+ @param PackageList Handle of the package list where this image will
+ be searched.
+ @param ImageId The image's id,, which is unique within
+ PackageList.
+ @param Image Points to the image.
+
+ @retval EFI_SUCCESS The new image was returned successfully.
+ @retval EFI_NOT_FOUND The image specified by ImageId is not in the
+ database. The specified PackageList is not in the database.
+ @retval EFI_BUFFER_TOO_SMALL The buffer specified by ImageSize is too small to
+ hold the image.
+ @retval EFI_INVALID_PARAMETER The Image or ImageSize was NULL.
+ @retval EFI_OUT_OF_RESOURCES The bitmap could not be retrieved because there was not
+ enough memory.
+
+**/
+EFI_STATUS
+EFIAPI
+HiiGetImage (
+ IN CONST EFI_HII_IMAGE_PROTOCOL *This,
+ IN EFI_HII_HANDLE PackageList,
+ IN EFI_IMAGE_ID ImageId,
+ OUT EFI_IMAGE_INPUT *Image
+ )
+{
+ HII_DATABASE_PRIVATE_DATA *Private;
+ Private = HII_IMAGE_DATABASE_PRIVATE_DATA_FROM_THIS (This);
+ return IGetImage (&Private->DatabaseList, PackageList, ImageId, Image, TRUE);
+}
+

/**
This function updates the image specified by ImageId in the specified PackageListHandle to
@@ -984,10 +1046,6 @@ HiiSetImage (
return EFI_INVALID_PARAMETER;
}

- if (!IsHiiHandleValid (PackageList)) {
- return EFI_NOT_FOUND;
- }
-
Private = HII_IMAGE_DATABASE_PRIVATE_DATA_FROM_THIS (This);
PackageListNode = LocatePackageList (&Private->DatabaseList, PackageList);
if (PackageListNode == NULL) {
@@ -1394,10 +1452,6 @@ HiiDrawImageId (
return EFI_INVALID_PARAMETER;
}

- if (!IsHiiHandleValid (PackageList)) {
- return EFI_NOT_FOUND;
- }
-
//
// Get the specified Image.
//
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ImageEx.c b/MdeModulePkg/Universal/HiiDatabaseDxe/ImageEx.c
new file mode 100644
index 0000000..1e3f3bd
--- /dev/null
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ImageEx.c
@@ -0,0 +1,423 @@
+/** @file
+Implementation for EFI_HII_IMAGE_EX_PROTOCOL.
+
+
+Copyright (c) 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
+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.
+
+**/
+
+
+#include "HiiDatabase.h"
+
+/**
+ The prototype of this extension function is the same with EFI_HII_IMAGE_PROTOCOL.NewImage().
+ This protocol invokes EFI_HII_IMAGE_PROTOCOL.NewImage() implicitly.
+
+ @param This A pointer to the EFI_HII_IMAGE_EX_PROTOCOL instance.
+ @param PackageList Handle of the package list where this image will
+ be added.
+ @param ImageId On return, contains the new image id, which is
+ unique within PackageList.
+ @param Image Points to the image.
+
+ @retval EFI_SUCCESS The new image was added successfully.
+ @retval EFI_NOT_FOUND The PackageList could not be found.
+ @retval EFI_OUT_OF_RESOURCES Could not add the image due to lack of resources.
+ @retval EFI_INVALID_PARAMETER Image is NULL or ImageId is NULL.
+**/
+EFI_STATUS
+EFIAPI
+HiiNewImageEx (
+ IN CONST EFI_HII_IMAGE_EX_PROTOCOL *This,
+ IN EFI_HII_HANDLE PackageList,
+ OUT EFI_IMAGE_ID *ImageId,
+ IN CONST EFI_IMAGE_INPUT *Image
+ )
+{
+ HII_DATABASE_PRIVATE_DATA *Private;
+
+ Private = HII_IMAGE_EX_DATABASE_PRIVATE_DATA_FROM_THIS (This);
+ return HiiNewImage (&Private->HiiImage, PackageList, ImageId, Image);
+}
+
+/**
+ Return the information about the image, associated with the package list.
+ The prototype of this extension function is the same with EFI_HII_IMAGE_PROTOCOL.GetImage().
+
+ This function is similar to EFI_HII_IMAGE_PROTOCOL.GetImage().The difference is that
+ this function will locate all EFI_HII_IMAGE_DECODER_PROTOCOL instances installed in the
+ system if the decoder of the certain image type is not supported by the
+ EFI_HII_IMAGE_EX_PROTOCOL. The function will attempt to decode the image to the
+ EFI_IMAGE_INPUT using the first EFI_HII_IMAGE_DECODER_PROTOCOL instance that
+ supports the requested image type.
+
+ @param This A pointer to the EFI_HII_IMAGE_EX_PROTOCOL instance.
+ @param PackageList The package list in the HII database to search for the
+ specified image.
+ @param ImageId The image's id, which is unique within PackageList.
+ @param Image Points to the image.
+
+ @retval EFI_SUCCESS The new image was returned successfully.
+ @retval EFI_NOT_FOUND The image specified by ImageId is not available. The specified
+ PackageList is not in the Database.
+ @retval EFI_INVALID_PARAMETER Image was NULL or ImageId was 0.
+ @retval EFI_OUT_OF_RESOURCES The bitmap could not be retrieved because there
+ was not enough memory.
+
+**/
+EFI_STATUS
+EFIAPI
+HiiGetImageEx (
+ IN CONST EFI_HII_IMAGE_EX_PROTOCOL *This,
+ IN EFI_HII_HANDLE PackageList,
+ IN EFI_IMAGE_ID ImageId,
+ OUT EFI_IMAGE_INPUT *Image
+ )
+{
+ HII_DATABASE_PRIVATE_DATA *Private;
+
+ Private = HII_IMAGE_EX_DATABASE_PRIVATE_DATA_FROM_THIS (This);
+ return IGetImage (&Private->DatabaseList, PackageList, ImageId, Image, FALSE);
+}
+
+
+/**
+ Change the information about the image.
+
+ Same with EFI_HII_IMAGE_PROTOCOL.SetImage(),this protocol invokes
+ EFI_HII_IMAGE_PROTOCOL.SetImage()implicitly.
+
+ @param This A pointer to the EFI_HII_IMAGE_EX_PROTOCOL instance.
+ @param PackageList The package list containing the images.
+ @param ImageId The image's id, which is unique within PackageList.
+ @param Image Points to the image.
+
+ @retval EFI_SUCCESS The new image was successfully updated.
+ @retval EFI_NOT_FOUND The image specified by ImageId is not in the
+ database. The specified PackageList is not in
+ the database.
+ @retval EFI_INVALID_PARAMETER The Image was NULL, the ImageId was 0 or
+ the Image->Bitmap was NULL.
+
+**/
+EFI_STATUS
+EFIAPI
+HiiSetImageEx (
+ IN CONST EFI_HII_IMAGE_EX_PROTOCOL *This,
+ IN EFI_HII_HANDLE PackageList,
+ IN EFI_IMAGE_ID ImageId,
+ IN CONST EFI_IMAGE_INPUT *Image
+ )
+{
+ HII_DATABASE_PRIVATE_DATA *Private;
+ Private = HII_IMAGE_EX_DATABASE_PRIVATE_DATA_FROM_THIS (This);
+ return HiiSetImage (&Private->HiiImage, PackageList, ImageId, Image);
+}
+
+
+/**
+ Renders an image to a bitmap or to the display.
+
+ The prototype of this extension function is the same with
+ EFI_HII_IMAGE_PROTOCOL.DrawImage(). This protocol invokes
+ EFI_HII_IMAGE_PROTOCOL.DrawImage() implicitly.
+
+ @param This A pointer to the EFI_HII_IMAGE_EX_PROTOCOL instance.
+ @param Flags Describes how the image is to be drawn.
+ @param Image Points to the image to be displayed.
+ @param Blt If this points to a non-NULL on entry, this points
+ to the image, which is Width pixels wide and
+ Height pixels high. The image will be drawn onto
+ this image and EFI_HII_DRAW_FLAG_CLIP is implied.
+ If this points to a NULL on entry, then a buffer
+ will be allocated to hold the generated image and
+ the pointer updated on exit. It is the caller's
+ responsibility to free this buffer.
+ @param BltX Specifies the offset from the left and top edge of
+ the output image of the first pixel in the image.
+ @param BltY Specifies the offset from the left and top edge of
+ the output image of the first pixel in the image.
+
+ @retval EFI_SUCCESS The image was successfully drawn.
+ @retval EFI_OUT_OF_RESOURCES Unable to allocate an output buffer for Blt.
+ @retval EFI_INVALID_PARAMETER The Image or Blt was NULL.
+
+**/
+EFI_STATUS
+EFIAPI
+HiiDrawImageEx (
+ IN CONST EFI_HII_IMAGE_EX_PROTOCOL *This,
+ IN EFI_HII_DRAW_FLAGS Flags,
+ IN CONST EFI_IMAGE_INPUT *Image,
+ IN OUT EFI_IMAGE_OUTPUT **Blt,
+ IN UINTN BltX,
+ IN UINTN BltY
+ )
+{
+ HII_DATABASE_PRIVATE_DATA *Private;
+ Private = HII_IMAGE_EX_DATABASE_PRIVATE_DATA_FROM_THIS (This);
+ return HiiDrawImage (&Private->HiiImage, Flags, Image, Blt, BltX, BltY);
+}
+
+
+/**
+ Renders an image to a bitmap or the screen containing the contents of the specified
+ image.
+
+ This function is similar to EFI_HII_IMAGE_PROTOCOL.DrawImageId(). The difference is that
+ this function will locate all EFI_HII_IMAGE_DECODER_PROTOCOL instances installed in the
+ system if the decoder of the certain image type is not supported by the
+ EFI_HII_IMAGE_EX_PROTOCOL. The function will attempt to decode the image to the
+ EFI_IMAGE_INPUT using the first EFI_HII_IMAGE_DECODER_PROTOCOL instance that
+ supports the requested image type.
+
+ @param This A pointer to the EFI_HII_IMAGE_EX_PROTOCOL instance.
+ @param Flags Describes how the image is to be drawn.
+ @param PackageList The package list in the HII database to search for
+ the specified image.
+ @param ImageId The image's id, which is unique within PackageList.
+ @param Blt If this points to a non-NULL on entry, this points
+ to the image, which is Width pixels wide and
+ Height pixels high. The image will be drawn onto
+ this image and EFI_HII_DRAW_FLAG_CLIP is implied.
+ If this points to a NULL on entry, then a buffer
+ will be allocated to hold the generated image
+ and the pointer updated on exit. It is the caller's
+ responsibility to free this buffer.
+ @param BltX Specifies the offset from the left and top edge of
+ the output image of the first pixel in the image.
+ @param BltY Specifies the offset from the left and top edge of
+ the output image of the first pixel in the image.
+
+ @retval EFI_SUCCESS The image was successfully drawn.
+ @retval EFI_OUT_OF_RESOURCES Unable to allocate an output buffer for Blt.
+ @retval EFI_INVALID_PARAMETER The Blt was NULL or ImageId was 0.
+ @retval EFI_NOT_FOUND The image specified by ImageId is not in the database.
+ The specified PackageList is not in the database.
+
+**/
+EFI_STATUS
+EFIAPI
+HiiDrawImageIdEx (
+ IN CONST EFI_HII_IMAGE_EX_PROTOCOL *This,
+ IN EFI_HII_DRAW_FLAGS Flags,
+ IN EFI_HII_HANDLE PackageList,
+ IN EFI_IMAGE_ID ImageId,
+ IN OUT EFI_IMAGE_OUTPUT **Blt,
+ IN UINTN BltX,
+ IN UINTN BltY
+ )
+{
+ EFI_STATUS Status;
+ EFI_IMAGE_INPUT Image;
+
+ //
+ // Check input parameter.
+ //
+ if (This == NULL || Blt == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ //
+ // Get the specified Image.
+ //
+ Status = HiiGetImageEx (This, PackageList, ImageId, &Image);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ //
+ // Draw this image.
+ //
+ Status = HiiDrawImageEx (This, Flags, &Image, Blt, BltX, BltY);
+ if (Image.Bitmap != NULL) {
+ FreePool (Image.Bitmap);
+ }
+ return Status;
+}
+
+/**
+ Return the first HII image decoder instance which supports the DecoderName.
+
+ @param BlockType The image block type.
+
+ @retval Pointer to the HII image decoder instance.
+**/
+EFI_HII_IMAGE_DECODER_PROTOCOL *
+LocateHiiImageDecoder (
+ UINT8 BlockType
+ )
+{
+ EFI_STATUS Status;
+ EFI_HII_IMAGE_DECODER_PROTOCOL *Decoder;
+ EFI_HANDLE *Handles;
+ UINTN HandleNum;
+ UINTN Index;
+ EFI_GUID *DecoderNames;
+ UINT16 NumberOfDecoderName;
+ UINT16 DecoderNameIndex;
+ EFI_GUID *DecoderName;
+
+ switch (BlockType) {
+ case EFI_HII_IIBT_IMAGE_JPEG:
+ DecoderName = &gEfiHiiImageDecoderNameJpegGuid;
+ break;
+
+ case EFI_HII_IIBT_IMAGE_PNG:
+ DecoderName = &gEfiHiiImageDecoderNamePngGuid;
+ break;
+
+ default:
+ ASSERT (FALSE);
+ return NULL;
+ }
+
+ Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiHiiImageDecoderProtocolGuid, NULL, &HandleNum, &Handles);
+ if (EFI_ERROR (Status)) {
+ return NULL;
+ }
+ for (Index = 0; Index < HandleNum; Index++) {
+ Status = gBS->HandleProtocol (Handles[Index], &gEfiHiiImageDecoderProtocolGuid, (VOID **) &Decoder);
+ if (EFI_ERROR (Status)) {
+ continue;
+ }
+
+ Status = Decoder->GetImageDecoderName (Decoder, &DecoderNames, &NumberOfDecoderName);
+ if (EFI_ERROR (Status)) {
+ continue;
+ }
+ for (DecoderNameIndex = 0; DecoderNameIndex < NumberOfDecoderName; DecoderNameIndex++) {
+ if (CompareGuid (DecoderName, &DecoderNames[DecoderNameIndex])) {
+ return Decoder;
+ }
+ }
+ }
+
+ return NULL;
+}
+
+/**
+ This function returns the image information to EFI_IMAGE_OUTPUT. Only the width
+ and height are returned to the EFI_IMAGE_OUTPUT instead of decoding the image
+ to the buffer. This function is used to get the geometry of the image. This function
+ will try to locate all of the EFI_HII_IMAGE_DECODER_PROTOCOL installed on the
+ system if the decoder of image type is not supported by the EFI_HII_IMAGE_EX_PROTOCOL.
+
+ @param This A pointer to the EFI_HII_IMAGE_EX_PROTOCOL instance.
+ @param PackageList Handle of the package list where this image will
+ be searched.
+ @param ImageId The image's id, which is unique within PackageList.
+ @param Image Points to the image.
+
+ @retval EFI_SUCCESS The new image was returned successfully.
+ @retval EFI_NOT_FOUND The image specified by ImageId is not in the
+ database. The specified PackageList is not in the database.
+ @retval EFI_BUFFER_TOO_SMALL The buffer specified by ImageSize is too small to
+ hold the image.
+ @retval EFI_INVALID_PARAMETER The Image was NULL or the ImageId was 0.
+ @retval EFI_OUT_OF_RESOURCES The bitmap could not be retrieved because there
+ was not enough memory.
+
+**/
+EFI_STATUS
+EFIAPI
+HiiGetImageInfo (
+ IN CONST EFI_HII_IMAGE_EX_PROTOCOL *This,
+ IN EFI_HII_HANDLE PackageList,
+ IN EFI_IMAGE_ID ImageId,
+ OUT EFI_IMAGE_OUTPUT *Image
+ )
+{
+ EFI_STATUS Status;
+ HII_DATABASE_PRIVATE_DATA *Private;
+ HII_DATABASE_PACKAGE_LIST_INSTANCE *PackageListNode;
+ HII_IMAGE_PACKAGE_INSTANCE *ImagePackage;
+ EFI_HII_IMAGE_BLOCK *CurrentImageBlock;
+ EFI_HII_IMAGE_DECODER_PROTOCOL *Decoder;
+ EFI_HII_IMAGE_DECODER_IMAGE_INFO_HEADER *ImageInfo;
+
+ if (Image == NULL || ImageId == 0) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Private = HII_IMAGE_EX_DATABASE_PRIVATE_DATA_FROM_THIS (This);
+ PackageListNode = LocatePackageList (&Private->DatabaseList, PackageList);
+ if (PackageListNode == NULL) {
+ return EFI_NOT_FOUND;
+ }
+ ImagePackage = PackageListNode->ImagePkg;
+ if (ImagePackage == NULL) {
+ return EFI_NOT_FOUND;
+ }
+
+ //
+ // Find the image block specified by ImageId
+ //
+ CurrentImageBlock = GetImageIdOrAddress (ImagePackage->ImageBlock, &ImageId);
+ switch (CurrentImageBlock->BlockType) {
+ case EFI_HII_IIBT_IMAGE_JPEG:
+ case EFI_HII_IIBT_IMAGE_PNG:
+ Decoder = LocateHiiImageDecoder (CurrentImageBlock->BlockType);
+ if (Decoder == NULL) {
+ return EFI_UNSUPPORTED;
+ }
+ //
+ // Use the common block code since the definition of two structures is the same.
+ //
+ ASSERT (OFFSET_OF (EFI_HII_IIBT_JPEG_BLOCK, Data) == OFFSET_OF (EFI_HII_IIBT_PNG_BLOCK, Data));
+ ASSERT (sizeof (((EFI_HII_IIBT_JPEG_BLOCK *) CurrentImageBlock)->Data) ==
+ sizeof (((EFI_HII_IIBT_PNG_BLOCK *) CurrentImageBlock)->Data));
+ ASSERT (OFFSET_OF (EFI_HII_IIBT_JPEG_BLOCK, Size) == OFFSET_OF (EFI_HII_IIBT_PNG_BLOCK, Size));
+ ASSERT (sizeof (((EFI_HII_IIBT_JPEG_BLOCK *) CurrentImageBlock)->Size) ==
+ sizeof (((EFI_HII_IIBT_PNG_BLOCK *) CurrentImageBlock)->Size));
+ Status = Decoder->GetImageInfo (
+ Decoder,
+ ((EFI_HII_IIBT_JPEG_BLOCK *) CurrentImageBlock)->Data,
+ ((EFI_HII_IIBT_JPEG_BLOCK *) CurrentImageBlock)->Size,
+ &ImageInfo
+ );
+
+ //
+ // Spec requires to use the first capable image decoder instance.
+ // The first image decoder instance may fail to decode the image.
+ //
+ if (!EFI_ERROR (Status)) {
+ Image->Height = ImageInfo->ImageHeight;
+ Image->Width = ImageInfo->ImageWidth;
+ Image->Image.Bitmap = NULL;
+ FreePool (ImageInfo);
+ }
+ return Status;
+
+ case EFI_HII_IIBT_IMAGE_1BIT_TRANS:
+ case EFI_HII_IIBT_IMAGE_4BIT_TRANS:
+ case EFI_HII_IIBT_IMAGE_8BIT_TRANS:
+ case EFI_HII_IIBT_IMAGE_1BIT:
+ case EFI_HII_IIBT_IMAGE_4BIT:
+ case EFI_HII_IIBT_IMAGE_8BIT:
+ //
+ // Use the common block code since the definition of these structures is the same.
+ //
+ Image->Width = ReadUnaligned16 (&((EFI_HII_IIBT_IMAGE_1BIT_BLOCK *) CurrentImageBlock)->Bitmap.Width);
+ Image->Height = ReadUnaligned16 (&((EFI_HII_IIBT_IMAGE_1BIT_BLOCK *) CurrentImageBlock)->Bitmap.Height);
+ Image->Image.Bitmap = NULL;
+ return EFI_SUCCESS;
+
+ case EFI_HII_IIBT_IMAGE_24BIT_TRANS:
+ case EFI_HII_IIBT_IMAGE_24BIT:
+ Image->Width = ReadUnaligned16 ((VOID *) &((EFI_HII_IIBT_IMAGE_24BIT_BLOCK *) CurrentImageBlock)->Bitmap.Width);
+ Image->Height = ReadUnaligned16 ((VOID *) &((EFI_HII_IIBT_IMAGE_24BIT_BLOCK *) CurrentImageBlock)->Bitmap.Height);
+ Image->Image.Bitmap = NULL;
+ return EFI_SUCCESS;
+
+ default:
+ return EFI_NOT_FOUND;
+ }
+}
--
2.9.0.windows.1


[PATCH v2 10/19] MdePkg/HiiImageDecoder.h: Add HiiImageDecoder protocol header file

Ruiyu Ni <ruiyu.ni@...>
 

Contributed-under: TianoCore Contribution Agreement 1.0
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
---
MdePkg/Include/Protocol/HiiImageDecoder.h | 200 ++++++++++++++++++++++++++++++
1 file changed, 200 insertions(+)
create mode 100644 MdePkg/Include/Protocol/HiiImageDecoder.h

diff --git a/MdePkg/Include/Protocol/HiiImageDecoder.h b/MdePkg/Include/Protocol/HiiImageDecoder.h
new file mode 100644
index 0000000..1ef48f1
--- /dev/null
+++ b/MdePkg/Include/Protocol/HiiImageDecoder.h
@@ -0,0 +1,200 @@
+/** @file
+ The file provides image decoder service for specific image file formats.
+
+ Copyright (c) 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
+ 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 __HII_IMAGE_DECODER_H__
+#define __HII_IMAGE_DECODER_H__
+
+#include <Protocol/HiiImage.h>
+
+#define EFI_HII_IMAGE_DECODER_PROTOCOL_GUID \
+ { 0x2F707EBB, 0x4A1A, 0x11d4, { 0x9A, 0x38, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D } }
+typedef struct _EFI_HII_IMAGE_DECODER_PROTOCOL EFI_HII_IMAGE_DECODER_PROTOCOL;
+
+//
+// HII Image Decoder Guid
+//
+#define EFI_HII_IMAGE_DECODER_NAME_JPEG_GUID \
+ {0xefefd093, 0xd9b, 0x46eb, { 0xa8, 0x56, 0x48, 0x35, 0x7, 0x0, 0xc9, 0x8 } }
+
+#define EFI_HII_IMAGE_DECODER_NAME_PNG_GUID \
+ {0xaf060190, 0x5e3a, 0x4025, {0xaf, 0xbd, 0xe1, 0xf9, 0x5, 0xbf, 0xaa, 0x4c } }
+
+//
+// EFI_HII_IMAGE_DECODER_COLOR_TYPE
+//
+typedef enum {
+ EFI_HII_IMAGE_DECODER_COLOR_TYPE_RGB = 0,
+ EFI_HII_IMAGE_DECODER_COLOR_TYPE_RGBA = 1,
+ EFI_HII_IMAGE_DECODER_COLOR_TYPE_CMYK = 2,
+ EFI_HII_IMAGE_DECODER_COLOR_TYPE_UNKNOWN = 0xff,
+} EFI_HII_IMAGE_DECODER_COLOR_TYPE;
+
+//
+// EFI_HII_IMAGE_DECODER_IMAGE_INFO_HEADER
+//
+typedef struct _EFI_IMAGE_DECODER_IMAGE_INFO_HEADER {
+ EFI_GUID DecoderName;
+ UINT16 ImageInfoSize;
+ UINT16 ImageWidth;
+ UINT16 ImageHeight;
+ EFI_HII_IMAGE_DECODER_COLOR_TYPE ColorType;
+ UINT8 ColorDepthInBits;
+} EFI_HII_IMAGE_DECODER_IMAGE_INFO_HEADER;
+
+//
+// EFI_HII_IMAGE_DECODER_JPEG_INFO
+//
+typedef struct _EFI_IMAGE_DECODER_JPEG_INFO {
+ EFI_HII_IMAGE_DECODER_IMAGE_INFO_HEADER Header;
+ UINT16 ScanType;
+ UINT64 Reserved;
+} EFI_IMAGE_DECODER_JPEG_INFO;
+
+//
+// EFI_HII_IMAGE_DECODER_PNG_INFO
+//
+typedef struct _EFI_IMAGE_DECODER_PNG_INFO {
+ EFI_HII_IMAGE_DECODER_IMAGE_INFO_HEADER Header;
+ UINT16 Channels;
+ UINT64 Reserved;
+} EFI_HII_IMAGE_DECODER_PNG_INFO;
+
+//
+// EFI_HII_IMAGE_DECODER_OTHER_INFO
+//
+typedef struct _EFI_IMAGE_DECODER_OTHER_INFO {
+ EFI_HII_IMAGE_DECODER_IMAGE_INFO_HEADER Header;
+ CHAR16 ImageExtenion[1];
+ //
+ // Variable length of image file extension name.
+ //
+} EFI_HII_IMAGE_DECODER_OTHER_INFO;
+
+/**
+ This function returns the decoder name.
+
+ There could be more than one EFI_HII_IMAGE_DECODER_PROTOCOL instances installed in the
+ system for different image formats. This function returns the decoder name which callers
+ can use to find the proper image decoder for the image. It is possible to support
+ multiple image formats in one EFI_HII_IMAGE_DECODER_PROTOCOL. The capability of the
+ supported image formats is returned in DecoderName and NumberOfDecoderName.
+
+ @param This EFI_HII_IMAGE_DECODER_PROTOCOL instance.
+
+ @param DecorderName Pointer to a dimension to retrieve the decoder names in
+ EFI_GUID format. The number of the decoder names is returned
+ in NumberOfDecoderName.
+
+ @param NumberOfDecorderName Pointer to retrieve the number of decoders which supported by
+ this decoder driver.
+
+ @retval EFI_SUCCESS The decoder name was returned successfully.
+ @retval EFI_INVALID_PARAMETER DecoderName is NULL or NumberOfDecoderName is NULL.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_HII_IMAGE_DECODER_GET_NAME)(
+ IN CONST EFI_HII_IMAGE_DECODER_PROTOCOL *This,
+ IN OUT EFI_GUID **DecorderName,
+ OUT UINT16 *NumberOfDecorderName
+ );
+
+/**
+ The function returns the EFI_HII_IMAGE_DECODER_IMAGE_INFO to the caller.
+
+ This function returns the image information of the given image raw data.
+ This function first checks whether the image raw data is supported by this
+ decoder or not. This function may go through the first few bytes in the
+ image raw data for the specific data structure or the image signature.
+ If the image is not supported by this image decoder, this function returns
+ EFI_UNSUPPORTED to the caller. Otherwise, this function returns the proper image
+ information to the caller. It is the callerís responsibility to free the ImageInfo.
+
+ @param This EFI_HII_IMAGE_DECODER_PROTOCOL instance.
+ @param Image Pointer to the image raw data.
+ @param SizeOfImage Size of the entire image raw data.
+ @param ImageInfo Pointer to receive the EFI_HII_IMAGE_DECODER_IMAGE_INFO
+
+ @retval EFI_SUCCESS The image info was returned successfully.
+ @retval EFI_UNSUPPORTED The image is not supported.
+ @retval EFI_INVALID_PARAMETER Image is NULL, or ImageInfo is NULL.
+ @retval EFI_OUT_OF_RESOURCES ImageInfo cannot be returned because there was not
+ enough memory.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_HII_IMAGE_DECODER_GET_IMAGE_INFO)(
+ IN CONST EFI_HII_IMAGE_DECODER_PROTOCOL *This,
+ IN VOID *Image,
+ IN UINTN SizeOfImage,
+ IN OUT EFI_HII_IMAGE_DECODER_IMAGE_INFO_HEADER **ImageInfo
+ );
+
+/**
+ The function decodes the image.
+
+ This function decodes the image which the image type of this image is
+ supported by this EFI_HII_IMAGE_DECODER_PROTOCOL.
+ If **Bitmap is not NULL, the caller intends to put the image in the given
+ image buffer. That allows the caller to put an image overlap on the original
+ image. The transparency is handled by the image decoder because the transparency
+ capability depends on the image format. Callers can set Transparent to FALSE to
+ force disabling the transparency process on the image. Forcing Transparent to
+ FALSE may also improve the performance of the image decoding because the image
+ decoder can skip the transparency processing.
+ If **Bitmap is NULL, the image decoder allocates the memory buffer for the
+ EFI_IMAGE_OUTPUT and decodes the image to the image buffer. It is the callerís
+ responsibility to free the memory for EFI_IMAGE_OUTPUT. Image decoder doesnít
+ have to handle the transparency in this case because there is no background image
+ given by the caller. The background color in this case is all black (#00000000).
+
+ @param This EFI_HII_IMAGE_DECODER_PROTOCOL instance.
+ @param Image Pointer to the image raw data
+ @param ImageRawDataSize Size of the entire image raw data
+ @param Bitmap EFI_IMAGE_OUTPUT to receive the image or overlap the
+ image on the original buffer.
+ @param Transparent BOOLEAN value indicates whether the image decoder has to
+ handle the transparent image or not.
+
+ @retval EFI_SUCCESS The image was decoded successfully.
+ @retval EFI_UNSUPPORTED The image is not supported.
+ @retval EFI_INVALID_PARAMETER Image is NULL, or Bitmap is NULL.
+ @retval EFI_OUT_OF_RESOURCES The image cannot be decoded because there was not
+ enough memory.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_HII_IMAGE_DECODER_DECODE)(
+ IN CONST EFI_HII_IMAGE_DECODER_PROTOCOL *This,
+ IN VOID *Image,
+ IN UINTN ImageRawDataSize,
+ IN OUT EFI_IMAGE_OUTPUT **Bitmap,
+ IN BOOLEAN Transparent
+ );
+
+
+///
+/// Services to access to images in the images database.
+///
+struct _EFI_HII_IMAGE_DECODER_PROTOCOL {
+ EFI_HII_IMAGE_DECODER_GET_NAME GetImageDecoderName;
+ EFI_HII_IMAGE_DECODER_GET_IMAGE_INFO GetImageInfo;
+ EFI_HII_IMAGE_DECODER_DECODE DecodeImage;
+};
+
+extern EFI_GUID gEfiHiiImageDecoderProtocolGuid;
+extern EFI_GUID gEfiHiiImageDecoderNameJpegGuid;
+extern EFI_GUID gEfiHiiImageDecoderNamePngGuid;
+
+#endif
--
2.9.0.windows.1


[PATCH v2 09/19] MdeModulePkg/HiiDatabase: Update HiiImage to support PNG/JPEG

Ruiyu Ni <ruiyu.ni@...>
 

1. Update GetImageIdOrAddress() to recognize PNG/JPEG image block.
A offset calculation bug was fixed.
2. Update HiiGetImage() comments to say PNG/JPEG support is provided
by HiiImageEx
3. Update HiiSetImage() to support replacing a PNG/JPEG image block
with a new image

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/Universal/HiiDatabaseDxe/Image.c | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c b/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c
index e5eb677..c8e9258 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c
@@ -127,7 +127,12 @@ GetImageIdOrAddress (
break;

case EFI_HII_IIBT_IMAGE_JPEG:
- Length = ReadUnaligned32 ((VOID *) &((EFI_HII_IIBT_JPEG_BLOCK *) CurrentImageBlock)->Size);
+ Length = OFFSET_OF (EFI_HII_IIBT_JPEG_BLOCK, Data) + ReadUnaligned32 ((VOID *) &((EFI_HII_IIBT_JPEG_BLOCK *) CurrentImageBlock)->Size);
+ ImageIdCurrent++;
+ break;
+
+ case EFI_HII_IIBT_IMAGE_PNG:
+ Length = OFFSET_OF (EFI_HII_IIBT_PNG_BLOCK, Data) + ReadUnaligned32 ((VOID *) &((EFI_HII_IIBT_PNG_BLOCK *) CurrentImageBlock)->Size);
ImageIdCurrent++;
break;

@@ -842,8 +847,10 @@ HiiGetImage (

switch (CurrentImageBlock->BlockType) {
case EFI_HII_IIBT_IMAGE_JPEG:
+ case EFI_HII_IIBT_IMAGE_PNG:
//
- // BUGBUG: need to be supported as soon as image tool is designed.
+ // HiiImage protocol doesn't support return JPEG/PNG.
+ // Use HiiImageEx instead.
//
return EFI_UNSUPPORTED;

@@ -1005,11 +1012,11 @@ HiiSetImage (
//
switch (CurrentImageBlock->BlockType) {
case EFI_HII_IIBT_IMAGE_JPEG:
- //
- // BUGBUG: need to be supported as soon as image tool is designed.
- //
- return EFI_UNSUPPORTED;
-
+ OldBlockSize = OFFSET_OF (EFI_HII_IIBT_JPEG_BLOCK, Data) + ReadUnaligned32 ((VOID *) &((EFI_HII_IIBT_JPEG_BLOCK *) CurrentImageBlock)->Size);
+ break;
+ case EFI_HII_IIBT_IMAGE_PNG:
+ OldBlockSize = OFFSET_OF (EFI_HII_IIBT_PNG_BLOCK, Data) + ReadUnaligned32 ((VOID *) &((EFI_HII_IIBT_PNG_BLOCK *) CurrentImageBlock)->Size);
+ break;
case EFI_HII_IIBT_IMAGE_1BIT:
case EFI_HII_IIBT_IMAGE_1BIT_TRANS:
OldBlockSize = sizeof (EFI_HII_IIBT_IMAGE_1BIT_BLOCK) - sizeof (UINT8) +
--
2.9.0.windows.1


[PATCH v2 08/19] MdePkg/HiiImage.h: Include GraphicsOutput.h

Ruiyu Ni <ruiyu.ni@...>
 

HiiImage.h uses EFI_GRAPHICS_OUTPUT_BLT_PIXEL which is defined in
GraphicsOutput.h. Include GraphicsOutput.h to avoid build failure
from consumer of HiiImage protocol.

Contributed-under: TianoCore Contribution Agreement 1.0
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
---
MdePkg/Include/Protocol/HiiImage.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/MdePkg/Include/Protocol/HiiImage.h b/MdePkg/Include/Protocol/HiiImage.h
index 3e1ea99..1d42bfa 100644
--- a/MdePkg/Include/Protocol/HiiImage.h
+++ b/MdePkg/Include/Protocol/HiiImage.h
@@ -1,7 +1,7 @@
/** @file
The file provides services to access to images in the images database.

- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 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
which accompanies this distribution. The full text of the license may be found at
@@ -15,6 +15,8 @@
#ifndef __HII_IMAGE_H__
#define __HII_IMAGE_H__

+#include <Protocol/GraphicsOutput.h>
+
#define EFI_HII_IMAGE_PROTOCOL_GUID \
{ 0x31a6406a, 0x6bdf, 0x4e46, { 0xb2, 0xa2, 0xeb, 0xaa, 0x89, 0xc4, 0x9, 0x20 } }

--
2.9.0.windows.1


[PATCH v2 07/19] MdemodulePkg/HiiDatabase: Correct typo in comments.

Ruiyu Ni <ruiyu.ni@...>
 

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>
---
.../HiiDatabaseDxe/ConfigKeywordHandler.c | 36 ++++++-------
.../Universal/HiiDatabaseDxe/ConfigRouting.c | 60 +++++++++++-----------
MdeModulePkg/Universal/HiiDatabaseDxe/Database.c | 14 ++---
MdeModulePkg/Universal/HiiDatabaseDxe/Font.c | 38 +++++++-------
.../Universal/HiiDatabaseDxe/HiiDatabaseEntry.c | 2 +-
5 files changed, 75 insertions(+), 75 deletions(-)

diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigKeywordHandler.c b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigKeywordHandler.c
index 10a901f..8e23a51 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigKeywordHandler.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigKeywordHandler.c
@@ -28,7 +28,7 @@ extern HII_DATABASE_PRIVATE_DATA mPrivate;
@param NextString string follow the possible PathHdr string.

@retval EFI_INVALID_PARAMETER The device path is not valid or the incoming parameter is invalid.
- @retval EFI_OUT_OF_RESOURCES Lake of resources to store neccesary structures.
+ @retval EFI_OUT_OF_RESOURCES Lake of resources to store necessary structures.
@retval EFI_SUCCESS The device path is retrieved and translated to binary format.
The Input string not include PathHdr section.

@@ -240,10 +240,10 @@ ExtractNameSpace (

@param String KeywordRequestformat string.
@param Keyword return the extract keyword string.
- @param NextString return the next string follow this keyword sectin.
+ @param NextString return the next string follow this keyword section.

@retval EFI_SUCCESS Success to get the keyword string.
- @retval EFI_INVALID_PARAMETER Parsr the input string return error.
+ @retval EFI_INVALID_PARAMETER Parse the input string return error.

**/
EFI_STATUS
@@ -306,10 +306,10 @@ ExtractKeyword (

@param String KeywordRequestformat string.
@param Value return the extract value string.
- @param NextString return the next string follow this keyword sectin.
+ @param NextString return the next string follow this keyword section.

@retval EFI_SUCCESS Success to get the keyword string.
- @retval EFI_INVALID_PARAMETER Parsr the input string return error.
+ @retval EFI_INVALID_PARAMETER Parse the input string return error.

**/
EFI_STATUS
@@ -361,10 +361,10 @@ ExtractValue (

@param String KeywordRequestformat string.
@param FilterFlags return the filter condition.
- @param NextString return the next string follow this keyword sectin.
+ @param NextString return the next string follow this keyword section.

@retval EFI_SUCCESS Success to get the keyword string.
- @retval EFI_INVALID_PARAMETER Parsr the input string return error.
+ @retval EFI_INVALID_PARAMETER Parse the input string return error.

**/
BOOLEAN
@@ -477,7 +477,7 @@ ExtractFilter (
String = KeywordPtr;
} else {
//
- // Only has paltform defined filter section, just skip it.
+ // Only has platform defined filter section, just skip it.
//
String += StrLen (String);
}
@@ -520,9 +520,9 @@ ExtractReadOnlyFromOpCode (

This is a internal function.

- @param OpCodeData The questin binary ifr data.
+ @param OpCodeData The question binary ifr data.
@param KeywordRequest KeywordRequestformat string.
- @param NextString return the next string follow this keyword sectin.
+ @param NextString return the next string follow this keyword section.
@param ReadOnly Return whether this question is read only.

@retval KEYWORD_HANDLER_NO_ERROR Success validate.
@@ -711,7 +711,7 @@ GetRecordFromDevicePath (
@param BufferSize Length of the buffer.
@param StringDest Buffer to store the string text.

- @retval EFI_SUCCESS The string text was outputed successfully.
+ @retval EFI_SUCCESS The string text was outputted successfully.
@retval EFI_OUT_OF_RESOURCES Out of resource.

**/
@@ -1310,7 +1310,7 @@ GetNextStringId (
@param KeywordValue Keyword value.
@param StringId String Id for this keyword.

- @retval KEYWORD_HANDLER_NO_ERROR Get String id succes.
+ @retval KEYWORD_HANDLER_NO_ERROR Get String id successfully.
@retval KEYWORD_HANDLER_KEYWORD_NOT_FOUND Not found the string id in the string package.
@retval KEYWORD_HANDLER_NAMESPACE_ID_NOT_FOUND Not found the string package for this namespace.
@retval KEYWORD_HANDLER_UNDEFINED_PROCESSING_ERROR Out of resource error.
@@ -1609,7 +1609,7 @@ GetWidth (
}

/**
- Converts all hex dtring characters in range ['A'..'F'] to ['a'..'f'] for
+ Converts all hex string characters in range ['A'..'F'] to ['a'..'f'] for
hex digits that appear between a '=' and a '&' in a config string.

If ConfigString is NULL, then ASSERT().
@@ -1657,7 +1657,7 @@ InternalLowerConfigString (
@param[in] DriverHandle The driver handle which supports a Device Path Protocol
that is the routing information PATH. Each byte of
the Device Path associated with DriverHandle is converted
- to a 2 Unicode character hexidecimal string.
+ to a 2 Unicode character hexadecimal string.

@retval NULL DriverHandle does not support the Device Path Protocol.
@retval Other A pointer to the Null-terminate Unicode <ConfigHdr> string
@@ -2356,7 +2356,7 @@ GetStringIdFromDatabase (
}

/**
- Genereate the KeywordResp String.
+ Generate the KeywordResp String.

<KeywordResp> ::= <NameSpaceId><PathHdr>'&'<Keyword>'&VALUE='<Number>['&READONLY']

@@ -2419,7 +2419,7 @@ GenerateKeywordResp (
RespStrLen += StrLen (PathHdr);

//
- // 1.3 Keyword setion.
+ // 1.3 Keyword section.
// 'KEYWORD='<String>[':'<DecCh>(1/4)]
//
RespStrLen += 8 + StrLen (KeywordData);
@@ -2709,7 +2709,7 @@ Error:
}

//
- // return the already get MultiKeywordString even error occured.
+ // return the already get MultiKeywordString even error occurred.
//
if (MultiKeywordResp == NULL) {
Status = EFI_NOT_FOUND;
@@ -3071,7 +3071,7 @@ Done:
@retval EFI_SUCCESS The specified action was completed successfully.

@retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
- 1.Progress, ProgressErr, or Resuts is NULL.
+ 1.Progress, ProgressErr, or Results is NULL.
2.Parsing of the KeywordString resulted in an error. See
Progress and ProgressErr for more data.

diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
index 9f036a5..a97e28b 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
@@ -65,7 +65,7 @@ CalculateConfigStringLen (

@retval EFI_NOT_FOUND The device path is not invalid.
@retval EFI_INVALID_PARAMETER Any incoming parameter is invalid.
- @retval EFI_OUT_OF_RESOURCES Lake of resources to store neccesary structures.
+ @retval EFI_OUT_OF_RESOURCES Lake of resources to store necessary structures.
@retval EFI_SUCCESS The device path is retrieved and translated to
binary format.

@@ -436,7 +436,7 @@ AppendToMultiString (
to free memory.
@param Len Length of the <Number>, in characters.

- @retval EFI_OUT_OF_RESOURCES Insufficient resources to store neccessary
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to store necessary
structures.
@retval EFI_SUCCESS Value of <Number> is outputted in Number
successfully.
@@ -518,7 +518,7 @@ Exit:
@param Found The Block whether has been found.
@param BufferLen The length of the buffer.

- @retval EFI_OUT_OF_RESOURCES Insufficient resources to store neccessary structures.
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to store necessary structures.
@retval EFI_SUCCESS The function finishes successfully.

**/
@@ -574,7 +574,7 @@ FindSameBlockElement(
@param AltConfigHdr Pointer to a Unicode string in <AltConfigHdr> format.
@param ConfigAltRespChanged Whether the ConfigAltResp has been changed.

- @retval EFI_OUT_OF_RESOURCES Insufficient resources to store neccessary structures.
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to store necessary structures.
@retval EFI_SUCCESS The function finishes successfully.

**/
@@ -715,7 +715,7 @@ Exit:
@param AltConfigHdr Pointer to a Unicode string in <AltConfigHdr> format.
@param ConfigAltRespChanged Whether the ConfigAltResp has been changed.

- @retval EFI_OUT_OF_RESOURCES Insufficient resources to store neccessary structures.
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to store necessary structures.
@retval EFI_SUCCESS The function finishes successfully.

**/
@@ -845,7 +845,7 @@ Exit:
string for the different varstore buffer.
@param AltConfigHdr Pointer to a Unicode string in <AltConfigHdr> format.

- @retval EFI_OUT_OF_RESOURCES Insufficient resources to store neccessary
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to store necessary
structures.
@retval EFI_SUCCESS The function finishes successfully.

@@ -1021,7 +1021,7 @@ MergeDefaultString (
}

//
- // Get the requestr ConfigHdr
+ // Get the request ConfigHdr
//
SizeAltCfgResp = 0;
StringPtr = *AltCfgResp;
@@ -1249,9 +1249,9 @@ InsertBlockData (
@param[in] HiiHandle A handle that was previously registered in the HII Database.

@retval NULL HiiHandle is not registered in the HII database
- @retval NULL There are not enough resources available to retrieve the suported
+ @retval NULL There are not enough resources available to retrieve the supported
languages.
- @retval NULL The list of suported languages could not be retrieved.
+ @retval NULL The list of supported languages could not be retrieved.
@retval Other A pointer to the Null-terminated ASCII string of supported languages.

**/
@@ -1697,7 +1697,7 @@ GetVarStoreType (
}

//
- // Free alllocated temp string.
+ // Free allocated temp string.
//
FreePool (VarStoreName);
FreePool (GuidStr);
@@ -1755,8 +1755,8 @@ GetElementsFromRequest (
@param Name Varstore name.
@param ConfigHdr Current configRequest info.

- @retval TRUE This varstore is the requst one.
- @retval FALSE This varstore is not the requst one.
+ @retval TRUE This varstore is the request one.
+ @retval FALSE This varstore is not the request one.

**/
BOOLEAN
@@ -1825,8 +1825,8 @@ Done:
@param DataBaseRecord The DataBaseRecord instance contains the found Hii handle and package.
@param ConfigHdr Request string ConfigHdr. If it is NULL,
the first found varstore will be as ConfigHdr.
- @retval TRUE This hii package is the reqeust one.
- @retval FALSE This hii package is not the reqeust one.
+ @retval TRUE This hii package is the request one.
+ @retval FALSE This hii package is not the request one.
**/
BOOLEAN
IsThisPackageList (
@@ -1955,7 +1955,7 @@ Done:

@param RequestBlockArray The array includes all the request info or NULL.
@param HiiHandle The hii handle for this form package.
- @param VarStorageData The varstore data strucure.
+ @param VarStorageData The varstore data structure.
@param IfrOpHdr Ifr opcode header for this opcode.
@param VarWidth The buffer width for this opcode.
@param ReturnData The data block added for this opcode.
@@ -2048,7 +2048,7 @@ IsThisOpcodeRequired (

@param HiiHandle Hii Handle for this hii package.
@param Package Pointer to the form package data.
- @param PackageLength Length of the pacakge.
+ @param PackageLength Length of the package.
@param ConfigHdr Request string ConfigHdr. If it is NULL,
the first found varstore will be as ConfigHdr.
@param RequestBlockArray The block array is retrieved from the request string.
@@ -2056,7 +2056,7 @@ IsThisOpcodeRequired (
@param DefaultIdArray Point to the got default id and default name array.

@retval EFI_SUCCESS The block array and the default value array are got.
- @retval EFI_INVALID_PARAMETER The varstore defintion in the differnt form pacakges
+ @retval EFI_INVALID_PARAMETER The varstore definition in the different form packages
are conflicted.
@retval EFI_OUT_OF_RESOURCES No enough memory.
**/
@@ -2493,7 +2493,7 @@ ParseIfrData (
DefaultData.DefaultId = VarDefaultId;
if ((IfrCheckBox->Flags & EFI_IFR_CHECKBOX_DEFAULT) == EFI_IFR_CHECKBOX_DEFAULT) {
//
- // When flag is set, defautl value is TRUE.
+ // When flag is set, default value is TRUE.
//
DefaultData.Type = DefaultValueFromFlag;
DefaultData.Value.b = TRUE;
@@ -2518,7 +2518,7 @@ ParseIfrData (
DefaultData.DefaultId = VarDefaultId;
if ((IfrCheckBox->Flags & EFI_IFR_CHECKBOX_DEFAULT_MFG) == EFI_IFR_CHECKBOX_DEFAULT_MFG) {
//
- // When flag is set, defautl value is TRUE.
+ // When flag is set, default value is TRUE.
//
DefaultData.Type = DefaultValueFromFlag;
DefaultData.Value.b = TRUE;
@@ -2534,7 +2534,7 @@ ParseIfrData (
}
if (SmallestIdFromFlag) {
//
- // When smallest default Id is given by the flag of CheckBox, set defaut value with TRUE for other default Id in the DefaultId list.
+ // When smallest default Id is given by the flag of CheckBox, set default value with TRUE for other default Id in the DefaultId list.
//
DefaultData.Type = DefaultValueFromOtherDefault;
DefaultData.Value.b = TRUE;
@@ -2548,7 +2548,7 @@ ParseIfrData (
}
} else {
//
- // When flag is not set, defautl value is FASLE.
+ // When flag is not set, default value is FASLE.
//
DefaultData.Type = DefaultValueFromDefault;
DefaultData.Value.b = FALSE;
@@ -2942,8 +2942,8 @@ ParseIfrData (
}

//
- // After insert the default value, reset the cleaned value for next
- // time used. If not set here, need to set the value before everytime
+ // After insert the default value, reset the cleaned value for next
+ // time used. If not set here, need to set the value before every time.
// use it.
//
DefaultData.Cleaned = FALSE;
@@ -3743,7 +3743,7 @@ GenerateAltConfigResp (
When Request points to NULL, the default value string
for each varstore in form package will be merged into
a <MultiConfigAltResp> format string and return.
- @param PointerProgress Optional parameter, it can be be NULL.
+ @param PointerProgress Optional parameter, it can be NULL.
When it is not NULL, if Request is NULL, it returns NULL.
On return, points to a character in the Request
string. Points to the string's null terminator if
@@ -3807,7 +3807,7 @@ GetFullStringFromHiiFormPackages (
}

//
- // 1. Get the request block array by Request String when Request string containts the block array.
+ // 1. Get the request block array by Request String when Request string contains the block array.
//
StringPtr = NULL;
if (*Request != NULL) {
@@ -3890,7 +3890,7 @@ GetFullStringFromHiiFormPackages (
//

//
- // Parse the opcode in form pacakge to get the default setting.
+ // Parse the opcode in form package to get the default setting.
//
Status = ParseIfrData (DataBaseRecord->Handle,
HiiFormPackage,
@@ -3936,7 +3936,7 @@ GetFullStringFromHiiFormPackages (
}

//
- // 5. Merge string into the input AltCfgResp if the iput *AltCfgResp is not NULL.
+ // 5. Merge string into the input AltCfgResp if the input *AltCfgResp is not NULL.
//
if (*AltCfgResp != NULL && DefaultAltCfgResp != NULL) {
Status = MergeDefaultString (AltCfgResp, DefaultAltCfgResp);
@@ -4009,7 +4009,7 @@ Done:
}

//
- // Free Pacakge data
+ // Free Package data
//
if (HiiFormPackage != NULL) {
FreePool (HiiFormPackage);
@@ -4675,7 +4675,7 @@ HiiConfigRoutingExtractConfig (

//
// Attach this <ConfigAltResp> to a <MultiConfigAltResp>. There is a '&'
- // which seperates the first <ConfigAltResp> and the following ones.
+ // which separates the first <ConfigAltResp> and the following ones.
//
ASSERT (*AccessProgress == 0);

@@ -4928,7 +4928,7 @@ HiiConfigRoutingExportConfig (

//
// Attach this <ConfigAltResp> to a <MultiConfigAltResp>. There is a '&'
- // which seperates the first <ConfigAltResp> and the following ones.
+ // which separates the first <ConfigAltResp> and the following ones.
//
if (!FirstElement) {
Status = AppendToMultiString (Results, L"&");
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c b/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
index 984c5d2..4fd83f8 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
@@ -356,7 +356,7 @@ InvokeRegisteredFunction (
@param NotifyType The type of change concerning the database.
@param PackageList Pointer to a package list which will be inserted
to.
- @param Package Created GUID pacakge
+ @param Package Created GUID package

@retval EFI_SUCCESS Guid Package is inserted successfully.
@retval EFI_OUT_OF_RESOURCES Unable to allocate necessary resources for the new
@@ -903,7 +903,7 @@ Error:
@param PackageList Pointer to a package list which will be adjusted.

@retval EFI_SUCCESS Adjust all string packages successfully.
- @retval others Can't adjust string packges.
+ @retval others Can't adjust string packages.

**/
EFI_STATUS
@@ -3041,7 +3041,7 @@ HiiNewPackageList (


/**
- This function removes the package list that is associated with a handle Handle
+ This function removes the package list that is associated with Handle
from the HII database. Before removing the package, any registered functions
with the notification type REMOVE_PACK and the same package type will be called.

@@ -3052,7 +3052,7 @@ HiiNewPackageList (

@retval EFI_SUCCESS The data associated with the Handle was removed
from the HII database.
- @retval EFI_NOT_FOUND The specified andle is not in database.
+ @retval EFI_NOT_FOUND The specified handle is not in database.
@retval EFI_INVALID_PARAMETER The Handle was not valid.

**/
@@ -3294,7 +3294,7 @@ HiiUpdatePackageList (
buffer that is required for the handles found.
@param Handle An array of EFI_HII_HANDLE instances returned.

- @retval EFI_SUCCESS The matching handles are outputed successfully.
+ @retval EFI_SUCCESS The matching handles are outputted successfully.
HandleBufferLength is updated with the actual length.
@retval EFI_BUFFER_TO_SMALL The HandleBufferLength parameter indicates that
Handle is too small to support the number of
@@ -3400,7 +3400,7 @@ HiiListPackageLists (
}
break;
//
- // Pesudo-type EFI_HII_PACKAGE_TYPE_ALL will cause all package handles
+ // Pseudo-type EFI_HII_PACKAGE_TYPE_ALL will cause all package handles
// to be listed.
//
case EFI_HII_PACKAGE_TYPE_ALL:
@@ -3457,7 +3457,7 @@ HiiListPackageLists (
Handle is too small to support the number of
handles. HandleBufferLength is updated with a
value that will enable the data to fit.
- @retval EFI_NOT_FOUND The specifiecd Handle could not be found in the
+ @retval EFI_NOT_FOUND The specified Handle could not be found in the
current database.
@retval EFI_INVALID_PARAMETER BufferSize was NULL.
@retval EFI_INVALID_PARAMETER The value referenced by BufferSize was not zero
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c b/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c
index 7e5d3bd..7855c7e 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c
@@ -275,7 +275,7 @@ GetGlyphBuffer (
@param RowWidth The width of the text on the line, in pixels.
@param RowHeight The height of the line, in pixels.
@param Transparent If TRUE, the Background color is ignored and all
- "off" pixels in the character's drawn wil use the
+ "off" pixels in the character's drawn will use the
pixel value from BltBuffer.
@param Origin On input, points to the origin of the to be
displayed character, on output, points to the
@@ -351,7 +351,7 @@ NarrowGlyphToBlt (
@param RowWidth The width of the text on the line, in pixels.
@param RowHeight The height of the line, in pixels.
@param Transparent If TRUE, the Background color is ignored and all
- "off" pixels in the character's drawn wil use the
+ "off" pixels in the character's drawn will use the
pixel value from BltBuffer.
@param Cell Points to EFI_HII_GLYPH_INFO structure.
@param Attributes The attribute of incoming glyph in GlyphBuffer.
@@ -467,7 +467,7 @@ GlyphToBlt (
@param RowWidth The width of the text on the line, in pixels.
@param RowHeight The height of the line, in pixels.
@param Transparent If TRUE, the Background color is ignored and all
- "off" pixels in the character's drawn wil use the
+ "off" pixels in the character's drawn will use the
pixel value from BltBuffer.
@param Cell Points to EFI_HII_GLYPH_INFO structure.
@param Attributes The attribute of incoming glyph in GlyphBuffer.
@@ -593,7 +593,7 @@ GlyphToImage (
@param InputCell Buffer which stores cell information of the
encoded bitmap.
@param GlyphBuffer Output the corresponding bitmap data of the found
- block. It is the caller's responsiblity to free
+ block. It is the caller's responsibility to free
this buffer.
@param Cell Output cell information of the encoded bitmap.
@param GlyphBufferLen If not NULL, output the length of GlyphBuffer.
@@ -647,7 +647,7 @@ WriteOutputParam (
@param CharValue Unicode character value, which identifies a glyph
block.
@param GlyphBuffer Output the corresponding bitmap data of the found
- block. It is the caller's responsiblity to free
+ block. It is the caller's responsibility to free
this buffer.
@param Cell Output cell information of the encoded bitmap.
@param GlyphBufferLen If not NULL, output the length of GlyphBuffer.
@@ -1143,7 +1143,7 @@ Exit:
@param FontHandle On entry, Points to the font handle returned by a
previous call to GetFontInfo() or NULL to start
with the first font.
- @param GlobalFontInfo If not NULL, output the corresponding globa font
+ @param GlobalFontInfo If not NULL, output the corresponding global font
info.

@retval TRUE Existed
@@ -1172,7 +1172,7 @@ IsFontInfoExisted (
ASSERT (FontInfo != NULL);

//
- // Matched flag represents an exactly match; VagueMatched1 repensents a RESIZE
+ // Matched flag represents an exactly match; VagueMatched1 represents a RESIZE
// or RESTYLE match; VagueMatched2 represents a RESIZE | RESTYLE match.
//
Matched = FALSE;
@@ -1248,7 +1248,7 @@ IsFontInfoExisted (
}
break;
//
- // If EFI_FONT_INFO_RESIZE is specified, then the sytem may attempt to
+ // If EFI_FONT_INFO_RESIZE is specified, then the system may attempt to
// stretch or shrink a font to meet the size requested.
//
case EFI_FONT_INFO_ANY_FONT | EFI_FONT_INFO_RESIZE:
@@ -1747,8 +1747,8 @@ HiiStringToImage (
}

//
- // Use the maxinum height of font as the base line.
- // And, use the maxinum height as line height.
+ // Use the maximum height of font as the base line.
+ // And, use the maximum height as line height.
//
LineHeight = Height;
LastLineHeight = Height;
@@ -1783,7 +1783,7 @@ HiiStringToImage (
}
//
// If EFI_HII_IGNORE_IF_NO_GLYPH is set, then characters which have no glyphs
- // are not drawn. Otherwise they are replaced wth Unicode character 0xFFFD.
+ // are not drawn. Otherwise they are replaced with Unicode character 0xFFFD.
//
StringIn2 = AllocateZeroPool (StrSize (StringPtr));
if (StringIn2 == NULL) {
@@ -2074,7 +2074,7 @@ HiiStringToImage (
for (Index1 = RowInfo[RowIndex].StartIndex; Index1 <= RowInfo[RowIndex].EndIndex; Index1++) {
if (RowInfo[RowIndex].LineWidth > 0 && RowInfo[RowIndex].LineWidth > LineOffset) {
//
- // Only BLT these character which have corrsponding glyph in font basebase.
+ // Only BLT these character which have corresponding glyph in font database.
//
GlyphToImage (
GlyphBuf[Index1],
@@ -2124,7 +2124,7 @@ HiiStringToImage (
}
} else {
//
- // Save the starting position for calculate the starting postition of next row.
+ // Save the starting position for calculate the starting position of next row.
//
RowBufferPtr = BufferPtr;
//
@@ -2134,7 +2134,7 @@ HiiStringToImage (
for (Index1 = RowInfo[RowIndex].StartIndex; Index1 <= RowInfo[RowIndex].EndIndex; Index1++) {
if (RowInfo[RowIndex].LineWidth > 0 && RowInfo[RowIndex].LineWidth > LineOffset) {
//
- // Only BLT these character which have corrsponding glyph in font basebase.
+ // Only BLT these character which have corresponding glyph in font database.
//
GlyphToImage (
GlyphBuf[Index1],
@@ -2299,13 +2299,13 @@ Exit:
when character display is normalized that some
character cells overlap.

- @retval EFI_SUCCESS The string was successfully rendered.
- @retval EFI_OUT_OF_RESOURCES Unable to allocate an output buffer for
- RowInfoArray or Blt.
+ @retval EFI_SUCCESS The string was successfully rendered.
+ @retval EFI_OUT_OF_RESOURCES Unable to allocate an output buffer for
+ RowInfoArray or Blt.
@retval EFI_INVALID_PARAMETER The Blt or PackageList was NULL.
@retval EFI_INVALID_PARAMETER Flags were invalid combination.
- @retval EFI_NOT_FOUND The specified PackageList is not in the Database or the stringid is not
- in the specified PackageList.
+ @retval EFI_NOT_FOUND The specified PackageList is not in the Database or the string id is not
+ in the specified PackageList.

**/
EFI_STATUS
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseEntry.c b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseEntry.c
index 03a4184..b48254f 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseEntry.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseEntry.c
@@ -160,7 +160,7 @@ OnReadyToBoot (
@retval EFI_SUCCESS The Hii database is setup correctly.
@return Other value if failed to create the default event for
gHiiKeyboardLayoutChanged. Check gBS->CreateEventEx for
- details. Or failed to insatll the protocols.
+ details. Or failed to install the protocols.
Check gBS->InstallMultipleProtocolInterfaces for details.
Or failed to create Ready To Boot Event.
Check EfiCreateEventReadyToBootEx for details.
--
2.9.0.windows.1


[PATCH v2 06/19] MdeModulePkg/HiiDatabase: Refine HiiDrawImage()

Ruiyu Ni <ruiyu.ni@...>
 

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/Universal/HiiDatabaseDxe/Image.c | 26 ++++++++++++--------------
1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c b/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c
index 2b9c3c3..e5eb677 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c
@@ -1139,7 +1139,6 @@ HiiDrawImage (
EFI_STATUS Status;
HII_DATABASE_PRIVATE_DATA *Private;
BOOLEAN Transparent;
- EFI_IMAGE_INPUT *ImageIn;
EFI_IMAGE_OUTPUT *ImageOut;
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer;
UINTN BufferLen;
@@ -1165,7 +1164,6 @@ HiiDrawImage (
}

FontInfo = NULL;
- ImageIn = (EFI_IMAGE_INPUT *) Image;

//
// Check whether the image will be drawn transparently or opaquely.
@@ -1180,7 +1178,7 @@ HiiDrawImage (
// Now EFI_HII_DRAW_FLAG_DEFAULT is set, whether image will be drawn depending
// on the image's transparency setting.
//
- if ((ImageIn->Flags & EFI_IMAGE_TRANSPARENT) == EFI_IMAGE_TRANSPARENT) {
+ if ((Image->Flags & EFI_IMAGE_TRANSPARENT) == EFI_IMAGE_TRANSPARENT) {
Transparent = TRUE;
}
}
@@ -1209,8 +1207,8 @@ HiiDrawImage (
// Clip the image by (Width, Height)
//

- Width = ImageIn->Width;
- Height = ImageIn->Height;
+ Width = Image->Width;
+ Height = Image->Height;

if (Width > (*Blt)->Width - BltX) {
Width = (*Blt)->Width - BltX;
@@ -1225,14 +1223,14 @@ HiiDrawImage (
return EFI_OUT_OF_RESOURCES;
}

- if (Width == ImageIn->Width && Height == ImageIn->Height) {
- CopyMem (BltBuffer, ImageIn->Bitmap, BufferLen);
+ if (Width == Image->Width && Height == Image->Height) {
+ CopyMem (BltBuffer, Image->Bitmap, BufferLen);
} else {
for (Ypos = 0; Ypos < Height; Ypos++) {
- OffsetY1 = ImageIn->Width * Ypos;
+ OffsetY1 = Image->Width * Ypos;
OffsetY2 = Width * Ypos;
for (Xpos = 0; Xpos < Width; Xpos++) {
- BltBuffer[OffsetY2 + Xpos] = ImageIn->Bitmap[OffsetY1 + Xpos];
+ BltBuffer[OffsetY2 + Xpos] = Image->Bitmap[OffsetY1 + Xpos];
}
}
}
@@ -1283,8 +1281,8 @@ HiiDrawImage (
//
// Allocate a new bitmap to hold the incoming image.
//
- Width = ImageIn->Width + BltX;
- Height = ImageIn->Height + BltY;
+ Width = Image->Width + BltX;
+ Height = Image->Height + BltY;

BufferLen = Width * Height * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL);
BltBuffer = (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) AllocateZeroPool (BufferLen);
@@ -1322,11 +1320,11 @@ HiiDrawImage (
//
*Blt = ImageOut;
return ImageToBlt (
- ImageIn->Bitmap,
+ Image->Bitmap,
BltX,
BltY,
- ImageIn->Width,
- ImageIn->Height,
+ Image->Width,
+ Image->Height,
Transparent,
Blt
);
--
2.9.0.windows.1