2 Library supports diplaying graphical splash screen,
3 locking of keyboard input and printing character on
4 screen. These basic graphics operations are based on UEFI HII,
5 Graphics Output protocol or UGA Draw protocol.
7 Copyright (c) 2006 - 2008, Intel Corporation
8 All rights reserved. This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
21 #include <Protocol/SimpleTextOut.h>
22 #include <Protocol/OEMBadging.h>
23 #include <Protocol/ConsoleControl.h>
24 #include <Protocol/GraphicsOutput.h>
25 #include <Protocol/FirmwareVolume2.h>
26 #include <Protocol/UgaDraw.h>
27 #include <Protocol/HiiFont.h>
28 #include <Protocol/HiiImage.h>
32 #include <Library/GraphicsLib.h>
33 #include <Library/PrintLib.h>
34 #include <Library/BaseLib.h>
35 #include <Library/MemoryAllocationLib.h>
36 #include <Library/UefiBootServicesTableLib.h>
37 #include <Library/DebugLib.h>
38 #include <Library/BaseMemoryLib.h>
39 #include <Library/DxePiLib.h>
40 #include <Library/PcdLib.h>
42 STATIC EFI_GRAPHICS_OUTPUT_BLT_PIXEL mEfiColors
[16] = {
43 { 0x00, 0x00, 0x00, 0x00 },
44 { 0x98, 0x00, 0x00, 0x00 },
45 { 0x00, 0x98, 0x00, 0x00 },
46 { 0x98, 0x98, 0x00, 0x00 },
47 { 0x00, 0x00, 0x98, 0x00 },
48 { 0x98, 0x00, 0x98, 0x00 },
49 { 0x00, 0x98, 0x98, 0x00 },
50 { 0x98, 0x98, 0x98, 0x00 },
51 { 0x10, 0x10, 0x10, 0x00 },
52 { 0xff, 0x10, 0x10, 0x00 },
53 { 0x10, 0xff, 0x10, 0x00 },
54 { 0xff, 0xff, 0x10, 0x00 },
55 { 0x10, 0x10, 0xff, 0x00 },
56 { 0xf0, 0x10, 0xff, 0x00 },
57 { 0x10, 0xff, 0xff, 0x00 },
58 { 0xff, 0xff, 0xff, 0x00 }
63 Return the graphics image file named FileNameGuid into Image and return it's
64 size in ImageSize. All Firmware Volumes (FV) in the system are searched for the
67 @param FileNameGuid File Name of graphics file in the FV(s).
68 @param Image Pointer to pointer to return graphics image. If NULL, a
69 buffer will be allocated.
70 @param ImageSize Size of the graphics Image in bytes. Zero if no image found.
72 @retval EFI_SUCCESS Image and ImageSize are valid.
73 @retval EFI_BUFFER_TOO_SMALL Image not big enough. ImageSize has required size
74 @retval EFI_NOT_FOUND FileNameGuid not found
79 GetGraphicsBitMapFromFV (
80 IN EFI_GUID
*FileNameGuid
,
85 return GetGraphicsBitMapFromFVEx (NULL
, FileNameGuid
, Image
, ImageSize
);
89 Return the graphics image file named FileNameGuid into Image and return it's
90 size in ImageSize. All Firmware Volumes (FV) in the system are searched for the
93 @param ImageHandle The driver image handle of the caller. The parameter is used to
94 optimize the loading of the image file so that the FV from which
95 the driver image is loaded will be tried first.
96 @param FileNameGuid File Name of graphics file in the FV(s).
97 @param Image Pointer to pointer to return graphics image. If NULL, a
98 buffer will be allocated.
99 @param ImageSize Size of the graphics Image in bytes. Zero if no image found.
101 @retval EFI_SUCCESS Image and ImageSize are valid.
102 @retval EFI_BUFFER_TOO_SMALL Image not big enough. ImageSize has required size
103 @retval EFI_NOT_FOUND FileNameGuid not found
108 GetGraphicsBitMapFromFVEx (
109 IN EFI_HANDLE ImageHandle
,
110 IN EFI_GUID
*FileNameGuid
,
115 return PiLibGetSectionFromAnyFv (
125 Convert a *.BMP graphics image to a GOP blt buffer. If a NULL Blt buffer
126 is passed in a GopBlt buffer will be allocated by this routine. If a GopBlt
127 buffer is passed in it will be used if it is big enough.
129 @param BmpImage Pointer to BMP file
130 @param BmpImageSize Number of bytes in BmpImage
131 @param GopBlt Buffer containing GOP version of BmpImage.
132 @param GopBltSize Size of GopBlt in bytes.
133 @param PixelHeight Height of GopBlt/BmpImage in pixels
134 @param PixelWidth Width of GopBlt/BmpImage in pixels
136 @retval EFI_SUCCESS GopBlt and GopBltSize are returned.
137 @retval EFI_UNSUPPORTED BmpImage is not a valid *.BMP image
138 @retval EFI_BUFFER_TOO_SMALL The passed in GopBlt buffer is not big enough.
139 GopBltSize will contain the required size.
140 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate.
147 IN UINTN BmpImageSize
,
148 IN OUT VOID
**GopBlt
,
149 IN OUT UINTN
*GopBltSize
,
150 OUT UINTN
*PixelHeight
,
151 OUT UINTN
*PixelWidth
156 BMP_IMAGE_HEADER
*BmpHeader
;
157 BMP_COLOR_MAP
*BmpColorMap
;
158 EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*BltBuffer
;
159 EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*Blt
;
167 BmpHeader
= (BMP_IMAGE_HEADER
*) BmpImage
;
169 if (BmpHeader
->CharB
!= 'B' || BmpHeader
->CharM
!= 'M') {
170 return EFI_UNSUPPORTED
;
174 // Doesn't support compress.
176 if (BmpHeader
->CompressionType
!= 0) {
177 return EFI_UNSUPPORTED
;
181 // Calculate Color Map offset in the image.
184 BmpColorMap
= (BMP_COLOR_MAP
*) (Image
+ sizeof (BMP_IMAGE_HEADER
));
187 // Calculate graphics image data address in the image
189 Image
= ((UINT8
*) BmpImage
) + BmpHeader
->ImageOffset
;
193 // Calculate the BltBuffer needed size.
195 BltBufferSize
= BmpHeader
->PixelWidth
* BmpHeader
->PixelHeight
* sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
);
197 if (*GopBlt
== NULL
) {
199 // GopBlt is not allocated by caller.
201 *GopBltSize
= BltBufferSize
;
202 *GopBlt
= AllocatePool (*GopBltSize
);
204 if (*GopBlt
== NULL
) {
205 return EFI_OUT_OF_RESOURCES
;
209 // GopBlt has been allocated by caller.
211 if (*GopBltSize
< BltBufferSize
) {
212 *GopBltSize
= BltBufferSize
;
213 return EFI_BUFFER_TOO_SMALL
;
217 *PixelWidth
= BmpHeader
->PixelWidth
;
218 *PixelHeight
= BmpHeader
->PixelHeight
;
221 // Convert image from BMP to Blt buffer format
224 for (Height
= 0; Height
< BmpHeader
->PixelHeight
; Height
++) {
225 Blt
= &BltBuffer
[(BmpHeader
->PixelHeight
- Height
- 1) * BmpHeader
->PixelWidth
];
226 for (Width
= 0; Width
< BmpHeader
->PixelWidth
; Width
++, Image
++, Blt
++) {
227 switch (BmpHeader
->BitPerPixel
) {
230 // Convert 1-bit (2 colors) BMP to 24-bit color
232 for (Index
= 0; Index
< 8 && Width
< BmpHeader
->PixelWidth
; Index
++) {
233 Blt
->Red
= BmpColorMap
[((*Image
) >> (7 - Index
)) & 0x1].Red
;
234 Blt
->Green
= BmpColorMap
[((*Image
) >> (7 - Index
)) & 0x1].Green
;
235 Blt
->Blue
= BmpColorMap
[((*Image
) >> (7 - Index
)) & 0x1].Blue
;
246 // Convert 4-bit (16 colors) BMP Palette to 24-bit color
248 Index
= (*Image
) >> 4;
249 Blt
->Red
= BmpColorMap
[Index
].Red
;
250 Blt
->Green
= BmpColorMap
[Index
].Green
;
251 Blt
->Blue
= BmpColorMap
[Index
].Blue
;
252 if (Width
< (BmpHeader
->PixelWidth
- 1)) {
255 Index
= (*Image
) & 0x0f;
256 Blt
->Red
= BmpColorMap
[Index
].Red
;
257 Blt
->Green
= BmpColorMap
[Index
].Green
;
258 Blt
->Blue
= BmpColorMap
[Index
].Blue
;
264 // Convert 8-bit (256 colors) BMP Palette to 24-bit color
266 Blt
->Red
= BmpColorMap
[*Image
].Red
;
267 Blt
->Green
= BmpColorMap
[*Image
].Green
;
268 Blt
->Blue
= BmpColorMap
[*Image
].Blue
;
275 Blt
->Blue
= *Image
++;
276 Blt
->Green
= *Image
++;
282 // Other bit format BMP is not supported.
288 return EFI_UNSUPPORTED
;
294 ImageIndex
= (UINTN
) (Image
- ImageHeader
);
295 if ((ImageIndex
% 4) != 0) {
297 // Bmp Image starts each row on a 32-bit boundary!
299 Image
= Image
+ (4 - (ImageIndex
% 4));
308 Use Console Control Protocol to lock the Console In Spliter virtual handle.
309 This is the ConInHandle and ConIn handle in the EFI system table. All key
310 presses will be ignored until the Password is typed in. The only way to
311 disable the password is to type it in to a ConIn device.
313 @param Password Password used to lock ConIn device.
315 @retval EFI_SUCCESS lock the Console In Spliter virtual handle successfully.
316 @retval EFI_UNSUPPORTED Password not found.
326 EFI_CONSOLE_CONTROL_PROTOCOL
*ConsoleControl
;
328 Status
= gBS
->LocateProtocol (&gEfiConsoleControlProtocolGuid
, NULL
, (VOID
**) &ConsoleControl
);
329 if (EFI_ERROR (Status
)) {
330 return EFI_UNSUPPORTED
;
333 Status
= ConsoleControl
->LockStdIn (ConsoleControl
, Password
);
339 Use Console Control to turn off UGA based Simple Text Out consoles from going
340 to the UGA device. Put up LogoFile on every UGA device that is a console.
342 @param LogoFile File name of logo to display on the center of the screen.
344 @retval EFI_SUCCESS ConsoleControl has been flipped to graphics and logo displayed.
345 @retval EFI_UNSUPPORTED Logo not found.
351 IN EFI_GUID
*LogoFile
354 return EnableQuietBootEx (LogoFile
, NULL
);
358 Use Console Control to turn off UGA based Simple Text Out consoles from going
359 to the UGA device. Put up LogoFile on every UGA device that is a console
361 @param LogoFile File name of logo to display on the center of the screen.
362 @param ImageHandle The driver image handle of the caller. The parameter is used to
363 optimize the loading of the logo file so that the FV from which
364 the driver image is loaded will be tried first.
366 @retval EFI_SUCCESS ConsoleControl has been flipped to graphics and logo displayed.
367 @retval EFI_UNSUPPORTED Logo not found.
373 IN EFI_GUID
*LogoFile
,
374 IN EFI_HANDLE ImageHandle
378 EFI_CONSOLE_CONTROL_PROTOCOL
*ConsoleControl
;
379 EFI_OEM_BADGING_PROTOCOL
*Badging
;
388 EFI_BADGING_FORMAT Format
;
389 EFI_BADGING_DISPLAY_ATTRIBUTE Attribute
;
394 EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*Blt
;
395 EFI_UGA_DRAW_PROTOCOL
*UgaDraw
;
398 EFI_GRAPHICS_OUTPUT_PROTOCOL
*GraphicsOutput
;
400 Status
= gBS
->LocateProtocol (&gEfiConsoleControlProtocolGuid
, NULL
, (VOID
**) &ConsoleControl
);
401 if (EFI_ERROR (Status
)) {
402 return EFI_UNSUPPORTED
;
407 // Try to open GOP first
409 Status
= gBS
->HandleProtocol (gST
->ConsoleOutHandle
, &gEfiGraphicsOutputProtocolGuid
, (VOID
**) &GraphicsOutput
);
410 if (EFI_ERROR (Status
) && FeaturePcdGet (PcdUgaConsumeSupport
)) {
411 GraphicsOutput
= NULL
;
413 // Open GOP failed, try to open UGA
415 Status
= gBS
->HandleProtocol (gST
->ConsoleOutHandle
, &gEfiUgaDrawProtocolGuid
, (VOID
**) &UgaDraw
);
417 if (EFI_ERROR (Status
)) {
418 return EFI_UNSUPPORTED
;
422 Status
= gBS
->LocateProtocol (&gEfiOEMBadgingProtocolGuid
, NULL
, (VOID
**) &Badging
);
425 // Set console control to graphics mode.
427 Status
= ConsoleControl
->SetMode (ConsoleControl
, EfiConsoleControlScreenGraphics
);
428 if (EFI_ERROR (Status
)) {
429 return EFI_UNSUPPORTED
;
432 if (GraphicsOutput
!= NULL
) {
433 SizeOfX
= GraphicsOutput
->Mode
->Info
->HorizontalResolution
;
434 SizeOfY
= GraphicsOutput
->Mode
->Info
->VerticalResolution
;
435 } else if (FeaturePcdGet (PcdUgaConsumeSupport
)) {
436 Status
= UgaDraw
->GetMode (UgaDraw
, &SizeOfX
, &SizeOfY
, &ColorDepth
, &RefreshRate
);
437 if (EFI_ERROR (Status
)) {
438 return EFI_UNSUPPORTED
;
441 return EFI_UNSUPPORTED
;
449 if (Badging
!= NULL
) {
451 // Get image from OEMBadging protocol.
453 Status
= Badging
->GetImage (
463 if (EFI_ERROR (Status
)) {
468 // Currently only support BMP format.
470 if (Format
!= EfiBadgingFormatBMP
) {
471 SafeFreePool (ImageData
);
476 // Get the specified image from FV.
478 Status
= GetGraphicsBitMapFromFVEx (ImageHandle
, LogoFile
, (VOID
**) &ImageData
, &ImageSize
);
479 if (EFI_ERROR (Status
)) {
480 return EFI_UNSUPPORTED
;
485 Attribute
= EfiBadgingDisplayAttributeCenter
;
489 Status
= ConvertBmpToGopBlt (
497 if (EFI_ERROR (Status
)) {
498 SafeFreePool (ImageData
);
499 if (Badging
== NULL
) {
507 // Caculate the display position according to Attribute.
510 case EfiBadgingDisplayAttributeLeftTop
:
515 case EfiBadgingDisplayAttributeCenterTop
:
516 DestX
= (SizeOfX
- Width
) / 2;
520 case EfiBadgingDisplayAttributeRightTop
:
521 DestX
= (SizeOfX
- Width
- CoordinateX
);
522 DestY
= CoordinateY
;;
525 case EfiBadgingDisplayAttributeCenterRight
:
526 DestX
= (SizeOfX
- Width
- CoordinateX
);
527 DestY
= (SizeOfY
- Height
) / 2;
530 case EfiBadgingDisplayAttributeRightBottom
:
531 DestX
= (SizeOfX
- Width
- CoordinateX
);
532 DestY
= (SizeOfY
- Height
- CoordinateY
);
535 case EfiBadgingDisplayAttributeCenterBottom
:
536 DestX
= (SizeOfX
- Width
) / 2;
537 DestY
= (SizeOfY
- Height
- CoordinateY
);
540 case EfiBadgingDisplayAttributeLeftBottom
:
542 DestY
= (SizeOfY
- Height
- CoordinateY
);
545 case EfiBadgingDisplayAttributeCenterLeft
:
547 DestY
= (SizeOfY
- Height
) / 2;
550 case EfiBadgingDisplayAttributeCenter
:
551 DestX
= (SizeOfX
- Width
) / 2;
552 DestY
= (SizeOfY
- Height
) / 2;
561 if ((DestX
>= 0) && (DestY
>= 0)) {
562 if (GraphicsOutput
!= NULL
) {
563 Status
= GraphicsOutput
->Blt (
573 Width
* sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
)
575 } else if (FeaturePcdGet (PcdUgaConsumeSupport
)) {
576 Status
= UgaDraw
->Blt (
578 (EFI_UGA_PIXEL
*) Blt
,
579 EfiUgaBltBufferToVideo
,
586 Width
* sizeof (EFI_UGA_PIXEL
)
589 Status
= EFI_UNSUPPORTED
;
593 SafeFreePool (ImageData
);
596 if (Badging
== NULL
) {
605 Use Console Control to turn on UGA based Simple Text Out consoles. The UGA
606 Simple Text Out screens will now be synced up with all non UGA output devices
608 @retval EFI_SUCCESS UGA devices are back in text mode and synced up.
609 @retval EFI_UNSUPPORTED Logo not found
619 EFI_CONSOLE_CONTROL_PROTOCOL
*ConsoleControl
;
621 Status
= gBS
->LocateProtocol (&gEfiConsoleControlProtocolGuid
, NULL
, (VOID
**) &ConsoleControl
);
622 if (EFI_ERROR (Status
)) {
623 return EFI_UNSUPPORTED
;
627 // Set console control to text mode.
629 return ConsoleControl
->SetMode (ConsoleControl
, EfiConsoleControlScreenText
);
633 Internal display string worker function.
635 @param GraphicsOutput Graphics output protocol interface.
636 @param UgaDraw UGA draw protocol interface.
637 @param Sto Simple text out protocol interface.
638 @param X X coordinate to start printing.
639 @param Y Y coordinate to start printing.
640 @param Foreground Foreground color.
641 @param Background Background color.
642 @param fmt Format string.
643 @param args Print arguments.
645 @return Number of Characters printed. Zero means no any character
646 displayed successfully.
651 IN EFI_GRAPHICS_OUTPUT_PROTOCOL
*GraphicsOutput
,
652 IN EFI_UGA_DRAW_PROTOCOL
*UgaDraw
,
653 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*Sto
,
656 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*Foreground
,
657 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*Background
,
665 CHAR16
*UnicodeWeight
;
666 UINT32 HorizontalResolution
;
667 UINT32 VerticalResolution
;
672 EFI_HII_FONT_PROTOCOL
*HiiFont
;
673 EFI_IMAGE_OUTPUT
*Blt
;
674 EFI_FONT_DISPLAY_INFO
*FontInfo
;
675 EFI_HII_ROW_INFO
*RowInfoArray
;
676 UINTN RowInfoArraySize
;
680 // For now, allocate an arbitrarily long buffer
682 Buffer
= AllocateZeroPool (0x10000);
683 if (Buffer
== NULL
) {
687 HorizontalResolution
= 0;
688 VerticalResolution
= 0;
693 if (GraphicsOutput
!= NULL
) {
694 HorizontalResolution
= GraphicsOutput
->Mode
->Info
->HorizontalResolution
;
695 VerticalResolution
= GraphicsOutput
->Mode
->Info
->VerticalResolution
;
696 } else if (FeaturePcdGet (PcdUgaConsumeSupport
)) {
697 UgaDraw
->GetMode (UgaDraw
, &HorizontalResolution
, &VerticalResolution
, &ColorDepth
, &RefreshRate
);
699 Status
= EFI_UNSUPPORTED
;
703 ASSERT ((HorizontalResolution
!= 0) && (VerticalResolution
!=0));
705 Status
= gBS
->LocateProtocol (&gEfiHiiFontProtocolGuid
, NULL
, (VOID
**) &HiiFont
);
706 if (EFI_ERROR (Status
)) {
710 PrintNum
= UnicodeVSPrint (Buffer
, 0x10000, fmt
, args
);
712 UnicodeWeight
= (CHAR16
*) Buffer
;
714 for (Index
= 0; UnicodeWeight
[Index
] != 0; Index
++) {
715 if (UnicodeWeight
[Index
] == CHAR_BACKSPACE
||
716 UnicodeWeight
[Index
] == CHAR_LINEFEED
||
717 UnicodeWeight
[Index
] == CHAR_CARRIAGE_RETURN
) {
718 UnicodeWeight
[Index
] = 0;
722 BufferLen
= StrLen (Buffer
);
724 LineBufferLen
= sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
) * HorizontalResolution
* EFI_GLYPH_HEIGHT
;
725 if (EFI_GLYPH_WIDTH
* EFI_GLYPH_HEIGHT
* sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL
) * BufferLen
> LineBufferLen
) {
726 Status
= EFI_INVALID_PARAMETER
;
730 Blt
= (EFI_IMAGE_OUTPUT
*) AllocateZeroPool (sizeof (EFI_IMAGE_OUTPUT
));
732 Status
= EFI_OUT_OF_RESOURCES
;
736 Blt
->Width
= (UINT16
) (HorizontalResolution
);
737 Blt
->Height
= (UINT16
) (VerticalResolution
);
739 FontInfo
= (EFI_FONT_DISPLAY_INFO
*) AllocateZeroPool (sizeof (EFI_FONT_DISPLAY_INFO
));
740 if (FontInfo
== NULL
) {
741 Status
= EFI_OUT_OF_RESOURCES
;
744 if (Foreground
!= NULL
) {
745 CopyMem (&FontInfo
->ForegroundColor
, Foreground
, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
));
748 &FontInfo
->ForegroundColor
,
749 &mEfiColors
[Sto
->Mode
->Attribute
& 0x0f],
750 sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
)
753 if (Background
!= NULL
) {
754 CopyMem (&FontInfo
->BackgroundColor
, Background
, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
));
757 &FontInfo
->BackgroundColor
,
758 &mEfiColors
[Sto
->Mode
->Attribute
>> 4],
759 sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
)
763 if (GraphicsOutput
!= NULL
) {
764 Blt
->Image
.Screen
= GraphicsOutput
;
766 Status
= HiiFont
->StringToImage (
768 EFI_HII_IGNORE_IF_NO_GLYPH
| EFI_HII_DIRECT_TO_SCREEN
,
779 } else if (FeaturePcdGet (PcdUgaConsumeSupport
)) {
780 ASSERT (UgaDraw
!= NULL
);
782 Blt
->Image
.Bitmap
= AllocateZeroPool (Blt
->Width
* Blt
->Height
* sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
));
783 if (Blt
->Image
.Bitmap
== NULL
) {
785 SafeFreePool (Buffer
);
786 return EFI_OUT_OF_RESOURCES
;
791 // StringToImage only support blt'ing image to device using GOP protocol. If GOP is not supported in this platform,
792 // we ask StringToImage to print the string to blt buffer, then blt to device using UgaDraw.
794 Status
= HiiFont
->StringToImage (
796 EFI_HII_IGNORE_IF_NO_GLYPH
,
807 if (!EFI_ERROR (Status
)) {
809 // Line breaks are handled by caller of DrawUnicodeWeightAtCursorN, so the updated parameter RowInfoArraySize by StringToImage will
810 // always be 1 or 0 (if there is no valid Unicode Char can be printed). ASSERT here to make sure.
812 ASSERT (RowInfoArraySize
<= 1);
814 Status
= UgaDraw
->Blt (
816 (EFI_UGA_PIXEL
*) Blt
->Image
.Bitmap
,
817 EfiUgaBltBufferToVideo
,
822 RowInfoArray
[0].LineWidth
,
823 RowInfoArray
[0].LineHeight
,
824 Blt
->Width
* sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
)
828 SafeFreePool (RowInfoArray
);
829 SafeFreePool (Blt
->Image
.Bitmap
);
831 Status
= EFI_UNSUPPORTED
;
836 SafeFreePool (FontInfo
);
839 if (EFI_ERROR (Status
)) {
847 Print Unicode string to graphics screen at the given X,Y coordinates of the graphics screen.
848 see definition of Print to find rules for constructing Fmt.
850 @param X Row to start printing at.
851 @param Y Column to start printing at.
852 @param ForeGround Foreground color.
853 @param BackGround background color.
854 @param Fmt Print format sting. See definition of Print.
855 @param ... Argumnet stream defined by Fmt string.
857 @return Number of Characters printed. Zero means no any character
858 displayed successfully.
866 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*ForeGround
, OPTIONAL
867 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*BackGround
, OPTIONAL
873 EFI_GRAPHICS_OUTPUT_PROTOCOL
*GraphicsOutput
;
874 EFI_UGA_DRAW_PROTOCOL
*UgaDraw
;
875 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*Sto
;
879 VA_START (Args
, Fmt
);
881 Handle
= gST
->ConsoleOutHandle
;
883 Status
= gBS
->HandleProtocol (
885 &gEfiGraphicsOutputProtocolGuid
,
886 (VOID
**) &GraphicsOutput
890 if (EFI_ERROR (Status
) && FeaturePcdGet (PcdUgaConsumeSupport
)) {
892 // If no GOP available, try to open UGA Draw protocol if supported.
894 GraphicsOutput
= NULL
;
896 Status
= gBS
->HandleProtocol (
898 &gEfiUgaDrawProtocolGuid
,
902 if (EFI_ERROR (Status
)) {
906 Status
= gBS
->HandleProtocol (
908 &gEfiSimpleTextOutProtocolGuid
,
912 if (EFI_ERROR (Status
)) {
916 return Print (GraphicsOutput
, UgaDraw
, Sto
, X
, Y
, ForeGround
, BackGround
, Fmt
, Args
);