From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smarthost01b.sbp.mail.zen.net.uk (smarthost01b.sbp.mail.zen.net.uk [212.23.1.3]) by mx.groups.io with SMTP id smtpd.web11.146484.1671138709708500887 for ; Thu, 15 Dec 2022 13:11:50 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=permerror, err=parse error for token &{10 18 sdn.klaviyomail.com}: permanent DNS error (domain: starlabs.systems, ip: 212.23.1.3, mailfrom: sean@starlabs.systems) Received: from [217.155.46.38] (helo=starbook..) by smarthost01b.sbp.mail.zen.net.uk with esmtp (Exim 4.90_1) (envelope-from ) id 1p5vW3-0000SI-Hq; Thu, 15 Dec 2022 21:11:43 +0000 From: "Sean Rhodes" To: devel@edk2.groups.io Cc: Sean Rhodes , Zhichao Gao , Ray Ni , Jian J Wang , Liming Gao Subject: [PATCH] MdeModulePkg/Logo: Add a PCD to control the position of the Logo Date: Thu, 15 Dec 2022 21:11:40 +0000 Message-Id: <743801c30caf65019b4b4097c0ad1c03ba053238.1671138700.git.sean@starlabs.systems> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 X-Originating-smarthost01b-IP: [217.155.46.38] Feedback-ID: 217.155.46.38 Content-Transfer-Encoding: quoted-printable When set to true, the Logo is positioned according to the BGRT specification, 38.2% from the top of the screen. When set to false, no behaviour is changed and the logo is positioned centrally. Cc: Zhichao Gao Cc: Ray Ni Cc: Jian J Wang Cc: Liming Gao Signed-off-by: Sean Rhodes --- MdeModulePkg/Logo/Logo.c | 28 +++++++++++++++++++++++++++- MdeModulePkg/Logo/LogoDxe.inf | 4 ++++ MdeModulePkg/MdeModulePkg.dec | 6 ++++++ MdeModulePkg/MdeModulePkg.uni | 6 ++++++ 4 files changed, 43 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Logo/Logo.c b/MdeModulePkg/Logo/Logo.c index 8ab874d2da..48862d3207 100644 --- a/MdeModulePkg/Logo/Logo.c +++ b/MdeModulePkg/Logo/Logo.c @@ -13,6 +13,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include =0D #include =0D #include =0D +#include =0D =0D typedef struct {=0D EFI_IMAGE_ID ImageId;=0D @@ -51,12 +52,14 @@ GetImage ( IN EDKII_PLATFORM_LOGO_PROTOCOL *This,=0D IN OUT UINT32 *Instance,=0D OUT EFI_IMAGE_INPUT *Image,=0D + EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput,=0D OUT EDKII_PLATFORM_LOGO_DISPLAY_ATTRIBUTE *Attribute,=0D OUT INTN *OffsetX,=0D OUT INTN *OffsetY=0D )=0D {=0D - UINT32 Current;=0D + UINT32 Current;=0D + EFI_STATUS Status;=0D =0D if ((Instance =3D=3D NULL) || (Image =3D=3D NULL) ||=0D (Attribute =3D=3D NULL) || (OffsetX =3D=3D NULL) || (OffsetY =3D=3D = NULL))=0D @@ -69,6 +72,29 @@ GetImage ( return EFI_NOT_FOUND;=0D }=0D =0D + if (FixedPcdGetBool (PcdFollowMicrosoftRecommended)) {=0D + //=0D + // Get current video resolution and text mode=0D + //=0D + Status =3D gBS->HandleProtocol (=0D + gST->ConsoleOutHandle,=0D + &gEfiGraphicsOutputProtocolGuid,=0D + (VOID **)&GraphicsOutput=0D + );=0D + if (!EFI_ERROR (Status)) {=0D + //=0D + // Center of LOGO is in the vertical position 38.2% when PcdBootLogo= OnlyEnable is TRUE=0D + // Y =3D (VerticalResolution - LogoHeight) / 2=0D + // Y' =3D VerticalResolution * 0.382 - LogoHeight * 0.5=0D + // OffsetY + Y =3D Y'=0D + // OffsetY =3D Y' - Y =3D -0.118 * VerticalResolution=0D + //=0D + *Attribute =3D EdkiiPlatformLogoDisplayAttributeCenter;=0D + *OffsetX =3D 0;=0D + *OffsetY =3D -118 * (INTN)GraphicsOutput->Mode->Info->VerticalReso= lution / 1000;=0D + }=0D + }=0D +=0D (*Instance)++;=0D *Attribute =3D mLogos[Current].Attribute;=0D *OffsetX =3D mLogos[Current].OffsetX;=0D diff --git a/MdeModulePkg/Logo/LogoDxe.inf b/MdeModulePkg/Logo/LogoDxe.inf index 41215d25d8..ce29950089 100644 --- a/MdeModulePkg/Logo/LogoDxe.inf +++ b/MdeModulePkg/Logo/LogoDxe.inf @@ -41,6 +41,7 @@ UefiBootServicesTableLib=0D UefiDriverEntryPoint=0D DebugLib=0D + PcdLib=0D =0D [Protocols]=0D gEfiHiiDatabaseProtocolGuid ## CONSUMES=0D @@ -48,6 +49,9 @@ gEfiHiiPackageListProtocolGuid ## PRODUCES CONSUMES=0D gEdkiiPlatformLogoProtocolGuid ## PRODUCES=0D =0D +[Pcd]=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdFollowMicrosoftRecommended ## CONSUMES= =0D +=0D [Depex]=0D gEfiHiiDatabaseProtocolGuid AND=0D gEfiHiiImageExProtocolGuid=0D diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index be5e829ca9..c8bb51df3b 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -2102,6 +2102,12 @@ # @Prompt The shared bit mask when Intel Tdx is enabled.=0D gEfiMdeModulePkgTokenSpaceGuid.PcdTdxSharedBitMask|0x0|UINT64|0x10000025= =0D =0D + ## This PCD sets the position of the Boot Logo.=0D + # TRUE - The Logo is positioned following the recommendations from Mi= crosoft.=0D + # FALSE - The logo is positioned in the center of the screen.=0D + # @ Prompt This position of the boot logo=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdFollowMicrosoftRecommended|FALSE|BOOLE= AN|0x10000026=0D +=0D [PcdsPatchableInModule]=0D ## Specify memory size with page number for PEI code when=0D # Loading Module at Fixed Address feature is enabled.=0D diff --git a/MdeModulePkg/MdeModulePkg.uni b/MdeModulePkg/MdeModulePkg.uni index 33ce9f6198..09c1ac1cc1 100644 --- a/MdeModulePkg/MdeModulePkg.uni +++ b/MdeModulePkg/MdeModulePkg.uni @@ -1338,3 +1338,9 @@ #string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdPcieResizableBarSupport_HELP= #language en-US "Indicates if the PCIe Resizable BAR Capability Supported.=

\n"=0D = "TRUE - PCIe Resizable BAR Capability is supported.
\= n"=0D = "FALSE - PCIe Resizable BAR Capability is not supported.<= BR>"=0D +=0D +#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdFollowMicrosoftRecommended_P= ROMPT #language en-US "The position of the Boot Logo"=0D +=0D +#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdFollowMicrosoftRecommend_HEL= P #language en-US "Sets the position of the Logo. When set to true, the L= ogo is positioned following the recommendations"=0D + = " from Microsoft, 38.2% from the top of the screen."=0D +=0D --=20 2.37.2