From nobody Thu Dec 26 13:08:30 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1506456986427695.1268201481429; Tue, 26 Sep 2017 13:16:26 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 8C0DC20945BCA; Tue, 26 Sep 2017 13:12:41 -0700 (PDT) Received: from cam-smtp0.cambridge.arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 7891221EC8D1A for ; Tue, 26 Sep 2017 13:12:27 -0700 (PDT) Received: from E111747.Emea.Arm.com (e111747.emea.arm.com [10.1.27.40]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id v8QKFY5b017392; Tue, 26 Sep 2017 21:15:37 +0100 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=217.140.96.140; helo=cam-smtp0.cambridge.arm.com; envelope-from=evan.lloyd@arm.com; receiver=edk2-devel@lists.01.org From: evan.lloyd@arm.com To: edk2-devel@lists.01.org Date: Tue, 26 Sep 2017 21:15:22 +0100 Message-Id: <20170926201529.11644-13-evan.lloyd@arm.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170926201529.11644-1-evan.lloyd@arm.com> References: <20170926201529.11644-1-evan.lloyd@arm.com> Subject: [edk2] [PATCH 12/19] ArmPlatformPkg: Redefine LcdPlatformGetTimings function X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "ard.biesheuvel@linaro.org"@arm.com, "leif.lindholm@linaro.org"@arm.com, "nd@arm.com"@arm.com, "Matteo.Carlini@arm.com"@arm.com MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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. Similarly the mode definition tables are also changed to use this data type and thus enable pass through access. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak Signed-off-by: Evan Lloyd --- ArmPlatformPkg/Include/Library/LcdPlatformLib.h = | 32 ++-- ArmPlatformPkg/ArmVExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress= .c | 122 +++++--------- ArmPlatformPkg/ArmVExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVE= xpress.c | 177 ++++++++------------ ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcd.c = | 55 +++--- ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111Lcd.c = | 48 +++--- 5 files changed, 180 insertions(+), 254 deletions(-) diff --git a/ArmPlatformPkg/Include/Library/LcdPlatformLib.h b/ArmPlatformP= kg/Include/Library/LcdPlatformLib.h index 48bdd8a51411137df040aa797fcff272785f7a35..f2f345b18fd15f2cde159fd42d3= 208a28f598a1f 100644 --- a/ArmPlatformPkg/Include/Library/LcdPlatformLib.h +++ b/ArmPlatformPkg/Include/Library/LcdPlatformLib.h @@ -152,6 +152,14 @@ typedef enum { LCD_BITS_PER_PIXEL_12_444 } LCD_BPP; =20 +// 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. @@ -219,29 +227,19 @@ LcdPlatformQueryMode ( /** Returns the display timing information for the requested mode number. * * @param IN ModeNumber Mode Number. - * @param OUT HRes Pointer 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 VRes Pointer 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 parameter= s. + * (Resolution, Sync, Back porch, Front p= orch) + * @param OUT Vertical Pointer to vertical timing parameters. + * (Resolution, Sync, Back porch, Front p= orch) + * * @retval EFI_SUCCESS Success if the requested mode is found. * @retval EFI_INVALID_PARAMETER Requested mode not found. **/ 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 CONST SCAN_TIMINGS **Horizontal, + OUT CONST SCAN_TIMINGS **Vertical ); =20 /** Return bits per pixel information for a mode number. diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/HdLcdArmVExpressLib/HdLc= dArmVExpress.c b/ArmPlatformPkg/ArmVExpressPkg/Library/HdLcdArmVExpressLib/= HdLcdArmVExpress.c index a6c4f414685db907a3fbc9a009969be8a09f7415..dc2c5fb89923304c46d137ec8ea= efc9418548d06 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVEx= press.c +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVEx= press.c @@ -30,58 +30,52 @@ =20 typedef struct { UINT32 Mode; - UINT32 HorizontalResolution; - UINT32 VerticalResolution; LCD_BPP Bpp; UINT32 OscFreq; =20 // These are used by HDLCD - UINT32 HSync; - UINT32 HBackPorch; - UINT32 HFrontPorch; - UINT32 VSync; - UINT32 VBackPorch; - UINT32 VFrontPorch; -} LCD_RESOLUTION; + SCAN_TIMINGS Horizontal; + SCAN_TIMINGS Vertical; +} DISPLAY_MODE; =20 /** The display modes supported by the platform. **/ -STATIC CONST LCD_RESOLUTION mResolutions[] =3D { +STATIC CONST DISPLAY_MODE mDisplayModes[] =3D { { // Mode 0 : VGA : 640 x 480 x 24 bpp - VGA, VGA_H_RES_PIXELS, VGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, + VGA, LCD_BITS_PER_PIXEL_24, VGA_OSC_FREQUENCY, - VGA_H_SYNC, VGA_H_BACK_PORCH, VGA_H_FRONT_PORCH, - VGA_V_SYNC, VGA_V_BACK_PORCH, VGA_V_FRONT_PORCH + {VGA_H_RES_PIXELS, VGA_H_SYNC, VGA_H_BACK_PORCH, VGA_H_FRONT_PORCH}, + {VGA_V_RES_PIXELS, VGA_V_SYNC, VGA_V_BACK_PORCH, VGA_V_FRONT_PORCH} }, { // Mode 1 : SVGA : 800 x 600 x 24 bpp - SVGA, SVGA_H_RES_PIXELS, SVGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, + SVGA, LCD_BITS_PER_PIXEL_24, SVGA_OSC_FREQUENCY, - SVGA_H_SYNC, SVGA_H_BACK_PORCH, SVGA_H_FRONT_PORCH, - SVGA_V_SYNC, SVGA_V_BACK_PORCH, SVGA_V_FRONT_PORCH + {SVGA_H_RES_PIXELS, SVGA_H_SYNC, SVGA_H_BACK_PORCH, SVGA_H_FRONT_PORCH= }, + {SVGA_V_RES_PIXELS, SVGA_V_SYNC, SVGA_V_BACK_PORCH, SVGA_V_FRONT_PORCH} }, { // Mode 2 : XGA : 1024 x 768 x 24 bpp - XGA, XGA_H_RES_PIXELS, XGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, + XGA, LCD_BITS_PER_PIXEL_24, XGA_OSC_FREQUENCY, - XGA_H_SYNC, XGA_H_BACK_PORCH, XGA_H_FRONT_PORCH, - XGA_V_SYNC, XGA_V_BACK_PORCH, XGA_V_FRONT_PORCH + {XGA_H_RES_PIXELS, XGA_H_SYNC, XGA_H_BACK_PORCH, XGA_H_FRONT_PORCH}, + {XGA_V_RES_PIXELS, XGA_V_SYNC, XGA_V_BACK_PORCH, XGA_V_FRONT_PORCH} }, { // Mode 3 : SXGA : 1280 x 1024 x 24 bpp - SXGA, SXGA_H_RES_PIXELS, SXGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, + SXGA, LCD_BITS_PER_PIXEL_24, (SXGA_OSC_FREQUENCY/2), - SXGA_H_SYNC, SXGA_H_BACK_PORCH, SXGA_H_FRONT_PORCH, - SXGA_V_SYNC, SXGA_V_BACK_PORCH, SXGA_V_FRONT_PORCH + {SXGA_H_RES_PIXELS, SXGA_H_SYNC, SXGA_H_BACK_PORCH, SXGA_H_FRONT_PORCH= }, + {SXGA_V_RES_PIXELS, SXGA_V_SYNC, SXGA_V_BACK_PORCH, SXGA_V_FRONT_PORCH} }, { // Mode 4 : UXGA : 1600 x 1200 x 24 bpp - UXGA, UXGA_H_RES_PIXELS, UXGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, + UXGA, LCD_BITS_PER_PIXEL_24, (UXGA_OSC_FREQUENCY/2), - UXGA_H_SYNC, UXGA_H_BACK_PORCH, UXGA_H_FRONT_PORCH, - UXGA_V_SYNC, UXGA_V_BACK_PORCH, UXGA_V_FRONT_PORCH + {UXGA_H_RES_PIXELS, UXGA_H_SYNC, UXGA_H_BACK_PORCH, UXGA_H_FRONT_PORCH= }, + {UXGA_V_RES_PIXELS, UXGA_V_SYNC, UXGA_V_BACK_PORCH, UXGA_V_FRONT_PORCH} }, { // Mode 5 : HD : 1920 x 1080 x 24 bpp - HD, HD_H_RES_PIXELS, HD_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, + HD, LCD_BITS_PER_PIXEL_24, (HD_OSC_FREQUENCY/2), - HD_H_SYNC, HD_H_BACK_PORCH, HD_H_FRONT_PORCH, - HD_V_SYNC, HD_V_BACK_PORCH, HD_V_FRONT_PORCH + {HD_H_RES_PIXELS, HD_H_SYNC, HD_H_BACK_PORCH, HD_H_FRONT_PORCH}, + {HD_V_RES_PIXELS, HD_V_SYNC, HD_V_BACK_PORCH, HD_V_FRONT_PORCH} } }; =20 @@ -209,7 +203,7 @@ LcdPlatformGetMaxMode(VOID) { /* The following line will report correctly the total number of graphics= modes * that could be supported by the graphics driver: */ - return (sizeof (mResolutions) / sizeof (LCD_RESOLUTION)); + return (sizeof (mDisplayModes) / sizeof (DISPLAY_MODE)); } =20 /** Set the requested display mode. @@ -232,7 +226,7 @@ LcdPlatformSetMode ( Status =3D ArmPlatformSysConfigSetDevice ( SYS_CFG_OSC_SITE1, FixedPcdGet32 (PcdHdLcdVideoModeOscId), - mResolutions[ModeNumber].OscFreq + mDisplayModes[ModeNumber].OscFreq ); if (EFI_ERROR (Status)) { ASSERT_EFI_ERROR (Status); @@ -242,7 +236,7 @@ LcdPlatformSetMode ( // Set the DVI into the new mode Status =3D ArmPlatformSysConfigSet ( SYS_CFG_DVIMODE, - mResolutions[ModeNumber].Mode + mDisplayModes[ModeNumber].Mode ); if (EFI_ERROR (Status)) { ASSERT_EFI_ERROR (Status); @@ -285,11 +279,11 @@ LcdPlatformQueryMode ( } =20 Info->Version =3D 0; - Info->HorizontalResolution =3D mResolutions[ModeNumber].HorizontalResolu= tion; - Info->VerticalResolution =3D mResolutions[ModeNumber].VerticalResolution; - Info->PixelsPerScanLine =3D mResolutions[ModeNumber].HorizontalResolutio= n; + Info->HorizontalResolution =3D mDisplayModes[ModeNumber].Horizontal.Reso= lution; + Info->VerticalResolution =3D mDisplayModes[ModeNumber].Vertical.Resoluti= on; + Info->PixelsPerScanLine =3D mDisplayModes[ModeNumber].Horizontal.Resolut= ion; =20 - switch (mResolutions[ModeNumber].Bpp) { + switch (mDisplayModes[ModeNumber].Bpp) { case LCD_BITS_PER_PIXEL_24: Info->PixelFormat =3D PixelRedGreenBlueReserved8Bi= tPerColor; Info->PixelInformation.RedMask =3D LCD_24BPP_RED_MASK; @@ -317,29 +311,20 @@ LcdPlatformQueryMode ( /** Returns the display timing information for the requested mode number. * * @param IN ModeNumber Mode Number. - * @param OUT HRes Pointer 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 VRes Pointer 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 parameter= s. + * (Resolution, Sync, Back porch, Front p= orch) + * @param OUT Vertical Pointer to vertical timing parameters. + * (Resolution, Sync, Back porch, Front p= orch) + * * @retval EFI_SUCCESS Success if the requested mode is found. * @retval EFI_INVALID_PARAMETER Requested mode not found. **/ EFI_STATUS LcdPlatformGetTimings ( - IN CONST UINT32 ModeNumber, - OUT UINT32 * CONST HRes, - OUT UINT32 * CONST HSync, - OUT UINT32 * CONST HBackPorch, - OUT UINT32 * CONST HFrontPorch, - OUT UINT32 * CONST VRes, - OUT UINT32 * CONST VSync, - OUT UINT32 * CONST VBackPorch, - OUT UINT32 * CONST VFrontPorch + IN CONST UINT32 ModeNumber, + OUT CONST SCAN_TIMINGS ** Horizontal, + OUT CONST SCAN_TIMINGS ** Vertical ) { if (ModeNumber >=3D LcdPlatformGetMaxMode ()) { @@ -347,35 +332,14 @@ LcdPlatformGetTimings ( return EFI_INVALID_PARAMETER; } =20 - if (HRes =3D=3D NULL - || HSync =3D=3D NULL - || HBackPorch =3D=3D NULL - || HFrontPorch =3D=3D NULL - || VRes =3D=3D NULL - || VSync =3D=3D NULL - || VBackPorch =3D=3D NULL - || VFrontPorch =3D=3D NULL) - { - // One of the pointers is NULL - ASSERT (HRes !=3D NULL); - ASSERT (HSync !=3D NULL); - ASSERT (HBackPorch !=3D NULL); - ASSERT (HFrontPorch !=3D NULL); - ASSERT (VRes !=3D NULL); - ASSERT (VSync !=3D NULL); - ASSERT (VBackPorch !=3D NULL); - ASSERT (VFrontPorch !=3D NULL); + if (Horizontal =3D=3D NULL || Vertical =3D=3D NULL) { + ASSERT (Horizontal !=3D NULL); + ASSERT (Vertical !=3D NULL); return EFI_INVALID_PARAMETER; } =20 - *HRes =3D mResolutions[ModeNumber].HorizontalResolution; - *HSync =3D mResolutions[ModeNumber].HSync; - *HBackPorch =3D mResolutions[ModeNumber].HBackPorch; - *HFrontPorch =3D mResolutions[ModeNumber].HFrontPorch; - *VRes =3D mResolutions[ModeNumber].VerticalResolution; - *VSync =3D mResolutions[ModeNumber].VSync; - *VBackPorch =3D mResolutions[ModeNumber].VBackPorch; - *VFrontPorch =3D mResolutions[ModeNumber].VFrontPorch; + *Horizontal =3D &mDisplayModes[ModeNumber].Horizontal; + *Vertical =3D &mDisplayModes[ModeNumber].Vertical; =20 return EFI_SUCCESS; } @@ -401,7 +365,7 @@ LcdPlatformGetBpp ( return EFI_INVALID_PARAMETER; } =20 - *Bpp =3D mResolutions[ModeNumber].Bpp; + *Bpp =3D mDisplayModes[ModeNumber].Bpp; =20 return EFI_SUCCESS; } diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/PL111LcdArmVExpressLib/P= L111LcdArmVExpress.c b/ArmPlatformPkg/ArmVExpressPkg/Library/PL111LcdArmVEx= pressLib/PL111LcdArmVExpress.c index aa5a1ff9c1c25c51796b75230ca149ae3a92db4a..753c5b615361f83625cdd4f0506= 909721da014b6 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/PL111LcdArmVExpressLib/PL111Lcd= ArmVExpress.c +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/PL111LcdArmVExpressLib/PL111Lcd= ArmVExpress.c @@ -28,117 +28,111 @@ =20 typedef struct { UINT32 Mode; - UINT32 HorizontalResolution; - UINT32 VerticalResolution; LCD_BPP Bpp; UINT32 OscFreq; =20 - UINT32 HSync; - UINT32 HBackPorch; - UINT32 HFrontPorch; - UINT32 VSync; - UINT32 VBackPorch; - UINT32 VFrontPorch; -} LCD_RESOLUTION; + SCAN_TIMINGS Horizontal; + SCAN_TIMINGS Vertical; +} DISPLAY_MODE; =20 /** The display modes supported by the platform. **/ -STATIC CONST LCD_RESOLUTION mResolutions[] =3D { +STATIC CONST DISPLAY_MODE mDisplayModes[] =3D { { // Mode 0 : VGA : 640 x 480 x 24 bpp - VGA, VGA_H_RES_PIXELS, VGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, + VGA, LCD_BITS_PER_PIXEL_24, VGA_OSC_FREQUENCY, - VGA_H_SYNC, VGA_H_BACK_PORCH, VGA_H_FRONT_PORCH, - VGA_V_SYNC, VGA_V_BACK_PORCH, VGA_V_FRONT_PORCH + {VGA_H_RES_PIXELS, VGA_H_SYNC, VGA_H_BACK_PORCH, VGA_H_FRONT_PORCH}, + {VGA_V_RES_PIXELS, VGA_V_SYNC, VGA_V_BACK_PORCH, VGA_V_FRONT_PORCH} }, { // Mode 1 : SVGA : 800 x 600 x 24 bpp - SVGA, SVGA_H_RES_PIXELS, SVGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, + SVGA, LCD_BITS_PER_PIXEL_24, SVGA_OSC_FREQUENCY, - SVGA_H_SYNC, SVGA_H_BACK_PORCH, SVGA_H_FRONT_PORCH, - SVGA_V_SYNC, SVGA_V_BACK_PORCH, SVGA_V_FRONT_PORCH + {SVGA_H_RES_PIXELS, SVGA_H_SYNC, SVGA_H_BACK_PORCH, SVGA_H_FRONT_POR= CH}, + {SVGA_V_RES_PIXELS, SVGA_V_SYNC, SVGA_V_BACK_PORCH, SVGA_V_FRONT_POR= CH} }, { // Mode 2 : XGA : 1024 x 768 x 24 bpp - XGA, XGA_H_RES_PIXELS, XGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, + XGA, LCD_BITS_PER_PIXEL_24, XGA_OSC_FREQUENCY, - XGA_H_SYNC, XGA_H_BACK_PORCH, XGA_H_FRONT_PORCH, - XGA_V_SYNC, XGA_V_BACK_PORCH, XGA_V_FRONT_PORCH + {XGA_H_RES_PIXELS, XGA_H_SYNC, XGA_H_BACK_PORCH, XGA_H_FRONT_PORCH}, + {XGA_V_RES_PIXELS, XGA_V_SYNC, XGA_V_BACK_PORCH, XGA_V_FRONT_PORCH} }, { // Mode 3 : SXGA : 1280 x 1024 x 24 bpp - SXGA, SXGA_H_RES_PIXELS, SXGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, + SXGA, LCD_BITS_PER_PIXEL_24, (SXGA_OSC_FREQUENCY/2), - SXGA_H_SYNC, SXGA_H_BACK_PORCH, SXGA_H_FRONT_PORCH, - SXGA_V_SYNC, SXGA_V_BACK_PORCH, SXGA_V_FRONT_PORCH + {SXGA_H_RES_PIXELS, SXGA_H_SYNC, SXGA_H_BACK_PORCH, SXGA_H_FRONT_POR= CH}, + {SXGA_V_RES_PIXELS, SXGA_V_SYNC, SXGA_V_BACK_PORCH, SXGA_V_FRONT_POR= CH} }, { // Mode 4 : UXGA : 1600 x 1200 x 24 bpp - UXGA, UXGA_H_RES_PIXELS, UXGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, + UXGA, LCD_BITS_PER_PIXEL_24, (UXGA_OSC_FREQUENCY/2), - UXGA_H_SYNC, UXGA_H_BACK_PORCH, UXGA_H_FRONT_PORCH, - UXGA_V_SYNC, UXGA_V_BACK_PORCH, UXGA_V_FRONT_PORCH + {UXGA_H_RES_PIXELS, UXGA_H_SYNC, UXGA_H_BACK_PORCH, UXGA_H_FRONT_POR= CH}, + {UXGA_V_RES_PIXELS, UXGA_V_SYNC, UXGA_V_BACK_PORCH, UXGA_V_FRONT_POR= CH} }, { // Mode 5 : HD : 1920 x 1080 x 24 bpp - HD, HD_H_RES_PIXELS, HD_V_RES_PIXELS, LCD_BITS_PER_PIXEL_24, + HD, LCD_BITS_PER_PIXEL_24, (HD_OSC_FREQUENCY/2), - HD_H_SYNC, HD_H_BACK_PORCH, HD_H_FRONT_PORCH, - HD_V_SYNC, HD_V_BACK_PORCH, HD_V_FRONT_PORCH + {HD_H_RES_PIXELS, HD_H_SYNC, HD_H_BACK_PORCH, HD_H_FRONT_PORCH}, + {HD_V_RES_PIXELS, HD_V_SYNC, HD_V_BACK_PORCH, HD_V_FRONT_PORCH} }, { // Mode 6 : VGA : 640 x 480 x 16 bpp (565 Mode) - VGA, VGA_H_RES_PIXELS, VGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_16_565, + VGA, LCD_BITS_PER_PIXEL_16_565, VGA_OSC_FREQUENCY, - VGA_H_SYNC, VGA_H_BACK_PORCH, VGA_H_FRONT_PORCH, - VGA_V_SYNC, VGA_V_BACK_PORCH, VGA_V_FRONT_PORCH + {VGA_H_RES_PIXELS, VGA_H_SYNC, VGA_H_BACK_PORCH, VGA_H_FRONT_PORCH}, + {VGA_V_RES_PIXELS, VGA_V_SYNC, VGA_V_BACK_PORCH, VGA_V_FRONT_PORCH} }, { // Mode 7 : SVGA : 800 x 600 x 16 bpp (565 Mode) - SVGA, SVGA_H_RES_PIXELS, SVGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_16_56= 5, + SVGA, LCD_BITS_PER_PIXEL_16_565, SVGA_OSC_FREQUENCY, - SVGA_H_SYNC, SVGA_H_BACK_PORCH, SVGA_H_FRONT_PORCH, - SVGA_V_SYNC, SVGA_V_BACK_PORCH, SVGA_V_FRONT_PORCH + {SVGA_H_RES_PIXELS, SVGA_H_SYNC, SVGA_H_BACK_PORCH, SVGA_H_FRONT_POR= CH}, + {SVGA_V_RES_PIXELS, SVGA_V_SYNC, SVGA_V_BACK_PORCH, SVGA_V_FRONT_POR= CH} }, { // Mode 8 : XGA : 1024 x 768 x 16 bpp (565 Mode) - XGA, XGA_H_RES_PIXELS, XGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_16_565, + XGA, LCD_BITS_PER_PIXEL_16_565, XGA_OSC_FREQUENCY, - XGA_H_SYNC, XGA_H_BACK_PORCH, XGA_H_FRONT_PORCH, - XGA_V_SYNC, XGA_V_BACK_PORCH, XGA_V_FRONT_PORCH + {XGA_H_RES_PIXELS, XGA_H_SYNC, XGA_H_BACK_PORCH, XGA_H_FRONT_PORCH}, + {XGA_V_RES_PIXELS, XGA_V_SYNC, XGA_V_BACK_PORCH, XGA_V_FRONT_PORCH} }, { // Mode 9 : VGA : 640 x 480 x 15 bpp - VGA, VGA_H_RES_PIXELS, VGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_16_555, + VGA, LCD_BITS_PER_PIXEL_16_555, VGA_OSC_FREQUENCY, - VGA_H_SYNC, VGA_H_BACK_PORCH, VGA_H_FRONT_PORCH, - VGA_V_SYNC, VGA_V_BACK_PORCH, VGA_V_FRONT_PORCH + {VGA_H_RES_PIXELS, VGA_H_SYNC, VGA_H_BACK_PORCH, VGA_H_FRONT_PORCH}, + {VGA_V_RES_PIXELS, VGA_V_SYNC, VGA_V_BACK_PORCH, VGA_V_FRONT_PORCH} }, { // Mode 10 : SVGA : 800 x 600 x 15 bpp - SVGA, SVGA_H_RES_PIXELS, SVGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_16_55= 5, + SVGA, LCD_BITS_PER_PIXEL_16_555, SVGA_OSC_FREQUENCY, - SVGA_H_SYNC, SVGA_H_BACK_PORCH, SVGA_H_FRONT_PORCH, - SVGA_V_SYNC, SVGA_V_BACK_PORCH, SVGA_V_FRONT_PORCH + {SVGA_H_RES_PIXELS, SVGA_H_SYNC, SVGA_H_BACK_PORCH, SVGA_H_FRONT_POR= CH}, + {SVGA_V_RES_PIXELS, SVGA_V_SYNC, SVGA_V_BACK_PORCH, SVGA_V_FRONT_POR= CH} }, { // Mode 11 : XGA : 1024 x 768 x 15 bpp - XGA, XGA_H_RES_PIXELS, XGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_16_555, + XGA, LCD_BITS_PER_PIXEL_16_555, XGA_OSC_FREQUENCY, - XGA_H_SYNC, XGA_H_BACK_PORCH, XGA_H_FRONT_PORCH, - XGA_V_SYNC, XGA_V_BACK_PORCH, XGA_V_FRONT_PORCH + {XGA_H_RES_PIXELS, XGA_H_SYNC, XGA_H_BACK_PORCH, XGA_H_FRONT_PORCH}, + {XGA_V_RES_PIXELS, XGA_V_SYNC, XGA_V_BACK_PORCH, XGA_V_FRONT_PORCH} }, { // Mode 12 : XGA : 1024 x 768 x 15 bpp - All the timing info is deri= ved from Linux Kernel Driver Settings - XGA, XGA_H_RES_PIXELS, XGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_16_555, + XGA, LCD_BITS_PER_PIXEL_16_555, 63500000, - XGA_H_SYNC, XGA_H_BACK_PORCH, XGA_H_FRONT_PORCH, - XGA_V_SYNC, XGA_V_BACK_PORCH, XGA_V_FRONT_PORCH + {XGA_H_RES_PIXELS, XGA_H_SYNC, XGA_H_BACK_PORCH, XGA_H_FRONT_PORCH}, + {XGA_V_RES_PIXELS, XGA_V_SYNC, XGA_V_BACK_PORCH, XGA_V_FRONT_PORCH} }, { // Mode 13 : VGA : 640 x 480 x 12 bpp (444 Mode) - VGA, VGA_H_RES_PIXELS, VGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_12_444, + VGA, LCD_BITS_PER_PIXEL_12_444, VGA_OSC_FREQUENCY, - VGA_H_SYNC, VGA_H_BACK_PORCH, VGA_H_FRONT_PORCH, - VGA_V_SYNC, VGA_V_BACK_PORCH, VGA_V_FRONT_PORCH + {VGA_H_RES_PIXELS, VGA_H_SYNC, VGA_H_BACK_PORCH, VGA_H_FRONT_PORCH}, + {VGA_V_RES_PIXELS, VGA_V_SYNC, VGA_V_BACK_PORCH, VGA_V_FRONT_PORCH} }, { // Mode 14 : SVGA : 800 x 600 x 12 bpp (444 Mode) - SVGA, SVGA_H_RES_PIXELS, SVGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_12_44= 4, + SVGA, LCD_BITS_PER_PIXEL_12_444, SVGA_OSC_FREQUENCY, - SVGA_H_SYNC, SVGA_H_BACK_PORCH, SVGA_H_FRONT_PORCH, - SVGA_V_SYNC, SVGA_V_BACK_PORCH, SVGA_V_FRONT_PORCH + {SVGA_H_RES_PIXELS, SVGA_H_SYNC, SVGA_H_BACK_PORCH, SVGA_H_FRONT_POR= CH}, + {SVGA_V_RES_PIXELS, SVGA_V_SYNC, SVGA_V_BACK_PORCH, SVGA_V_FRONT_POR= CH} }, { // Mode 15 : XGA : 1024 x 768 x 12 bpp (444 Mode) - XGA, XGA_H_RES_PIXELS, XGA_V_RES_PIXELS, LCD_BITS_PER_PIXEL_12_444, + XGA, LCD_BITS_PER_PIXEL_12_444, XGA_OSC_FREQUENCY, - XGA_H_SYNC, XGA_H_BACK_PORCH, XGA_H_FRONT_PORCH, - XGA_V_SYNC, XGA_V_BACK_PORCH, XGA_V_FRONT_PORCH + {XGA_H_RES_PIXELS, XGA_H_SYNC, XGA_H_BACK_PORCH, XGA_H_FRONT_PORCH}, + {XGA_V_RES_PIXELS, XGA_V_SYNC, XGA_V_BACK_PORCH, XGA_V_FRONT_PORCH} } }; =20 @@ -308,7 +302,7 @@ LcdPlatformSetMode ( Status =3D ArmPlatformSysConfigSetDevice ( Function, OscillatorId, - mResolutions[ModeNumber].OscFreq + mDisplayModes[ModeNumber].OscFreq ); if (EFI_ERROR (Status)) { ASSERT_EFI_ERROR (Status); @@ -326,7 +320,7 @@ LcdPlatformSetMode ( // Set the DVI into the new mode Status =3D ArmPlatformSysConfigSet ( SYS_CFG_DVIMODE, - mResolutions[ModeNumber].Mode + mDisplayModes[ModeNumber].Mode ); if (EFI_ERROR (Status)) { ASSERT_EFI_ERROR (Status); @@ -368,11 +362,11 @@ LcdPlatformQueryMode ( } =20 Info->Version =3D 0; - Info->HorizontalResolution =3D mResolutions[ModeNumber].HorizontalResolu= tion; - Info->VerticalResolution =3D mResolutions[ModeNumber].VerticalResolution; - Info->PixelsPerScanLine =3D mResolutions[ModeNumber].HorizontalResolutio= n; + Info->HorizontalResolution =3D mDisplayModes[ModeNumber].Horizontal.Reso= lution; + Info->VerticalResolution =3D mDisplayModes[ModeNumber].Vertical.Resoluti= on; + Info->PixelsPerScanLine =3D mDisplayModes[ModeNumber].Horizontal.Resolut= ion; =20 - switch (mResolutions[ModeNumber].Bpp) { + switch (mDisplayModes[ModeNumber].Bpp) { case LCD_BITS_PER_PIXEL_24: Info->PixelFormat =3D PixelRedGreenBlueReserved8Bi= tPerColor; Info->PixelInformation.RedMask =3D LCD_24BPP_RED_MASK; @@ -400,14 +394,10 @@ LcdPlatformQueryMode ( /** Returns the display timing information for the requested mode number. * * @param IN ModeNumber Mode Number. - * @param OUT HRes Pointer 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 VRes Pointer 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 parameter= s. + * (Resolution, Sync, Back porch, Front p= orch) + * @param OUT Vertical Pointer to vertical timing parameters. + * (Resolution, Sync, Back porch, Front p= orch) * * @retval EFI_SUCCESS Success if the requested mode is found. * @retval EFI_INVALID_PARAMETER Requested mode not found. @@ -415,15 +405,9 @@ LcdPlatformQueryMode ( **/ EFI_STATUS LcdPlatformGetTimings ( - IN CONST UINT32 ModeNumber, - OUT UINT32 * CONST HRes, - OUT UINT32 * CONST HSync, - OUT UINT32 * CONST HBackPorch, - OUT UINT32 * CONST HFrontPorch, - OUT UINT32 * CONST VRes, - OUT UINT32 * CONST VSync, - OUT UINT32 * CONST VBackPorch, - OUT UINT32 * CONST VFrontPorch + IN CONST UINT32 ModeNumber, + OUT CONST SCAN_TIMINGS ** Horizontal, + OUT CONST SCAN_TIMINGS ** Vertical ) { if (ModeNumber >=3D LcdPlatformGetMaxMode ()) { @@ -431,35 +415,16 @@ LcdPlatformGetTimings ( return EFI_INVALID_PARAMETER; } =20 - if (HRes =3D=3D NULL - || HSync =3D=3D NULL - || HBackPorch =3D=3D NULL - || HFrontPorch =3D=3D NULL - || VRes =3D=3D NULL - || VSync =3D=3D NULL - || VBackPorch =3D=3D NULL - || VFrontPorch =3D=3D NULL) + if (Horizontal =3D=3D NULL || Vertical =3D=3D NULL) { // One of the pointers is NULL - ASSERT (HRes !=3D NULL); - ASSERT (HSync !=3D NULL); - ASSERT (HBackPorch !=3D NULL); - ASSERT (HFrontPorch !=3D NULL); - ASSERT (VRes !=3D NULL); - ASSERT (VSync !=3D NULL); - ASSERT (VBackPorch !=3D NULL); - ASSERT (VFrontPorch !=3D NULL); + ASSERT (Horizontal !=3D NULL); + ASSERT (Vertical !=3D NULL); return EFI_INVALID_PARAMETER; } =20 - *HRes =3D mResolutions[ModeNumber].HorizontalResolution; - *HSync =3D mResolutions[ModeNumber].HSync; - *HBackPorch =3D mResolutions[ModeNumber].HBackPorch; - *HFrontPorch =3D mResolutions[ModeNumber].HFrontPorch; - *VRes =3D mResolutions[ModeNumber].VerticalResolution; - *VSync =3D mResolutions[ModeNumber].VSync; - *VBackPorch =3D mResolutions[ModeNumber].VBackPorch; - *VFrontPorch =3D mResolutions[ModeNumber].VFrontPorch; + *Horizontal =3D &mDisplayModes[ModeNumber].Horizontal; + *Vertical =3D &mDisplayModes[ModeNumber].Vertical; =20 return EFI_SUCCESS; } @@ -485,7 +450,7 @@ LcdPlatformGetBpp ( return EFI_INVALID_PARAMETER; } =20 - *Bpp =3D mResolutions[ModeNumber].Bpp; + *Bpp =3D mDisplayModes[ModeNumber].Bpp; =20 return EFI_SUCCESS; } diff --git a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcd.c b/ArmPlatf= ormPkg/Drivers/LcdGraphicsOutputDxe/HdLcd.c index 33c555e75cafaf9affddd0992c4bd9f9289f6703..03153c06d314cb497c91889386c= a6075c0c9f718 100644 --- a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcd.c +++ b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcd.c @@ -84,35 +84,25 @@ LcdSetMode ( IN CONST UINT32 ModeNumber ) { - EFI_STATUS Status; - UINT32 HRes; - UINT32 HSync; - UINT32 HBackPorch; - UINT32 HFrontPorch; - UINT32 VRes; - UINT32 VSync; - UINT32 VBackPorch; - UINT32 VFrontPorch; - UINT32 BytesPerPixel; - LCD_BPP LcdBpp; + EFI_STATUS Status; + CONST SCAN_TIMINGS *Horizontal; + CONST SCAN_TIMINGS *Vertical; + UINT32 BytesPerPixel; + LCD_BPP LcdBpp; =20 =20 // Set the video mode timings and other relevant information Status =3D LcdPlatformGetTimings ( ModeNumber, - &HRes, - &HSync, - &HBackPorch, - &HFrontPorch, - &VRes, - &VSync, - &VBackPorch, - &VFrontPorch + &Horizontal, + &Vertical ); if (EFI_ERROR (Status)) { ASSERT_EFI_ERROR (Status); return Status; } + ASSERT (Horizontal !=3D NULL); + ASSERT (Vertical !=3D NULL); =20 Status =3D LcdPlatformGetBpp (ModeNumber, &LcdBpp); if (EFI_ERROR (Status)) { @@ -126,21 +116,26 @@ LcdSetMode ( MmioWrite32 (HDLCD_REG_COMMAND, HDLCD_DISABLE); =20 // 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 * BytesPerP= ixel); + + MmioWrite32 (HDLCD_REG_FB_LINE_COUNT, Vertical->Resolution - 1); =20 // 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); =20 // 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); =20 // Enable the controller MmioWrite32 (HDLCD_REG_COMMAND, HDLCD_ENABLE); diff --git a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111Lcd.c b/ArmPl= atformPkg/Drivers/LcdGraphicsOutputDxe/PL111Lcd.c index 12db9d910ed1d7874095a5f79fe588491811f75a..6de60491e9fd0c5bca71e743aac= 2862ff85f6e7e 100644 --- a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111Lcd.c +++ b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111Lcd.c @@ -86,34 +86,24 @@ LcdSetMode ( IN CONST UINT32 ModeNumber ) { - EFI_STATUS Status; - UINT32 HRes; - UINT32 HSync; - UINT32 HBackPorch; - UINT32 HFrontPorch; - UINT32 VRes; - UINT32 VSync; - UINT32 VBackPorch; - UINT32 VFrontPorch; - UINT32 LcdControl; - LCD_BPP LcdBpp; + EFI_STATUS Status; + CONST SCAN_TIMINGS *Horizontal; + CONST SCAN_TIMINGS *Vertical; + UINT32 LcdControl; + LCD_BPP LcdBpp; =20 // Set the video mode timings and other relevant information Status =3D LcdPlatformGetTimings ( ModeNumber, - &HRes, - &HSync, - &HBackPorch, - &HFrontPorch, - &VRes, - &VSync, - &VBackPorch, - &VFrontPorch + &Horizontal, + &Vertical ); if (EFI_ERROR (Status)) { ASSERT_EFI_ERROR (Status); return Status; } + ASSERT (Horizontal !=3D NULL); + ASSERT (Vertical !=3D NULL); =20 Status =3D LcdPlatformGetBpp (ModeNumber, &LcdBpp); if (EFI_ERROR (Status)) { @@ -127,15 +117,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 + ) ); =20 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) ); =20 - MmioWrite32 (PL111_REG_LCD_TIMING_2, CLK_SIG_POLARITY (HRes)); MmioWrite32 (PL111_REG_LCD_TIMING_3, 0); =20 // PL111_REG_LCD_CONTROL --=20 Guid("CE165669-3EF3-493F-B85D-6190EE5B9759") _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel