[edk2-devel] [PATCH] MdeModulePkg/Logo: Add a PCD to control the position of the Logo

Sheng Lean Tan sheng.tan at 9elements.com
Mon Mar 6 09:56:59 UTC 2023


This patch has been pending for ages, can someone help to review?
Thank you.
Best Regards,
*Lean Sheng Tan*



9elements GmbH, Kortumstraße 19-21, 44787 Bochum, Germany
Email: sheng.tan at 9elements.com
Phone: *+49 234 68 94 188 <+492346894188>*
Mobile: *+49 176 76 113842 <+4917676113842>*

Registered office: Bochum
Commercial register: Amtsgericht Bochum, HRB 17519
Management: Sebastian German, Eray Bazaar

Data protection information according to Art. 13 GDPR
<https://9elements.com/privacy>


On Fri, 17 Feb 2023 at 13:59, Sheng Lean Tan via groups.io <sheng.tan=
9elements.com at groups.io> wrote:

> Hi all,
> Could you help to review this? thanks.
>
> Best Regards,
> *Lean Sheng Tan*
>
>
>
> 9elements GmbH, Kortumstraße 19-21, 44787 Bochum, Germany
> Email: sheng.tan at 9elements.com
> Phone: *+49 234 68 94 188 <+492346894188>*
> Mobile: *+49 176 76 113842 <+4917676113842>*
>
> Registered office: Bochum
> Commercial register: Amtsgericht Bochum, HRB 17519
> Management: Sebastian German, Eray Bazaar
>
> Data protection information according to Art. 13 GDPR
> <https://9elements.com/privacy>
>
>
> On Wed, 21 Dec 2022 at 09:20, Sean Rhodes <sean at starlabs.systems> wrote:
>
>> 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 <zhichao.gao at intel.com>
>> Cc: Ray Ni <ray.ni at intel.com>
>> Cc: Jian J Wang <jian.j.wang at intel.com>
>> Cc: Liming Gao <gaoliming at byosoft.com.cn>
>> Signed-off-by: Sean Rhodes <sean at starlabs.systems>
>> ---
>>  MdeModulePkg/MdeModulePkg.dec |  6 ++++++
>>  MdeModulePkg/Logo/LogoDxe.inf |  4 ++++
>>  MdeModulePkg/Logo/Logo.c      | 28 +++++++++++++++++++++++++++-
>>  MdeModulePkg/MdeModulePkg.uni |  6 ++++++
>>  4 files changed, 43 insertions(+), 1 deletion(-)
>>
>> 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 @@ [PcdsFixedAtBuild, PcdsPatchableInModule,
>> PcdsDynamic, PcdsDynamicEx]
>>    # @Prompt The shared bit mask when Intel Tdx is enabled.
>>
>>  gEfiMdeModulePkgTokenSpaceGuid.PcdTdxSharedBitMask|0x0|UINT64|0x10000025
>>
>> +  ## This PCD sets the position of the Boot Logo.
>> +  #   TRUE  - The Logo is positioned following the recommendations from
>> Microsoft.
>> +  #   FALSE - The logo is positioned in the center of the screen.
>> +  # @ Prompt This position of the boot logo
>> +
>> gEfiMdeModulePkgTokenSpaceGuid.PcdFollowMicrosoftRecommended|FALSE|BOOLEAN|0x10000026
>> +
>>  [PcdsPatchableInModule]
>>    ## Specify memory size with page number for PEI code when
>>    #  Loading Module at Fixed Address feature is enabled.
>> 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 @@ [LibraryClasses]
>>    UefiBootServicesTableLib
>>    UefiDriverEntryPoint
>>    DebugLib
>> +  PcdLib
>>
>>  [Protocols]
>>    gEfiHiiDatabaseProtocolGuid        ## CONSUMES
>> @@ -48,6 +49,9 @@ [Protocols]
>>    gEfiHiiPackageListProtocolGuid     ## PRODUCES CONSUMES
>>    gEdkiiPlatformLogoProtocolGuid     ## PRODUCES
>>
>> +[Pcd]
>> +  gEfiMdeModulePkgTokenSpaceGuid.PcdFollowMicrosoftRecommended ##
>> CONSUMES
>> +
>>  [Depex]
>>    gEfiHiiDatabaseProtocolGuid AND
>>    gEfiHiiImageExProtocolGuid
>> diff --git a/MdeModulePkg/Logo/Logo.c b/MdeModulePkg/Logo/Logo.c
>> index 8ab874d2da..96e34b2011 100644
>> --- a/MdeModulePkg/Logo/Logo.c
>> +++ b/MdeModulePkg/Logo/Logo.c
>> @@ -13,6 +13,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>>  #include <Protocol/HiiPackageList.h>
>>  #include <Library/UefiBootServicesTableLib.h>
>>  #include <Library/DebugLib.h>
>> +#include <Library/PcdLib.h>
>>
>>  typedef struct {
>>    EFI_IMAGE_ID                             ImageId;
>> @@ -51,12 +52,14 @@ GetImage (
>>    IN     EDKII_PLATFORM_LOGO_PROTOCOL        *This,
>>    IN OUT UINT32                              *Instance,
>>    OUT EFI_IMAGE_INPUT                        *Image,
>> +  EFI_GRAPHICS_OUTPUT_PROTOCOL               *GraphicsOutput,
>>    OUT EDKII_PLATFORM_LOGO_DISPLAY_ATTRIBUTE  *Attribute,
>>    OUT INTN                                   *OffsetX,
>>    OUT INTN                                   *OffsetY
>>    )
>>  {
>> -  UINT32  Current;
>> +  UINT32      Current;
>> +  EFI_STATUS  Status;
>>
>>    if ((Instance == NULL) || (Image == NULL) ||
>>        (Attribute == NULL) || (OffsetX == NULL) || (OffsetY == NULL))
>> @@ -69,6 +72,29 @@ GetImage (
>>      return EFI_NOT_FOUND;
>>    }
>>
>> +  if (PcdGetBool (PcdFollowMicrosoftRecommended)) {
>> +    //
>> +    // Get current video resolution and text mode
>> +    //
>> +    Status = gBS->HandleProtocol (
>> +                    gST->ConsoleOutHandle,
>> +                    &gEfiGraphicsOutputProtocolGuid,
>> +                    (VOID **)&GraphicsOutput
>> +                    );
>> +    if (!EFI_ERROR (Status)) {
>> +      //
>> +      // Center of LOGO is in the vertical position 38.2% when
>> PcdBootLogoOnlyEnable is TRUE
>> +      // Y = (VerticalResolution - LogoHeight) / 2
>> +      // Y' = VerticalResolution * 0.382 - LogoHeight * 0.5
>> +      // OffsetY + Y = Y'
>> +      // OffsetY = Y' - Y = -0.118 * VerticalResolution
>> +      //
>> +      *Attribute = EdkiiPlatformLogoDisplayAttributeCenter;
>> +      *OffsetX   = 0;
>> +      *OffsetY   = -118 *
>> (INTN)GraphicsOutput->Mode->Info->VerticalResolution / 1000;
>> +    }
>> +  }
>> +
>>    (*Instance)++;
>>    *Attribute = mLogos[Current].Attribute;
>>    *OffsetX   = mLogos[Current].OffsetX;
>> 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.<BR><BR>\n"
>>
>>                    "TRUE  - PCIe Resizable BAR Capability is
>> supported.<BR>\n"
>>
>>                    "FALSE - PCIe Resizable BAR Capability is not
>> supported.<BR>"
>> +
>> +#string
>> STR_gEfiMdeModulePkgTokenSpaceGuid_PcdFollowMicrosoftRecommended_PROMPT
>> #language en-US "The position of the Boot Logo"
>> +
>> +#string
>> STR_gEfiMdeModulePkgTokenSpaceGuid_PcdFollowMicrosoftRecommend_HELP
>>  #language en-US "Sets the position of the Logo. When set to true, the Logo
>> is positioned following the recommendations"
>> +
>>                      " from Microsoft, 38.2% from the top of the screen."
>> +
>> --
>> 2.37.2
>>
>>
>>
>> ------------
>> Groups.io Links: You receive all messages sent to this group.
>> View/Reply Online (#97684): https://edk2.groups.io/g/devel/message/97684
>> Mute This Topic: https://groups.io/mt/95802829/6757431
>> Group Owner: devel+owner at edk2.groups.io
>> Unsubscribe: https://edk2.groups.io/g/devel/unsub [
>> sheng.tan at 9elements.com]
>> ------------
>>
>>
>> 
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#100724): https://edk2.groups.io/g/devel/message/100724
Mute This Topic: https://groups.io/mt/95802829/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/edk2-devel-archive/attachments/20230306/c6bf7cd0/attachment-0001.htm>


More information about the edk2-devel-archive mailing list