]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPlatformPkg: Redefine LcdPlatformGetTimings function
authorGirish Pathak <girish.pathak at arm.com>
Tue, 26 Sep 2017 20:15:22 +0000 (21:15 +0100)
committerLeif Lindholm <leif.lindholm@linaro.org>
Mon, 23 Apr 2018 11:00:57 +0000 (12:00 +0100)
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>
ArmPlatformPkg/Include/Library/LcdPlatformLib.h
ArmPlatformPkg/Library/HdLcd/HdLcd.c
ArmPlatformPkg/Library/LcdPlatformNullLib/LcdPlatformNullLib.c
ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c

index e51e78640ae7b1acd51ac333ba3faa8c78aea5a5..8338b327fd2dd0d6b31653e278e25da5ac850939 100644 (file)
@@ -153,6 +153,14 @@ typedef enum {
   LCD_BITS_PER_PIXEL_12_444\r
 } LCD_BPP;\r
 \r
   LCD_BITS_PER_PIXEL_12_444\r
 } LCD_BPP;\r
 \r
+// Display timing settings.\r
+typedef struct {\r
+  UINT32                      Resolution;\r
+  UINT32                      Sync;\r
+  UINT32                      BackPorch;\r
+  UINT32                      FrontPorch;\r
+} SCAN_TIMINGS;\r
+\r
 /** Platform related initialization function.\r
 \r
   @param[in] Handle              Handle to the LCD device instance.\r
 /** Platform related initialization function.\r
 \r
   @param[in] Handle              Handle to the LCD device instance.\r
@@ -228,14 +236,11 @@ LcdPlatformQueryMode (
 \r
   @param[in]  ModeNumber          Mode Number.\r
 \r
 \r
   @param[in]  ModeNumber          Mode Number.\r
 \r
-  @param[out] HRes                Pointer to horizontal resolution.\r
-  @param[out] HSync               Pointer to horizontal sync width.\r
-  @param[out] HBackPorch          Pointer to horizontal back porch.\r
-  @param[out] HFrontPorch         Pointer to horizontal front porch.\r
-  @param[out] VRes                Pointer to vertical resolution.\r
-  @param[out] VSync               Pointer to vertical sync width.\r
-  @param[out] VBackPorch          Pointer to vertical back porch.\r
-  @param[out] VFrontPorch         Pointer to vertical front porch.\r
+  @param[out] Horizontal          Pointer to horizontal timing parameters.\r
+                                  (Resolution, Sync, Back porch, Front porch)\r
+  @param[out] Vertical            Pointer to vertical timing parameters.\r
+                                  (Resolution, Sync, Back porch, Front porch)\r
+\r
 \r
   @retval EFI_SUCCESS             Display timing information for the requested\r
                                   mode returned successfully.\r
 \r
   @retval EFI_SUCCESS             Display timing information for the requested\r
                                   mode returned successfully.\r
@@ -244,14 +249,8 @@ LcdPlatformQueryMode (
 EFI_STATUS\r
 LcdPlatformGetTimings (\r
   IN  UINT32                              ModeNumber,\r
 EFI_STATUS\r
 LcdPlatformGetTimings (\r
   IN  UINT32                              ModeNumber,\r
-  OUT UINT32*                             HRes,\r
-  OUT UINT32*                             HSync,\r
-  OUT UINT32*                             HBackPorch,\r
-  OUT UINT32*                             HFrontPorch,\r
-  OUT UINT32*                             VRes,\r
-  OUT UINT32*                             VSync,\r
-  OUT UINT32*                             VBackPorch,\r
-  OUT UINT32*                             VFrontPorch\r
+  OUT SCAN_TIMINGS                        **Horizontal,\r
+  OUT SCAN_TIMINGS                        **Vertical\r
   );\r
 \r
 /** Return bits per pixel information for a mode number.\r
   );\r
 \r
 /** Return bits per pixel information for a mode number.\r
index 039048398c531ec944bc4b43a5551a554a368481..f5886848ce582b475b597ccca015c816707ade0e 100644 (file)
@@ -98,34 +98,25 @@ LcdSetMode (
   )\r
 {\r
   EFI_STATUS        Status;\r
   )\r
 {\r
   EFI_STATUS        Status;\r
-  UINT32            HRes;\r
-  UINT32            HSync;\r
-  UINT32            HBackPorch;\r
-  UINT32            HFrontPorch;\r
-  UINT32            VRes;\r
-  UINT32            VSync;\r
-  UINT32            VBackPorch;\r
-  UINT32            VFrontPorch;\r
+  SCAN_TIMINGS      *Horizontal;\r
+  SCAN_TIMINGS      *Vertical;\r
   UINT32            BytesPerPixel;\r
   LCD_BPP           LcdBpp;\r
 \r
   // Set the video mode timings and other relevant information\r
   Status = LcdPlatformGetTimings (\r
              ModeNumber,\r
   UINT32            BytesPerPixel;\r
   LCD_BPP           LcdBpp;\r
 \r
   // Set the video mode timings and other relevant information\r
   Status = LcdPlatformGetTimings (\r
              ModeNumber,\r
-             &HRes,\r
-             &HSync,\r
-             &HBackPorch,\r
-             &HFrontPorch,\r
-             &VRes,\r
-             &VSync,\r
-             &VBackPorch,\r
-             &VFrontPorch\r
+             &Horizontal,\r
+             &Vertical\r
              );\r
   if (EFI_ERROR (Status)) {\r
     ASSERT_EFI_ERROR (Status);\r
     return Status;\r
   }\r
 \r
              );\r
   if (EFI_ERROR (Status)) {\r
     ASSERT_EFI_ERROR (Status);\r
     return Status;\r
   }\r
 \r
+  ASSERT (Horizontal != NULL);\r
+  ASSERT (Vertical != NULL);\r
+\r
   Status = LcdPlatformGetBpp (ModeNumber, &LcdBpp);\r
   if (EFI_ERROR (Status)) {\r
     ASSERT_EFI_ERROR (Status);\r
   Status = LcdPlatformGetBpp (ModeNumber, &LcdBpp);\r
   if (EFI_ERROR (Status)) {\r
     ASSERT_EFI_ERROR (Status);\r
@@ -138,21 +129,26 @@ LcdSetMode (
   MmioWrite32 (HDLCD_REG_COMMAND, HDLCD_DISABLE);\r
 \r
   // Update the frame buffer information with the new settings\r
   MmioWrite32 (HDLCD_REG_COMMAND, HDLCD_DISABLE);\r
 \r
   // Update the frame buffer information with the new settings\r
-  MmioWrite32 (HDLCD_REG_FB_LINE_LENGTH, HRes * BytesPerPixel);\r
-  MmioWrite32 (HDLCD_REG_FB_LINE_PITCH,  HRes * BytesPerPixel);\r
-  MmioWrite32 (HDLCD_REG_FB_LINE_COUNT,  VRes - 1);\r
+  MmioWrite32 (\r
+    HDLCD_REG_FB_LINE_LENGTH,\r
+    Horizontal->Resolution * BytesPerPixel\r
+    );\r
+\r
+  MmioWrite32 (HDLCD_REG_FB_LINE_PITCH, Horizontal->Resolution * BytesPerPixel);\r
+\r
+  MmioWrite32 (HDLCD_REG_FB_LINE_COUNT, Vertical->Resolution - 1);\r
 \r
   // Set the vertical timing information\r
 \r
   // Set the vertical timing information\r
-  MmioWrite32 (HDLCD_REG_V_SYNC,         VSync);\r
-  MmioWrite32 (HDLCD_REG_V_BACK_PORCH,   VBackPorch);\r
-  MmioWrite32 (HDLCD_REG_V_DATA,         VRes - 1);\r
-  MmioWrite32 (HDLCD_REG_V_FRONT_PORCH,  VFrontPorch);\r
+  MmioWrite32 (HDLCD_REG_V_SYNC,        Vertical->Sync);\r
+  MmioWrite32 (HDLCD_REG_V_BACK_PORCH,  Vertical->BackPorch);\r
+  MmioWrite32 (HDLCD_REG_V_DATA,        Vertical->Resolution - 1);\r
+  MmioWrite32 (HDLCD_REG_V_FRONT_PORCH, Vertical->FrontPorch);\r
 \r
   // Set the horizontal timing information\r
 \r
   // Set the horizontal timing information\r
-  MmioWrite32 (HDLCD_REG_H_SYNC,         HSync);\r
-  MmioWrite32 (HDLCD_REG_H_BACK_PORCH,   HBackPorch);\r
-  MmioWrite32 (HDLCD_REG_H_DATA,         HRes - 1);\r
-  MmioWrite32 (HDLCD_REG_H_FRONT_PORCH,  HFrontPorch);\r
+  MmioWrite32 (HDLCD_REG_H_SYNC,        Horizontal->Sync);\r
+  MmioWrite32 (HDLCD_REG_H_BACK_PORCH,  Horizontal->BackPorch);\r
+  MmioWrite32 (HDLCD_REG_H_DATA,        Horizontal->Resolution - 1);\r
+  MmioWrite32 (HDLCD_REG_H_FRONT_PORCH, Horizontal->FrontPorch);\r
 \r
   // Enable the controller\r
   MmioWrite32 (HDLCD_REG_COMMAND, HDLCD_ENABLE);\r
 \r
   // Enable the controller\r
   MmioWrite32 (HDLCD_REG_COMMAND, HDLCD_ENABLE);\r
index b76894c534fb413d87c77c528f0bb7d49862c78f..492edd1ba2e57158c21920d6df11eed5673649c1 100644 (file)
@@ -123,14 +123,8 @@ LcdPlatformQueryMode (
 EFI_STATUS\r
 LcdPlatformGetTimings (\r
   IN  UINT32                              ModeNumber,\r
 EFI_STATUS\r
 LcdPlatformGetTimings (\r
   IN  UINT32                              ModeNumber,\r
-  OUT UINT32*                             HRes,\r
-  OUT UINT32*                             HSync,\r
-  OUT UINT32*                             HBackPorch,\r
-  OUT UINT32*                             HFrontPorch,\r
-  OUT UINT32*                             VRes,\r
-  OUT UINT32*                             VSync,\r
-  OUT UINT32*                             VBackPorch,\r
-  OUT UINT32*                             VFrontPorch\r
+  OUT SCAN_TIMINGS                        **Horizontal,\r
+  OUT SCAN_TIMINGS                        **Vertical\r
   )\r
 {\r
   ASSERT (FALSE);\r
   )\r
 {\r
   ASSERT (FALSE);\r
index 465cb6845437f57d15f05a271d1b01f634e11b56..c9e2736911881fc36b51562b9259b7bccf30747d 100644 (file)
@@ -84,34 +84,25 @@ LcdSetMode (
   )\r
 {\r
   EFI_STATUS        Status;\r
   )\r
 {\r
   EFI_STATUS        Status;\r
-  UINT32            HRes;\r
-  UINT32            HSync;\r
-  UINT32            HBackPorch;\r
-  UINT32            HFrontPorch;\r
-  UINT32            VRes;\r
-  UINT32            VSync;\r
-  UINT32            VBackPorch;\r
-  UINT32            VFrontPorch;\r
+  SCAN_TIMINGS      *Horizontal;\r
+  SCAN_TIMINGS      *Vertical;\r
   UINT32            LcdControl;\r
   LCD_BPP           LcdBpp;\r
 \r
   // Set the video mode timings and other relevant information\r
   Status = LcdPlatformGetTimings (\r
              ModeNumber,\r
   UINT32            LcdControl;\r
   LCD_BPP           LcdBpp;\r
 \r
   // Set the video mode timings and other relevant information\r
   Status = LcdPlatformGetTimings (\r
              ModeNumber,\r
-             &HRes,\r
-             &HSync,\r
-             &HBackPorch,\r
-             &HFrontPorch,\r
-             &VRes,\r
-             &VSync,\r
-             &VBackPorch,\r
-             &VFrontPorch\r
+             &Horizontal,\r
+             &Vertical\r
              );\r
   if (EFI_ERROR (Status)) {\r
     ASSERT_EFI_ERROR (Status);\r
     return Status;\r
   }\r
 \r
              );\r
   if (EFI_ERROR (Status)) {\r
     ASSERT_EFI_ERROR (Status);\r
     return Status;\r
   }\r
 \r
+  ASSERT (Horizontal != NULL);\r
+  ASSERT (Vertical != NULL);\r
+\r
   Status = LcdPlatformGetBpp (ModeNumber, &LcdBpp);\r
   if (EFI_ERROR (Status)) {\r
     ASSERT_EFI_ERROR (Status);\r
   Status = LcdPlatformGetBpp (ModeNumber, &LcdBpp);\r
   if (EFI_ERROR (Status)) {\r
     ASSERT_EFI_ERROR (Status);\r
@@ -124,15 +115,29 @@ LcdSetMode (
   // Set Timings\r
   MmioWrite32 (\r
     PL111_REG_LCD_TIMING_0,\r
   // Set Timings\r
   MmioWrite32 (\r
     PL111_REG_LCD_TIMING_0,\r
-    HOR_AXIS_PANEL (HBackPorch, HFrontPorch, HSync, HRes)\r
+    HOR_AXIS_PANEL (\r
+      Horizontal->BackPorch,\r
+      Horizontal->FrontPorch,\r
+      Horizontal->Sync,\r
+      Horizontal->Resolution\r
+      )\r
     );\r
 \r
   MmioWrite32 (\r
     PL111_REG_LCD_TIMING_1,\r
     );\r
 \r
   MmioWrite32 (\r
     PL111_REG_LCD_TIMING_1,\r
-    VER_AXIS_PANEL (VBackPorch, VFrontPorch, VSync, VRes)\r
+    VER_AXIS_PANEL (\r
+      Vertical->BackPorch,\r
+      Vertical->FrontPorch,\r
+      Vertical->Sync,\r
+      Vertical->Resolution\r
+      )\r
+    );\r
+\r
+  MmioWrite32 (\r
+    PL111_REG_LCD_TIMING_2,\r
+    CLK_SIG_POLARITY (Horizontal->Resolution)\r
     );\r
 \r
     );\r
 \r
-  MmioWrite32 (PL111_REG_LCD_TIMING_2, CLK_SIG_POLARITY (HRes));\r
   MmioWrite32 (PL111_REG_LCD_TIMING_3, 0);\r
 \r
   // PL111_REG_LCD_CONTROL\r
   MmioWrite32 (PL111_REG_LCD_TIMING_3, 0);\r
 \r
   // PL111_REG_LCD_CONTROL\r