summaryrefslogtreecommitdiffstats
path: root/ArmPlatformPkg/Library/PL111Lcd
diff options
context:
space:
mode:
authorGirish Pathak <girish.pathak at arm.com>2017-09-26 21:15:24 +0100
committerLeif Lindholm <leif.lindholm@linaro.org>2018-04-23 12:01:04 +0100
commitfe787dfb0f94669ce091f80601f2e654eff5728f (patch)
tree08b9ac7f2cf81c2fe34bd0e0491084c010cb947a /ArmPlatformPkg/Library/PL111Lcd
parent262c88461b6bf6fab2b13cef9421fbd777357ac3 (diff)
downloadedk2-fe787dfb0f94669ce091f80601f2e654eff5728f.tar.gz
edk2-fe787dfb0f94669ce091f80601f2e654eff5728f.tar.bz2
edk2-fe787dfb0f94669ce091f80601f2e654eff5728f.zip
ArmPlatformPkg: Add PCD to select pixel format
Current HDLCD and PL111 platform libraries do not support display modes with PixelBlueGreenRedReserved8BitPerColor format, i.e. because of historical confusion, they do not support the UEFI default PixelBlueGreenRedReserved8BitPerColor format In LcdPlatformLib for PL111, LcdPlatformQueryMode returns the pixel format as PixelRedGreenBlueReserved8BitPerColor which is wrong, because that does not match the display controller's pixel format which is set to BGR in PL111Lcd LcdHwLib. Also it is not possible to configure pixel format as RGB/BGR for the display modes for a platform at build time. This change adds PcdGopPixelFormat to configure pixel format as PixelRedGreenBlueReserved8BitPerColor or PixelBlueGreenRedReserved8BitPerColor or PixelBitMask. With this change, pixel format can be selected in the platform specific .dsc file for all supported display modes. Support for PixelBitMask is not implemented in PL111 or HDLCD LcdHwLib libraries, hence HDLCD and PL111 platform libraries will return error EFI_UNSUPPORTED if PcdGopPixelFormat is set to PixelBitMask. Indeed, it is not clear what selecting PixelBitMask might mean, but the option is allowed as it might suit a custom platform. 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> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Diffstat (limited to 'ArmPlatformPkg/Library/PL111Lcd')
-rw-r--r--ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c b/ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c
index c9e2736911..0496376fff 100644
--- a/ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c
+++ b/ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c
@@ -76,7 +76,6 @@ LcdInitialize (
@retval EFI_SUCCESS Display mode set successfuly.
@retval !(EFI_SUCCESS) Other errors.
-
**/
EFI_STATUS
LcdSetMode (
@@ -89,6 +88,8 @@ LcdSetMode (
UINT32 LcdControl;
LCD_BPP LcdBpp;
+ EFI_GRAPHICS_OUTPUT_MODE_INFORMATION ModeInfo;
+
// Set the video mode timings and other relevant information
Status = LcdPlatformGetTimings (
ModeNumber,
@@ -109,6 +110,13 @@ LcdSetMode (
return Status;
}
+ // Get the pixel format information
+ Status = LcdPlatformQueryMode (ModeNumber, &ModeInfo);
+ if (EFI_ERROR (Status)) {
+ ASSERT_EFI_ERROR (Status);
+ return Status;
+ }
+
// Disable the CLCD_LcdEn bit
MmioAnd32 (PL111_REG_LCD_CONTROL, ~PL111_CTRL_LCD_EN);
@@ -142,7 +150,10 @@ LcdSetMode (
// PL111_REG_LCD_CONTROL
LcdControl = PL111_CTRL_LCD_EN | PL111_CTRL_LCD_BPP (LcdBpp) |
- PL111_CTRL_LCD_TFT | PL111_CTRL_LCD_PWR | PL111_CTRL_BGR;
+ PL111_CTRL_LCD_TFT | PL111_CTRL_LCD_PWR;
+ if (ModeInfo.PixelFormat == PixelBlueGreenRedReserved8BitPerColor) {
+ LcdControl |= PL111_CTRL_BGR;
+ }
MmioWrite32 (PL111_REG_LCD_CONTROL, LcdControl);
return EFI_SUCCESS;