mirror of https://github.com/acidanthera/audk.git
1.Removed PrintXY from Graphics Library.
2.Added PrintXY and AsciiPrintXY in Uefi Library 3.Moved PcdUgaConsumeSupport from MdeModulePkg to MdePkg. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6642 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
b10a05d6c3
commit
b31547205f
|
@ -60,4 +60,4 @@
|
||||||
gEfiOEMBadgingProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
gEfiOEMBadgingProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||||
|
|
||||||
[FeaturePcd.common]
|
[FeaturePcd.common]
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdUgaConsumeSupport
|
gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport
|
||||||
|
|
|
@ -38,25 +38,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#include <Library/DxeServicesLib.h>
|
#include <Library/DxeServicesLib.h>
|
||||||
#include <Library/PcdLib.h>
|
#include <Library/PcdLib.h>
|
||||||
|
|
||||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL mEfiColors[16] = {
|
|
||||||
{ 0x00, 0x00, 0x00, 0x00 },
|
|
||||||
{ 0x98, 0x00, 0x00, 0x00 },
|
|
||||||
{ 0x00, 0x98, 0x00, 0x00 },
|
|
||||||
{ 0x98, 0x98, 0x00, 0x00 },
|
|
||||||
{ 0x00, 0x00, 0x98, 0x00 },
|
|
||||||
{ 0x98, 0x00, 0x98, 0x00 },
|
|
||||||
{ 0x00, 0x98, 0x98, 0x00 },
|
|
||||||
{ 0x98, 0x98, 0x98, 0x00 },
|
|
||||||
{ 0x10, 0x10, 0x10, 0x00 },
|
|
||||||
{ 0xff, 0x10, 0x10, 0x00 },
|
|
||||||
{ 0x10, 0xff, 0x10, 0x00 },
|
|
||||||
{ 0xff, 0xff, 0x10, 0x00 },
|
|
||||||
{ 0x10, 0x10, 0xff, 0x00 },
|
|
||||||
{ 0xf0, 0x10, 0xff, 0x00 },
|
|
||||||
{ 0x10, 0xff, 0xff, 0x00 },
|
|
||||||
{ 0xff, 0xff, 0xff, 0x00 }
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Return the graphics image file named FileNameGuid into Image and return it's
|
Return the graphics image file named FileNameGuid into Image and return it's
|
||||||
|
@ -636,299 +617,3 @@ DisableQuietBoot (
|
||||||
return ConsoleControl->SetMode (ConsoleControl, EfiConsoleControlScreenText);
|
return ConsoleControl->SetMode (ConsoleControl, EfiConsoleControlScreenText);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
Internal display string worker function.
|
|
||||||
|
|
||||||
@param GraphicsOutput Graphics output protocol interface.
|
|
||||||
@param UgaDraw UGA draw protocol interface.
|
|
||||||
@param Sto Simple text out protocol interface.
|
|
||||||
@param X X coordinate to start printing.
|
|
||||||
@param Y Y coordinate to start printing.
|
|
||||||
@param Foreground Foreground color.
|
|
||||||
@param Background Background color.
|
|
||||||
@param fmt Format string.
|
|
||||||
@param args Print arguments.
|
|
||||||
|
|
||||||
@return Number of Characters printed. Zero means no any character
|
|
||||||
displayed successfully.
|
|
||||||
|
|
||||||
**/
|
|
||||||
UINTN
|
|
||||||
Print (
|
|
||||||
IN EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput,
|
|
||||||
IN EFI_UGA_DRAW_PROTOCOL *UgaDraw,
|
|
||||||
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Sto,
|
|
||||||
IN UINTN X,
|
|
||||||
IN UINTN Y,
|
|
||||||
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Foreground,
|
|
||||||
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Background,
|
|
||||||
IN CHAR16 *fmt,
|
|
||||||
IN VA_LIST args
|
|
||||||
)
|
|
||||||
{
|
|
||||||
VOID *Buffer;
|
|
||||||
EFI_STATUS Status;
|
|
||||||
UINTN Index;
|
|
||||||
CHAR16 *UnicodeWeight;
|
|
||||||
UINT32 HorizontalResolution;
|
|
||||||
UINT32 VerticalResolution;
|
|
||||||
UINT32 ColorDepth;
|
|
||||||
UINT32 RefreshRate;
|
|
||||||
UINTN BufferLen;
|
|
||||||
UINTN LineBufferLen;
|
|
||||||
EFI_HII_FONT_PROTOCOL *HiiFont;
|
|
||||||
EFI_IMAGE_OUTPUT *Blt;
|
|
||||||
EFI_FONT_DISPLAY_INFO *FontInfo;
|
|
||||||
EFI_HII_ROW_INFO *RowInfoArray;
|
|
||||||
UINTN RowInfoArraySize;
|
|
||||||
UINTN PrintNum;
|
|
||||||
|
|
||||||
//
|
|
||||||
// For now, allocate an arbitrarily long buffer
|
|
||||||
//
|
|
||||||
Buffer = AllocateZeroPool (0x10000);
|
|
||||||
if (Buffer == NULL) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
HorizontalResolution = 0;
|
|
||||||
VerticalResolution = 0;
|
|
||||||
Blt = NULL;
|
|
||||||
FontInfo = NULL;
|
|
||||||
PrintNum = 0;
|
|
||||||
|
|
||||||
if (GraphicsOutput != NULL) {
|
|
||||||
HorizontalResolution = GraphicsOutput->Mode->Info->HorizontalResolution;
|
|
||||||
VerticalResolution = GraphicsOutput->Mode->Info->VerticalResolution;
|
|
||||||
} else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
|
|
||||||
UgaDraw->GetMode (UgaDraw, &HorizontalResolution, &VerticalResolution, &ColorDepth, &RefreshRate);
|
|
||||||
} else {
|
|
||||||
Status = EFI_UNSUPPORTED;
|
|
||||||
goto Error;
|
|
||||||
}
|
|
||||||
|
|
||||||
ASSERT ((HorizontalResolution != 0) && (VerticalResolution !=0));
|
|
||||||
|
|
||||||
Status = gBS->LocateProtocol (&gEfiHiiFontProtocolGuid, NULL, (VOID **) &HiiFont);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
goto Error;
|
|
||||||
}
|
|
||||||
|
|
||||||
PrintNum = UnicodeVSPrint (Buffer, 0x10000, fmt, args);
|
|
||||||
|
|
||||||
UnicodeWeight = (CHAR16 *) Buffer;
|
|
||||||
|
|
||||||
for (Index = 0; UnicodeWeight[Index] != 0; Index++) {
|
|
||||||
if (UnicodeWeight[Index] == CHAR_BACKSPACE ||
|
|
||||||
UnicodeWeight[Index] == CHAR_LINEFEED ||
|
|
||||||
UnicodeWeight[Index] == CHAR_CARRIAGE_RETURN) {
|
|
||||||
UnicodeWeight[Index] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
BufferLen = StrLen (Buffer);
|
|
||||||
|
|
||||||
LineBufferLen = sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * HorizontalResolution * EFI_GLYPH_HEIGHT;
|
|
||||||
if (EFI_GLYPH_WIDTH * EFI_GLYPH_HEIGHT * sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * BufferLen > LineBufferLen) {
|
|
||||||
Status = EFI_INVALID_PARAMETER;
|
|
||||||
goto Error;
|
|
||||||
}
|
|
||||||
|
|
||||||
Blt = (EFI_IMAGE_OUTPUT *) AllocateZeroPool (sizeof (EFI_IMAGE_OUTPUT));
|
|
||||||
if (Blt == NULL) {
|
|
||||||
Status = EFI_OUT_OF_RESOURCES;
|
|
||||||
goto Error;
|
|
||||||
}
|
|
||||||
|
|
||||||
Blt->Width = (UINT16) (HorizontalResolution);
|
|
||||||
Blt->Height = (UINT16) (VerticalResolution);
|
|
||||||
|
|
||||||
FontInfo = (EFI_FONT_DISPLAY_INFO *) AllocateZeroPool (sizeof (EFI_FONT_DISPLAY_INFO));
|
|
||||||
if (FontInfo == NULL) {
|
|
||||||
Status = EFI_OUT_OF_RESOURCES;
|
|
||||||
goto Error;
|
|
||||||
}
|
|
||||||
if (Foreground != NULL) {
|
|
||||||
CopyMem (&FontInfo->ForegroundColor, Foreground, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
|
|
||||||
} else {
|
|
||||||
CopyMem (
|
|
||||||
&FontInfo->ForegroundColor,
|
|
||||||
&mEfiColors[Sto->Mode->Attribute & 0x0f],
|
|
||||||
sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (Background != NULL) {
|
|
||||||
CopyMem (&FontInfo->BackgroundColor, Background, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
|
|
||||||
} else {
|
|
||||||
CopyMem (
|
|
||||||
&FontInfo->BackgroundColor,
|
|
||||||
&mEfiColors[Sto->Mode->Attribute >> 4],
|
|
||||||
sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GraphicsOutput != NULL) {
|
|
||||||
Blt->Image.Screen = GraphicsOutput;
|
|
||||||
|
|
||||||
Status = HiiFont->StringToImage (
|
|
||||||
HiiFont,
|
|
||||||
EFI_HII_IGNORE_IF_NO_GLYPH | EFI_HII_DIRECT_TO_SCREEN,
|
|
||||||
Buffer,
|
|
||||||
FontInfo,
|
|
||||||
&Blt,
|
|
||||||
X,
|
|
||||||
Y,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
} else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
|
|
||||||
ASSERT (UgaDraw!= NULL);
|
|
||||||
|
|
||||||
Blt->Image.Bitmap = AllocateZeroPool (Blt->Width * Blt->Height * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
|
|
||||||
if (Blt->Image.Bitmap == NULL) {
|
|
||||||
FreePool (Blt);
|
|
||||||
FreePool (Buffer);
|
|
||||||
return EFI_OUT_OF_RESOURCES;
|
|
||||||
}
|
|
||||||
|
|
||||||
RowInfoArray = NULL;
|
|
||||||
//
|
|
||||||
// StringToImage only support blt'ing image to device using GOP protocol. If GOP is not supported in this platform,
|
|
||||||
// we ask StringToImage to print the string to blt buffer, then blt to device using UgaDraw.
|
|
||||||
//
|
|
||||||
Status = HiiFont->StringToImage (
|
|
||||||
HiiFont,
|
|
||||||
EFI_HII_IGNORE_IF_NO_GLYPH,
|
|
||||||
Buffer,
|
|
||||||
FontInfo,
|
|
||||||
&Blt,
|
|
||||||
X,
|
|
||||||
Y,
|
|
||||||
&RowInfoArray,
|
|
||||||
&RowInfoArraySize,
|
|
||||||
NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!EFI_ERROR (Status)) {
|
|
||||||
//
|
|
||||||
// Line breaks are handled by caller of DrawUnicodeWeightAtCursorN, so the updated parameter RowInfoArraySize by StringToImage will
|
|
||||||
// always be 1 or 0 (if there is no valid Unicode Char can be printed). ASSERT here to make sure.
|
|
||||||
//
|
|
||||||
ASSERT (RowInfoArraySize <= 1);
|
|
||||||
|
|
||||||
Status = UgaDraw->Blt (
|
|
||||||
UgaDraw,
|
|
||||||
(EFI_UGA_PIXEL *) Blt->Image.Bitmap,
|
|
||||||
EfiUgaBltBufferToVideo,
|
|
||||||
X,
|
|
||||||
Y,
|
|
||||||
X,
|
|
||||||
Y,
|
|
||||||
RowInfoArray[0].LineWidth,
|
|
||||||
RowInfoArray[0].LineHeight,
|
|
||||||
Blt->Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (RowInfoArray != NULL) {
|
|
||||||
FreePool (RowInfoArray);
|
|
||||||
}
|
|
||||||
if (Blt->Image.Bitmap != NULL) {
|
|
||||||
FreePool (Blt->Image.Bitmap);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Status = EFI_UNSUPPORTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
Error:
|
|
||||||
if (Blt != NULL) {
|
|
||||||
FreePool (Blt);
|
|
||||||
}
|
|
||||||
if (FontInfo != NULL) {
|
|
||||||
FreePool (FontInfo);
|
|
||||||
}
|
|
||||||
FreePool (Buffer);
|
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
return PrintNum;
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Print Unicode string to graphics screen at the given X,Y coordinates of the graphics screen.
|
|
||||||
see definition of Print to find rules for constructing Fmt.
|
|
||||||
|
|
||||||
@param X Row to start printing at.
|
|
||||||
@param Y Column to start printing at.
|
|
||||||
@param ForeGround Foreground color.
|
|
||||||
@param BackGround background color.
|
|
||||||
@param Fmt Print format sting. See definition of Print.
|
|
||||||
@param ... Variable argument list whose contents are accessed based on
|
|
||||||
the format string specified by Format.
|
|
||||||
|
|
||||||
@return Number of Characters printed. Zero means no any character
|
|
||||||
displayed successfully.
|
|
||||||
|
|
||||||
**/
|
|
||||||
UINTN
|
|
||||||
EFIAPI
|
|
||||||
PrintXY (
|
|
||||||
IN UINTN X,
|
|
||||||
IN UINTN Y,
|
|
||||||
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround, OPTIONAL
|
|
||||||
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround, OPTIONAL
|
|
||||||
IN CHAR16 *Fmt,
|
|
||||||
...
|
|
||||||
)
|
|
||||||
{
|
|
||||||
EFI_HANDLE Handle;
|
|
||||||
EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
|
|
||||||
EFI_UGA_DRAW_PROTOCOL *UgaDraw;
|
|
||||||
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Sto;
|
|
||||||
EFI_STATUS Status;
|
|
||||||
VA_LIST Args;
|
|
||||||
|
|
||||||
VA_START (Args, Fmt);
|
|
||||||
|
|
||||||
Handle = gST->ConsoleOutHandle;
|
|
||||||
|
|
||||||
Status = gBS->HandleProtocol (
|
|
||||||
Handle,
|
|
||||||
&gEfiGraphicsOutputProtocolGuid,
|
|
||||||
(VOID **) &GraphicsOutput
|
|
||||||
);
|
|
||||||
|
|
||||||
UgaDraw = NULL;
|
|
||||||
if (EFI_ERROR (Status) && FeaturePcdGet (PcdUgaConsumeSupport)) {
|
|
||||||
//
|
|
||||||
// If no GOP available, try to open UGA Draw protocol if supported.
|
|
||||||
//
|
|
||||||
GraphicsOutput = NULL;
|
|
||||||
|
|
||||||
Status = gBS->HandleProtocol (
|
|
||||||
Handle,
|
|
||||||
&gEfiUgaDrawProtocolGuid,
|
|
||||||
(VOID **) &UgaDraw
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = gBS->HandleProtocol (
|
|
||||||
Handle,
|
|
||||||
&gEfiSimpleTextOutProtocolGuid,
|
|
||||||
(VOID **) &Sto
|
|
||||||
);
|
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Print (GraphicsOutput, UgaDraw, Sto, X, Y, ForeGround, BackGround, Fmt, Args);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -59,4 +59,4 @@
|
||||||
gEfiHiiFontProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
gEfiHiiFontProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||||
|
|
||||||
[FeaturePcd.common]
|
[FeaturePcd.common]
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdUgaConsumeSupport
|
gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport
|
||||||
|
|
|
@ -289,9 +289,6 @@
|
||||||
## If PcdSupportHardwareErrorRecord is TRUE, support hardware error record via variable in BDS.
|
## If PcdSupportHardwareErrorRecord is TRUE, support hardware error record via variable in BDS.
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSupportHardwareErrorRecord|FALSE|BOOLEAN|0x00010045
|
gEfiMdeModulePkgTokenSpaceGuid.PcdSupportHardwareErrorRecord|FALSE|BOOLEAN|0x00010045
|
||||||
|
|
||||||
## If TRUE, UGA Draw Protocol is still consumed in platform.
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdUgaConsumeSupport|TRUE|BOOLEAN|0x00010046
|
|
||||||
|
|
||||||
## If TRUE, Robustnesss improvement such as for DUET. Default is not required.
|
## If TRUE, Robustnesss improvement such as for DUET. Default is not required.
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdTurnOffUsbLegacySupport|FALSE|BOOLEAN|0x00010047
|
gEfiMdeModulePkgTokenSpaceGuid.PcdTurnOffUsbLegacySupport|FALSE|BOOLEAN|0x00010047
|
||||||
|
|
||||||
|
|
|
@ -141,7 +141,7 @@
|
||||||
[FeaturePcd.common]
|
[FeaturePcd.common]
|
||||||
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLangDeprecate
|
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLangDeprecate
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSupportHardwareErrorRecord
|
gEfiMdeModulePkgTokenSpaceGuid.PcdSupportHardwareErrorRecord
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdUgaConsumeSupport
|
gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport
|
||||||
|
|
||||||
[Pcd.common]
|
[Pcd.common]
|
||||||
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLangCodes
|
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLangCodes
|
||||||
|
|
|
@ -84,4 +84,4 @@
|
||||||
[FeaturePcd.common]
|
[FeaturePcd.common]
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport
|
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport
|
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdUgaConsumeSupport
|
gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport
|
||||||
|
|
|
@ -62,4 +62,4 @@
|
||||||
gEfiHiiDatabaseProtocolGuid # PROTOCOL TO_START
|
gEfiHiiDatabaseProtocolGuid # PROTOCOL TO_START
|
||||||
|
|
||||||
[FeaturePcd.common]
|
[FeaturePcd.common]
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdUgaConsumeSupport
|
gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport
|
|
@ -17,9 +17,6 @@
|
||||||
#ifndef __EFI_GRAPHICS_LIB_H__
|
#ifndef __EFI_GRAPHICS_LIB_H__
|
||||||
#define __EFI_GRAPHICS_LIB_H__
|
#define __EFI_GRAPHICS_LIB_H__
|
||||||
|
|
||||||
#include <Protocol/GraphicsOutput.h>
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Return the graphics image file named FileNameGuid into Image and return it's
|
Return the graphics image file named FileNameGuid into Image and return it's
|
||||||
size in ImageSize. All Firmware Volumes (FV) in the system are searched for the
|
size in ImageSize. All Firmware Volumes (FV) in the system are searched for the
|
||||||
|
@ -146,32 +143,4 @@ LockKeyboards (
|
||||||
IN CHAR16 *Password
|
IN CHAR16 *Password
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Print Unicode string to graphics screen at the given X,Y coordinates of the graphics screen.
|
|
||||||
see definition of Print to find rules for constructing Fmt.
|
|
||||||
|
|
||||||
@param[in] X Row to start printing at
|
|
||||||
@param[in] Y Column to start printing at
|
|
||||||
@param[in] ForeGround Foreground color
|
|
||||||
@param[in] BackGround background color
|
|
||||||
@param[in] Fmt Print format sting. See definition of Print
|
|
||||||
@param ... Variable argument list whose contents are accessed based on
|
|
||||||
the format string specified by Format.
|
|
||||||
|
|
||||||
@return Number of Characters printed.
|
|
||||||
|
|
||||||
**/
|
|
||||||
UINTN
|
|
||||||
EFIAPI
|
|
||||||
PrintXY (
|
|
||||||
IN UINTN X,
|
|
||||||
IN UINTN Y,
|
|
||||||
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround, OPTIONAL
|
|
||||||
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround, OPTIONAL
|
|
||||||
IN CHAR16 *Fmt,
|
|
||||||
...
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -28,6 +28,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#include <Protocol/ComponentName2.h>
|
#include <Protocol/ComponentName2.h>
|
||||||
#include <Protocol/DriverDiagnostics.h>
|
#include <Protocol/DriverDiagnostics.h>
|
||||||
#include <Protocol/DriverDiagnostics2.h>
|
#include <Protocol/DriverDiagnostics2.h>
|
||||||
|
#include <Protocol/GraphicsOutput.h>
|
||||||
|
|
||||||
#include <Library/BaseLib.h>
|
#include <Library/BaseLib.h>
|
||||||
|
|
||||||
|
@ -915,6 +916,104 @@ AsciiErrorPrint (
|
||||||
...
|
...
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Prints a formatted Unicode string to a graphics console device specified by
|
||||||
|
ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE at the given (X,Y) coordinates.
|
||||||
|
|
||||||
|
This function prints a formatted Unicode string to the graphics console device
|
||||||
|
specified by ConsoleOutputHandle in EFI_SYSTEM_TABLE and returns the number of
|
||||||
|
Unicode characters printed. If the length of the formatted Unicode string is
|
||||||
|
greater than PcdUefiLibMaxPrintBufferSize, then only the first
|
||||||
|
PcdUefiLibMaxPrintBufferSize characters are printed. The EFI_HII_FONT_PROTOCOL
|
||||||
|
is used to convert the string to a bitmap using the glyphs registered with the
|
||||||
|
HII database. No wrapping is performed, so any portions of the string the fall
|
||||||
|
outside the active display region will not be displayed.
|
||||||
|
|
||||||
|
If a graphics console device is not associated with the ConsoleOutputHandle
|
||||||
|
defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned.
|
||||||
|
If the EFI_HII_FONT_PROTOCOL is not present in the handle database, then no
|
||||||
|
string is printed, and 0 is returned.
|
||||||
|
If Format is NULL, then ASSERT().
|
||||||
|
If Format is not aligned on a 16-bit boundary, then ASSERT().
|
||||||
|
|
||||||
|
@param X X coordinate to print the string.
|
||||||
|
@param Y Y coordinate to print the string.
|
||||||
|
@param ForeGround The forground color of the string being printed. This is
|
||||||
|
an optional parameter that may be NULL. If it is NULL,
|
||||||
|
then the foreground color of the current ConOut device
|
||||||
|
in the EFI_SYSTEM_TABLE is used.
|
||||||
|
@param BackGround The background color of the string being printed. This is
|
||||||
|
an optional parameter that may be NULL. If it is NULL,
|
||||||
|
then the background color of the current ConOut device
|
||||||
|
in the EFI_SYSTEM_TABLE is used.
|
||||||
|
@param Format Null-terminated Unicode format string. See Print Library
|
||||||
|
for the supported format string syntax.
|
||||||
|
@param ... Variable argument list whose contents are accessed based on
|
||||||
|
the format string specified by Format.
|
||||||
|
|
||||||
|
@return The number of Unicode characters printed.
|
||||||
|
|
||||||
|
**/
|
||||||
|
UINTN
|
||||||
|
EFIAPI
|
||||||
|
PrintXY (
|
||||||
|
IN UINTN X,
|
||||||
|
IN UINTN Y,
|
||||||
|
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround, OPTIONAL
|
||||||
|
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround, OPTIONAL
|
||||||
|
IN CONST CHAR16 *Format,
|
||||||
|
...
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Prints a formatted ASCII string to a graphics console device specified by
|
||||||
|
ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE at the given (X,Y) coordinates.
|
||||||
|
|
||||||
|
This function prints a formatted ASCII string to the graphics console device
|
||||||
|
specified by ConsoleOutputHandle in EFI_SYSTEM_TABLE and returns the number of
|
||||||
|
ASCII characters printed. If the length of the formatted ASCII string is
|
||||||
|
greater than PcdUefiLibMaxPrintBufferSize, then only the first
|
||||||
|
PcdUefiLibMaxPrintBufferSize characters are printed. The EFI_HII_FONT_PROTOCOL
|
||||||
|
is used to convert the string to a bitmap using the glyphs registered with the
|
||||||
|
HII database. No wrapping is performed, so any portions of the string the fall
|
||||||
|
outside the active display region will not be displayed.
|
||||||
|
|
||||||
|
If a graphics console device is not associated with the ConsoleOutputHandle
|
||||||
|
defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned.
|
||||||
|
If the EFI_HII_FONT_PROTOCOL is not present in the handle database, then no
|
||||||
|
string is printed, and 0 is returned.
|
||||||
|
If Format is NULL, then ASSERT().
|
||||||
|
If Format is not aligned on a 16-bit boundary, then ASSERT().
|
||||||
|
|
||||||
|
@param X X coordinate to print the string.
|
||||||
|
@param Y Y coordinate to print the string.
|
||||||
|
@param ForeGround The forground color of the string being printed. This is
|
||||||
|
an optional parameter that may be NULL. If it is NULL,
|
||||||
|
then the foreground color of the current ConOut device
|
||||||
|
in the EFI_SYSTEM_TABLE is used.
|
||||||
|
@param BackGround The background color of the string being printed. This is
|
||||||
|
an optional parameter that may be NULL. If it is NULL,
|
||||||
|
then the background color of the current ConOut device
|
||||||
|
in the EFI_SYSTEM_TABLE is used.
|
||||||
|
@param Format Null-terminated ASCII format string. See Print Library
|
||||||
|
for the supported format string syntax.
|
||||||
|
@param ... Variable argument list whose contents are accessed based on
|
||||||
|
the format string specified by Format.
|
||||||
|
|
||||||
|
@return The number of ASCII characters printed.
|
||||||
|
|
||||||
|
**/
|
||||||
|
UINTN
|
||||||
|
EFIAPI
|
||||||
|
AsciiPrintXY (
|
||||||
|
IN UINTN X,
|
||||||
|
IN UINTN Y,
|
||||||
|
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround, OPTIONAL
|
||||||
|
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround, OPTIONAL
|
||||||
|
IN CONST CHAR8 *Format,
|
||||||
|
...
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Initializes a driver by installing the Driver Binding Protocol onto the driver's
|
Initializes a driver by installing the Driver Binding Protocol onto the driver's
|
||||||
DriverBindingHandle. This is typically the same as the driver's ImageHandle, but
|
DriverBindingHandle. This is typically the same as the driver's ImageHandle, but
|
||||||
|
|
|
@ -64,12 +64,17 @@
|
||||||
|
|
||||||
[Protocols]
|
[Protocols]
|
||||||
gEfiDriverBindingProtocolGuid # ALWAYS_CONSUMED
|
gEfiDriverBindingProtocolGuid # ALWAYS_CONSUMED
|
||||||
|
gEfiSimpleTextOutProtocolGuid # ALWAYS_CONSUMED
|
||||||
|
gEfiGraphicsOutputProtocolGuid # ALWAYS_CONSUMED
|
||||||
|
gEfiHiiFontProtocolGuid # ALWAYS_CONSUMED
|
||||||
gEfiComponentNameProtocolGuid # SOMETIMES_CONSUMED
|
gEfiComponentNameProtocolGuid # SOMETIMES_CONSUMED
|
||||||
gEfiComponentName2ProtocolGuid # SOMETIMES_CONSUMED
|
gEfiComponentName2ProtocolGuid # SOMETIMES_CONSUMED
|
||||||
gEfiDriverConfigurationProtocolGuid # SOMETIMES_CONSUMED
|
gEfiDriverConfigurationProtocolGuid # SOMETIMES_CONSUMED
|
||||||
gEfiDriverConfiguration2ProtocolGuid # SOMETIMES_CONSUMED
|
gEfiDriverConfiguration2ProtocolGuid # SOMETIMES_CONSUMED
|
||||||
gEfiDriverDiagnosticsProtocolGuid # SOMETIMES_CONSUMED
|
gEfiDriverDiagnosticsProtocolGuid # SOMETIMES_CONSUMED
|
||||||
gEfiDriverDiagnostics2ProtocolGuid # SOMETIMES_CONSUMED
|
gEfiDriverDiagnostics2ProtocolGuid # SOMETIMES_CONSUMED
|
||||||
|
gEfiUgaDrawProtocolGuid # SOMETIMES_CONSUMED
|
||||||
|
|
||||||
|
|
||||||
[Pcd.common]
|
[Pcd.common]
|
||||||
gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize
|
gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize
|
||||||
|
@ -80,6 +85,7 @@
|
||||||
gEfiMdePkgTokenSpaceGuid.PcdComponentNameDisable
|
gEfiMdePkgTokenSpaceGuid.PcdComponentNameDisable
|
||||||
gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnostics2Disable
|
gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnostics2Disable
|
||||||
gEfiMdePkgTokenSpaceGuid.PcdComponentName2Disable
|
gEfiMdePkgTokenSpaceGuid.PcdComponentName2Disable
|
||||||
|
gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport
|
||||||
|
|
||||||
[Guids]
|
[Guids]
|
||||||
gEfiGlobalVariableGuid
|
gEfiGlobalVariableGuid
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
Internal include file for UefiLib.
|
Internal include file for UefiLib.
|
||||||
|
|
||||||
Copyright (c) 2007, Intel Corporation.<BR>
|
Copyright (c) 2007 - 2008, Intel Corporation.<BR>
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -22,6 +22,9 @@
|
||||||
#include <Protocol/DriverDiagnostics.h>
|
#include <Protocol/DriverDiagnostics.h>
|
||||||
#include <Protocol/DriverDiagnostics2.h>
|
#include <Protocol/DriverDiagnostics2.h>
|
||||||
#include <Protocol/LoadedImage.h>
|
#include <Protocol/LoadedImage.h>
|
||||||
|
#include <Protocol/GraphicsOutput.h>
|
||||||
|
#include <Protocol/UgaDraw.h>
|
||||||
|
#include <Protocol/HiiFont.h>
|
||||||
|
|
||||||
#include <Guid/EventGroup.h>
|
#include <Guid/EventGroup.h>
|
||||||
#include <Guid/EventLegacyBios.h>
|
#include <Guid/EventLegacyBios.h>
|
||||||
|
|
|
@ -13,9 +13,27 @@
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
#include "UefiLibInternal.h"
|
#include "UefiLibInternal.h"
|
||||||
|
|
||||||
|
EFI_GRAPHICS_OUTPUT_BLT_PIXEL mEfiColors[16] = {
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00 },
|
||||||
|
{ 0x98, 0x00, 0x00, 0x00 },
|
||||||
|
{ 0x00, 0x98, 0x00, 0x00 },
|
||||||
|
{ 0x98, 0x98, 0x00, 0x00 },
|
||||||
|
{ 0x00, 0x00, 0x98, 0x00 },
|
||||||
|
{ 0x98, 0x00, 0x98, 0x00 },
|
||||||
|
{ 0x00, 0x98, 0x98, 0x00 },
|
||||||
|
{ 0x98, 0x98, 0x98, 0x00 },
|
||||||
|
{ 0x10, 0x10, 0x10, 0x00 },
|
||||||
|
{ 0xff, 0x10, 0x10, 0x00 },
|
||||||
|
{ 0x10, 0xff, 0x10, 0x00 },
|
||||||
|
{ 0xff, 0xff, 0x10, 0x00 },
|
||||||
|
{ 0x10, 0x10, 0xff, 0x00 },
|
||||||
|
{ 0xf0, 0x10, 0xff, 0x00 },
|
||||||
|
{ 0x10, 0xff, 0xff, 0x00 },
|
||||||
|
{ 0xff, 0xff, 0xff, 0x00 }
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Internal function which prints a formatted Unicode string to the console output device
|
Internal function which prints a formatted Unicode string to the console output device
|
||||||
specified by Console
|
specified by Console
|
||||||
|
@ -35,7 +53,6 @@
|
||||||
output buffer not including the Null-terminator.
|
output buffer not including the Null-terminator.
|
||||||
**/
|
**/
|
||||||
UINTN
|
UINTN
|
||||||
EFIAPI
|
|
||||||
InternalPrint (
|
InternalPrint (
|
||||||
IN CONST CHAR16 *Format,
|
IN CONST CHAR16 *Format,
|
||||||
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Console,
|
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Console,
|
||||||
|
@ -47,7 +64,7 @@ InternalPrint (
|
||||||
UINTN BufferSize;
|
UINTN BufferSize;
|
||||||
|
|
||||||
ASSERT (Format != NULL);
|
ASSERT (Format != NULL);
|
||||||
ASSERT (((UINTN) Format & 0x01) == 0);
|
ASSERT (((UINTN) Format & BIT0) == 0);
|
||||||
|
|
||||||
BufferSize = (PcdGet32 (PcdUefiLibMaxPrintBufferSize) + 1) * sizeof (CHAR16);
|
BufferSize = (PcdGet32 (PcdUefiLibMaxPrintBufferSize) + 1) * sizeof (CHAR16);
|
||||||
|
|
||||||
|
@ -154,11 +171,8 @@ ErrorPrint (
|
||||||
specified by Console and returns the number of ASCII characters that printed
|
specified by Console and returns the number of ASCII characters that printed
|
||||||
to it. If the length of the formatted ASCII string is greater than PcdUefiLibMaxPrintBufferSize,
|
to it. If the length of the formatted ASCII string is greater than PcdUefiLibMaxPrintBufferSize,
|
||||||
then only the first PcdUefiLibMaxPrintBufferSize characters are sent to Console.
|
then only the first PcdUefiLibMaxPrintBufferSize characters are sent to Console.
|
||||||
If Format is NULL, then ASSERT().
|
|
||||||
|
|
||||||
If Format is NULL, then ASSERT().
|
If Format is NULL, then ASSERT().
|
||||||
If Format is not aligned on a 16-bit boundary, then ASSERT().
|
|
||||||
|
|
||||||
|
|
||||||
@param Format Null-terminated ASCII format string.
|
@param Format Null-terminated ASCII format string.
|
||||||
@param Console The output console.
|
@param Console The output console.
|
||||||
|
@ -169,7 +183,6 @@ ErrorPrint (
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINTN
|
UINTN
|
||||||
EFIAPI
|
|
||||||
AsciiInternalPrint (
|
AsciiInternalPrint (
|
||||||
IN CONST CHAR8 *Format,
|
IN CONST CHAR8 *Format,
|
||||||
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Console,
|
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Console,
|
||||||
|
@ -280,3 +293,388 @@ AsciiErrorPrint (
|
||||||
return Return;
|
return Return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Internal function to print a formatted Unicode string to a graphics console device specified by
|
||||||
|
ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE at the given (X,Y) coordinates.
|
||||||
|
|
||||||
|
This function prints a formatted Unicode string to the graphics console device
|
||||||
|
specified by ConsoleOutputHandle in EFI_SYSTEM_TABLE and returns the number of
|
||||||
|
Unicode characters printed. The EFI_HII_FONT_PROTOCOL is used to convert the
|
||||||
|
string to a bitmap using the glyphs registered with the
|
||||||
|
HII database. No wrapping is performed, so any portions of the string the fall
|
||||||
|
outside the active display region will not be displayed.
|
||||||
|
|
||||||
|
If a graphics console device is not associated with the ConsoleOutputHandle
|
||||||
|
defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned.
|
||||||
|
If the EFI_HII_FONT_PROTOCOL is not present in the handle database, then no
|
||||||
|
string is printed, and 0 is returned.
|
||||||
|
|
||||||
|
@param X X coordinate to print the string.
|
||||||
|
@param Y Y coordinate to print the string.
|
||||||
|
@param ForeGround The forground color of the string being printed. This is
|
||||||
|
an optional parameter that may be NULL. If it is NULL,
|
||||||
|
then the foreground color of the current ConOut device
|
||||||
|
in the EFI_SYSTEM_TABLE is used.
|
||||||
|
@param BackGround The background color of the string being printed. This is
|
||||||
|
an optional parameter that may be NULL. If it is NULL,
|
||||||
|
then the background color of the current ConOut device
|
||||||
|
in the EFI_SYSTEM_TABLE is used.
|
||||||
|
@param Buffer Null-terminated Unicode formatted string.
|
||||||
|
@param PrintNum The number of Unicode formatted string to be printed.
|
||||||
|
|
||||||
|
@return Number of Unicode Characters printed. Zero means no any character
|
||||||
|
displayed successfully.
|
||||||
|
|
||||||
|
**/
|
||||||
|
UINTN
|
||||||
|
InternalPrintGraphic (
|
||||||
|
IN UINTN X,
|
||||||
|
IN UINTN Y,
|
||||||
|
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Foreground,
|
||||||
|
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Background,
|
||||||
|
IN CHAR16 *Buffer,
|
||||||
|
IN UINTN PrintNum
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
UINTN Index;
|
||||||
|
CHAR16 *UnicodeWeight;
|
||||||
|
UINT32 HorizontalResolution;
|
||||||
|
UINT32 VerticalResolution;
|
||||||
|
UINT32 ColorDepth;
|
||||||
|
UINT32 RefreshRate;
|
||||||
|
UINTN LineBufferLen;
|
||||||
|
EFI_HII_FONT_PROTOCOL *HiiFont;
|
||||||
|
EFI_IMAGE_OUTPUT *Blt;
|
||||||
|
EFI_FONT_DISPLAY_INFO FontInfo;
|
||||||
|
EFI_HII_ROW_INFO *RowInfoArray;
|
||||||
|
UINTN RowInfoArraySize;
|
||||||
|
EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
|
||||||
|
EFI_UGA_DRAW_PROTOCOL *UgaDraw;
|
||||||
|
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Sto;
|
||||||
|
EFI_HANDLE ConsoleHandle;
|
||||||
|
|
||||||
|
HorizontalResolution = 0;
|
||||||
|
VerticalResolution = 0;
|
||||||
|
Blt = NULL;
|
||||||
|
|
||||||
|
ConsoleHandle = gST->ConsoleOutHandle;
|
||||||
|
|
||||||
|
Status = gBS->HandleProtocol (
|
||||||
|
ConsoleHandle,
|
||||||
|
&gEfiGraphicsOutputProtocolGuid,
|
||||||
|
(VOID **) &GraphicsOutput
|
||||||
|
);
|
||||||
|
|
||||||
|
UgaDraw = NULL;
|
||||||
|
if (EFI_ERROR (Status) && FeaturePcdGet (PcdUgaConsumeSupport)) {
|
||||||
|
//
|
||||||
|
// If no GOP available, try to open UGA Draw protocol if supported.
|
||||||
|
//
|
||||||
|
GraphicsOutput = NULL;
|
||||||
|
|
||||||
|
Status = gBS->HandleProtocol (
|
||||||
|
ConsoleHandle,
|
||||||
|
&gEfiUgaDrawProtocolGuid,
|
||||||
|
(VOID **) &UgaDraw
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = gBS->HandleProtocol (
|
||||||
|
ConsoleHandle,
|
||||||
|
&gEfiSimpleTextOutProtocolGuid,
|
||||||
|
(VOID **) &Sto
|
||||||
|
);
|
||||||
|
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GraphicsOutput != NULL) {
|
||||||
|
HorizontalResolution = GraphicsOutput->Mode->Info->HorizontalResolution;
|
||||||
|
VerticalResolution = GraphicsOutput->Mode->Info->VerticalResolution;
|
||||||
|
} else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
|
||||||
|
UgaDraw->GetMode (UgaDraw, &HorizontalResolution, &VerticalResolution, &ColorDepth, &RefreshRate);
|
||||||
|
} else {
|
||||||
|
Status = EFI_UNSUPPORTED;
|
||||||
|
goto Error;
|
||||||
|
}
|
||||||
|
|
||||||
|
ASSERT ((HorizontalResolution != 0) && (VerticalResolution !=0));
|
||||||
|
|
||||||
|
Status = gBS->LocateProtocol (&gEfiHiiFontProtocolGuid, NULL, (VOID **) &HiiFont);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
goto Error;
|
||||||
|
}
|
||||||
|
|
||||||
|
UnicodeWeight = Buffer;
|
||||||
|
|
||||||
|
for (Index = 0; UnicodeWeight[Index] != 0; Index++) {
|
||||||
|
if (UnicodeWeight[Index] == CHAR_BACKSPACE ||
|
||||||
|
UnicodeWeight[Index] == CHAR_LINEFEED ||
|
||||||
|
UnicodeWeight[Index] == CHAR_CARRIAGE_RETURN) {
|
||||||
|
UnicodeWeight[Index] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LineBufferLen = sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * HorizontalResolution * EFI_GLYPH_HEIGHT;
|
||||||
|
if (EFI_GLYPH_WIDTH * EFI_GLYPH_HEIGHT * sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * PrintNum > LineBufferLen) {
|
||||||
|
Status = EFI_INVALID_PARAMETER;
|
||||||
|
goto Error;
|
||||||
|
}
|
||||||
|
|
||||||
|
Blt = (EFI_IMAGE_OUTPUT *) AllocateZeroPool (sizeof (EFI_IMAGE_OUTPUT));
|
||||||
|
ASSERT (Blt != NULL);
|
||||||
|
|
||||||
|
Blt->Width = (UINT16) (HorizontalResolution);
|
||||||
|
Blt->Height = (UINT16) (VerticalResolution);
|
||||||
|
|
||||||
|
ZeroMem (&FontInfo, sizeof (EFI_FONT_DISPLAY_INFO));
|
||||||
|
|
||||||
|
if (Foreground != NULL) {
|
||||||
|
CopyMem (&FontInfo.ForegroundColor, Foreground, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
|
||||||
|
} else {
|
||||||
|
CopyMem (
|
||||||
|
&FontInfo.ForegroundColor,
|
||||||
|
&mEfiColors[Sto->Mode->Attribute & 0x0f],
|
||||||
|
sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (Background != NULL) {
|
||||||
|
CopyMem (&FontInfo.BackgroundColor, Background, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
|
||||||
|
} else {
|
||||||
|
CopyMem (
|
||||||
|
&FontInfo.BackgroundColor,
|
||||||
|
&mEfiColors[Sto->Mode->Attribute >> 4],
|
||||||
|
sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GraphicsOutput != NULL) {
|
||||||
|
Blt->Image.Screen = GraphicsOutput;
|
||||||
|
|
||||||
|
Status = HiiFont->StringToImage (
|
||||||
|
HiiFont,
|
||||||
|
EFI_HII_IGNORE_IF_NO_GLYPH | EFI_HII_DIRECT_TO_SCREEN,
|
||||||
|
Buffer,
|
||||||
|
&FontInfo,
|
||||||
|
&Blt,
|
||||||
|
X,
|
||||||
|
Y,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
} else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
|
||||||
|
ASSERT (UgaDraw!= NULL);
|
||||||
|
|
||||||
|
Blt->Image.Bitmap = AllocateZeroPool (Blt->Width * Blt->Height * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
|
||||||
|
ASSERT (Blt->Image.Bitmap != NULL);
|
||||||
|
|
||||||
|
RowInfoArray = NULL;
|
||||||
|
//
|
||||||
|
// StringToImage only support blt'ing image to device using GOP protocol. If GOP is not supported in this platform,
|
||||||
|
// we ask StringToImage to print the string to blt buffer, then blt to device using UgaDraw.
|
||||||
|
//
|
||||||
|
Status = HiiFont->StringToImage (
|
||||||
|
HiiFont,
|
||||||
|
EFI_HII_IGNORE_IF_NO_GLYPH,
|
||||||
|
Buffer,
|
||||||
|
&FontInfo,
|
||||||
|
&Blt,
|
||||||
|
X,
|
||||||
|
Y,
|
||||||
|
&RowInfoArray,
|
||||||
|
&RowInfoArraySize,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!EFI_ERROR (Status)) {
|
||||||
|
ASSERT (RowInfoArray != NULL);
|
||||||
|
//
|
||||||
|
// Line breaks are handled by caller of DrawUnicodeWeightAtCursorN, so the updated parameter RowInfoArraySize by StringToImage will
|
||||||
|
// always be 1 or 0 (if there is no valid Unicode Char can be printed). ASSERT here to make sure.
|
||||||
|
//
|
||||||
|
ASSERT (RowInfoArraySize <= 1);
|
||||||
|
|
||||||
|
Status = UgaDraw->Blt (
|
||||||
|
UgaDraw,
|
||||||
|
(EFI_UGA_PIXEL *) Blt->Image.Bitmap,
|
||||||
|
EfiUgaBltBufferToVideo,
|
||||||
|
X,
|
||||||
|
Y,
|
||||||
|
X,
|
||||||
|
Y,
|
||||||
|
RowInfoArray[0].LineWidth,
|
||||||
|
RowInfoArray[0].LineHeight,
|
||||||
|
Blt->Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
FreePool (RowInfoArray);
|
||||||
|
FreePool (Blt->Image.Bitmap);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Status = EFI_UNSUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
FreePool (Blt);
|
||||||
|
|
||||||
|
Error:
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
return PrintNum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Prints a formatted Unicode string to a graphics console device specified by
|
||||||
|
ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE at the given (X,Y) coordinates.
|
||||||
|
|
||||||
|
This function prints a formatted Unicode string to the graphics console device
|
||||||
|
specified by ConsoleOutputHandle in EFI_SYSTEM_TABLE and returns the number of
|
||||||
|
Unicode characters printed. If the length of the formatted Unicode string is
|
||||||
|
greater than PcdUefiLibMaxPrintBufferSize, then only the first
|
||||||
|
PcdUefiLibMaxPrintBufferSize characters are printed. The EFI_HII_FONT_PROTOCOL
|
||||||
|
is used to convert the string to a bitmap using the glyphs registered with the
|
||||||
|
HII database. No wrapping is performed, so any portions of the string the fall
|
||||||
|
outside the active display region will not be displayed.
|
||||||
|
|
||||||
|
If a graphics console device is not associated with the ConsoleOutputHandle
|
||||||
|
defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned.
|
||||||
|
If the EFI_HII_FONT_PROTOCOL is not present in the handle database, then no
|
||||||
|
string is printed, and 0 is returned.
|
||||||
|
If Format is NULL, then ASSERT().
|
||||||
|
If Format is not aligned on a 16-bit boundary, then ASSERT().
|
||||||
|
|
||||||
|
@param X X coordinate to print the string.
|
||||||
|
@param Y Y coordinate to print the string.
|
||||||
|
@param ForeGround The forground color of the string being printed. This is
|
||||||
|
an optional parameter that may be NULL. If it is NULL,
|
||||||
|
then the foreground color of the current ConOut device
|
||||||
|
in the EFI_SYSTEM_TABLE is used.
|
||||||
|
@param BackGround The background color of the string being printed. This is
|
||||||
|
an optional parameter that may be NULL. If it is NULL,
|
||||||
|
then the background color of the current ConOut device
|
||||||
|
in the EFI_SYSTEM_TABLE is used.
|
||||||
|
@param Format Null-terminated Unicode format string. See Print Library
|
||||||
|
for the supported format string syntax.
|
||||||
|
@param ... Variable argument list whose contents are accessed based on
|
||||||
|
the format string specified by Format.
|
||||||
|
|
||||||
|
@return The number of characters printed.
|
||||||
|
|
||||||
|
**/
|
||||||
|
UINTN
|
||||||
|
EFIAPI
|
||||||
|
PrintXY (
|
||||||
|
IN UINTN X,
|
||||||
|
IN UINTN Y,
|
||||||
|
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround, OPTIONAL
|
||||||
|
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround, OPTIONAL
|
||||||
|
IN CONST CHAR16 *Format,
|
||||||
|
...
|
||||||
|
)
|
||||||
|
{
|
||||||
|
VA_LIST Marker;
|
||||||
|
CHAR16 *Buffer;
|
||||||
|
UINTN BufferSize;
|
||||||
|
UINTN PrintNum;
|
||||||
|
UINTN ReturnNum;
|
||||||
|
|
||||||
|
ASSERT (Format != NULL);
|
||||||
|
ASSERT (((UINTN) Format & BIT0) == 0);
|
||||||
|
|
||||||
|
VA_START (Marker, Format);
|
||||||
|
|
||||||
|
BufferSize = (PcdGet32 (PcdUefiLibMaxPrintBufferSize) + 1) * sizeof (CHAR16);
|
||||||
|
|
||||||
|
Buffer = (CHAR16 *) AllocatePool (BufferSize);
|
||||||
|
ASSERT (Buffer != NULL);
|
||||||
|
|
||||||
|
PrintNum = UnicodeVSPrint (Buffer, BufferSize, Format, Marker);
|
||||||
|
|
||||||
|
ReturnNum = InternalPrintGraphic (X, Y, ForeGround, BackGround, Buffer, PrintNum);
|
||||||
|
|
||||||
|
FreePool (Buffer);
|
||||||
|
|
||||||
|
return ReturnNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Prints a formatted ASCII string to a graphics console device specified by
|
||||||
|
ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE at the given (X,Y) coordinates.
|
||||||
|
|
||||||
|
This function prints a formatted ASCII string to the graphics console device
|
||||||
|
specified by ConsoleOutputHandle in EFI_SYSTEM_TABLE and returns the number of
|
||||||
|
Unicode characters printed. If the length of the formatted ASCII string is
|
||||||
|
greater than PcdUefiLibMaxPrintBufferSize, then only the first
|
||||||
|
PcdUefiLibMaxPrintBufferSize characters are printed. The EFI_HII_FONT_PROTOCOL
|
||||||
|
is used to convert the string to a bitmap using the glyphs registered with the
|
||||||
|
HII database. No wrapping is performed, so any portions of the string the fall
|
||||||
|
outside the active display region will not be displayed.
|
||||||
|
|
||||||
|
If a graphics console device is not associated with the ConsoleOutputHandle
|
||||||
|
defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned.
|
||||||
|
If the EFI_HII_FONT_PROTOCOL is not present in the handle database, then no
|
||||||
|
string is printed, and 0 is returned.
|
||||||
|
If Format is NULL, then ASSERT().
|
||||||
|
|
||||||
|
@param X X coordinate to print the string.
|
||||||
|
@param Y Y coordinate to print the string.
|
||||||
|
@param ForeGround The forground color of the string being printed. This is
|
||||||
|
an optional parameter that may be NULL. If it is NULL,
|
||||||
|
then the foreground color of the current ConOut device
|
||||||
|
in the EFI_SYSTEM_TABLE is used.
|
||||||
|
@param BackGround The background color of the string being printed. This is
|
||||||
|
an optional parameter that may be NULL. If it is NULL,
|
||||||
|
then the background color of the current ConOut device
|
||||||
|
in the EFI_SYSTEM_TABLE is used.
|
||||||
|
@param Format Null-terminated ASCII format string. See Print Library
|
||||||
|
for the supported format string syntax.
|
||||||
|
@param ... Variable argument list whose contents are accessed based on
|
||||||
|
the format string specified by Format.
|
||||||
|
|
||||||
|
@return The number of characters printed.
|
||||||
|
|
||||||
|
**/
|
||||||
|
UINTN
|
||||||
|
EFIAPI
|
||||||
|
AsciiPrintXY (
|
||||||
|
IN UINTN X,
|
||||||
|
IN UINTN Y,
|
||||||
|
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround, OPTIONAL
|
||||||
|
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround, OPTIONAL
|
||||||
|
IN CONST CHAR8 *Format,
|
||||||
|
...
|
||||||
|
)
|
||||||
|
{
|
||||||
|
VA_LIST Marker;
|
||||||
|
CHAR16 *Buffer;
|
||||||
|
UINTN BufferSize;
|
||||||
|
UINTN PrintNum;
|
||||||
|
UINTN ReturnNum;
|
||||||
|
|
||||||
|
ASSERT (Format != NULL);
|
||||||
|
|
||||||
|
VA_START (Marker, Format);
|
||||||
|
|
||||||
|
BufferSize = (PcdGet32 (PcdUefiLibMaxPrintBufferSize) + 1) * sizeof (CHAR16);
|
||||||
|
|
||||||
|
Buffer = (CHAR16 *) AllocatePool (BufferSize);
|
||||||
|
ASSERT (Buffer != NULL);
|
||||||
|
|
||||||
|
PrintNum = UnicodeSPrintAsciiFormat (Buffer, BufferSize, Format, Marker);
|
||||||
|
|
||||||
|
ReturnNum = InternalPrintGraphic (X, Y, ForeGround, BackGround, Buffer, PrintNum);
|
||||||
|
|
||||||
|
FreePool (Buffer);
|
||||||
|
|
||||||
|
return ReturnNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -401,6 +401,9 @@
|
||||||
## Indicates whether EFI 1.1 ISO 639-2 language supports are obsolete
|
## Indicates whether EFI 1.1 ISO 639-2 language supports are obsolete
|
||||||
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLangDeprecate|FALSE|BOOLEAN|0x00000012 .
|
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLangDeprecate|FALSE|BOOLEAN|0x00000012 .
|
||||||
|
|
||||||
|
## If TRUE, UGA Draw Protocol is still consumed.
|
||||||
|
gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport|TRUE|BOOLEAN|0x00000013 .
|
||||||
|
|
||||||
[PcdsFixedAtBuild.common]
|
[PcdsFixedAtBuild.common]
|
||||||
## Indicates the maximum length of unicode string
|
## Indicates the maximum length of unicode string
|
||||||
gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength|1000000|UINT32|0x00000001
|
gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength|1000000|UINT32|0x00000001
|
||||||
|
|
Loading…
Reference in New Issue