summaryrefslogtreecommitdiff
path: root/IntelFrameworkModulePkg/Library
diff options
context:
space:
mode:
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2008-03-19 05:22:06 +0000
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2008-03-19 05:22:06 +0000
commit8541adab27901906118876f1acd3555666677ff9 (patch)
treed5d326e649b30f5557ddfa974657fb1822a0cdf4 /IntelFrameworkModulePkg/Library
parent18b84857507fc28b8fbfbcd434f9c48bbcaf4ac5 (diff)
downloadedk2-platforms-8541adab27901906118876f1acd3555666677ff9.tar.xz
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
Diffstat (limited to 'IntelFrameworkModulePkg/Library')
-rw-r--r--IntelFrameworkModulePkg/Library/GraphicsLib/Graphics.c29
-rw-r--r--IntelFrameworkModulePkg/Library/GraphicsLib/GraphicsLib.inf2
2 files changed, 19 insertions, 12 deletions
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 <Library/MemoryAllocationLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/DebugLib.h>
+#include <Library/PcdLib.h>
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 (
diff --git a/IntelFrameworkModulePkg/Library/GraphicsLib/GraphicsLib.inf b/IntelFrameworkModulePkg/Library/GraphicsLib/GraphicsLib.inf
index a25ed94bf8..39eee4b711 100644
--- a/IntelFrameworkModulePkg/Library/GraphicsLib/GraphicsLib.inf
+++ b/IntelFrameworkModulePkg/Library/GraphicsLib/GraphicsLib.inf
@@ -56,3 +56,5 @@
gEfiFirmwareVolume2ProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiOEMBadgingProtocolGuid # PROTOCOL ALWAYS_CONSUMED
+[FeaturePcd.common]
+ gEfiMdeModulePkgTokenSpaceGuid.PcdUgaConsumeSupport