diff options
author | Girish Pathak <girish.pathak at arm.com> | 2017-09-26 21:15:22 +0100 |
---|---|---|
committer | Leif Lindholm <leif.lindholm@linaro.org> | 2018-04-23 12:00:57 +0100 |
commit | 262c88461b6bf6fab2b13cef9421fbd777357ac3 (patch) | |
tree | 7a2984576a6fa09f6bd967ceb5913956681c5c3d /ArmPlatformPkg/Library | |
parent | c18ef81e79c2beccc5738e564fb56f1b78d2d5fc (diff) | |
download | edk2-262c88461b6bf6fab2b13cef9421fbd777357ac3.tar.gz edk2-262c88461b6bf6fab2b13cef9421fbd777357ac3.tar.bz2 edk2-262c88461b6bf6fab2b13cef9421fbd777357ac3.zip |
ArmPlatformPkg: Redefine LcdPlatformGetTimings function
The LcdPlatformGetTimings interface function takes similar sets of
multiple parameters for horizontal and vertical timings which can be
aggregated in a common data type. This change defines a structure
SCAN_TIMINGS for this which can be used to describe both horizontal and
vertical scan timings, and accordingly redefines the
LcdPlatformGetTiming interface, greatly reducing the amount of data
passed about.
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')
-rw-r--r-- | ArmPlatformPkg/Library/HdLcd/HdLcd.c | 50 | ||||
-rw-r--r-- | ArmPlatformPkg/Library/LcdPlatformNullLib/LcdPlatformNullLib.c | 10 | ||||
-rw-r--r-- | ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c | 43 |
3 files changed, 49 insertions, 54 deletions
diff --git a/ArmPlatformPkg/Library/HdLcd/HdLcd.c b/ArmPlatformPkg/Library/HdLcd/HdLcd.c index 039048398c..f5886848ce 100644 --- a/ArmPlatformPkg/Library/HdLcd/HdLcd.c +++ b/ArmPlatformPkg/Library/HdLcd/HdLcd.c @@ -98,34 +98,25 @@ LcdSetMode ( )
{
EFI_STATUS Status;
- UINT32 HRes;
- UINT32 HSync;
- UINT32 HBackPorch;
- UINT32 HFrontPorch;
- UINT32 VRes;
- UINT32 VSync;
- UINT32 VBackPorch;
- UINT32 VFrontPorch;
+ SCAN_TIMINGS *Horizontal;
+ SCAN_TIMINGS *Vertical;
UINT32 BytesPerPixel;
LCD_BPP LcdBpp;
// Set the video mode timings and other relevant information
Status = LcdPlatformGetTimings (
ModeNumber,
- &HRes,
- &HSync,
- &HBackPorch,
- &HFrontPorch,
- &VRes,
- &VSync,
- &VBackPorch,
- &VFrontPorch
+ &Horizontal,
+ &Vertical
);
if (EFI_ERROR (Status)) {
ASSERT_EFI_ERROR (Status);
return Status;
}
+ ASSERT (Horizontal != NULL);
+ ASSERT (Vertical != NULL);
+
Status = LcdPlatformGetBpp (ModeNumber, &LcdBpp);
if (EFI_ERROR (Status)) {
ASSERT_EFI_ERROR (Status);
@@ -138,21 +129,26 @@ LcdSetMode ( MmioWrite32 (HDLCD_REG_COMMAND, HDLCD_DISABLE);
// Update the frame buffer information with the new settings
- MmioWrite32 (HDLCD_REG_FB_LINE_LENGTH, HRes * BytesPerPixel);
- MmioWrite32 (HDLCD_REG_FB_LINE_PITCH, HRes * BytesPerPixel);
- MmioWrite32 (HDLCD_REG_FB_LINE_COUNT, VRes - 1);
+ MmioWrite32 (
+ HDLCD_REG_FB_LINE_LENGTH,
+ Horizontal->Resolution * BytesPerPixel
+ );
+
+ MmioWrite32 (HDLCD_REG_FB_LINE_PITCH, Horizontal->Resolution * BytesPerPixel);
+
+ MmioWrite32 (HDLCD_REG_FB_LINE_COUNT, Vertical->Resolution - 1);
// Set the vertical timing information
- MmioWrite32 (HDLCD_REG_V_SYNC, VSync);
- MmioWrite32 (HDLCD_REG_V_BACK_PORCH, VBackPorch);
- MmioWrite32 (HDLCD_REG_V_DATA, VRes - 1);
- MmioWrite32 (HDLCD_REG_V_FRONT_PORCH, VFrontPorch);
+ MmioWrite32 (HDLCD_REG_V_SYNC, Vertical->Sync);
+ MmioWrite32 (HDLCD_REG_V_BACK_PORCH, Vertical->BackPorch);
+ MmioWrite32 (HDLCD_REG_V_DATA, Vertical->Resolution - 1);
+ MmioWrite32 (HDLCD_REG_V_FRONT_PORCH, Vertical->FrontPorch);
// Set the horizontal timing information
- MmioWrite32 (HDLCD_REG_H_SYNC, HSync);
- MmioWrite32 (HDLCD_REG_H_BACK_PORCH, HBackPorch);
- MmioWrite32 (HDLCD_REG_H_DATA, HRes - 1);
- MmioWrite32 (HDLCD_REG_H_FRONT_PORCH, HFrontPorch);
+ MmioWrite32 (HDLCD_REG_H_SYNC, Horizontal->Sync);
+ MmioWrite32 (HDLCD_REG_H_BACK_PORCH, Horizontal->BackPorch);
+ MmioWrite32 (HDLCD_REG_H_DATA, Horizontal->Resolution - 1);
+ MmioWrite32 (HDLCD_REG_H_FRONT_PORCH, Horizontal->FrontPorch);
// Enable the controller
MmioWrite32 (HDLCD_REG_COMMAND, HDLCD_ENABLE);
diff --git a/ArmPlatformPkg/Library/LcdPlatformNullLib/LcdPlatformNullLib.c b/ArmPlatformPkg/Library/LcdPlatformNullLib/LcdPlatformNullLib.c index b76894c534..492edd1ba2 100644 --- a/ArmPlatformPkg/Library/LcdPlatformNullLib/LcdPlatformNullLib.c +++ b/ArmPlatformPkg/Library/LcdPlatformNullLib/LcdPlatformNullLib.c @@ -123,14 +123,8 @@ LcdPlatformQueryMode ( EFI_STATUS
LcdPlatformGetTimings (
IN UINT32 ModeNumber,
- OUT UINT32* HRes,
- OUT UINT32* HSync,
- OUT UINT32* HBackPorch,
- OUT UINT32* HFrontPorch,
- OUT UINT32* VRes,
- OUT UINT32* VSync,
- OUT UINT32* VBackPorch,
- OUT UINT32* VFrontPorch
+ OUT SCAN_TIMINGS **Horizontal,
+ OUT SCAN_TIMINGS **Vertical
)
{
ASSERT (FALSE);
diff --git a/ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c b/ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c index 465cb68454..c9e2736911 100644 --- a/ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c +++ b/ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c @@ -84,34 +84,25 @@ LcdSetMode ( )
{
EFI_STATUS Status;
- UINT32 HRes;
- UINT32 HSync;
- UINT32 HBackPorch;
- UINT32 HFrontPorch;
- UINT32 VRes;
- UINT32 VSync;
- UINT32 VBackPorch;
- UINT32 VFrontPorch;
+ SCAN_TIMINGS *Horizontal;
+ SCAN_TIMINGS *Vertical;
UINT32 LcdControl;
LCD_BPP LcdBpp;
// Set the video mode timings and other relevant information
Status = LcdPlatformGetTimings (
ModeNumber,
- &HRes,
- &HSync,
- &HBackPorch,
- &HFrontPorch,
- &VRes,
- &VSync,
- &VBackPorch,
- &VFrontPorch
+ &Horizontal,
+ &Vertical
);
if (EFI_ERROR (Status)) {
ASSERT_EFI_ERROR (Status);
return Status;
}
+ ASSERT (Horizontal != NULL);
+ ASSERT (Vertical != NULL);
+
Status = LcdPlatformGetBpp (ModeNumber, &LcdBpp);
if (EFI_ERROR (Status)) {
ASSERT_EFI_ERROR (Status);
@@ -124,15 +115,29 @@ LcdSetMode ( // Set Timings
MmioWrite32 (
PL111_REG_LCD_TIMING_0,
- HOR_AXIS_PANEL (HBackPorch, HFrontPorch, HSync, HRes)
+ HOR_AXIS_PANEL (
+ Horizontal->BackPorch,
+ Horizontal->FrontPorch,
+ Horizontal->Sync,
+ Horizontal->Resolution
+ )
);
MmioWrite32 (
PL111_REG_LCD_TIMING_1,
- VER_AXIS_PANEL (VBackPorch, VFrontPorch, VSync, VRes)
+ VER_AXIS_PANEL (
+ Vertical->BackPorch,
+ Vertical->FrontPorch,
+ Vertical->Sync,
+ Vertical->Resolution
+ )
+ );
+
+ MmioWrite32 (
+ PL111_REG_LCD_TIMING_2,
+ CLK_SIG_POLARITY (Horizontal->Resolution)
);
- MmioWrite32 (PL111_REG_LCD_TIMING_2, CLK_SIG_POLARITY (HRes));
MmioWrite32 (PL111_REG_LCD_TIMING_3, 0);
// PL111_REG_LCD_CONTROL
|