2 Basic Graphics operations based on UEFI HII, Graphics Output protocol or UGA
5 Copyright (c) 2006 - 2008, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 #include <Protocol/SimpleTextOut.h>
20 #include <Protocol/OEMBadging.h>
21 #include <Protocol/ConsoleControl.h>
22 #include <Protocol/GraphicsOutput.h>
23 #include <Protocol/FirmwareVolume2.h>
24 #include <Protocol/UgaDraw.h>
25 #include <Protocol/HiiFont.h>
26 #include <Protocol/HiiImage.h>
30 #include <Library/GraphicsLib.h>
31 #include <Library/PrintLib.h>
32 #include <Library/BaseLib.h>
33 #include <Library/MemoryAllocationLib.h>
34 #include <Library/UefiBootServicesTableLib.h>
35 #include <Library/DebugLib.h>
36 #include <Library/BaseMemoryLib.h>
37 #include <Library/DxePiLib.h>
38 #include <Library/PcdLib.h>
40 STATIC EFI_GRAPHICS_OUTPUT_BLT_PIXEL mEfiColors
[16] = {
41 { 0x00, 0x00, 0x00, 0x00 },
42 { 0x98, 0x00, 0x00, 0x00 },
43 { 0x00, 0x98, 0x00, 0x00 },
44 { 0x98, 0x98, 0x00, 0x00 },
45 { 0x00, 0x00, 0x98, 0x00 },
46 { 0x98, 0x00, 0x98, 0x00 },
47 { 0x00, 0x98, 0x98, 0x00 },
48 { 0x98, 0x98, 0x98, 0x00 },
49 { 0x10, 0x10, 0x10, 0x00 },
50 { 0xff, 0x10, 0x10, 0x00 },
51 { 0x10, 0xff, 0x10, 0x00 },
52 { 0xff, 0xff, 0x10, 0x00 },
53 { 0x10, 0x10, 0xff, 0x00 },
54 { 0xf0, 0x10, 0xff, 0x00 },
55 { 0x10, 0xff, 0xff, 0x00 },
56 { 0xff, 0xff, 0xff, 0x00 }
61 Return the graphics image file named FileNameGuid into Image and return it's
62 size in ImageSize. All Firmware Volumes (FV) in the system are searched for the
65 @param FileNameGuid File Name of graphics file in the FV(s).
66 @param Image Pointer to pointer to return graphics image. If NULL, a
67 buffer will be allocated.
68 @param ImageSize Size of the graphics Image in bytes. Zero if no image found.
70 @retval EFI_SUCCESS Image and ImageSize are valid.
71 @retval EFI_BUFFER_TOO_SMALL Image not big enough. ImageSize has required size
72 @retval EFI_NOT_FOUND FileNameGuid not found
77 GetGraphicsBitMapFromFV (
78 IN EFI_GUID
*FileNameGuid
,
83 return GetGraphicsBitMapFromFVEx (NULL
, FileNameGuid
, Image
, ImageSize
);
87 Return the graphics image file named FileNameGuid into Image and return it's
88 size in ImageSize. All Firmware Volumes (FV) in the system are searched for the
91 @param ImageHandle The driver image handle of the caller. The parameter is used to
92 optimize the loading of the image file so that the FV from which
93 the driver image is loaded will be tried first.
94 @param FileNameGuid File Name of graphics file in the FV(s).
95 @param Image Pointer to pointer to return graphics image. If NULL, a
96 buffer will be allocated.
97 @param ImageSize Size of the graphics Image in bytes. Zero if no image found.
99 @retval EFI_SUCCESS Image and ImageSize are valid.
100 @retval EFI_BUFFER_TOO_SMALL Image not big enough. ImageSize has required size
101 @retval EFI_NOT_FOUND FileNameGuid not found
106 GetGraphicsBitMapFromFVEx (
107 IN EFI_HANDLE ImageHandle
,
108 IN EFI_GUID
*FileNameGuid
,
113 return PiLibGetSectionFromAnyFv (
123 Convert a *.BMP graphics image to a GOP blt buffer. If a NULL Blt buffer
124 is passed in a GopBlt buffer will be allocated by this routine. If a GopBlt
125 buffer is passed in it will be used if it is big enough.
127 @param BmpImage Pointer to BMP file
128 @param BmpImageSize Number of bytes in BmpImage
129 @param GopBlt Buffer containing GOP version of BmpImage.
130 @param GopBltSize Size of GopBlt in bytes.
131 @param PixelHeight Height of GopBlt/BmpImage in pixels
132 @param PixelWidth Width of GopBlt/BmpImage in pixels
134 @retval EFI_SUCCESS GopBlt and GopBltSize are returned.
135 @retval EFI_UNSUPPORTED BmpImage is not a valid *.BMP image
136 @retval EFI_BUFFER_TOO_SMALL The passed in GopBlt buffer is not big enough.
137 GopBltSize will contain the required size.
138 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate.
145 IN UINTN BmpImageSize
,
146 IN OUT VOID
**GopBlt
,
147 IN OUT UINTN
*GopBltSize
,
148 OUT UINTN
*PixelHeight
,
149 OUT UINTN
*PixelWidth
154 BMP_IMAGE_HEADER
*BmpHeader
;
155 BMP_COLOR_MAP
*BmpColorMap
;
156 EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*BltBuffer
;
157 EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*Blt
;
165 BmpHeader
= (BMP_IMAGE_HEADER
*) BmpImage
;
167 if (BmpHeader
->CharB
!= 'B' || BmpHeader
->CharM
!= 'M') {
168 return EFI_UNSUPPORTED
;
172 // Doesn't support compress.
174 if (BmpHeader
->CompressionType
!= 0) {
175 return EFI_UNSUPPORTED
;
179 // Calculate Color Map offset in the image.
182 BmpColorMap
= (BMP_COLOR_MAP
*) (Image
+ sizeof (BMP_IMAGE_HEADER
));
185 // Calculate graphics image data address in the image
187 Image
= ((UINT8
*) BmpImage
) + BmpHeader
->ImageOffset
;
191 // Calculate the BltBuffer needed size.
193 BltBufferSize
= BmpHeader
->PixelWidth
* BmpHeader
->PixelHeight
* sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
);
195 if (*GopBlt
== NULL
) {
197 // GopBlt is not allocated by caller.
199 *GopBltSize
= BltBufferSize
;
200 *GopBlt
= AllocatePool (*GopBltSize
);
202 if (*GopBlt
== NULL
) {
203 return EFI_OUT_OF_RESOURCES
;
207 // GopBlt has been allocated by caller.
209 if (*GopBltSize
< BltBufferSize
) {
210 *GopBltSize
= BltBufferSize
;
211 return EFI_BUFFER_TOO_SMALL
;
215 *PixelWidth
= BmpHeader
->PixelWidth
;
216 *PixelHeight
= BmpHeader
->PixelHeight
;
219 // Convert image from BMP to Blt buffer format
222 for (Height
= 0; Height
< BmpHeader
->PixelHeight
; Height
++) {
223 Blt
= &BltBuffer
[(BmpHeader
->PixelHeight
- Height
- 1) * BmpHeader
->PixelWidth
];
224 for (Width
= 0; Width
< BmpHeader
->PixelWidth
; Width
++, Image
++, Blt
++) {
225 switch (BmpHeader
->BitPerPixel
) {
228 // Convert 1-bit (2 colors) BMP to 24-bit color
230 for (Index
= 0; Index
< 8 && Width
< BmpHeader
->PixelWidth
; Index
++) {
231 Blt
->Red
= BmpColorMap
[((*Image
) >> (7 - Index
)) & 0x1].Red
;
232 Blt
->Green
= BmpColorMap
[((*Image
) >> (7 - Index
)) & 0x1].Green
;
233 Blt
->Blue
= BmpColorMap
[((*Image
) >> (7 - Index
)) & 0x1].Blue
;
244 // Convert 4-bit (16 colors) BMP Palette to 24-bit color
246 Index
= (*Image
) >> 4;
247 Blt
->Red
= BmpColorMap
[Index
].Red
;
248 Blt
->Green
= BmpColorMap
[Index
].Green
;
249 Blt
->Blue
= BmpColorMap
[Index
].Blue
;
250 if (Width
< (BmpHeader
->PixelWidth
- 1)) {
253 Index
= (*Image
) & 0x0f;
254 Blt
->Red
= BmpColorMap
[Index
].Red
;
255 Blt
->Green
= BmpColorMap
[Index
].Green
;
256 Blt
->Blue
= BmpColorMap
[Index
].Blue
;
262 // Convert 8-bit (256 colors) BMP Palette to 24-bit color
264 Blt
->Red
= BmpColorMap
[*Image
].Red
;
265 Blt
->Green
= BmpColorMap
[*Image
].Green
;
266 Blt
->Blue
= BmpColorMap
[*Image
].Blue
;
273 Blt
->Blue
= *Image
++;
274 Blt
->Green
= *Image
++;
280 // Other bit format BMP is not supported.
286 return EFI_UNSUPPORTED
;
292 ImageIndex
= (UINTN
) (Image
- ImageHeader
);
293 if ((ImageIndex
% 4) != 0) {
295 // Bmp Image starts each row on a 32-bit boundary!
297 Image
= Image
+ (4 - (ImageIndex
% 4));
306 Use Console Control Protocol to lock the Console In Spliter virtual handle.
307 This is the ConInHandle and ConIn handle in the EFI system table. All key
308 presses will be ignored until the Password is typed in. The only way to
309 disable the password is to type it in to a ConIn device.
311 @param Password Password used to lock ConIn device.
313 @retval EFI_SUCCESS ConsoleControl has been flipped to graphics and logo
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 SafeFreePool (ImageData
);
475 // Get the specified image from FV.
477 Status
= GetGraphicsBitMapFromFVEx (ImageHandle
, LogoFile
, (VOID
**) &ImageData
, &ImageSize
);
478 if (EFI_ERROR (Status
)) {
479 return EFI_UNSUPPORTED
;
484 Attribute
= EfiBadgingDisplayAttributeCenter
;
488 Status
= ConvertBmpToGopBlt (
496 if (EFI_ERROR (Status
)) {
497 SafeFreePool (ImageData
);
498 if (Badging
== NULL
) {
506 // Caculate the display position according to Attribute.
509 case EfiBadgingDisplayAttributeLeftTop
:
514 case EfiBadgingDisplayAttributeCenterTop
:
515 DestX
= (SizeOfX
- Width
) / 2;
519 case EfiBadgingDisplayAttributeRightTop
:
520 DestX
= (SizeOfX
- Width
- CoordinateX
);
521 DestY
= CoordinateY
;;
524 case EfiBadgingDisplayAttributeCenterRight
:
525 DestX
= (SizeOfX
- Width
- CoordinateX
);
526 DestY
= (SizeOfY
- Height
) / 2;
529 case EfiBadgingDisplayAttributeRightBottom
:
530 DestX
= (SizeOfX
- Width
- CoordinateX
);
531 DestY
= (SizeOfY
- Height
- CoordinateY
);
534 case EfiBadgingDisplayAttributeCenterBottom
:
535 DestX
= (SizeOfX
- Width
) / 2;
536 DestY
= (SizeOfY
- Height
- CoordinateY
);
539 case EfiBadgingDisplayAttributeLeftBottom
:
541 DestY
= (SizeOfY
- Height
- CoordinateY
);
544 case EfiBadgingDisplayAttributeCenterLeft
:
546 DestY
= (SizeOfY
- Height
) / 2;
549 case EfiBadgingDisplayAttributeCenter
:
550 DestX
= (SizeOfX
- Width
) / 2;
551 DestY
= (SizeOfY
- Height
) / 2;
560 if ((DestX
>= 0) && (DestY
>= 0)) {
561 if (GraphicsOutput
!= NULL
) {
562 Status
= GraphicsOutput
->Blt (
572 Width
* sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
)
574 } else if (FeaturePcdGet (PcdUgaConsumeSupport
)) {
575 Status
= UgaDraw
->Blt (
577 (EFI_UGA_PIXEL
*) Blt
,
578 EfiUgaBltBufferToVideo
,
585 Width
* sizeof (EFI_UGA_PIXEL
)
588 Status
= EFI_UNSUPPORTED
;
592 SafeFreePool (ImageData
);
595 if (Badging
== NULL
) {
604 Use Console Control to turn on UGA based Simple Text Out consoles. The UGA
605 Simple Text Out screens will now be synced up with all non UGA output devices
607 @retval EFI_SUCCESS UGA devices are back in text mode and synced up.
608 @retval EFI_UNSUPPORTED Logo not found
618 EFI_CONSOLE_CONTROL_PROTOCOL
*ConsoleControl
;
620 Status
= gBS
->LocateProtocol (&gEfiConsoleControlProtocolGuid
, NULL
, (VOID
**) &ConsoleControl
);
621 if (EFI_ERROR (Status
)) {
622 return EFI_UNSUPPORTED
;
626 // Set console control to text mode.
628 return ConsoleControl
->SetMode (ConsoleControl
, EfiConsoleControlScreenText
);
632 Internal display string worker function.
634 @param GraphicsOutput Graphics output protocol interface.
635 @param UgaDraw UGA draw protocol interface.
636 @param Sto Simple text out protocol interface.
637 @param X X coordinate to start printing.
638 @param Y Y coordinate to start printing.
639 @param Foreground Foreground color.
640 @param Background Background color.
641 @param fmt Format string.
642 @param args Print arguments.
644 @return Number of Characters printed. Zero means no any character
645 displayed successfully.
650 IN EFI_GRAPHICS_OUTPUT_PROTOCOL
*GraphicsOutput
,
651 IN EFI_UGA_DRAW_PROTOCOL
*UgaDraw
,
652 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*Sto
,
655 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*Foreground
,
656 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*Background
,
664 CHAR16
*UnicodeWeight
;
665 UINT32 HorizontalResolution
;
666 UINT32 VerticalResolution
;
671 EFI_HII_FONT_PROTOCOL
*HiiFont
;
672 EFI_IMAGE_OUTPUT
*Blt
;
673 EFI_FONT_DISPLAY_INFO
*FontInfo
;
674 EFI_HII_ROW_INFO
*RowInfoArray
;
675 UINTN RowInfoArraySize
;
679 // For now, allocate an arbitrarily long buffer
681 Buffer
= AllocateZeroPool (0x10000);
682 if (Buffer
== NULL
) {
686 HorizontalResolution
= 0;
687 VerticalResolution
= 0;
692 if (GraphicsOutput
!= NULL
) {
693 HorizontalResolution
= GraphicsOutput
->Mode
->Info
->HorizontalResolution
;
694 VerticalResolution
= GraphicsOutput
->Mode
->Info
->VerticalResolution
;
695 } else if (FeaturePcdGet (PcdUgaConsumeSupport
)) {
696 UgaDraw
->GetMode (UgaDraw
, &HorizontalResolution
, &VerticalResolution
, &ColorDepth
, &RefreshRate
);
698 Status
= EFI_UNSUPPORTED
;
702 ASSERT ((HorizontalResolution
!= 0) && (VerticalResolution
!=0));
704 Status
= gBS
->LocateProtocol (&gEfiHiiFontProtocolGuid
, NULL
, (VOID
**) &HiiFont
);
705 if (EFI_ERROR (Status
)) {
709 PrintNum
= UnicodeVSPrint (Buffer
, 0x10000, fmt
, args
);
711 UnicodeWeight
= (CHAR16
*) Buffer
;
713 for (Index
= 0; UnicodeWeight
[Index
] != 0; Index
++) {
714 if (UnicodeWeight
[Index
] == CHAR_BACKSPACE
||
715 UnicodeWeight
[Index
] == CHAR_LINEFEED
||
716 UnicodeWeight
[Index
] == CHAR_CARRIAGE_RETURN
) {
717 UnicodeWeight
[Index
] = 0;
721 BufferLen
= StrLen (Buffer
);
723 LineBufferLen
= sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
) * HorizontalResolution
* EFI_GLYPH_HEIGHT
;
724 if (EFI_GLYPH_WIDTH
* EFI_GLYPH_HEIGHT
* sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL
) * BufferLen
> LineBufferLen
) {
725 Status
= EFI_INVALID_PARAMETER
;
729 Blt
= (EFI_IMAGE_OUTPUT
*) AllocateZeroPool (sizeof (EFI_IMAGE_OUTPUT
));
731 Status
= EFI_OUT_OF_RESOURCES
;
735 Blt
->Width
= (UINT16
) (HorizontalResolution
);
736 Blt
->Height
= (UINT16
) (VerticalResolution
);
738 FontInfo
= (EFI_FONT_DISPLAY_INFO
*) AllocateZeroPool (sizeof (EFI_FONT_DISPLAY_INFO
));
739 if (FontInfo
== NULL
) {
740 Status
= EFI_OUT_OF_RESOURCES
;
743 if (Foreground
!= NULL
) {
744 CopyMem (&FontInfo
->ForegroundColor
, Foreground
, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
));
747 &FontInfo
->ForegroundColor
,
748 &mEfiColors
[Sto
->Mode
->Attribute
& 0x0f],
749 sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
)
752 if (Background
!= NULL
) {
753 CopyMem (&FontInfo
->BackgroundColor
, Background
, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
));
756 &FontInfo
->BackgroundColor
,
757 &mEfiColors
[Sto
->Mode
->Attribute
>> 4],
758 sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
)
762 if (GraphicsOutput
!= NULL
) {
763 Blt
->Image
.Screen
= GraphicsOutput
;
765 Status
= HiiFont
->StringToImage (
767 EFI_HII_IGNORE_IF_NO_GLYPH
| EFI_HII_DIRECT_TO_SCREEN
,
778 } else if (FeaturePcdGet (PcdUgaConsumeSupport
)) {
779 ASSERT (UgaDraw
!= NULL
);
781 Blt
->Image
.Bitmap
= AllocateZeroPool (Blt
->Width
* Blt
->Height
* sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
));
782 if (Blt
->Image
.Bitmap
== NULL
) {
784 SafeFreePool (Buffer
);
785 return EFI_OUT_OF_RESOURCES
;
790 // StringToImage only support blt'ing image to device using GOP protocol. If GOP is not supported in this platform,
791 // we ask StringToImage to print the string to blt buffer, then blt to device using UgaDraw.
793 Status
= HiiFont
->StringToImage (
795 EFI_HII_IGNORE_IF_NO_GLYPH
,
806 if (!EFI_ERROR (Status
)) {
808 // Line breaks are handled by caller of DrawUnicodeWeightAtCursorN, so the updated parameter RowInfoArraySize by StringToImage will
809 // always be 1 or 0 (if there is no valid Unicode Char can be printed). ASSERT here to make sure.
811 ASSERT (RowInfoArraySize
<= 1);
813 Status
= UgaDraw
->Blt (
815 (EFI_UGA_PIXEL
*) Blt
->Image
.Bitmap
,
816 EfiUgaBltBufferToVideo
,
821 RowInfoArray
[0].LineWidth
,
822 RowInfoArray
[0].LineHeight
,
823 Blt
->Width
* sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
)
827 SafeFreePool (RowInfoArray
);
828 SafeFreePool (Blt
->Image
.Bitmap
);
830 Status
= EFI_UNSUPPORTED
;
835 SafeFreePool (FontInfo
);
838 if (EFI_ERROR (Status
)) {
846 Print to graphics screen at the given X,Y coordinates of the graphics screen.
847 see definition of Print to find rules for constructing Fmt.
849 @param X Row to start printing at.
850 @param Y Column to start printing at.
851 @param ForeGround Foreground color.
852 @param BackGround background color.
853 @param Fmt Print format sting. See definition of Print.
854 @param ... Argumnet stream defined by Fmt string.
856 @return Number of Characters printed. Zero means no any character
857 displayed successfully.
865 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*ForeGround
, OPTIONAL
866 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*BackGround
, OPTIONAL
872 EFI_GRAPHICS_OUTPUT_PROTOCOL
*GraphicsOutput
;
873 EFI_UGA_DRAW_PROTOCOL
*UgaDraw
;
874 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*Sto
;
878 VA_START (Args
, Fmt
);
880 Handle
= gST
->ConsoleOutHandle
;
882 Status
= gBS
->HandleProtocol (
884 &gEfiGraphicsOutputProtocolGuid
,
885 (VOID
**) &GraphicsOutput
889 if (EFI_ERROR (Status
) && FeaturePcdGet (PcdUgaConsumeSupport
)) {
891 // If no GOP available, try to open UGA Draw protocol if supported.
893 GraphicsOutput
= NULL
;
895 Status
= gBS
->HandleProtocol (
897 &gEfiUgaDrawProtocolGuid
,
901 if (EFI_ERROR (Status
)) {
905 Status
= gBS
->HandleProtocol (
907 &gEfiSimpleTextOutProtocolGuid
,
911 if (EFI_ERROR (Status
)) {
915 return Print (GraphicsOutput
, UgaDraw
, Sto
, X
, Y
, ForeGround
, BackGround
, Fmt
, Args
);