From 8541adab27901906118876f1acd3555666677ff9 Mon Sep 17 00:00:00 2001 From: vanjeff Date: Wed, 19 Mar 2008 05:22:06 +0000 Subject: 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 --- .../Library/GraphicsLib/Graphics.c | 29 +++++++++++++--------- 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'IntelFrameworkModulePkg/Library/GraphicsLib/Graphics.c') diff --git a/IntelFrameworkModulePkg/Library/GraphicsLib/Graphics.c b/IntelFrameworkModulePkg/Library/GraphicsLib/Graphics.c index 5ab779a6a3..283d9be358 100644 --- a/IntelFrameworkModulePkg/Library/GraphicsLib/Graphics.c +++ b/IntelFrameworkModulePkg/Library/GraphicsLib/Graphics.c @@ -35,6 +35,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include +#include EFI_STATUS GetGraphicsBitMapFromFV ( @@ -390,15 +391,15 @@ Returns: // Try to open GOP first // Status = gBS->HandleProtocol (gST->ConsoleOutHandle, &gEfiGraphicsOutputProtocolGuid, (VOID **) &GraphicsOutput); - if (EFI_ERROR(Status)) { + if (EFI_ERROR(Status) && FeaturePcdGet (PcdUgaConsumeSupport)) { GraphicsOutput = NULL; // // Open GOP failed, try to open UGA // Status = gBS->HandleProtocol (gST->ConsoleOutHandle, &gEfiUgaDrawProtocolGuid, (VOID **) &UgaDraw); - if (EFI_ERROR (Status)) { - return EFI_UNSUPPORTED; - } + } + if (EFI_ERROR (Status)) { + return EFI_UNSUPPORTED; } Badging = NULL; @@ -409,7 +410,7 @@ Returns: if (GraphicsOutput != NULL) { SizeOfX = GraphicsOutput->Mode->Info->HorizontalResolution; SizeOfY = GraphicsOutput->Mode->Info->VerticalResolution; - } else { + } else if (FeaturePcdGet (PcdUgaConsumeSupport)) { Status = UgaDraw->GetMode (UgaDraw, &SizeOfX, &SizeOfY, &ColorDepth, &RefreshRate); if (EFI_ERROR (Status)) { return EFI_UNSUPPORTED; @@ -539,7 +540,7 @@ Returns: Height, Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) ); - } else { + } else if (FeaturePcdGet (PcdUgaConsumeSupport)) { Status = UgaDraw->Blt ( UgaDraw, (EFI_UGA_PIXEL *) Blt, @@ -552,6 +553,8 @@ Returns: Height, Width * sizeof (EFI_UGA_PIXEL) ); + } else { + Status = EFI_UNSUPPORTED; } } @@ -696,7 +699,7 @@ Returns: if (GraphicsOutput != NULL) { HorizontalResolution = GraphicsOutput->Mode->Info->HorizontalResolution; VerticalResolution = GraphicsOutput->Mode->Info->VerticalResolution; - } else { + } else if (FeaturePcdGet (PcdUgaConsumeSupport)) { // // Get the current mode information from the UGA Draw Protocol // @@ -784,7 +787,7 @@ Returns: GLYPH_HEIGHT, BufferGlyphWidth * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) ); - } else { + } else if (FeaturePcdGet (PcdUgaConsumeSupport)) { Status = UgaDraw->Blt ( UgaDraw, (EFI_UGA_PIXEL *) (UINTN) LineBuffer, @@ -797,6 +800,8 @@ Returns: GLYPH_HEIGHT, BufferGlyphWidth * sizeof (EFI_UGA_PIXEL) ); + } else { + Status = EFI_UNSUPPORTED; } Error: @@ -861,7 +866,7 @@ Returns: (VOID **) &GraphicsOutput ); - if (EFI_ERROR (Status)) { + if (EFI_ERROR (Status) && FeaturePcdGet (PcdUgaConsumeSupport)) { GraphicsOutput = NULL; Status = gBS->HandleProtocol ( @@ -869,10 +874,10 @@ Returns: &gEfiUgaDrawProtocolGuid, (VOID **) &UgaDraw ); + } - if (EFI_ERROR (Status)) { - return Status; - } + if (EFI_ERROR (Status)) { + return Status; } Status = gBS->HandleProtocol ( -- cgit v1.2.3