add PCD PcdUgaConsumeSupport to switch on/off EFI UGA Draw Protocol's consuming, it could save size by changing PCD's value to FALSE.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4911 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
vanjeff 2008-03-19 05:22:06 +00:00
parent 18b8485750
commit 8541adab27
13 changed files with 347 additions and 309 deletions

View File

@ -35,6 +35,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Library/MemoryAllocationLib.h> #include <Library/MemoryAllocationLib.h>
#include <Library/UefiBootServicesTableLib.h> #include <Library/UefiBootServicesTableLib.h>
#include <Library/DebugLib.h> #include <Library/DebugLib.h>
#include <Library/PcdLib.h>
EFI_STATUS EFI_STATUS
GetGraphicsBitMapFromFV ( GetGraphicsBitMapFromFV (
@ -390,16 +391,16 @@ Returns:
// Try to open GOP first // Try to open GOP first
// //
Status = gBS->HandleProtocol (gST->ConsoleOutHandle, &gEfiGraphicsOutputProtocolGuid, (VOID **) &GraphicsOutput); Status = gBS->HandleProtocol (gST->ConsoleOutHandle, &gEfiGraphicsOutputProtocolGuid, (VOID **) &GraphicsOutput);
if (EFI_ERROR(Status)) { if (EFI_ERROR(Status) && FeaturePcdGet (PcdUgaConsumeSupport)) {
GraphicsOutput = NULL; GraphicsOutput = NULL;
// //
// Open GOP failed, try to open UGA // Open GOP failed, try to open UGA
// //
Status = gBS->HandleProtocol (gST->ConsoleOutHandle, &gEfiUgaDrawProtocolGuid, (VOID **) &UgaDraw); Status = gBS->HandleProtocol (gST->ConsoleOutHandle, &gEfiUgaDrawProtocolGuid, (VOID **) &UgaDraw);
}
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
} }
}
Badging = NULL; Badging = NULL;
Status = gBS->LocateProtocol (&gEfiOEMBadgingProtocolGuid, NULL, (VOID **) &Badging); Status = gBS->LocateProtocol (&gEfiOEMBadgingProtocolGuid, NULL, (VOID **) &Badging);
@ -409,7 +410,7 @@ Returns:
if (GraphicsOutput != NULL) { if (GraphicsOutput != NULL) {
SizeOfX = GraphicsOutput->Mode->Info->HorizontalResolution; SizeOfX = GraphicsOutput->Mode->Info->HorizontalResolution;
SizeOfY = GraphicsOutput->Mode->Info->VerticalResolution; SizeOfY = GraphicsOutput->Mode->Info->VerticalResolution;
} else { } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
Status = UgaDraw->GetMode (UgaDraw, &SizeOfX, &SizeOfY, &ColorDepth, &RefreshRate); Status = UgaDraw->GetMode (UgaDraw, &SizeOfX, &SizeOfY, &ColorDepth, &RefreshRate);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
@ -539,7 +540,7 @@ Returns:
Height, Height,
Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
); );
} else { } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
Status = UgaDraw->Blt ( Status = UgaDraw->Blt (
UgaDraw, UgaDraw,
(EFI_UGA_PIXEL *) Blt, (EFI_UGA_PIXEL *) Blt,
@ -552,6 +553,8 @@ Returns:
Height, Height,
Width * sizeof (EFI_UGA_PIXEL) Width * sizeof (EFI_UGA_PIXEL)
); );
} else {
Status = EFI_UNSUPPORTED;
} }
} }
@ -696,7 +699,7 @@ Returns:
if (GraphicsOutput != NULL) { if (GraphicsOutput != NULL) {
HorizontalResolution = GraphicsOutput->Mode->Info->HorizontalResolution; HorizontalResolution = GraphicsOutput->Mode->Info->HorizontalResolution;
VerticalResolution = GraphicsOutput->Mode->Info->VerticalResolution; VerticalResolution = GraphicsOutput->Mode->Info->VerticalResolution;
} else { } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
// //
// Get the current mode information from the UGA Draw Protocol // Get the current mode information from the UGA Draw Protocol
// //
@ -784,7 +787,7 @@ Returns:
GLYPH_HEIGHT, GLYPH_HEIGHT,
BufferGlyphWidth * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) BufferGlyphWidth * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
); );
} else { } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
Status = UgaDraw->Blt ( Status = UgaDraw->Blt (
UgaDraw, UgaDraw,
(EFI_UGA_PIXEL *) (UINTN) LineBuffer, (EFI_UGA_PIXEL *) (UINTN) LineBuffer,
@ -797,6 +800,8 @@ Returns:
GLYPH_HEIGHT, GLYPH_HEIGHT,
BufferGlyphWidth * sizeof (EFI_UGA_PIXEL) BufferGlyphWidth * sizeof (EFI_UGA_PIXEL)
); );
} else {
Status = EFI_UNSUPPORTED;
} }
Error: Error:
@ -861,7 +866,7 @@ Returns:
(VOID **) &GraphicsOutput (VOID **) &GraphicsOutput
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status) && FeaturePcdGet (PcdUgaConsumeSupport)) {
GraphicsOutput = NULL; GraphicsOutput = NULL;
Status = gBS->HandleProtocol ( Status = gBS->HandleProtocol (
@ -869,11 +874,11 @@ Returns:
&gEfiUgaDrawProtocolGuid, &gEfiUgaDrawProtocolGuid,
(VOID **) &UgaDraw (VOID **) &UgaDraw
); );
}
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }
}
Status = gBS->HandleProtocol ( Status = gBS->HandleProtocol (
Handle, Handle,

View File

@ -56,3 +56,5 @@
gEfiFirmwareVolume2ProtocolGuid # PROTOCOL ALWAYS_CONSUMED gEfiFirmwareVolume2ProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiOEMBadgingProtocolGuid # PROTOCOL ALWAYS_CONSUMED gEfiOEMBadgingProtocolGuid # PROTOCOL ALWAYS_CONSUMED
[FeaturePcd.common]
gEfiMdeModulePkgTokenSpaceGuid.PcdUgaConsumeSupport

View File

@ -38,6 +38,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Library/DebugLib.h> #include <Library/DebugLib.h>
#include <Library/BaseMemoryLib.h> #include <Library/BaseMemoryLib.h>
#include <Library/DxePiLib.h> #include <Library/DxePiLib.h>
#include <Library/PcdLib.h>
STATIC EFI_GRAPHICS_OUTPUT_BLT_PIXEL mEfiColors[16] = { STATIC EFI_GRAPHICS_OUTPUT_BLT_PIXEL mEfiColors[16] = {
{ 0x00, 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00, 0x00 },
@ -442,16 +443,16 @@ Returns:
// Try to open GOP first // Try to open GOP first
// //
Status = gBS->HandleProtocol (gST->ConsoleOutHandle, &gEfiGraphicsOutputProtocolGuid, (VOID**)&GraphicsOutput); Status = gBS->HandleProtocol (gST->ConsoleOutHandle, &gEfiGraphicsOutputProtocolGuid, (VOID**)&GraphicsOutput);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status) && FeaturePcdGet (PcdUgaConsumeSupport)) {
GraphicsOutput = NULL; GraphicsOutput = NULL;
// //
// Open GOP failed, try to open UGA // Open GOP failed, try to open UGwhA
// //
Status = gBS->HandleProtocol (gST->ConsoleOutHandle, &gEfiUgaDrawProtocolGuid, (VOID**)&UgaDraw); Status = gBS->HandleProtocol (gST->ConsoleOutHandle, &gEfiUgaDrawProtocolGuid, (VOID**)&UgaDraw);
}
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
} }
}
Badging = NULL; Badging = NULL;
Status = gBS->LocateProtocol (&gEfiOEMBadgingProtocolGuid, NULL, (VOID**)&Badging); Status = gBS->LocateProtocol (&gEfiOEMBadgingProtocolGuid, NULL, (VOID**)&Badging);
@ -464,7 +465,7 @@ Returns:
if (GraphicsOutput != NULL) { if (GraphicsOutput != NULL) {
SizeOfX = GraphicsOutput->Mode->Info->HorizontalResolution; SizeOfX = GraphicsOutput->Mode->Info->HorizontalResolution;
SizeOfY = GraphicsOutput->Mode->Info->VerticalResolution; SizeOfY = GraphicsOutput->Mode->Info->VerticalResolution;
} else { } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
Status = UgaDraw->GetMode (UgaDraw, &SizeOfX, &SizeOfY, &ColorDepth, &RefreshRate); Status = UgaDraw->GetMode (UgaDraw, &SizeOfX, &SizeOfY, &ColorDepth, &RefreshRate);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
@ -593,7 +594,7 @@ Returns:
Height, Height,
Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
); );
} else { } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
Status = UgaDraw->Blt ( Status = UgaDraw->Blt (
UgaDraw, UgaDraw,
(EFI_UGA_PIXEL *) Blt, (EFI_UGA_PIXEL *) Blt,
@ -721,16 +722,23 @@ Returns:
return EFI_OUT_OF_RESOURCES; return EFI_OUT_OF_RESOURCES;
} }
HorizontalResolution = 0;
VerticalResolution = 0;
Blt = NULL;
FontInfo = NULL;
if (GraphicsOutput != NULL) { if (GraphicsOutput != NULL) {
HorizontalResolution = GraphicsOutput->Mode->Info->HorizontalResolution; HorizontalResolution = GraphicsOutput->Mode->Info->HorizontalResolution;
VerticalResolution = GraphicsOutput->Mode->Info->VerticalResolution; VerticalResolution = GraphicsOutput->Mode->Info->VerticalResolution;
} else { } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
UgaDraw->GetMode (UgaDraw, &HorizontalResolution, &VerticalResolution, &ColorDepth, &RefreshRate); UgaDraw->GetMode (UgaDraw, &HorizontalResolution, &VerticalResolution, &ColorDepth, &RefreshRate);
} else {
Status = EFI_UNSUPPORTED;
goto Error;
} }
ASSERT ((HorizontalResolution != 0) && (VerticalResolution !=0)); ASSERT ((HorizontalResolution != 0) && (VerticalResolution !=0));
Blt = NULL;
FontInfo = NULL;
ASSERT (GraphicsOutput != NULL); ASSERT (GraphicsOutput != NULL);
Status = gBS->LocateProtocol (&gEfiHiiFontProtocolGuid, NULL, (VOID **) &HiiFont); Status = gBS->LocateProtocol (&gEfiHiiFontProtocolGuid, NULL, (VOID **) &HiiFont);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
@ -866,7 +874,7 @@ Returns:
); );
UgaDraw = NULL; UgaDraw = NULL;
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status) && FeaturePcdGet (PcdUgaConsumeSupport)) {
GraphicsOutput = NULL; GraphicsOutput = NULL;
Status = gBS->HandleProtocol ( Status = gBS->HandleProtocol (
@ -874,11 +882,10 @@ Returns:
&gEfiUgaDrawProtocolGuid, &gEfiUgaDrawProtocolGuid,
(VOID**)&UgaDraw (VOID**)&UgaDraw
); );
}
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }
}
Status = gBS->HandleProtocol ( Status = gBS->HandleProtocol (
Handle, Handle,

View File

@ -55,3 +55,6 @@
gEfiFirmwareVolume2ProtocolGuid # PROTOCOL ALWAYS_CONSUMED gEfiFirmwareVolume2ProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiOEMBadgingProtocolGuid # PROTOCOL ALWAYS_CONSUMED gEfiOEMBadgingProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiHiiFontProtocolGuid # PROTOCOL ALWAYS_CONSUMED gEfiHiiFontProtocolGuid # PROTOCOL ALWAYS_CONSUMED
[FeaturePcd.common]
gEfiMdeModulePkgTokenSpaceGuid.PcdUgaConsumeSupport

View File

@ -126,7 +126,8 @@
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE|BOOLEAN|0x00010042 gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE|BOOLEAN|0x00010042
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|TRUE|BOOLEAN|0x00010043 gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|TRUE|BOOLEAN|0x00010043
gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreImageLoaderSearchTeSectionFirst|TRUE|BOOLEAN|0x00010044 gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreImageLoaderSearchTeSectionFirst|TRUE|BOOLEAN|0x00010044
gEfiMdeModulePkgTokenSpaceGuid.PcdSupportHardwareErrorRecord|FALSE|BOOLEAN|0x00010044 gEfiMdeModulePkgTokenSpaceGuid.PcdSupportHardwareErrorRecord|FALSE|BOOLEAN|0x00010045
gEfiMdeModulePkgTokenSpaceGuid.PcdUgaConsumeSupport|TRUE|BOOLEAN|0x00010046
[PcdsFixedAtBuild.common] [PcdsFixedAtBuild.common]
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPcdCallBackNumberPerPcdEntry|0x08|UINT32|0x0001000f gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPcdCallBackNumberPerPcdEntry|0x08|UINT32|0x0001000f

View File

@ -143,6 +143,7 @@
[FeaturePcd.common] [FeaturePcd.common]
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLangDepricate gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLangDepricate
gEfiMdeModulePkgTokenSpaceGuid.PcdSupportHardwareErrorRecord gEfiMdeModulePkgTokenSpaceGuid.PcdSupportHardwareErrorRecord
gEfiMdeModulePkgTokenSpaceGuid.PcdUgaConsumeSupport
[Pcd.common] [Pcd.common]
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLangCodes gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLangCodes

View File

@ -79,7 +79,7 @@ Returns:
&gEfiGraphicsOutputProtocolGuid, &gEfiGraphicsOutputProtocolGuid,
(VOID **) &GraphicsOutput (VOID **) &GraphicsOutput
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status) && FeaturePcdGet (PcdUgaConsumeSupport)) {
GraphicsOutput = NULL; GraphicsOutput = NULL;
Status = gBS->HandleProtocol ( Status = gBS->HandleProtocol (
@ -87,15 +87,17 @@ Returns:
&gEfiUgaDrawProtocolGuid, &gEfiUgaDrawProtocolGuid,
(VOID **) &UgaDraw (VOID **) &UgaDraw
); );
}
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
} }
}
SizeOfX = 0;
SizeOfY = 0;
if (GraphicsOutput != NULL) { if (GraphicsOutput != NULL) {
SizeOfX = GraphicsOutput->Mode->Info->HorizontalResolution; SizeOfX = GraphicsOutput->Mode->Info->HorizontalResolution;
SizeOfY = GraphicsOutput->Mode->Info->VerticalResolution; SizeOfY = GraphicsOutput->Mode->Info->VerticalResolution;
} else { } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
Status = UgaDraw->GetMode ( Status = UgaDraw->GetMode (
UgaDraw, UgaDraw,
&SizeOfX, &SizeOfX,
@ -106,6 +108,8 @@ Returns:
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
} }
} else {
return EFI_UNSUPPORTED;
} }
BlockWidth = SizeOfX / 100; BlockWidth = SizeOfX / 100;
@ -135,7 +139,7 @@ Returns:
SizeOfY - (PosY - GLYPH_HEIGHT - 1), SizeOfY - (PosY - GLYPH_HEIGHT - 1),
SizeOfX * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) SizeOfX * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
); );
} else { } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
Status = UgaDraw->Blt ( Status = UgaDraw->Blt (
UgaDraw, UgaDraw,
(EFI_UGA_PIXEL *) &Color, (EFI_UGA_PIXEL *) &Color,
@ -168,7 +172,7 @@ Returns:
BlockHeight, BlockHeight,
(BlockWidth) * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) (BlockWidth) * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
); );
} else { } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
Status = UgaDraw->Blt ( Status = UgaDraw->Blt (
UgaDraw, UgaDraw,
(EFI_UGA_PIXEL *) &ProgressColor, (EFI_UGA_PIXEL *) &ProgressColor,

View File

@ -1236,6 +1236,9 @@ Returns:
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }
GraphicsOutput = NULL;
UgaDraw = NULL;
// //
// Try to Open Graphics Output protocol // Try to Open Graphics Output protocol
// //
@ -1247,9 +1250,8 @@ Returns:
mConOut.VirtualHandle, mConOut.VirtualHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL EFI_OPEN_PROTOCOL_GET_PROTOCOL
); );
if (EFI_ERROR (Status)) {
GraphicsOutput = NULL; if (EFI_ERROR (Status) && FeaturePcdGet (PcdUgaConsumeSupport)) {
}
// //
// Open UGA_DRAW protocol // Open UGA_DRAW protocol
// //
@ -1261,8 +1263,6 @@ Returns:
mConOut.VirtualHandle, mConOut.VirtualHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL EFI_OPEN_PROTOCOL_GET_PROTOCOL
); );
if (EFI_ERROR (Status)) {
UgaDraw = NULL;
} }
// //
@ -1278,7 +1278,7 @@ Returns:
Status = ConSplitterTextOutAddDevice (&mConOut, TextOut, GraphicsOutput, UgaDraw); Status = ConSplitterTextOutAddDevice (&mConOut, TextOut, GraphicsOutput, UgaDraw);
ConSplitterTextOutSetAttribute (&mConOut.TextOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK)); ConSplitterTextOutSetAttribute (&mConOut.TextOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));
if (FeaturePcdGet (PcdConOutUgaSupport)) { if (FeaturePcdGet (PcdConOutUgaSupport) && FeaturePcdGet (PcdUgaConsumeSupport)) {
// //
// Match the UGA mode data of ConOut with the current mode // Match the UGA mode data of ConOut with the current mode
// //
@ -2711,7 +2711,7 @@ Returns:
} }
} }
} }
if (UgaDraw != NULL) { if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {
// //
// Graphics console driver can ensure the same mode for all GOP devices // Graphics console driver can ensure the same mode for all GOP devices
// so we can get the current mode from this video device // so we can get the current mode from this video device
@ -2751,7 +2751,7 @@ Done:
if (GraphicsOutput != NULL) { if (GraphicsOutput != NULL) {
Private->CurrentNumberOfGraphicsOutput++; Private->CurrentNumberOfGraphicsOutput++;
} }
if (UgaDraw != NULL) { if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {
Private->CurrentNumberOfUgaDraw++; Private->CurrentNumberOfUgaDraw++;
} }
@ -2989,7 +2989,7 @@ Returns:
} }
} }
if (FeaturePcdGet (PcdConOutUgaSupport)) { if (FeaturePcdGet (PcdConOutUgaSupport)) {
if (UgaDraw != NULL) { if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {
Status = UgaDraw->GetMode ( Status = UgaDraw->GetMode (
UgaDraw, UgaDraw,
&UgaHorizontalResolution, &UgaHorizontalResolution,
@ -3084,7 +3084,7 @@ Returns:
if (TextOutList->TextOut == TextOut) { if (TextOutList->TextOut == TextOut) {
CopyMem (TextOutList, TextOutList + 1, sizeof (TEXT_OUT_AND_GOP_DATA) * Index); CopyMem (TextOutList, TextOutList + 1, sizeof (TEXT_OUT_AND_GOP_DATA) * Index);
CurrentNumOfConsoles--; CurrentNumOfConsoles--;
if (TextOutList->UgaDraw != NULL) { if (TextOutList->UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {
Private->CurrentNumberOfUgaDraw--; Private->CurrentNumberOfUgaDraw--;
} }
if (TextOutList->GraphicsOutput != NULL) { if (TextOutList->GraphicsOutput != NULL) {

View File

@ -84,3 +84,4 @@
[FeaturePcd.common] [FeaturePcd.common]
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport
gEfiMdeModulePkgTokenSpaceGuid.PcdUgaConsumeSupport

View File

@ -311,7 +311,7 @@ Routine Description:
} }
} }
if (EFI_ERROR (ReturnStatus)) { if (EFI_ERROR (ReturnStatus) && FeaturePcdGet (PcdUgaConsumeSupport)) {
UgaDraw = Private->TextOutList[Index].UgaDraw; UgaDraw = Private->TextOutList[Index].UgaDraw;
if (UgaDraw != NULL) { if (UgaDraw != NULL) {
Status = UgaDraw->SetMode ( Status = UgaDraw->SetMode (
@ -581,7 +581,7 @@ ConSpliterGraphicsOutputBlt (
} }
UgaDraw = Private->TextOutList[Index].UgaDraw; UgaDraw = Private->TextOutList[Index].UgaDraw;
if (UgaDraw != NULL) { if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {
Status = UgaDraw->Blt ( Status = UgaDraw->Blt (
UgaDraw, UgaDraw,
(EFI_UGA_PIXEL *) BltBuffer, (EFI_UGA_PIXEL *) BltBuffer,
@ -628,7 +628,7 @@ DevNullGopSync (
Private->GraphicsOutput.Mode->Info->VerticalResolution, Private->GraphicsOutput.Mode->Info->VerticalResolution,
0 0
); );
} else { } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
return UgaDraw->Blt ( return UgaDraw->Blt (
UgaDraw, UgaDraw,
(EFI_UGA_PIXEL *) Private->GraphicsOutputBlt, (EFI_UGA_PIXEL *) Private->GraphicsOutputBlt,
@ -641,6 +641,8 @@ DevNullGopSync (
Private->GraphicsOutput.Mode->Info->VerticalResolution, Private->GraphicsOutput.Mode->Info->VerticalResolution,
0 0
); );
} else {
return EFI_UNSUPPORTED;
} }
} }
@ -767,8 +769,12 @@ ConSpliterUgaDrawSetMode (
// return the worst status met // return the worst status met
// //
for (Index = 0; Index < Private->CurrentNumberOfConsoles; Index++) { for (Index = 0; Index < Private->CurrentNumberOfConsoles; Index++) {
ReturnStatus = EFI_UNSUPPORTED;
if (FeaturePcdGet (PcdUgaConsumeSupport)) {
UgaDraw = Private->TextOutList[Index].UgaDraw; UgaDraw = Private->TextOutList[Index].UgaDraw;
if (UgaDraw != NULL) { if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {
Status = UgaDraw->SetMode ( Status = UgaDraw->SetMode (
UgaDraw, UgaDraw,
HorizontalResolution, HorizontalResolution,
@ -780,6 +786,7 @@ ConSpliterUgaDrawSetMode (
ReturnStatus = Status; ReturnStatus = Status;
} }
} }
}
if (EFI_ERROR (ReturnStatus)) { if (EFI_ERROR (ReturnStatus)) {
GraphicsOutput = Private->TextOutList[Index].GraphicsOutput; GraphicsOutput = Private->TextOutList[Index].GraphicsOutput;
@ -1043,7 +1050,7 @@ ConSpliterUgaDrawBlt (
} }
} }
if (Private->TextOutList[Index].UgaDraw != NULL) { if (Private->TextOutList[Index].UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {
Status = Private->TextOutList[Index].UgaDraw->Blt ( Status = Private->TextOutList[Index].UgaDraw->Blt (
Private->TextOutList[Index].UgaDraw, Private->TextOutList[Index].UgaDraw,
BltBuffer, BltBuffer,
@ -1077,7 +1084,7 @@ DevNullUgaSync (
IN EFI_UGA_DRAW_PROTOCOL *UgaDraw IN EFI_UGA_DRAW_PROTOCOL *UgaDraw
) )
{ {
if (UgaDraw != NULL) { if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {
return UgaDraw->Blt ( return UgaDraw->Blt (
UgaDraw, UgaDraw,
Private->UgaBlt, Private->UgaBlt,
@ -1090,7 +1097,7 @@ DevNullUgaSync (
Private->UgaVerticalResolution, Private->UgaVerticalResolution,
Private->UgaHorizontalResolution * sizeof (EFI_UGA_PIXEL) Private->UgaHorizontalResolution * sizeof (EFI_UGA_PIXEL)
); );
} else { } else if (GraphicsOutput != NULL) {
return GraphicsOutput->Blt ( return GraphicsOutput->Blt (
GraphicsOutput, GraphicsOutput,
(EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) Private->UgaBlt, (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) Private->UgaBlt,
@ -1103,6 +1110,8 @@ DevNullUgaSync (
Private->UgaVerticalResolution, Private->UgaVerticalResolution,
0 0
); );
} else {
return EFI_UNSUPPORTED;
} }
} }

View File

@ -144,6 +144,7 @@ GraphicsConsoleControllerDriverSupported (
EFI_UGA_DRAW_PROTOCOL *UgaDraw; EFI_UGA_DRAW_PROTOCOL *UgaDraw;
EFI_DEVICE_PATH_PROTOCOL *DevicePath; EFI_DEVICE_PATH_PROTOCOL *DevicePath;
GraphicsOutput = NULL;
UgaDraw = NULL; UgaDraw = NULL;
// //
// Open the IO Abstraction(s) needed to perform the supported test // Open the IO Abstraction(s) needed to perform the supported test
@ -157,8 +158,7 @@ GraphicsConsoleControllerDriverSupported (
EFI_OPEN_PROTOCOL_BY_DRIVER EFI_OPEN_PROTOCOL_BY_DRIVER
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status) && FeaturePcdGet (PcdUgaConsumeSupport)) {
GraphicsOutput = NULL;
// //
// Open Graphics Output Protocol failed, try to open UGA Draw Protocol // Open Graphics Output Protocol failed, try to open UGA Draw Protocol
// //
@ -170,10 +170,10 @@ GraphicsConsoleControllerDriverSupported (
Controller, Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER EFI_OPEN_PROTOCOL_BY_DRIVER
); );
}
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }
}
// //
// We need to ensure that we do not layer on top of a virtual handle. // We need to ensure that we do not layer on top of a virtual handle.
@ -215,7 +215,7 @@ Error:
This->DriverBindingHandle, This->DriverBindingHandle,
Controller Controller
); );
} else { } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
gBS->CloseProtocol ( gBS->CloseProtocol (
Controller, Controller,
&gEfiUgaDrawProtocolGuid, &gEfiUgaDrawProtocolGuid,
@ -292,9 +292,8 @@ GraphicsConsoleControllerDriverStart (
Controller, Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER EFI_OPEN_PROTOCOL_BY_DRIVER
); );
if (EFI_ERROR(Status)) {
Private->GraphicsOutput = NULL;
if (EFI_ERROR(Status) && FeaturePcdGet (PcdUgaConsumeSupport)) {
Status = gBS->OpenProtocol ( Status = gBS->OpenProtocol (
Controller, Controller,
&gEfiUgaDrawProtocolGuid, &gEfiUgaDrawProtocolGuid,
@ -303,10 +302,11 @@ GraphicsConsoleControllerDriverStart (
Controller, Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER EFI_OPEN_PROTOCOL_BY_DRIVER
); );
}
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
goto Error; goto Error;
} }
}
NarrowFontSize = ReturnNarrowFontSize (); NarrowFontSize = ReturnNarrowFontSize ();
@ -385,7 +385,7 @@ GraphicsConsoleControllerDriverStart (
VerticalResolution = Private->GraphicsOutput->Mode->Info->VerticalResolution; VerticalResolution = Private->GraphicsOutput->Mode->Info->VerticalResolution;
ModeNumber = Private->GraphicsOutput->Mode->Mode; ModeNumber = Private->GraphicsOutput->Mode->Mode;
} }
} else { } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
// //
// At first try to set user-defined resolution // At first try to set user-defined resolution
// //
@ -401,7 +401,7 @@ GraphicsConsoleControllerDriverStart (
if (!EFI_ERROR (Status)) { if (!EFI_ERROR (Status)) {
HorizontalResolution = CURRENT_HORIZONTAL_RESOLUTION; HorizontalResolution = CURRENT_HORIZONTAL_RESOLUTION;
VerticalResolution = CURRENT_VERTICAL_RESOLUTION; VerticalResolution = CURRENT_VERTICAL_RESOLUTION;
} else { } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
// //
// Try to set 800*600 which is required by UEFI/EFI spec // Try to set 800*600 which is required by UEFI/EFI spec
// //
@ -541,7 +541,7 @@ Error:
This->DriverBindingHandle, This->DriverBindingHandle,
Controller Controller
); );
} else { } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
gBS->CloseProtocol ( gBS->CloseProtocol (
Controller, Controller,
&gEfiUgaDrawProtocolGuid, &gEfiUgaDrawProtocolGuid,
@ -608,7 +608,7 @@ GraphicsConsoleControllerDriverStop (
This->DriverBindingHandle, This->DriverBindingHandle,
Controller Controller
); );
} else { } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
gBS->CloseProtocol ( gBS->CloseProtocol (
Controller, Controller,
&gEfiUgaDrawProtocolGuid, &gEfiUgaDrawProtocolGuid,
@ -927,7 +927,7 @@ GraphicsConsoleConOutOutputString (
GLYPH_HEIGHT, GLYPH_HEIGHT,
Delta Delta
); );
} else { } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
// //
// Scroll Screen Up One Row // Scroll Screen Up One Row
// //
@ -1340,7 +1340,7 @@ GraphicsConsoleConOutSetMode (
0 0
); );
} }
} else { } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
// //
// Get the current UGA Draw mode information // Get the current UGA Draw mode information
// //
@ -1518,7 +1518,7 @@ GraphicsConsoleConOutClearScreen (
ModeData->GopHeight, ModeData->GopHeight,
0 0
); );
} else { } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
Status = UgaDraw->Blt ( Status = UgaDraw->Blt (
UgaDraw, UgaDraw,
(EFI_UGA_PIXEL *) (UINTN) &Background, (EFI_UGA_PIXEL *) (UINTN) &Background,
@ -1531,6 +1531,8 @@ GraphicsConsoleConOutClearScreen (
ModeData->GopHeight, ModeData->GopHeight,
0 0
); );
} else {
Status = EFI_UNSUPPORTED;
} }
This->Mode->CursorColumn = 0; This->Mode->CursorColumn = 0;
@ -1729,7 +1731,7 @@ DrawUnicodeWeightAtCursorN (
NULL NULL
); );
} else { } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
ASSERT (Private->UgaDraw!= NULL); ASSERT (Private->UgaDraw!= NULL);
UgaDraw = Private->UgaDraw; UgaDraw = Private->UgaDraw;
@ -1782,6 +1784,8 @@ DrawUnicodeWeightAtCursorN (
SafeFreePool (RowInfoArray); SafeFreePool (RowInfoArray);
SafeFreePool (Blt->Image.Bitmap); SafeFreePool (Blt->Image.Bitmap);
} else {
Status = EFI_UNSUPPORTED;
} }
SafeFreePool (Blt); SafeFreePool (Blt);
@ -1840,7 +1844,7 @@ EraseCursor (
GLYPH_HEIGHT, GLYPH_HEIGHT,
GLYPH_WIDTH * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) GLYPH_WIDTH * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
); );
} else { } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
UgaDraw->Blt ( UgaDraw->Blt (
UgaDraw, UgaDraw,
(EFI_UGA_PIXEL *) (UINTN) BltChar, (EFI_UGA_PIXEL *) (UINTN) BltChar,
@ -1881,7 +1885,7 @@ EraseCursor (
GLYPH_HEIGHT, GLYPH_HEIGHT,
GLYPH_WIDTH * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) GLYPH_WIDTH * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
); );
} else { } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
UgaDraw->Blt ( UgaDraw->Blt (
UgaDraw, UgaDraw,
(EFI_UGA_PIXEL *) (UINTN) BltChar, (EFI_UGA_PIXEL *) (UINTN) BltChar,

View File

@ -24,7 +24,6 @@ Revision History
#define _GRAPHICS_CONSOLE_H #define _GRAPHICS_CONSOLE_H
#include <PiDxe.h> #include <PiDxe.h>
//#include <Protocol/FrameworkHii.h>
#include <Protocol/SimpleTextOut.h> #include <Protocol/SimpleTextOut.h>
#include <Protocol/GraphicsOutput.h> #include <Protocol/GraphicsOutput.h>
#include <Protocol/UgaDraw.h> #include <Protocol/UgaDraw.h>
@ -32,12 +31,12 @@ Revision History
#include <Library/DebugLib.h> #include <Library/DebugLib.h>
#include <Library/UefiDriverEntryPoint.h> #include <Library/UefiDriverEntryPoint.h>
#include <Library/UefiLib.h> #include <Library/UefiLib.h>
//#include <Library/FrameworkHiiLib.h>
#include <Library/BaseMemoryLib.h> #include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h> #include <Library/MemoryAllocationLib.h>
#include <Library/UefiBootServicesTableLib.h> #include <Library/UefiBootServicesTableLib.h>
#include <Library/HiiLib.h> #include <Library/HiiLib.h>
#include <Library/BaseLib.h> #include <Library/BaseLib.h>
#include <Library/PcdLib.h>
#include <MdeModuleHii.h> #include <MdeModuleHii.h>

View File

@ -62,3 +62,5 @@
gEfiHiiFontProtocolGuid gEfiHiiFontProtocolGuid
gEfiHiiDatabaseProtocolGuid gEfiHiiDatabaseProtocolGuid
[FeaturePcd.common]
gEfiMdeModulePkgTokenSpaceGuid.PcdUgaConsumeSupport