Re: [edk2] [PATCH v3 09/16] ArmPlatformPkg: Redefine LcdPlatformGetTimings function
Reviewed-by: Evan Lloyd > -Original Message- > From: edk2-devel On Behalf Of Girish > Pathak > Sent: 20 March 2018 16:12 > To: edk2-devel@lists.01.org > Cc: nd ; Stephanie Hughes-Fitt f...@arm.com>; leif.lindh...@linaro.org; ard.biesheu...@linaro.org > Subject: [edk2] [PATCH v3 09/16] ArmPlatformPkg: Redefine > LcdPlatformGetTimings function > > From: Girish Pathak > > 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 > Signed-off-by: Evan Lloyd > Reviewed-by: Ard Biesheuvel > --- > ArmPlatformPkg/Include/Library/LcdPlatformLib.h| 31 > ++ > -- > ArmPlatformPkg/Library/HdLcd/HdLcd.c | 50 > + > --- > ArmPlatformPkg/Library/LcdPlatformNullLib/LcdPlatformNullLib.c | 10 +--- > ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c | 43 > + > 4 files changed, 64 insertions(+), 70 deletions(-) > > diff --git a/ArmPlatformPkg/Include/Library/LcdPlatformLib.h > b/ArmPlatformPkg/Include/Library/LcdPlatformLib.h > index > e51e78640ae7b1acd51ac333ba3faa8c78aea5a5..8338b327fd2dd0d6b316 > 53e278e25da5ac850939 100644 > --- a/ArmPlatformPkg/Include/Library/LcdPlatformLib.h > +++ b/ArmPlatformPkg/Include/Library/LcdPlatformLib.h > @@ -153,6 +153,14 @@ typedef enum { >LCD_BITS_PER_PIXEL_12_444 > } LCD_BPP; > > +// Display timing settings. > +typedef struct { > + UINT32 Resolution; > + UINT32 Sync; > + UINT32 BackPorch; > + UINT32 FrontPorch; > +} SCAN_TIMINGS; > + > /** Platform related initialization function. > >@param[in] Handle Handle to the LCD device instance. > @@ -228,14 +236,11 @@ LcdPlatformQueryMode ( > >@param[in] ModeNumber Mode Number. > > - @param[out] HResPointer to horizontal resolution. > - @param[out] HSync Pointer to horizontal sync width. > - @param[out] HBackPorch Pointer to horizontal back porch. > - @param[out] HFrontPorch Pointer to horizontal front porch. > - @param[out] VResPointer to vertical resolution. > - @param[out] VSync Pointer to vertical sync width. > - @param[out] VBackPorch Pointer to vertical back porch. > - @param[out] VFrontPorch Pointer to vertical front porch. > + @param[out] Horizontal Pointer to horizontal timing parameters. > + (Resolution, Sync, Back porch, Front porch) > + @param[out] VerticalPointer to vertical timing parameters. > + (Resolution, Sync, Back porch, Front > + porch) > + > >@retval EFI_SUCCESS Display timing information for the > requested >mode returned successfully. > @@ -244,14 +249,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 >); > > /** Return bits per pixel information for a mode number. > diff --git a/ArmPlatformPkg/Library/HdLcd/HdLcd.c > b/ArmPlatformPkg/Library/HdLcd/HdLcd.c > index > 039048398c531ec944bc4b43a5551a554a368481..f5886848ce582b475b5 > 97ccca015c816707ade0e 100644 > --- a/ArmPlatformPkg/Library/HdLcd/HdLcd.c > +++ b/ArmPlatformPkg/Library/HdLcd/HdLcd.c > @@ -98,34 +98,25 @@ LcdSetMode ( >) > { >EFI_STATUSStatus; > - UINT32HRes; > - UINT32HSync; > - UINT32HBackPorch; > - UINT32HFrontPorch; > - UINT32VRes; > - UINT32VSync; > - UINT32VBac
[edk2] [PATCH v3 09/16] ArmPlatformPkg: Redefine LcdPlatformGetTimings function
From: Girish Pathak 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 Signed-off-by: Evan Lloyd Reviewed-by: Ard Biesheuvel --- ArmPlatformPkg/Include/Library/LcdPlatformLib.h| 31 ++-- ArmPlatformPkg/Library/HdLcd/HdLcd.c | 50 +--- ArmPlatformPkg/Library/LcdPlatformNullLib/LcdPlatformNullLib.c | 10 +--- ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c | 43 + 4 files changed, 64 insertions(+), 70 deletions(-) diff --git a/ArmPlatformPkg/Include/Library/LcdPlatformLib.h b/ArmPlatformPkg/Include/Library/LcdPlatformLib.h index e51e78640ae7b1acd51ac333ba3faa8c78aea5a5..8338b327fd2dd0d6b31653e278e25da5ac850939 100644 --- a/ArmPlatformPkg/Include/Library/LcdPlatformLib.h +++ b/ArmPlatformPkg/Include/Library/LcdPlatformLib.h @@ -153,6 +153,14 @@ typedef enum { LCD_BITS_PER_PIXEL_12_444 } LCD_BPP; +// Display timing settings. +typedef struct { + UINT32 Resolution; + UINT32 Sync; + UINT32 BackPorch; + UINT32 FrontPorch; +} SCAN_TIMINGS; + /** Platform related initialization function. @param[in] Handle Handle to the LCD device instance. @@ -228,14 +236,11 @@ LcdPlatformQueryMode ( @param[in] ModeNumber Mode Number. - @param[out] HResPointer to horizontal resolution. - @param[out] HSync Pointer to horizontal sync width. - @param[out] HBackPorch Pointer to horizontal back porch. - @param[out] HFrontPorch Pointer to horizontal front porch. - @param[out] VResPointer to vertical resolution. - @param[out] VSync Pointer to vertical sync width. - @param[out] VBackPorch Pointer to vertical back porch. - @param[out] VFrontPorch Pointer to vertical front porch. + @param[out] Horizontal Pointer to horizontal timing parameters. + (Resolution, Sync, Back porch, Front porch) + @param[out] VerticalPointer to vertical timing parameters. + (Resolution, Sync, Back porch, Front porch) + @retval EFI_SUCCESS Display timing information for the requested mode returned successfully. @@ -244,14 +249,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 ); /** Return bits per pixel information for a mode number. diff --git a/ArmPlatformPkg/Library/HdLcd/HdLcd.c b/ArmPlatformPkg/Library/HdLcd/HdLcd.c index 039048398c531ec944bc4b43a5551a554a368481..f5886848ce582b475b597ccca015c816707ade0e 100644 --- a/ArmPlatformPkg/Library/HdLcd/HdLcd.c +++ b/ArmPlatformPkg/Library/HdLcd/HdLcd.c @@ -98,34 +98,25 @@ LcdSetMode ( ) { EFI_STATUSStatus; - UINT32HRes; - UINT32HSync; - UINT32HBackPorch; - UINT32HFrontPorch; - UINT32VRes; - UINT32VSync; - UINT32VBackPorch; - UINT32VFrontPorch; + SCAN_TIMINGS *Horizontal; + SCAN_TIMINGS *Vertical; UINT32BytesPerPixel; 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_DISA