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/UgaDraw.h>
26 #include <Protocol/HiiFont.h>
27 #include <Protocol/HiiImage.h>
31 #include <Library/GraphicsLib.h>
32 #include <Library/PrintLib.h>
33 #include <Library/BaseLib.h>
34 #include <Library/MemoryAllocationLib.h>
35 #include <Library/UefiBootServicesTableLib.h>
36 #include <Library/DebugLib.h>
37 #include <Library/BaseMemoryLib.h>
38 #include <Library/DxeServicesLib.h>
39 #include <Library/PcdLib.h>
41 EFI_GRAPHICS_OUTPUT_BLT_PIXEL mEfiColors
[16] = {
42 { 0x00, 0x00, 0x00, 0x00 },
43 { 0x98, 0x00, 0x00, 0x00 },
44 { 0x00, 0x98, 0x00, 0x00 },
45 { 0x98, 0x98, 0x00, 0x00 },
46 { 0x00, 0x00, 0x98, 0x00 },
47 { 0x98, 0x00, 0x98, 0x00 },
48 { 0x00, 0x98, 0x98, 0x00 },
49 { 0x98, 0x98, 0x98, 0x00 },
50 { 0x10, 0x10, 0x10, 0x00 },
51 { 0xff, 0x10, 0x10, 0x00 },
52 { 0x10, 0xff, 0x10, 0x00 },
53 { 0xff, 0xff, 0x10, 0x00 },
54 { 0x10, 0x10, 0xff, 0x00 },
55 { 0xf0, 0x10, 0xff, 0x00 },
56 { 0x10, 0xff, 0xff, 0x00 },
57 { 0xff, 0xff, 0xff, 0x00 }
62 Return the graphics image file named FileNameGuid into Image and return it's
63 size in ImageSize. All Firmware Volumes (FV) in the system are searched for the
66 @param FileNameGuid File Name of graphics file in the FV(s).
67 @param Image Pointer to pointer to return graphics image. If NULL, a
68 buffer will be allocated.
69 @param ImageSize Size of the graphics Image in bytes. Zero if no image found.
71 @retval EFI_SUCCESS Image and ImageSize are valid.
72 @retval EFI_BUFFER_TOO_SMALL Image not big enough. ImageSize has required size
73 @retval EFI_NOT_FOUND FileNameGuid not found
78 GetGraphicsBitMapFromFV (
79 IN EFI_GUID
*FileNameGuid
,
84 return GetGraphicsBitMapFromFVEx (NULL
, FileNameGuid
, Image
, ImageSize
);
88 Return the graphics image file named FileNameGuid into Image and return it's
89 size in ImageSize. All Firmware Volumes (FV) in the system are searched for the
92 @param ImageHandle The driver image handle of the caller. The parameter is used to
93 optimize the loading of the image file so that the FV from which
94 the driver image is loaded will be tried first.
95 @param FileNameGuid File Name of graphics file in the FV(s).
96 @param Image Pointer to pointer to return graphics image. If NULL, a
97 buffer will be allocated.
98 @param ImageSize Size of the graphics Image in bytes. Zero if no image found.
100 @retval EFI_SUCCESS Image and ImageSize are valid.
101 @retval EFI_BUFFER_TOO_SMALL Image not big enough. ImageSize has required size
102 @retval EFI_NOT_FOUND FileNameGuid not found
107 GetGraphicsBitMapFromFVEx (
108 IN EFI_HANDLE ImageHandle
,
109 IN EFI_GUID
*FileNameGuid
,
114 return GetSectionFromAnyFv (
124 Convert a *.BMP graphics image to a GOP blt buffer. If a NULL Blt buffer
125 is passed in a GopBlt buffer will be allocated by this routine. If a GopBlt
126 buffer is passed in it will be used if it is big enough.
128 @param BmpImage Pointer to BMP file
129 @param BmpImageSize Number of bytes in BmpImage
130 @param GopBlt Buffer containing GOP version of BmpImage.
131 @param GopBltSize Size of GopBlt in bytes.
132 @param PixelHeight Height of GopBlt/BmpImage in pixels
133 @param PixelWidth Width of GopBlt/BmpImage in pixels
135 @retval EFI_SUCCESS GopBlt and GopBltSize are returned.
136 @retval EFI_UNSUPPORTED BmpImage is not a valid *.BMP image
137 @retval EFI_BUFFER_TOO_SMALL The passed in GopBlt buffer is not big enough.
138 GopBltSize will contain the required size.
139 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate.
146 IN UINTN BmpImageSize
,
147 IN OUT VOID
**GopBlt
,
148 IN OUT UINTN
*GopBltSize
,
149 OUT UINTN
*PixelHeight
,
150 OUT UINTN
*PixelWidth
155 BMP_IMAGE_HEADER
*BmpHeader
;
156 BMP_COLOR_MAP
*BmpColorMap
;
157 EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*BltBuffer
;
158 EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*Blt
;
166 BmpHeader
= (BMP_IMAGE_HEADER
*) BmpImage
;
168 if (BmpHeader
->CharB
!= 'B' || BmpHeader
->CharM
!= 'M') {
169 return EFI_UNSUPPORTED
;
173 // Doesn't support compress.
175 if (BmpHeader
->CompressionType
!= 0) {
176 return EFI_UNSUPPORTED
;
180 // Calculate Color Map offset in the image.
183 BmpColorMap
= (BMP_COLOR_MAP
*) (Image
+ sizeof (BMP_IMAGE_HEADER
));
186 // Calculate graphics image data address in the image
188 Image
= ((UINT8
*) BmpImage
) + BmpHeader
->ImageOffset
;
192 // Calculate the BltBuffer needed size.
194 BltBufferSize
= BmpHeader
->PixelWidth
* BmpHeader
->PixelHeight
* sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
);
196 if (*GopBlt
== NULL
) {
198 // GopBlt is not allocated by caller.
200 *GopBltSize
= BltBufferSize
;
201 *GopBlt
= AllocatePool (*GopBltSize
);
203 if (*GopBlt
== NULL
) {
204 return EFI_OUT_OF_RESOURCES
;
208 // GopBlt has been allocated by caller.
210 if (*GopBltSize
< BltBufferSize
) {
211 *GopBltSize
= BltBufferSize
;
212 return EFI_BUFFER_TOO_SMALL
;
216 *PixelWidth
= BmpHeader
->PixelWidth
;
217 *PixelHeight
= BmpHeader
->PixelHeight
;
220 // Convert image from BMP to Blt buffer format
223 for (Height
= 0; Height
< BmpHeader
->PixelHeight
; Height
++) {
224 Blt
= &BltBuffer
[(BmpHeader
->PixelHeight
- Height
- 1) * BmpHeader
->PixelWidth
];
225 for (Width
= 0; Width
< BmpHeader
->PixelWidth
; Width
++, Image
++, Blt
++) {
226 switch (BmpHeader
->BitPerPixel
) {
229 // Convert 1-bit (2 colors) BMP to 24-bit color
231 for (Index
= 0; Index
< 8 && Width
< BmpHeader
->PixelWidth
; Index
++) {
232 Blt
->Red
= BmpColorMap
[((*Image
) >> (7 - Index
)) & 0x1].Red
;
233 Blt
->Green
= BmpColorMap
[((*Image
) >> (7 - Index
)) & 0x1].Green
;
234 Blt
->Blue
= BmpColorMap
[((*Image
) >> (7 - Index
)) & 0x1].Blue
;
245 // Convert 4-bit (16 colors) BMP Palette to 24-bit color
247 Index
= (*Image
) >> 4;
248 Blt
->Red
= BmpColorMap
[Index
].Red
;
249 Blt
->Green
= BmpColorMap
[Index
].Green
;
250 Blt
->Blue
= BmpColorMap
[Index
].Blue
;
251 if (Width
< (BmpHeader
->PixelWidth
- 1)) {
254 Index
= (*Image
) & 0x0f;
255 Blt
->Red
= BmpColorMap
[Index
].Red
;
256 Blt
->Green
= BmpColorMap
[Index
].Green
;
257 Blt
->Blue
= BmpColorMap
[Index
].Blue
;
263 // Convert 8-bit (256 colors) BMP Palette to 24-bit color
265 Blt
->Red
= BmpColorMap
[*Image
].Red
;
266 Blt
->Green
= BmpColorMap
[*Image
].Green
;
267 Blt
->Blue
= BmpColorMap
[*Image
].Blue
;
274 Blt
->Blue
= *Image
++;
275 Blt
->Green
= *Image
++;
281 // Other bit format BMP is not supported.
287 return EFI_UNSUPPORTED
;
293 ImageIndex
= (UINTN
) (Image
- ImageHeader
);
294 if ((ImageIndex
% 4) != 0) {
296 // Bmp Image starts each row on a 32-bit boundary!
298 Image
= Image
+ (4 - (ImageIndex
% 4));
307 Use Console Control Protocol to lock the Console In Spliter virtual handle.
308 This is the ConInHandle and ConIn handle in the EFI system table. All key
309 presses will be ignored until the Password is typed in. The only way to
310 disable the password is to type it in to a ConIn device.
312 @param Password Password used to lock ConIn device.
314 @retval EFI_SUCCESS lock the Console In Spliter virtual handle successfully.
315 @retval EFI_UNSUPPORTED Password not found.
325 EFI_CONSOLE_CONTROL_PROTOCOL
*ConsoleControl
;
327 Status
= gBS
->LocateProtocol (&gEfiConsoleControlProtocolGuid
, NULL
, (VOID
**) &ConsoleControl
);
328 if (EFI_ERROR (Status
)) {
329 return EFI_UNSUPPORTED
;
332 Status
= ConsoleControl
->LockStdIn (ConsoleControl
, Password
);
338 Use Console Control to turn off UGA based Simple Text Out consoles from going
339 to the UGA device. Put up LogoFile on every UGA device that is a console.
341 @param LogoFile File name of logo to display on the center of the screen.
343 @retval EFI_SUCCESS ConsoleControl has been flipped to graphics and logo displayed.
344 @retval EFI_UNSUPPORTED Logo not found.
350 IN EFI_GUID
*LogoFile
353 return EnableQuietBootEx (LogoFile
, NULL
);
357 Use Console Control to turn off UGA based Simple Text Out consoles from going
358 to the UGA device. Put up LogoFile on every UGA device that is a console
360 @param LogoFile File name of logo to display on the center of the screen.
361 @param ImageHandle The driver image handle of the caller. The parameter is used to
362 optimize the loading of the logo file so that the FV from which
363 the driver image is loaded will be tried first.
365 @retval EFI_SUCCESS ConsoleControl has been flipped to graphics and logo displayed.
366 @retval EFI_UNSUPPORTED Logo not found.
372 IN EFI_GUID
*LogoFile
,
373 IN EFI_HANDLE ImageHandle
377 EFI_CONSOLE_CONTROL_PROTOCOL
*ConsoleControl
;
378 EFI_OEM_BADGING_PROTOCOL
*Badging
;
387 EFI_BADGING_FORMAT Format
;
388 EFI_BADGING_DISPLAY_ATTRIBUTE Attribute
;
393 EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*Blt
;
394 EFI_UGA_DRAW_PROTOCOL
*UgaDraw
;
397 EFI_GRAPHICS_OUTPUT_PROTOCOL
*GraphicsOutput
;
399 Status
= gBS
->LocateProtocol (&gEfiConsoleControlProtocolGuid
, NULL
, (VOID
**) &ConsoleControl
);
400 if (EFI_ERROR (Status
)) {
401 return EFI_UNSUPPORTED
;
406 // Try to open GOP first
408 Status
= gBS
->HandleProtocol (gST
->ConsoleOutHandle
, &gEfiGraphicsOutputProtocolGuid
, (VOID
**) &GraphicsOutput
);
409 if (EFI_ERROR (Status
) && FeaturePcdGet (PcdUgaConsumeSupport
)) {
410 GraphicsOutput
= NULL
;
412 // Open GOP failed, try to open UGA
414 Status
= gBS
->HandleProtocol (gST
->ConsoleOutHandle
, &gEfiUgaDrawProtocolGuid
, (VOID
**) &UgaDraw
);
416 if (EFI_ERROR (Status
)) {
417 return EFI_UNSUPPORTED
;
421 Status
= gBS
->LocateProtocol (&gEfiOEMBadgingProtocolGuid
, NULL
, (VOID
**) &Badging
);
424 // Set console control to graphics mode.
426 Status
= ConsoleControl
->SetMode (ConsoleControl
, EfiConsoleControlScreenGraphics
);
427 if (EFI_ERROR (Status
)) {
428 return EFI_UNSUPPORTED
;
431 if (GraphicsOutput
!= NULL
) {
432 SizeOfX
= GraphicsOutput
->Mode
->Info
->HorizontalResolution
;
433 SizeOfY
= GraphicsOutput
->Mode
->Info
->VerticalResolution
;
434 } else if (FeaturePcdGet (PcdUgaConsumeSupport
)) {
435 Status
= UgaDraw
->GetMode (UgaDraw
, &SizeOfX
, &SizeOfY
, &ColorDepth
, &RefreshRate
);
436 if (EFI_ERROR (Status
)) {
437 return EFI_UNSUPPORTED
;
440 return EFI_UNSUPPORTED
;
448 if (Badging
!= NULL
) {
450 // Get image from OEMBadging protocol.
452 Status
= Badging
->GetImage (
462 if (EFI_ERROR (Status
)) {
467 // Currently only support BMP format.
469 if (Format
!= EfiBadgingFormatBMP
) {
470 if (ImageData
!= NULL
) {
471 FreePool (ImageData
);
477 // Get the specified image from FV.
479 Status
= GetGraphicsBitMapFromFVEx (ImageHandle
, LogoFile
, (VOID
**) &ImageData
, &ImageSize
);
480 if (EFI_ERROR (Status
)) {
481 return EFI_UNSUPPORTED
;
486 Attribute
= EfiBadgingDisplayAttributeCenter
;
490 Status
= ConvertBmpToGopBlt (
498 if (EFI_ERROR (Status
)) {
499 if (ImageData
!= NULL
) {
500 FreePool (ImageData
);
502 if (Badging
== NULL
) {
510 // Caculate the display position according to Attribute.
513 case EfiBadgingDisplayAttributeLeftTop
:
518 case EfiBadgingDisplayAttributeCenterTop
:
519 DestX
= (SizeOfX
- Width
) / 2;
523 case EfiBadgingDisplayAttributeRightTop
:
524 DestX
= (SizeOfX
- Width
- CoordinateX
);
525 DestY
= CoordinateY
;;
528 case EfiBadgingDisplayAttributeCenterRight
:
529 DestX
= (SizeOfX
- Width
- CoordinateX
);
530 DestY
= (SizeOfY
- Height
) / 2;
533 case EfiBadgingDisplayAttributeRightBottom
:
534 DestX
= (SizeOfX
- Width
- CoordinateX
);
535 DestY
= (SizeOfY
- Height
- CoordinateY
);
538 case EfiBadgingDisplayAttributeCenterBottom
:
539 DestX
= (SizeOfX
- Width
) / 2;
540 DestY
= (SizeOfY
- Height
- CoordinateY
);
543 case EfiBadgingDisplayAttributeLeftBottom
:
545 DestY
= (SizeOfY
- Height
- CoordinateY
);
548 case EfiBadgingDisplayAttributeCenterLeft
:
550 DestY
= (SizeOfY
- Height
) / 2;
553 case EfiBadgingDisplayAttributeCenter
:
554 DestX
= (SizeOfX
- Width
) / 2;
555 DestY
= (SizeOfY
- Height
) / 2;
564 if ((DestX
>= 0) && (DestY
>= 0)) {
565 if (GraphicsOutput
!= NULL
) {
566 Status
= GraphicsOutput
->Blt (
576 Width
* sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
)
578 } else if (FeaturePcdGet (PcdUgaConsumeSupport
)) {
579 Status
= UgaDraw
->Blt (
581 (EFI_UGA_PIXEL
*) Blt
,
582 EfiUgaBltBufferToVideo
,
589 Width
* sizeof (EFI_UGA_PIXEL
)
592 Status
= EFI_UNSUPPORTED
;
596 if (ImageData
!= NULL
) {
597 FreePool (ImageData
);
603 if (Badging
== NULL
) {
612 Use Console Control to turn on UGA based Simple Text Out consoles. The UGA
613 Simple Text Out screens will now be synced up with all non UGA output devices
615 @retval EFI_SUCCESS UGA devices are back in text mode and synced up.
616 @retval EFI_UNSUPPORTED Logo not found
626 EFI_CONSOLE_CONTROL_PROTOCOL
*ConsoleControl
;
628 Status
= gBS
->LocateProtocol (&gEfiConsoleControlProtocolGuid
, NULL
, (VOID
**) &ConsoleControl
);
629 if (EFI_ERROR (Status
)) {
630 return EFI_UNSUPPORTED
;
634 // Set console control to text mode.
636 return ConsoleControl
->SetMode (ConsoleControl
, EfiConsoleControlScreenText
);
640 Internal display string worker function.
642 @param GraphicsOutput Graphics output protocol interface.
643 @param UgaDraw UGA draw protocol interface.
644 @param Sto Simple text out protocol interface.
645 @param X X coordinate to start printing.
646 @param Y Y coordinate to start printing.
647 @param Foreground Foreground color.
648 @param Background Background color.
649 @param fmt Format string.
650 @param args Print arguments.
652 @return Number of Characters printed. Zero means no any character
653 displayed successfully.
658 IN EFI_GRAPHICS_OUTPUT_PROTOCOL
*GraphicsOutput
,
659 IN EFI_UGA_DRAW_PROTOCOL
*UgaDraw
,
660 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*Sto
,
663 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*Foreground
,
664 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*Background
,
672 CHAR16
*UnicodeWeight
;
673 UINT32 HorizontalResolution
;
674 UINT32 VerticalResolution
;
679 EFI_HII_FONT_PROTOCOL
*HiiFont
;
680 EFI_IMAGE_OUTPUT
*Blt
;
681 EFI_FONT_DISPLAY_INFO
*FontInfo
;
682 EFI_HII_ROW_INFO
*RowInfoArray
;
683 UINTN RowInfoArraySize
;
687 // For now, allocate an arbitrarily long buffer
689 Buffer
= AllocateZeroPool (0x10000);
690 if (Buffer
== NULL
) {
694 HorizontalResolution
= 0;
695 VerticalResolution
= 0;
700 if (GraphicsOutput
!= NULL
) {
701 HorizontalResolution
= GraphicsOutput
->Mode
->Info
->HorizontalResolution
;
702 VerticalResolution
= GraphicsOutput
->Mode
->Info
->VerticalResolution
;
703 } else if (FeaturePcdGet (PcdUgaConsumeSupport
)) {
704 UgaDraw
->GetMode (UgaDraw
, &HorizontalResolution
, &VerticalResolution
, &ColorDepth
, &RefreshRate
);
706 Status
= EFI_UNSUPPORTED
;
710 ASSERT ((HorizontalResolution
!= 0) && (VerticalResolution
!=0));
712 Status
= gBS
->LocateProtocol (&gEfiHiiFontProtocolGuid
, NULL
, (VOID
**) &HiiFont
);
713 if (EFI_ERROR (Status
)) {
717 PrintNum
= UnicodeVSPrint (Buffer
, 0x10000, fmt
, args
);
719 UnicodeWeight
= (CHAR16
*) Buffer
;
721 for (Index
= 0; UnicodeWeight
[Index
] != 0; Index
++) {
722 if (UnicodeWeight
[Index
] == CHAR_BACKSPACE
||
723 UnicodeWeight
[Index
] == CHAR_LINEFEED
||
724 UnicodeWeight
[Index
] == CHAR_CARRIAGE_RETURN
) {
725 UnicodeWeight
[Index
] = 0;
729 BufferLen
= StrLen (Buffer
);
731 LineBufferLen
= sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
) * HorizontalResolution
* EFI_GLYPH_HEIGHT
;
732 if (EFI_GLYPH_WIDTH
* EFI_GLYPH_HEIGHT
* sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL
) * BufferLen
> LineBufferLen
) {
733 Status
= EFI_INVALID_PARAMETER
;
737 Blt
= (EFI_IMAGE_OUTPUT
*) AllocateZeroPool (sizeof (EFI_IMAGE_OUTPUT
));
739 Status
= EFI_OUT_OF_RESOURCES
;
743 Blt
->Width
= (UINT16
) (HorizontalResolution
);
744 Blt
->Height
= (UINT16
) (VerticalResolution
);
746 FontInfo
= (EFI_FONT_DISPLAY_INFO
*) AllocateZeroPool (sizeof (EFI_FONT_DISPLAY_INFO
));
747 if (FontInfo
== NULL
) {
748 Status
= EFI_OUT_OF_RESOURCES
;
751 if (Foreground
!= NULL
) {
752 CopyMem (&FontInfo
->ForegroundColor
, Foreground
, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
));
755 &FontInfo
->ForegroundColor
,
756 &mEfiColors
[Sto
->Mode
->Attribute
& 0x0f],
757 sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
)
760 if (Background
!= NULL
) {
761 CopyMem (&FontInfo
->BackgroundColor
, Background
, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
));
764 &FontInfo
->BackgroundColor
,
765 &mEfiColors
[Sto
->Mode
->Attribute
>> 4],
766 sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
)
770 if (GraphicsOutput
!= NULL
) {
771 Blt
->Image
.Screen
= GraphicsOutput
;
773 Status
= HiiFont
->StringToImage (
775 EFI_HII_IGNORE_IF_NO_GLYPH
| EFI_HII_DIRECT_TO_SCREEN
,
786 } else if (FeaturePcdGet (PcdUgaConsumeSupport
)) {
787 ASSERT (UgaDraw
!= NULL
);
789 Blt
->Image
.Bitmap
= AllocateZeroPool (Blt
->Width
* Blt
->Height
* sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
));
790 if (Blt
->Image
.Bitmap
== NULL
) {
793 return EFI_OUT_OF_RESOURCES
;
798 // StringToImage only support blt'ing image to device using GOP protocol. If GOP is not supported in this platform,
799 // we ask StringToImage to print the string to blt buffer, then blt to device using UgaDraw.
801 Status
= HiiFont
->StringToImage (
803 EFI_HII_IGNORE_IF_NO_GLYPH
,
814 if (!EFI_ERROR (Status
)) {
816 // Line breaks are handled by caller of DrawUnicodeWeightAtCursorN, so the updated parameter RowInfoArraySize by StringToImage will
817 // always be 1 or 0 (if there is no valid Unicode Char can be printed). ASSERT here to make sure.
819 ASSERT (RowInfoArraySize
<= 1);
821 Status
= UgaDraw
->Blt (
823 (EFI_UGA_PIXEL
*) Blt
->Image
.Bitmap
,
824 EfiUgaBltBufferToVideo
,
829 RowInfoArray
[0].LineWidth
,
830 RowInfoArray
[0].LineHeight
,
831 Blt
->Width
* sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
)
835 if (RowInfoArray
!= NULL
) {
836 FreePool (RowInfoArray
);
838 if (Blt
->Image
.Bitmap
!= NULL
) {
839 FreePool (Blt
->Image
.Bitmap
);
842 Status
= EFI_UNSUPPORTED
;
849 if (FontInfo
!= NULL
) {
854 if (EFI_ERROR (Status
)) {
862 Print Unicode string to graphics screen at the given X,Y coordinates of the graphics screen.
863 see definition of Print to find rules for constructing Fmt.
865 @param X Row to start printing at.
866 @param Y Column to start printing at.
867 @param ForeGround Foreground color.
868 @param BackGround background color.
869 @param Fmt Print format sting. See definition of Print.
870 @param ... Argumnet stream defined by Fmt string.
872 @return Number of Characters printed. Zero means no any character
873 displayed successfully.
881 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*ForeGround
, OPTIONAL
882 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*BackGround
, OPTIONAL
888 EFI_GRAPHICS_OUTPUT_PROTOCOL
*GraphicsOutput
;
889 EFI_UGA_DRAW_PROTOCOL
*UgaDraw
;
890 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*Sto
;
894 VA_START (Args
, Fmt
);
896 Handle
= gST
->ConsoleOutHandle
;
898 Status
= gBS
->HandleProtocol (
900 &gEfiGraphicsOutputProtocolGuid
,
901 (VOID
**) &GraphicsOutput
905 if (EFI_ERROR (Status
) && FeaturePcdGet (PcdUgaConsumeSupport
)) {
907 // If no GOP available, try to open UGA Draw protocol if supported.
909 GraphicsOutput
= NULL
;
911 Status
= gBS
->HandleProtocol (
913 &gEfiUgaDrawProtocolGuid
,
917 if (EFI_ERROR (Status
)) {
921 Status
= gBS
->HandleProtocol (
923 &gEfiSimpleTextOutProtocolGuid
,
927 if (EFI_ERROR (Status
)) {
931 return Print (GraphicsOutput
, UgaDraw
, Sto
, X
, Y
, ForeGround
, BackGround
, Fmt
, Args
);