REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2368

Remove all UGA code in MdePkg except the definition

The reason why keep definition is because downstream need it to pass
build.
It will be removed when all downstream remove UGA support

Signed-off-by: Guomin Jiang <guomin.ji...@intel.com>
Cc: Michael D Kinney <michael.d.kin...@intel.com>
Cc: Liming Gao <gaolim...@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang....@intel.com>
---
 MdePkg/Library/UefiLib/UefiLib.inf       |  4 +-
 MdePkg/Library/UefiLib/UefiLibInternal.h |  3 +-
 MdePkg/Library/UefiLib/UefiLibPrint.c    | 91 +-----------------------
 MdePkg/MdePkg.dsc                        |  3 -
 4 files changed, 3 insertions(+), 98 deletions(-)

diff --git a/MdePkg/Library/UefiLib/UefiLib.inf 
b/MdePkg/Library/UefiLib/UefiLib.inf
index 01ed92092da2..ac9d68907261 100644
--- a/MdePkg/Library/UefiLib/UefiLib.inf
+++ b/MdePkg/Library/UefiLib/UefiLib.inf
@@ -7,7 +7,7 @@
 #  EFI Driver Model related protocols, manage Unicode string tables for UEFI 
Drivers,
 #  and print messages on the console output and standard error devices.
 #
-# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2022, Intel Corporation. All rights reserved.<BR>
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -67,7 +67,6 @@
   gEfiGraphicsOutputProtocolGuid                  ## SOMETIMES_CONSUMES
   gEfiHiiFontProtocolGuid                         ## SOMETIMES_CONSUMES
   gEfiSimpleFileSystemProtocolGuid                ## SOMETIMES_CONSUMES
-  gEfiUgaDrawProtocolGuid | gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport      
           ## SOMETIMES_CONSUMES # Consumes if gEfiGraphicsOutputProtocolGuid 
uninstalled
   gEfiComponentNameProtocolGuid  | NOT 
gEfiMdePkgTokenSpaceGuid.PcdComponentNameDisable   ## SOMETIMES_PRODUCES # User 
chooses to produce it
   gEfiComponentName2ProtocolGuid | NOT 
gEfiMdePkgTokenSpaceGuid.PcdComponentName2Disable  ## SOMETIMES_PRODUCES # User 
chooses to produce it
   gEfiDriverConfigurationProtocolGuid                            ## 
SOMETIMES_PRODUCES # User chooses to produce it
@@ -84,5 +83,4 @@
   gEfiMdePkgTokenSpaceGuid.PcdComponentNameDisable        ## CONSUMES
   gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnostics2Disable   ## CONSUMES
   gEfiMdePkgTokenSpaceGuid.PcdComponentName2Disable       ## CONSUMES
-  gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport           ## CONSUMES
 
