public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Guomin Jiang" <guomin.jiang@intel.com>
To: devel@edk2.groups.io
Cc: GuoMinJ <newexplorerj@gmail.com>,
	Jian J Wang <jian.j.wang@intel.com>,
	Hao A Wu <hao.a.wu@intel.com>
Subject: [PATCH 04/18] MdeModulePkg: Remove All UGA Support
Date: Fri,  8 May 2020 16:38:10 +0800	[thread overview]
Message-ID: <20200508083824.1785-5-guomin.jiang@intel.com> (raw)
In-Reply-To: <20200508083824.1785-1-guomin.jiang@intel.com>

From: GuoMinJ <newexplorerj@gmail.com>

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

Remove All UGA Support in MdeModulePkg, first remove from library.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Signed-off-by: Guomin Jiang <guomin.jiang@intel.com>
---
 MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.c       |   2 +-
 MdeModulePkg/Include/Library/BootLogoLib.h    |   2 +-
 .../Library/BootLogoLib/BootLogoLib.c         | 224 +++++-------------
 .../Library/BootLogoLib/BootLogoLib.inf       |   4 -
 4 files changed, 55 insertions(+), 177 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.c
index 64284ac8251c..2b03ecb258c6 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.c
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.c
@@ -49,7 +49,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_PCI_HOTPLUG_REQUEST_PROTOCOL mPciHotPlugReques
   Installs driver module protocols and. Creates virtual device handles for ConIn,
   ConOut, and StdErr. Installs Simple Text In protocol, Simple Text In Ex protocol,
   Simple Pointer protocol, Absolute Pointer protocol on those virtual handlers.
-  Installs Graphics Output protocol and/or UGA Draw protocol if needed.
+  Installs Graphics Output protocol if needed.
 
   @param[in] ImageHandle    The firmware allocated handle for the EFI image.
   @param[in] SystemTable    A pointer to the EFI System Table.
diff --git a/MdeModulePkg/Include/Library/BootLogoLib.h b/MdeModulePkg/Include/Library/BootLogoLib.h
index afd895b257c3..8af87790d1d3 100644
--- a/MdeModulePkg/Include/Library/BootLogoLib.h
+++ b/MdeModulePkg/Include/Library/BootLogoLib.h
@@ -27,7 +27,7 @@ BootLogoEnableLogo (
   Use SystemTable ConOut to turn on video based Simple Text Out consoles. The
   Simple Text Out screens will now be synced up with all non-video output devices.
 
-  @retval EFI_SUCCESS     UGA devices are back in text mode and synced up.
+  @retval EFI_SUCCESS     Devices are back in text mode and synced up.
 
 **/
 EFI_STATUS
diff --git a/MdeModulePkg/Library/BootLogoLib/BootLogoLib.c b/MdeModulePkg/Library/BootLogoLib/BootLogoLib.c
index 134660f28d34..ce8e725fedab 100644
--- a/MdeModulePkg/Library/BootLogoLib/BootLogoLib.c
+++ b/MdeModulePkg/Library/BootLogoLib/BootLogoLib.c
@@ -12,7 +12,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include <Protocol/GraphicsOutput.h>
 #include <Protocol/SimpleTextOut.h>
 #include <Protocol/PlatformLogo.h>
-#include <Protocol/UgaDraw.h>
 #include <Protocol/BootLogo.h>
 #include <Protocol/BootLogo2.h>
 #include <Library/BaseLib.h>
@@ -47,9 +46,6 @@ BootLogoEnableLogo (
   UINT32                                Instance;
   EFI_IMAGE_INPUT                       Image;
   EFI_GRAPHICS_OUTPUT_BLT_PIXEL         *Blt;
-  EFI_UGA_DRAW_PROTOCOL                 *UgaDraw;
-  UINT32                                ColorDepth;
-  UINT32                                RefreshRate;
   EFI_GRAPHICS_OUTPUT_PROTOCOL          *GraphicsOutput;
   EFI_BOOT_LOGO_PROTOCOL                *BootLogo;
   EDKII_BOOT_LOGO2_PROTOCOL             *BootLogo2;
@@ -68,21 +64,10 @@ BootLogoEnableLogo (
     return EFI_UNSUPPORTED;
   }
 
-  UgaDraw = NULL;
   //
   // Try to open GOP first
   //
   Status = gBS->HandleProtocol (gST->ConsoleOutHandle, &gEfiGraphicsOutputProtocolGuid, (VOID **) &GraphicsOutput);
-  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)) {
-      UgaDraw = NULL;
-    }
-  }
   if (EFI_ERROR (Status)) {
     return EFI_UNSUPPORTED;
   }
