diff options
author | vanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-11-20 03:08:28 +0000 |
---|---|---|
committer | vanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-11-20 03:08:28 +0000 |
commit | b31547205f3f46a563249fdf300fe67ee915a3a1 (patch) | |
tree | 413a5fb124fffb4a40740709a2f8791681f8faef /MdeModulePkg | |
parent | b10a05d6c3024ec78935353f157df9e7411dfe06 (diff) | |
download | edk2-platforms-b31547205f3f46a563249fdf300fe67ee915a3a1.tar.xz |
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
Diffstat (limited to 'MdeModulePkg')
6 files changed, 4 insertions, 322 deletions
diff --git a/MdeModulePkg/Library/GraphicsLib/Graphics.c b/MdeModulePkg/Library/GraphicsLib/Graphics.c index b23026fba0..63e0696cf4 100644 --- a/MdeModulePkg/Library/GraphicsLib/Graphics.c +++ b/MdeModulePkg/Library/GraphicsLib/Graphics.c @@ -38,25 +38,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include <Library/DxeServicesLib.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
@@ -636,299 +617,3 @@ DisableQuietBoot ( 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);
-}
-
diff --git a/MdeModulePkg/Library/GraphicsLib/GraphicsLib.inf b/MdeModulePkg/Library/GraphicsLib/GraphicsLib.inf index 0288b8490d..7fb759adb0 100644 --- a/MdeModulePkg/Library/GraphicsLib/GraphicsLib.inf +++ b/MdeModulePkg/Library/GraphicsLib/GraphicsLib.inf @@ -59,4 +59,4 @@ gEfiHiiFontProtocolGuid # PROTOCOL ALWAYS_CONSUMED
[FeaturePcd.common]
- gEfiMdeModulePkgTokenSpaceGuid.PcdUgaConsumeSupport
+ gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index 303a9387f4..fb9f8532c8 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -289,9 +289,6 @@ ## If PcdSupportHardwareErrorRecord is TRUE, support hardware error record via variable in BDS.
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.
gEfiMdeModulePkgTokenSpaceGuid.PcdTurnOffUsbLegacySupport|FALSE|BOOLEAN|0x00010047
diff --git a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf b/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf index 2824c1af02..bc1311c2be 100644 --- a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf +++ b/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf @@ -141,7 +141,7 @@ [FeaturePcd.common]
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLangDeprecate
gEfiMdeModulePkgTokenSpaceGuid.PcdSupportHardwareErrorRecord
- gEfiMdeModulePkgTokenSpaceGuid.PcdUgaConsumeSupport
+ gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport
[Pcd.common]
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLangCodes
diff --git a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf index 2bf9bd2012..e190e10c05 100644 --- a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf +++ b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf @@ -84,4 +84,4 @@ [FeaturePcd.common]
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport
- gEfiMdeModulePkgTokenSpaceGuid.PcdUgaConsumeSupport
+ gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport
diff --git a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf index 32600c0ff7..9e3c449306 100644 --- a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf +++ b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf @@ -62,4 +62,4 @@ gEfiHiiDatabaseProtocolGuid # PROTOCOL TO_START
[FeaturePcd.common]
- gEfiMdeModulePkgTokenSpaceGuid.PcdUgaConsumeSupport
\ No newline at end of file + gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport
\ No newline at end of file |