diff --git a/MdePkg/Library/UefiLib/UefiLibInternal.h 
b/MdePkg/Library/UefiLib/UefiLibInternal.h
index 4365282cf213..be5c9ddcdde8 100644
--- a/MdePkg/Library/UefiLib/UefiLibInternal.h
+++ b/MdePkg/Library/UefiLib/UefiLibInternal.h
@@ -1,7 +1,7 @@
 /** @file
   Internal include file for UefiLib.
 
-  Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2007 - 2022, Intel Corporation. All rights reserved.<BR>
    SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
 
@@ -18,7 +18,6 @@
 #include <Protocol/DriverDiagnostics2.h>
 #include <Protocol/LoadedImage.h>
 #include <Protocol/GraphicsOutput.h>
-#include <Protocol/UgaDraw.h>
 #include <Protocol/HiiFont.h>
 
 #include <Guid/EventGroup.h>
diff --git a/MdePkg/Library/UefiLib/UefiLibPrint.c 
b/MdePkg/Library/UefiLib/UefiLibPrint.c
index 39edeb7283dd..2451775aeb90 100644
--- a/MdePkg/Library/UefiLib/UefiLibPrint.c
+++ b/MdePkg/Library/UefiLib/UefiLibPrint.c
@@ -2,7 +2,7 @@
   Mde UEFI library API implementation.
   Print to StdErr or ConOut defined in EFI_SYSTEM_TABLE
 
-  Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2007 - 2022, Intel Corporation. All rights reserved.<BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -344,20 +344,14 @@ InternalPrintGraphic (
   EFI_STATUS                       Status;
   UINT32                           HorizontalResolution;
   UINT32                           VerticalResolution;
-  UINT32                           ColorDepth;
-  UINT32                           RefreshRate;
   EFI_HII_FONT_PROTOCOL            *HiiFont;
   EFI_IMAGE_OUTPUT                 *Blt;
   EFI_FONT_DISPLAY_INFO            FontInfo;
   EFI_HII_ROW_INFO                 *RowInfoArray;
   UINTN                            RowInfoArraySize;
   EFI_GRAPHICS_OUTPUT_PROTOCOL     *GraphicsOutput;
-  EFI_UGA_DRAW_PROTOCOL            *UgaDraw;
   EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL  *Sto;
   EFI_HANDLE                       ConsoleHandle;
-  UINTN                            Width;
-  UINTN                            Height;
-  UINTN                            Delta;
 
   HorizontalResolution = 0;
   VerticalResolution   = 0;
@@ -374,20 +368,6 @@ InternalPrintGraphic (
                   (VOID **)&GraphicsOutput
                   );
 
-  UgaDraw = NULL;
-  if (EFI_ERROR (Status) && FeaturePcdGet (PcdUgaConsumeSupport)) {
-    //
-    // If no GOP available, try to open UGA Draw protocol if supported.
-    //
-    GraphicsOutput = NULL;
-
-    Status = gBS->HandleProtocol (
-                    ConsoleHandle,
-                    &gEfiUgaDrawProtocolGuid,
-                    (VOID **)&UgaDraw
-                    );
-  }
-
   if (EFI_ERROR (Status)) {
     goto Error;
   }
@@ -405,8 +385,6 @@ InternalPrintGraphic (
   if (GraphicsOutput != NULL) {
     HorizontalResolution = GraphicsOutput->Mode->Info->HorizontalResolution;
     VerticalResolution   = GraphicsOutput->Mode->Info->VerticalResolution;
-  } else if ((UgaDraw != NULL) && FeaturePcdGet (PcdUgaConsumeSupport)) {
-    UgaDraw->GetMode (UgaDraw, &HorizontalResolution, &VerticalResolution, 
&ColorDepth, &RefreshRate);
   } else {
     goto Error;
   }
@@ -466,73 +444,6 @@ InternalPrintGraphic (
     if (EFI_ERROR (Status)) {
       goto Error;
     }
-  } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
-    ASSERT (UgaDraw != NULL);
-
-    //
-    // Ensure Width * Height * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) doesn't 
overflow.
-    //
-    if (Blt->Width > DivU64x32 (MAX_UINTN, Blt->Height * sizeof 
(EFI_GRAPHICS_OUTPUT_BLT_PIXEL))) {
-      goto Error;
-    }
-
-    Blt->Image.Bitmap = AllocateZeroPool ((UINT32)Blt->Width * Blt->Height * 
sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
-    ASSERT (Blt->Image.Bitmap != NULL);
-
-    //
-    //  StringToImage only support blt'ing image to device using GOP protocol. 
If GOP is not supported in this platform,
-    //  we ask StringToImage to print the string to blt buffer, then blt to 
device using UgaDraw.
-    //
-    Status = HiiFont->StringToImage (
-                        HiiFont,
-                        EFI_HII_IGNORE_IF_NO_GLYPH | EFI_HII_OUT_FLAG_CLIP |
-                        EFI_HII_OUT_FLAG_CLIP_CLEAN_X | 
EFI_HII_OUT_FLAG_CLIP_CLEAN_Y |
-                        EFI_HII_IGNORE_LINE_BREAK,
-                        Buffer,
-                        &FontInfo,
-                        &Blt,
-                        PointX,
-                        PointY,
-                        &RowInfoArray,
-                        &RowInfoArraySize,
-                        NULL
-                        );
-
-    if (!EFI_ERROR (Status)) {
-      ASSERT (RowInfoArray != NULL);
-      //
-      // Explicit Line break characters are ignored, so the updated parameter 
RowInfoArraySize by StringToImage will
-      // always be 1 or 0 (if there is no valid Unicode Char can be printed). 
ASSERT here to make sure.
-      //
-      ASSERT (RowInfoArraySize <= 1);
-
-      if (RowInfoArraySize != 0) {
-        Width  = RowInfoArray[0].LineWidth;
-        Height = RowInfoArray[0].LineHeight;
-        Delta  = Blt->Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL);
-      } else {
-        Width  = 0;
-        Height = 0;
-        Delta  = 0;
-      }
-
-      Status = UgaDraw->Blt (
-                          UgaDraw,
-                          (EFI_UGA_PIXEL *)Blt->Image.Bitmap,
-                          EfiUgaBltBufferToVideo,
-                          PointX,
-                          PointY,
-                          PointX,
-                          PointY,
-                          Width,
-                          Height,
-                          Delta
-                          );
-    } else {
-      goto Error;
-    }
-
-    FreePool (Blt->Image.Bitmap);
   } else {
     goto Error;
   }
diff --git a/MdePkg/MdePkg.dsc b/MdePkg/MdePkg.dsc
index 3d8874e64782..e67d4716df21 100644
--- a/MdePkg/MdePkg.dsc
+++ b/MdePkg/MdePkg.dsc
@@ -23,9 +23,6 @@
 
 !include MdePkg/MdeLibs.dsc.inc
 
-[PcdsFeatureFlag]
-  gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport|TRUE
-
 [PcdsFixedAtBuild]
   gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x0f
   gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80000000
-- 
2.26.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91392): https://edk2.groups.io/g/devel/message/91392
Mute This Topic: https://groups.io/mt/92393226/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to