@@ -108,17 +93,8 @@ BootLogoEnableLogo (
   //
   gST->ConOut->EnableCursor (gST->ConOut, FALSE);
 
-  if (GraphicsOutput != NULL) {
-    SizeOfX = GraphicsOutput->Mode->Info->HorizontalResolution;
-    SizeOfY = GraphicsOutput->Mode->Info->VerticalResolution;
-
-  } else {
-    ASSERT (UgaDraw != NULL);
-    Status = UgaDraw->GetMode (UgaDraw, &SizeOfX, &SizeOfY, &ColorDepth, &RefreshRate);
-    if (EFI_ERROR (Status)) {
-      return EFI_UNSUPPORTED;
-    }
-  }
+  SizeOfX = GraphicsOutput->Mode->Info->HorizontalResolution;
+  SizeOfY = GraphicsOutput->Mode->Info->VerticalResolution;
 
   Blt = NULL;
   NumberOfLogos = 0;
@@ -205,34 +181,18 @@ BootLogoEnableLogo (
     DestY += OffsetY;
 
     if ((DestX >= 0) && (DestY >= 0)) {
-      if (GraphicsOutput != NULL) {
-        Status = GraphicsOutput->Blt (
-                                   GraphicsOutput,
-                                   Blt,
-                                   EfiBltBufferToVideo,
-                                   0,
-                                   0,
-                                   (UINTN) DestX,
-                                   (UINTN) DestY,
-                                   Image.Width,
-                                   Image.Height,
-                                   Image.Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
-                                   );
-      } else {
-        ASSERT (UgaDraw != NULL);
-        Status = UgaDraw->Blt (
-                            UgaDraw,
-                            (EFI_UGA_PIXEL *) Blt,
-                            EfiUgaBltBufferToVideo,
-                            0,
-                            0,
-                            (UINTN) DestX,
-                            (UINTN) DestY,
-                            Image.Width,
-                            Image.Height,
-                            Image.Width * sizeof (EFI_UGA_PIXEL)
-                            );
-      }
+      Status = GraphicsOutput->Blt (
+                                 GraphicsOutput,
+                                 Blt,
+                                 EfiBltBufferToVideo,
+                                 0,
+                                 0,
+                                 (UINTN) DestX,
+                                 (UINTN) DestY,
+                                 Image.Width,
+                                 Image.Height,
+                                 Image.Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
+                                 );
 
       //
       // Report displayed Logo information.
@@ -305,33 +265,18 @@ BootLogoEnableLogo (
       return EFI_OUT_OF_RESOURCES;
     }
 
-    if (GraphicsOutput != NULL) {
-      Status = GraphicsOutput->Blt (
-                          GraphicsOutput,
-                          LogoBlt,
-                          EfiBltVideoToBltBuffer,
-                          LogoDestX,
-                          LogoDestY,
-                          0,
-                          0,
-                          LogoWidth,
-                          LogoHeight,
-                          LogoWidth * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
-                          );
-    } else {
-      Status = UgaDraw->Blt (
-                          UgaDraw,
-                          (EFI_UGA_PIXEL *) LogoBlt,
-                          EfiUgaVideoToBltBuffer,
-                          LogoDestX,
-                          LogoDestY,
-                          0,
-                          0,
-                          LogoWidth,
-                          LogoHeight,
-                          LogoWidth * sizeof (EFI_UGA_PIXEL)
-                          );
-    }
+    Status = GraphicsOutput->Blt (
+                        GraphicsOutput,
+                        LogoBlt,
+                        EfiBltVideoToBltBuffer,
+                        LogoDestX,
+                        LogoDestY,
+                        0,
+                        0,
+                        LogoWidth,
+                        LogoHeight,
+                        LogoWidth * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
+                        );
   }
 
   if (!EFI_ERROR (Status)) {
@@ -363,7 +308,7 @@ BootLogoEnableLogo (
   Use SystemTable Conout to turn on video based Simple Text Out consoles. The
   Simple Text Out screens will now be synced up with all non video output devices
 
-  @retval EFI_SUCCESS     UGA devices are back in text mode and synced up.
+  @retval EFI_SUCCESS     GOP devices are back in text mode and synced up.
 
 **/
 EFI_STATUS
@@ -408,11 +353,8 @@ BootLogoUpdateProgress (
 {
   EFI_STATUS                     Status;
   EFI_GRAPHICS_OUTPUT_PROTOCOL   *GraphicsOutput;
-  EFI_UGA_DRAW_PROTOCOL          *UgaDraw;
   UINT32                         SizeOfX;
   UINT32                         SizeOfY;
-  UINT32                         ColorDepth;
-  UINT32                         RefreshRate;
   EFI_GRAPHICS_OUTPUT_BLT_PIXEL  Color;
   UINTN                          BlockHeight;
   UINTN                          BlockWidth;
@@ -425,39 +367,13 @@ BootLogoUpdateProgress (
     return EFI_INVALID_PARAMETER;
   }
 
-  UgaDraw = NULL;
   Status = gBS->HandleProtocol (gST->ConsoleOutHandle, &gEfiGraphicsOutputProtocolGuid, (VOID **) &GraphicsOutput);
-  if (EFI_ERROR (Status) && FeaturePcdGet (PcdUgaConsumeSupport)) {
-    GraphicsOutput = NULL;
-
-    Status = gBS->HandleProtocol (gST->ConsoleOutHandle, &gEfiUgaDrawProtocolGuid, (VOID **) &UgaDraw);
-    if (EFI_ERROR (Status)) {
-      UgaDraw = NULL;
-    }
-  }
   if (EFI_ERROR (Status)) {
     return EFI_UNSUPPORTED;
   }
 
-  SizeOfX = 0;
-  SizeOfY = 0;
-  if (GraphicsOutput != NULL) {
-    SizeOfX = GraphicsOutput->Mode->Info->HorizontalResolution;
-    SizeOfY = GraphicsOutput->Mode->Info->VerticalResolution;
-  } else if (UgaDraw != NULL) {
-    Status = UgaDraw->GetMode (
-                        UgaDraw,
-                        &SizeOfX,
-                        &SizeOfY,
-                        &ColorDepth,
-                        &RefreshRate
-                        );
-    if (EFI_ERROR (Status)) {
-      return EFI_UNSUPPORTED;
-    }
-  } else {
-    return EFI_UNSUPPORTED;
-  }
+  SizeOfX = GraphicsOutput->Mode->Info->HorizontalResolution;
+  SizeOfY = GraphicsOutput->Mode->Info->VerticalResolution;
 
   BlockWidth  = SizeOfX / 100;
   BlockHeight = SizeOfY / 50;
@@ -473,70 +389,36 @@ BootLogoUpdateProgress (
     //
     SetMem (&Color, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0x0);
 
-    if (GraphicsOutput != NULL) {
-      Status = GraphicsOutput->Blt (
-                          GraphicsOutput,
-                          &Color,
-                          EfiBltVideoFill,
-                          0,
-                          0,
-                          0,
-                          PosY - EFI_GLYPH_HEIGHT - 1,
-                          SizeOfX,
-                          SizeOfY - (PosY - EFI_GLYPH_HEIGHT - 1),
-                          SizeOfX * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
-                          );
-    } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
-      Status = UgaDraw->Blt (
-                          UgaDraw,
-                          (EFI_UGA_PIXEL *) &Color,
-                          EfiUgaVideoFill,
-                          0,
-                          0,
-                          0,
-                          PosY - EFI_GLYPH_HEIGHT - 1,
-                          SizeOfX,
-                          SizeOfY - (PosY - EFI_GLYPH_HEIGHT - 1),
-                          SizeOfX * sizeof (EFI_UGA_PIXEL)
-                          );
-    } else {
-      return EFI_UNSUPPORTED;
-    }
+    Status = GraphicsOutput->Blt (
+                        GraphicsOutput,
+                        &Color,
+                        EfiBltVideoFill,
+                        0,
+                        0,
+                        0,
+                        PosY - EFI_GLYPH_HEIGHT - 1,
+                        SizeOfX,
+                        SizeOfY - (PosY - EFI_GLYPH_HEIGHT - 1),
+                        SizeOfX * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
+                        );
   }
   //
   // Show progress by drawing blocks
   //
   for (Index = PreviousValue; Index < BlockNum; Index++) {
     PosX = Index * BlockWidth;
-    if (GraphicsOutput != NULL) {
-      Status = GraphicsOutput->Blt (
-                          GraphicsOutput,
-                          &ProgressColor,
-                          EfiBltVideoFill,
-                          0,
-                          0,
-                          PosX,
-                          PosY,
-                          BlockWidth - 1,
-                          BlockHeight,
-                          (BlockWidth) * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
-                          );
-    } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
-      Status = UgaDraw->Blt (
-                          UgaDraw,
-                          (EFI_UGA_PIXEL *) &ProgressColor,
-                          EfiUgaVideoFill,
-                          0,
-                          0,
-                          PosX,
-                          PosY,
-                          BlockWidth - 1,
-                          BlockHeight,
-                          (BlockWidth) * sizeof (EFI_UGA_PIXEL)
-                          );
-    } else {
-      return EFI_UNSUPPORTED;
-    }
+    Status = GraphicsOutput->Blt (
+                        GraphicsOutput,
+                        &ProgressColor,
+                        EfiBltVideoFill,
+                        0,
+                        0,
+                        PosX,
+                        PosY,
+                        BlockWidth - 1,
+                        BlockHeight,
+                        (BlockWidth) * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
+                        );
   }
 
   PrintXY (
diff --git a/MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf b/MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
index 7d50f2dfa3ab..03fd70451bc6 100644
--- a/MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
+++ b/MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
@@ -42,11 +42,7 @@ [LibraryClasses]
 
 [Protocols]
   gEfiGraphicsOutputProtocolGuid                ## SOMETIMES_CONSUMES
-  gEfiUgaDrawProtocolGuid |PcdUgaConsumeSupport ## SOMETIMES_CONSUMES
   gEfiBootLogoProtocolGuid                      ## SOMETIMES_CONSUMES
   gEdkiiBootLogo2ProtocolGuid                   ## SOMETIMES_CONSUMES
   gEfiUserManagerProtocolGuid                   ## CONSUMES
   gEdkiiPlatformLogoProtocolGuid                ## CONSUMES
-
-[FeaturePcd]
-  gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport ## CONSUMES
-- 
2.25.1.windows.1


  parent reply	other threads:[~2020-05-08  8:38 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-08  8:38 [PATCH 00/18] Remove All UGA Support Guomin Jiang
2020-05-08  8:38 ` [PATCH 01/18] BaseTools: " Guomin Jiang
2020-05-09  1:47   ` [edk2-devel] " Ni, Ray
2020-05-08  8:38 ` [PATCH 02/18] UefiPayloadPkg: " Guomin Jiang
2020-05-08 14:57   ` Ma, Maurice
2020-05-08  8:38 ` [PATCH 03/18] ShellPkg: " Guomin Jiang
2020-05-08  8:38 ` Guomin Jiang [this message]
2020-05-08  8:38 ` [PATCH 05/18] MdeModulePkg/ConSplitterDxe: " Guomin Jiang
2020-05-08  8:38 ` [PATCH 06/18] MdeModulePkg/GraphicsConsoleDxe: " Guomin Jiang
2020-05-08  8:38 ` [PATCH 07/18] EmulatorPkg: " Guomin Jiang
2020-05-09  3:02   ` Ni, Ray
2020-05-08  8:38 ` [PATCH 08/18] OvmfPkg: " Guomin Jiang
2020-05-08  8:38 ` [PATCH 09/18] ArmPkg: " Guomin Jiang
2020-05-08  8:38 ` [PATCH 10/18] ArmVirtPkg: " Guomin Jiang
2020-05-08  8:38 ` [PATCH 11/18] MdePkg: " Guomin Jiang
2020-05-08  8:38 ` [PATCH 12/18] MdeModulePkg: " Guomin Jiang
2020-05-08  8:38 ` [PATCH 13/18] MdeModulePkg/ConSplitterDxe: " Guomin Jiang
2020-05-09  3:03   ` Ni, Ray
2020-05-08  8:38 ` [PATCH 14/18] " Guomin Jiang
2020-05-08  8:38 ` [PATCH 15/18] OvmfPkg: " Guomin Jiang
2020-05-08  8:38 ` [PATCH 16/18] UefiPayloadPkg: " Guomin Jiang
2020-05-08 14:58   ` Ma, Maurice
2020-05-08  8:38 ` [PATCH 17/18] ArmVirtPkg: " Guomin Jiang
2020-05-08  8:38 ` [PATCH 18/18] MdeModulePkg: " Guomin Jiang
2020-05-08 10:09 ` [edk2-devel] [PATCH 00/18] " Laszlo Ersek
2020-05-08 11:00   ` Ard Biesheuvel
2020-05-08 13:04     ` Guomin Jiang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200508083824.1785-5-guomin.jiang@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox