From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::234; helo=mail-wm0-x234.google.com; envelope-from=leif.lindholm@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm0-x234.google.com (mail-wm0-x234.google.com [IPv6:2a00:1450:400c:c09::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 3487821F3882E for ; Fri, 13 Oct 2017 00:45:41 -0700 (PDT) Received: by mail-wm0-x234.google.com with SMTP id 196so26866220wma.1 for ; Fri, 13 Oct 2017 00:49:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=unxrof1vn8nI6IWPKCQokTJmYDhnqLiYKx4V8Y40wuQ=; b=h9sjITS1RSDQMUhXIjnWCGsebCe6Uhc57uYGm1vRidEnJqAT6YFGsRx61sD8tq32bN KBfuY1hUFN/5pc8TxFnhCqz5e99VTllJ9NZDiLt+AX7+il5VwEqBgXwjRTILmvYb1cPQ u9vV0I5Dukj2HxtL4CmGC+9vKjuWSf+2CYhdE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=unxrof1vn8nI6IWPKCQokTJmYDhnqLiYKx4V8Y40wuQ=; b=JkrmxZW/TpNQuTqmF0SlN41DyNEJxFi06ZyLjF0nCQhOmEuxv9gtI5yEmmf3iJqNbT u6VvkkeLJVvOLCAVmKuUHuOGow1mZ4H6xRWaIRSzqkojo40oV0q1hyva8AdKaf7YVdjv 3t9KwaagsuOxL4ECoVBVNFlxhBBvD6COENzDyK8CHX7kIv3kDHZBHD65Xo8ZVpCCUz2N B9AKAhwZ352y6vQWqS/c3nOa27f//+UsFJTQZRJDUACnIV4qTls6i1lDjdvRT9uyhpT1 90qk19K4xVmJr8fTKep7Vu965aONCaUeKptJwsPBjsUaZC3lmZW37eoag2o7liFjWP+h n2uw== X-Gm-Message-State: AMCzsaVXOzOdzYrNJFZ7qwORkwhYOVLxLn9WSa+K9fMnXiRQ/s4dHaDQ T+9BJroz6sZfXne8V9+edtV+oQ== X-Google-Smtp-Source: ABhQp+QbioYK35JyGPL6n7Cv5lAGi+TkgNRTYgFgBwA4xSEDTo1XdjMVuhTb4LRKD6rNQRcM1UpJtg== X-Received: by 10.28.130.131 with SMTP id e125mr800797wmd.125.1507880951014; Fri, 13 Oct 2017 00:49:11 -0700 (PDT) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id a195sm587002wme.34.2017.10.13.00.49.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 13 Oct 2017 00:49:09 -0700 (PDT) Date: Fri, 13 Oct 2017 08:49:08 +0100 From: Leif Lindholm To: evan.lloyd@arm.com Cc: edk2-devel@lists.01.org Message-ID: <20171013074908.j2fcf2bhllhnvgcd@bivouac.eciton.net> References: <20170926201529.11644-1-evan.lloyd@arm.com> <20170926201529.11644-13-evan.lloyd@arm.com> MIME-Version: 1.0 In-Reply-To: <20170926201529.11644-13-evan.lloyd@arm.com> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [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: , X-List-Received-Date: Fri, 13 Oct 2017 07:45:42 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Sep 26, 2017 at 09:15:22PM +0100, evan.lloyd@arm.com wrote: > 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/PL111LcdArmVExpress.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/ArmPlatformPkg/Include/Library/LcdPlatformLib.h > index 48bdd8a51411137df040aa797fcff272785f7a35..f2f345b18fd15f2cde159fd42d3208a28f598a1f 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; > > +// 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 parameters. > + * (Resolution, Sync, Back porch, Front porch) > + * @param OUT Vertical Pointer to vertical timing parameters. > + * (Resolution, Sync, Back porch, Front porch) > + * > * @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 > ); > > /** Return bits per pixel information for a mode number. > diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c b/ArmPlatformPkg/ArmVExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c > index a6c4f414685db907a3fbc9a009969be8a09f7415..dc2c5fb89923304c46d137ec8eaefc9418548d06 100644 > --- a/ArmPlatformPkg/ArmVExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c > +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c > @@ -30,58 +30,52 @@ > > typedef struct { > UINT32 Mode; > - UINT32 HorizontalResolution; > - UINT32 VerticalResolution; > LCD_BPP Bpp; > UINT32 OscFreq; > > // 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; > > /** The display modes supported by the platform. > **/ > -STATIC CONST LCD_RESOLUTION mResolutions[] = { > +STATIC CONST DISPLAY_MODE mDisplayModes[] = { > { // 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} > } > }; > > @@ -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)); > } > > /** Set the requested display mode. > @@ -232,7 +226,7 @@ LcdPlatformSetMode ( > Status = ArmPlatformSysConfigSetDevice ( > SYS_CFG_OSC_SITE1, > FixedPcdGet32 (PcdHdLcdVideoModeOscId), > - mResolutions[ModeNumber].OscFreq > + mDisplayModes[ModeNumber].OscFreq This and the case below will need to be rebased onto something that fixes the indentation from 3-space to 2-space, and updated. > ); > if (EFI_ERROR (Status)) { > ASSERT_EFI_ERROR (Status); > @@ -242,7 +236,7 @@ LcdPlatformSetMode ( > // Set the DVI into the new mode > Status = ArmPlatformSysConfigSet ( > SYS_CFG_DVIMODE, > - mResolutions[ModeNumber].Mode > + mDisplayModes[ModeNumber].Mode > ); > if (EFI_ERROR (Status)) { > ASSERT_EFI_ERROR (Status); > @@ -285,11 +279,11 @@ LcdPlatformQueryMode ( > } > > Info->Version = 0; > - Info->HorizontalResolution = mResolutions[ModeNumber].HorizontalResolution; > - Info->VerticalResolution = mResolutions[ModeNumber].VerticalResolution; > - Info->PixelsPerScanLine = mResolutions[ModeNumber].HorizontalResolution; > + Info->HorizontalResolution = mDisplayModes[ModeNumber].Horizontal.Resolution; > + Info->VerticalResolution = mDisplayModes[ModeNumber].Vertical.Resolution; > + Info->PixelsPerScanLine = mDisplayModes[ModeNumber].Horizontal.Resolution; > > - switch (mResolutions[ModeNumber].Bpp) { > + switch (mDisplayModes[ModeNumber].Bpp) { > case LCD_BITS_PER_PIXEL_24: > Info->PixelFormat = PixelRedGreenBlueReserved8BitPerColor; > Info->PixelInformation.RedMask = 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 parameters. > + * (Resolution, Sync, Back porch, Front porch) > + * @param OUT Vertical Pointer to vertical timing parameters. > + * (Resolution, Sync, Back porch, Front porch) > + > * > * @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 >= LcdPlatformGetMaxMode ()) { > @@ -347,35 +332,14 @@ LcdPlatformGetTimings ( > return EFI_INVALID_PARAMETER; > } > > - if (HRes == NULL > - || HSync == NULL > - || HBackPorch == NULL > - || HFrontPorch == NULL > - || VRes == NULL > - || VSync == NULL > - || VBackPorch == NULL > - || VFrontPorch == NULL) > - { > - // One of the pointers is NULL > - ASSERT (HRes != NULL); > - ASSERT (HSync != NULL); > - ASSERT (HBackPorch != NULL); > - ASSERT (HFrontPorch != NULL); > - ASSERT (VRes != NULL); > - ASSERT (VSync != NULL); > - ASSERT (VBackPorch != NULL); > - ASSERT (VFrontPorch != NULL); > + if (Horizontal == NULL || Vertical == NULL) { > + ASSERT (Horizontal != NULL); > + ASSERT (Vertical != NULL); > return EFI_INVALID_PARAMETER; > } > > - *HRes = mResolutions[ModeNumber].HorizontalResolution; > - *HSync = mResolutions[ModeNumber].HSync; > - *HBackPorch = mResolutions[ModeNumber].HBackPorch; > - *HFrontPorch = mResolutions[ModeNumber].HFrontPorch; > - *VRes = mResolutions[ModeNumber].VerticalResolution; > - *VSync = mResolutions[ModeNumber].VSync; > - *VBackPorch = mResolutions[ModeNumber].VBackPorch; > - *VFrontPorch = mResolutions[ModeNumber].VFrontPorch; > + *Horizontal = &mDisplayModes[ModeNumber].Horizontal; > + *Vertical = &mDisplayModes[ModeNumber].Vertical; > > return EFI_SUCCESS; > } > @@ -401,7 +365,7 @@ LcdPlatformGetBpp ( > return EFI_INVALID_PARAMETER; > } > > - *Bpp = mResolutions[ModeNumber].Bpp; > + *Bpp = mDisplayModes[ModeNumber].Bpp; > > return EFI_SUCCESS; > } > diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c b/ArmPlatformPkg/ArmVExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c > index aa5a1ff9c1c25c51796b75230ca149ae3a92db4a..753c5b615361f83625cdd4f0506909721da014b6 100644 > --- a/ArmPlatformPkg/ArmVExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c > +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c > @@ -28,117 +28,111 @@ > > typedef struct { > UINT32 Mode; > - UINT32 HorizontalResolution; > - UINT32 VerticalResolution; > LCD_BPP Bpp; > UINT32 OscFreq; > > - UINT32 HSync; > - UINT32 HBackPorch; > - UINT32 HFrontPorch; > - UINT32 VSync; > - UINT32 VBackPorch; > - UINT32 VFrontPorch; > -} LCD_RESOLUTION; > + SCAN_TIMINGS Horizontal; > + SCAN_TIMINGS Vertical; > +} DISPLAY_MODE; > > /** The display modes supported by the platform. > **/ > -STATIC CONST LCD_RESOLUTION mResolutions[] = { > +STATIC CONST DISPLAY_MODE mDisplayModes[] = { > { // Mode 0 : VGA : 640 x 480 x 24 bpp Again, indentation needs fixing in earlier patch and this one regenerated on top. No further comments on this patch, other than : nice bit of cleanup. / Leif > - 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} > }, > { // 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_565, > + 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_PORCH}, > + {SVGA_V_RES_PIXELS, SVGA_V_SYNC, SVGA_V_BACK_PORCH, SVGA_V_FRONT_PORCH} > }, > { // 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_555, > + 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_PORCH}, > + {SVGA_V_RES_PIXELS, SVGA_V_SYNC, SVGA_V_BACK_PORCH, SVGA_V_FRONT_PORCH} > }, > { // 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 derived 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_444, > + 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_PORCH}, > + {SVGA_V_RES_PIXELS, SVGA_V_SYNC, SVGA_V_BACK_PORCH, SVGA_V_FRONT_PORCH} > }, > { // 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} > } > }; > > @@ -308,7 +302,7 @@ LcdPlatformSetMode ( > Status = 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 = ArmPlatformSysConfigSet ( > SYS_CFG_DVIMODE, > - mResolutions[ModeNumber].Mode > + mDisplayModes[ModeNumber].Mode > ); > if (EFI_ERROR (Status)) { > ASSERT_EFI_ERROR (Status); > @@ -368,11 +362,11 @@ LcdPlatformQueryMode ( > } > > Info->Version = 0; > - Info->HorizontalResolution = mResolutions[ModeNumber].HorizontalResolution; > - Info->VerticalResolution = mResolutions[ModeNumber].VerticalResolution; > - Info->PixelsPerScanLine = mResolutions[ModeNumber].HorizontalResolution; > + Info->HorizontalResolution = mDisplayModes[ModeNumber].Horizontal.Resolution; > + Info->VerticalResolution = mDisplayModes[ModeNumber].Vertical.Resolution; > + Info->PixelsPerScanLine = mDisplayModes[ModeNumber].Horizontal.Resolution; > > - switch (mResolutions[ModeNumber].Bpp) { > + switch (mDisplayModes[ModeNumber].Bpp) { > case LCD_BITS_PER_PIXEL_24: > Info->PixelFormat = PixelRedGreenBlueReserved8BitPerColor; > Info->PixelInformation.RedMask = 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 parameters. > + * (Resolution, Sync, Back porch, Front porch) > + * @param OUT Vertical Pointer to vertical timing parameters. > + * (Resolution, Sync, Back porch, Front porch) > * > * @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 >= LcdPlatformGetMaxMode ()) { > @@ -431,35 +415,16 @@ LcdPlatformGetTimings ( > return EFI_INVALID_PARAMETER; > } > > - if (HRes == NULL > - || HSync == NULL > - || HBackPorch == NULL > - || HFrontPorch == NULL > - || VRes == NULL > - || VSync == NULL > - || VBackPorch == NULL > - || VFrontPorch == NULL) > + if (Horizontal == NULL || Vertical == NULL) > { > // One of the pointers is NULL > - ASSERT (HRes != NULL); > - ASSERT (HSync != NULL); > - ASSERT (HBackPorch != NULL); > - ASSERT (HFrontPorch != NULL); > - ASSERT (VRes != NULL); > - ASSERT (VSync != NULL); > - ASSERT (VBackPorch != NULL); > - ASSERT (VFrontPorch != NULL); > + ASSERT (Horizontal != NULL); > + ASSERT (Vertical != NULL); > return EFI_INVALID_PARAMETER; > } > > - *HRes = mResolutions[ModeNumber].HorizontalResolution; > - *HSync = mResolutions[ModeNumber].HSync; > - *HBackPorch = mResolutions[ModeNumber].HBackPorch; > - *HFrontPorch = mResolutions[ModeNumber].HFrontPorch; > - *VRes = mResolutions[ModeNumber].VerticalResolution; > - *VSync = mResolutions[ModeNumber].VSync; > - *VBackPorch = mResolutions[ModeNumber].VBackPorch; > - *VFrontPorch = mResolutions[ModeNumber].VFrontPorch; > + *Horizontal = &mDisplayModes[ModeNumber].Horizontal; > + *Vertical = &mDisplayModes[ModeNumber].Vertical; > > return EFI_SUCCESS; > } > @@ -485,7 +450,7 @@ LcdPlatformGetBpp ( > return EFI_INVALID_PARAMETER; > } > > - *Bpp = mResolutions[ModeNumber].Bpp; > + *Bpp = mDisplayModes[ModeNumber].Bpp; > > return EFI_SUCCESS; > } > diff --git a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcd.c b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcd.c > index 33c555e75cafaf9affddd0992c4bd9f9289f6703..03153c06d314cb497c91889386ca6075c0c9f718 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; > > > // 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)) { > @@ -126,21 +116,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/Drivers/LcdGraphicsOutputDxe/PL111Lcd.c b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111Lcd.c > index 12db9d910ed1d7874095a5f79fe588491811f75a..6de60491e9fd0c5bca71e743aac2862ff85f6e7e 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; > > // 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)) { > @@ -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 > + ) > ); > > 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 > -- > Guid("CE165669-3EF3-493F-B85D-6190EE5B9759") >