public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: Evan Lloyd <evan.lloyd@arm.com>
Cc: "edk2-devel@lists.01.org" <edk2-devel@lists.01.org>,
	<"ard.biesheuvel@linaro.org"@arm.com>,
	 <"leif.lindholm@linaro.org"@arm.com>,
	<"Matteo.Carlini@arm.com"@arm.com>,  <"nd@arm.com"@arm.com>
Subject: Re: [PATCH v2 09/13] ArmPlatformPkg: PCD to swap red/blue format for HDLCD
Date: Sat, 23 Dec 2017 13:34:21 +0000	[thread overview]
Message-ID: <CAKv+Gu8YYx1sJFdrQPggMuS8WgOKFgUDOS_ZK56js03SHWuqwA@mail.gmail.com> (raw)
In-Reply-To: <20171222183418.8616-10-evan.lloyd@arm.com>

On 22 December 2017 at 18:34,  <evan.lloyd@arm.com> wrote:
> From: Girish Pathak <girish.pathak at arm.com>
>
> This change adds a new PCD PcdArmHdlcdSwapBlueRedSelect
> to swap values for HDLCD RED_SELECT and BLUE_SELECT registers
> on platforms where blue and red hardware lines are swapped.
>
> If set to TRUE in the platform dsc, HDLCD library will swap the values
> while setting RED_SELECT and BLUE_SELECT registers. The default
> value of the PCD is FALSE.
>
> NOTE: The motive for this is that a discrepancy in the Red/Blue lines
> exists between some VersatileExpress platforms.  Rather than have
> divergent code, this build switch allows a simple, pragmatic solution.
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Girish Pathak <girish.pathak@arm.com>
> Signed-off-by: Evan Lloyd <evan.lloyd@arm.com>
> ---
>  ArmPlatformPkg/ArmPlatformPkg.dec      | 3 +++
>  ArmPlatformPkg/Library/HdLcd/HdLcd.inf | 2 ++
>  ArmPlatformPkg/Library/HdLcd/HdLcd.c   | 4 ++++
>  3 files changed, 9 insertions(+)
>
> diff --git a/ArmPlatformPkg/ArmPlatformPkg.dec b/ArmPlatformPkg/ArmPlatformPkg.dec
> index e412414e0ba6506c7158e69bac04469e45601736..9a61e4a511024c80e787500de5038779363f0d95 100644
> --- a/ArmPlatformPkg/ArmPlatformPkg.dec
> +++ b/ArmPlatformPkg/ArmPlatformPkg.dec
> @@ -104,6 +104,9 @@ [PcdsFixedAtBuild.common]
>    # Default is set to UEFI console font format PixelBlueGreenRedReserved8BitPerColor
>    gArmPlatformTokenSpaceGuid.PcdGopPixelFormat|0x00000001|UINT32|0x00000040
>
> +  ## If set, this will swap settings for HDLCD RED_SELECT and BLUE_SELECT registers
> +  gArmPlatformTokenSpaceGuid.PcdArmHdLcdSwapBlueRedSelect|FALSE|BOOLEAN|0x00000045
> +
>  [PcdsFixedAtBuild.common,PcdsDynamic.common]
>    ## PL031 RealTimeClock
>    gArmPlatformTokenSpaceGuid.PcdPL031RtcBase|0x0|UINT32|0x00000024
> diff --git a/ArmPlatformPkg/Library/HdLcd/HdLcd.inf b/ArmPlatformPkg/Library/HdLcd/HdLcd.inf
> index 67aad05d210b95b2d23b8e52e4392685efcf3795..0f440d1ef730159a8be3780667700979b607a1e2 100644
> --- a/ArmPlatformPkg/Library/HdLcd/HdLcd.inf
> +++ b/ArmPlatformPkg/Library/HdLcd/HdLcd.inf
> @@ -40,3 +40,5 @@ [LibraryClasses]
>
>  [FixedPcd]
>    gArmPlatformTokenSpaceGuid.PcdArmHdLcdBase
> +  gArmPlatformTokenSpaceGuid.PcdArmHdLcdSwapBlueRedSelect
> +
> diff --git a/ArmPlatformPkg/Library/HdLcd/HdLcd.c b/ArmPlatformPkg/Library/HdLcd/HdLcd.c
> index 72cd5fa33b2553195638c595e72843a56b2e267c..4f802977e8b55ed83364d3ec8fa46082e128c76b 100644
> --- a/ArmPlatformPkg/Library/HdLcd/HdLcd.c
> +++ b/ArmPlatformPkg/Library/HdLcd/HdLcd.c
> @@ -98,7 +98,11 @@ LcdSetMode (
>      return Status;
>    }
>
> +#if (!FixedPcdGetBool (PcdArmHdLcdSwapBlueRedSelect))
>    if (ModeInfo.PixelFormat == PixelBlueGreenRedReserved8BitPerColor) {
> +#else
> +  if (ModeInfo.PixelFormat == PixelRedGreenBlueReserved8BitPerColor) {
> +#endif

Please don't nest CPP and C conditionals like this. It is difficult to
follow, and results in poor build time coverage (the non-taken branch
at the CPP level is never seen by the compiler)

I suggest you use a variable for the RHS of the inner if, or find some
other way to get rid of the #if/#else/#endif

Thanks,
Ard.


>      MmioWrite32 (HDLCD_REG_RED_SELECT,  (8 << 8) | 16);
>      MmioWrite32 (HDLCD_REG_BLUE_SELECT, (8 << 8) | 0);
>    } else {
> --
> Guid("CE165669-3EF3-493F-B85D-6190EE5B9759")
>


  reply	other threads:[~2017-12-23 13:29 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-22 18:34 [PATCH v2 00/13] ArmPlatformPkg: Update GOP evan.lloyd
2017-12-22 18:34 ` [PATCH v2 01/13] ArmPlatformPkg: Tidy Lcd code: Coding standard evan.lloyd
2017-12-23 13:19   ` Ard Biesheuvel
2018-01-02 15:11     ` Evan Lloyd
2018-01-02 15:21       ` Ard Biesheuvel
2018-01-02 15:21         ` Ard Biesheuvel
2018-01-03 16:06         ` Evan Lloyd
2017-12-22 18:34 ` [PATCH v2 02/13] ArmPlatformPkg: Tidy Lcd code: Updated comments evan.lloyd
2017-12-22 18:34 ` [PATCH v2 03/13] ArmPlatformPkg: PL111 and HDLCD: add const qualifier evan.lloyd
2017-12-23 13:21   ` Ard Biesheuvel
2017-12-22 18:34 ` [PATCH v2 04/13] ArmPlatformPkg: HDLCD and PL111: Update debug ASSERTS evan.lloyd
2017-12-23 13:22   ` Ard Biesheuvel
2017-12-22 18:34 ` [PATCH v2 05/13] ArmPlatformPkg: PL111Lcd: Replace magic number with macro evan.lloyd
2017-12-23 13:24   ` Ard Biesheuvel
2017-12-22 18:34 ` [PATCH v2 06/13] ArmPlatformPkg: Implement LcdIdentify function for HDLCD GOP evan.lloyd
2017-12-23 13:24   ` Ard Biesheuvel
2017-12-22 18:34 ` [PATCH v2 07/13] ArmPlatformPkg: Redefine LcdPlatformGetTimings function evan.lloyd
2017-12-23 13:27   ` Ard Biesheuvel
2017-12-22 18:34 ` [PATCH v2 08/13] ArmPlatformPkg: Add PCD to select pixel format evan.lloyd
2017-12-23 13:29   ` Ard Biesheuvel
2017-12-22 18:34 ` [PATCH v2 09/13] ArmPlatformPkg: PCD to swap red/blue format for HDLCD evan.lloyd
2017-12-23 13:34   ` Ard Biesheuvel [this message]
2017-12-22 18:34 ` [PATCH v2 10/13] ArmPlatformPkg: Additional display modes evan.lloyd
2017-12-23 13:35   ` Ard Biesheuvel
2017-12-22 18:34 ` [PATCH v2 11/13] ArmPlatformPkg: Reserving framebuffer at build evan.lloyd
2017-12-23 13:36   ` Ard Biesheuvel
2017-12-22 18:34 ` [PATCH v2 12/13] ArmPlatformPkg: New DP500/DP550/DP650 GOP driver evan.lloyd
2017-12-23 13:44   ` Ard Biesheuvel
2017-12-22 18:34 ` [PATCH v2 13/13] ArmPlatformPkg: Introduce SCMI protocol evan.lloyd
2017-12-23 14:05   ` Ard Biesheuvel

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=CAKv+Gu8YYx1sJFdrQPggMuS8WgOKFgUDOS_ZK56js03SHWuqwA@mail.gmail.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