summaryrefslogtreecommitdiffstats
path: root/ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c
diff options
context:
space:
mode:
Diffstat (limited to 'ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c')
-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;