From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a01:111:f400:fe08::615; helo=eur03-am5-obe.outbound.protection.outlook.com; envelope-from=evan.lloyd@arm.com; receiver=edk2-devel@lists.01.org Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-am5eur03on0615.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe08::615]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 38C7C225E966B for ; Wed, 21 Mar 2018 05:46:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=6fOsBP5Lbv9LxY47Irl8mlXbII9gqT8MCzzUzkPQG04=; b=SBf0uyJftmgBsBi9l28hCDHiGoA/t39D6NLnf1IkSXN3+L0c3/+Kp8nWtrNbR/ISH7FvvqpK6MusJbvaz33MgbTvfaMqaO379zBwEucXpOUNifpYDsE4Ume0VmV91DMeNEjwEXns6tAGQrK5s9NyT9Blh3c4mVxwyYjjGv0/1yQ= Received: from HE1PR0801MB1771.eurprd08.prod.outlook.com (10.168.150.14) by HE1PR0801MB1786.eurprd08.prod.outlook.com (10.168.150.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.588.14; Wed, 21 Mar 2018 12:53:27 +0000 Received: from HE1PR0801MB1771.eurprd08.prod.outlook.com ([fe80::69cc:3ecf:9c8c:f5a3]) by HE1PR0801MB1771.eurprd08.prod.outlook.com ([fe80::69cc:3ecf:9c8c:f5a3%17]) with mapi id 15.20.0588.017; Wed, 21 Mar 2018 12:53:27 +0000 From: Evan Lloyd To: Girish Pathak , "edk2-devel@lists.01.org" CC: nd , Stephanie Hughes-Fitt , "leif.lindholm@linaro.org" , "ard.biesheuvel@linaro.org" Thread-Topic: [edk2] [PATCH v3 10/16] ArmPlatformPkg: Add PCD to select pixel format Thread-Index: AQHTwGZLHTiKsFuN/EWXEB1Fh7xGQaPapmNA Date: Wed, 21 Mar 2018 12:53:27 +0000 Message-ID: References: <20180320161212.79120-1-girish.pathak@arm.com> <20180320161212.79120-11-girish.pathak@arm.com> In-Reply-To: <20180320161212.79120-11-girish.pathak@arm.com> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [217.140.96.140] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; HE1PR0801MB1786; 6:9x8jav9gd+LVUDP/RB5GXDECepG9aUhkHYeHORzSE1+QGOgROiC47woaM4RqfjBTx0uUeTwpVWMkkf02qHJaJe6RWyc1dY2WWXHyLLfgvNemXh1PYUp4oc1vKdhubyicuH+iC27+Z0LOnRwae8mF5hnVJlM8dhxh50WzWxsoR0ZHDrJW19U9QUJ2++YQv1at5hhVE+073TUiA+F7SX43eRzCfM9XV3m2zN8kE01Y0qXtPJPUXMv+rcFqKMS+97CU7HHn8U9OBlFZyPVK3ZwEp4uScvepRaaXaVNW5X9a41uEPIvxEfXw2fdFYJZ0AKO4dd1yeaGwgxmWyXryGMRDKe4uXXg7S3m89h0vKSJmbt5M5Un4UPhVjIUHPPrfqOxA; 5:ygLH48P9XSBT44wE24l+VDw7vXN3VaKZRyo80vDpwkWlWIMHxXDidNdKh0/rJa0RAaGJZrjbSN9zNv87UVQDSctdb6x+yYG06HD3bwTs+gOu+MiDMuKSzk6rPeXEMQRwMlRkvfEuCQqzo+aIfnnHNkcVdcmk1MtdXx7Lj1Q9Bp4=; 24:Ey7bgCVbw7J8Zt9FrgoTTFW9iuXpXNiTbe3jnDl6nAsoKUKAiGGfzDrzBqiAr4MU3amwDDYSt0lNtzOIHIxHft6hlSjFcfewE6r56e2poq8=; 7:tSD8i1xmiS4K2KfxqDZgb4djJNx7IzVqaHe6TFOlURUPz2R1vbhlLtitF5b8C7usCSjq3/xd2gk+Z4UYQQvOwao3Vi8c7bq7reoTtnLRntIkE2RvdtRqdf6EqCN+KkyrSRk29gNLSXIVe8DUyK/ejMBc7sZiSdpep6F5230yIyMUjQFcLB5O23O2YKowpLDSTlfwD4ygFIuTUBWFelqhph5T0CLxKI+DlnGn3BmTecC2i7IbTje1BygW6HEy6Upq x-ms-exchange-antispam-srfa-diagnostics: SOS;SOR; x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 94964e41-ac24-420d-a074-08d58f2abda3 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(2017052603328)(7153060)(7193020); SRVR:HE1PR0801MB1786; x-ms-traffictypediagnostic: HE1PR0801MB1786: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Evan.Lloyd@arm.com; nodisclaimer: True x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(180628864354917)(162533806227266); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231221)(944501323)(52105095)(10201501046)(3002001)(93006095)(93001095)(6055026)(6041310)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(6072148)(201708071742011); SRVR:HE1PR0801MB1786; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0801MB1786; x-forefront-prvs: 0618E4E7E1 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39380400002)(366004)(346002)(376002)(396003)(39860400002)(13464003)(189003)(199004)(2950100002)(97736004)(105586002)(3280700002)(2906002)(25786009)(81156014)(99286004)(316002)(59450400001)(7696005)(966005)(26005)(110136005)(14454004)(478600001)(76176011)(6506007)(102836004)(72206003)(2900100001)(8676002)(54906003)(81166006)(5660300001)(86362001)(5250100002)(4326008)(33656002)(6246003)(6436002)(9686003)(229853002)(53546011)(2501003)(575784001)(3846002)(106356001)(3660700001)(6116002)(66066001)(53936002)(7736002)(68736007)(305945005)(55016002)(6306002)(8936002)(74316002)(19627235001); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR0801MB1786; H:HE1PR0801MB1771.eurprd08.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: FGeLECkjGLYfcoFbRlP6dsnqg2wuTxfjqxYvpgNdDf52hyrUGMHPE7BJP3Sie0Bkp5UHHH/+uOPg7GmIyczGtSCaTqAUsvehtsZGpx2Bll1PItIiu7onmL//ic+g/Nq6n96FloLiuTc6ZhanPirZxS/2AKQGS82fzq9gfFxr/3yLJ9GUaCRFL56gdy/hS8GzeYcOPbKRXkXKazy4zz6Jn30w8RuAuDKoa425M0ERZ+QA0dEZjXYcJJ1bGtT4+RJfGx4jHE0DS98HJnSqo6fiRDvTbbPknOfHIIQy+uAA/JjvokyvNVrmRwxfYA6Uz59/OhtxhPt9/Cx//frvnCU94g== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: 94964e41-ac24-420d-a074-08d58f2abda3 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Mar 2018 12:53:27.4558 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0801MB1786 Subject: Re: [PATCH v3 10/16] ArmPlatformPkg: Add PCD to select pixel format X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 12:47:00 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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 Fitt@arm.com>; leif.lindholm@linaro.org; ard.biesheuvel@linaro.org > Subject: [edk2] [PATCH v3 10/16] ArmPlatformPkg: Add PCD to select pixel > format >=20 > From: Girish Pathak >=20 > Current HDLCD and PL111 platform libraries do not support display modes > with PixelBlueGreenRedReserved8BitPerColor format, i.e. because of > historical confusion, they do not support the UEFI default > PixelBlueGreenRedReserved8BitPerColor format >=20 > In LcdPlatformLib for PL111, LcdPlatformQueryMode returns the pixel > format as PixelRedGreenBlueReserved8BitPerColor which is wrong, because > that does not match the display controller's pixel format which is set to > BGR in PL111Lcd LcdHwLib. >=20 > Also it is not possible to configure pixel format as RGB/BGR for the disp= lay > modes for a platform at build time. >=20 > This change adds PcdGopPixelFormat to configure pixel format as > PixelRedGreenBlueReserved8BitPerColor or > PixelBlueGreenRedReserved8BitPerColor or > PixelBitMask. > With this change, pixel format can be selected in the platform specific .= dsc > file for all supported display modes. >=20 > Support for PixelBitMask is not implemented in PL111 or HDLCD LcdHwLib > libraries, hence HDLCD and PL111 platform libraries will return error > EFI_UNSUPPORTED if PcdGopPixelFormat is set to PixelBitMask. Indeed, it > is not clear what selecting PixelBitMask might mean, but the option is > allowed as it might suit a custom platform. >=20 > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Girish Pathak > Signed-off-by: Evan Lloyd > Reviewed-by: Ard Biesheuvel > --- > ArmPlatformPkg/ArmPlatformPkg.dec | 9 +++- > ArmPlatformPkg/Library/HdLcd/HdLcd.c | 54 +++++++------------- > ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c | 15 +++++- > 3 files changed, 40 insertions(+), 38 deletions(-) >=20 > diff --git a/ArmPlatformPkg/ArmPlatformPkg.dec > b/ArmPlatformPkg/ArmPlatformPkg.dec > index > 7cec775abeee219e6821488a2c5abe88d23bbed1..378bee9cbc9e4bd50c37 > b38156016424e24cba73 100644 > --- a/ArmPlatformPkg/ArmPlatformPkg.dec > +++ b/ArmPlatformPkg/ArmPlatformPkg.dec > @@ -1,6 +1,6 @@ > #/** @file > # > -# Copyright (c) 2011-2017, ARM Limited. All rights reserved. > +# Copyright (c) 2011-2018, ARM Limited. All rights reserved. > # Copyright (c) 2015, Intel Corporation. All rights reserved. > # > # This program and the accompanying materials @@ -97,6 +97,13 @@ > [PcdsFixedAtBuild.common] >=20 > gArmPlatformTokenSpaceGuid.PcdPL180SysMciRegAddress|0x00000000| > UINT32|0x00000028 >=20 > gArmPlatformTokenSpaceGuid.PcdPL180MciBaseAddress|0x00000000|UI > NT32|0x00000029 >=20 > + # Graphics Output Pixel format > + # 0 : PixelRedGreenBlueReserved8BitPerColor > + # 1 : PixelBlueGreenRedReserved8BitPerColor > + # 2 : PixelBitMask > + # Default is set to UEFI console font format > + PixelBlueGreenRedReserved8BitPerColor > + > + > gArmPlatformTokenSpaceGuid.PcdGopPixelFormat|0x00000001|UINT32|0 > x00000 > + 040 > + > [PcdsFixedAtBuild.common,PcdsDynamic.common] > ## PL031 RealTimeClock >=20 > gArmPlatformTokenSpaceGuid.PcdPL031RtcBase|0x0|UINT32|0x00000024 > diff --git a/ArmPlatformPkg/Library/HdLcd/HdLcd.c > b/ArmPlatformPkg/Library/HdLcd/HdLcd.c > index > f5886848ce582b475b597ccca015c816707ade0e..96f2bf437fbabd2509f86 > 0c67c5442def5b5f03d 100644 > --- a/ArmPlatformPkg/Library/HdLcd/HdLcd.c > +++ b/ArmPlatformPkg/Library/HdLcd/HdLcd.c > @@ -22,31 +22,7 @@ >=20 > #include "HdLcd.h" >=20 > -STATIC > -UINTN > -GetBytesPerPixel ( > - IN LCD_BPP Bpp > - ) > -{ > - switch (Bpp) { > - case LCD_BITS_PER_PIXEL_24: > - return 4; > - > - case LCD_BITS_PER_PIXEL_16_565: > - case LCD_BITS_PER_PIXEL_16_555: > - case LCD_BITS_PER_PIXEL_12_444: > - return 2; > - > - case LCD_BITS_PER_PIXEL_8: > - case LCD_BITS_PER_PIXEL_4: > - case LCD_BITS_PER_PIXEL_2: > - case LCD_BITS_PER_PIXEL_1: > - return 1; > - > - default: > - return 0; > - } > -} > +#define BYTES_PER_PIXEL 4 >=20 > /** Initialize display. >=20 > @@ -78,10 +54,6 @@ LcdInitialize ( > HDLCD_LITTLE_ENDIAN | HDLCD_4BYTES_PER_PIXEL > ); >=20 > - MmioWrite32 (HDLCD_REG_RED_SELECT, (0 << 16 | 8 << 8 | 0)); > - MmioWrite32 (HDLCD_REG_GREEN_SELECT, (0 << 16 | 8 << 8 | 8)); > - MmioWrite32 (HDLCD_REG_BLUE_SELECT, (0 << 16 | 8 << 8 | 16)); > - > return EFI_SUCCESS; > } >=20 > @@ -100,8 +72,8 @@ LcdSetMode ( > EFI_STATUS Status; > SCAN_TIMINGS *Horizontal; > SCAN_TIMINGS *Vertical; > - UINT32 BytesPerPixel; > - LCD_BPP LcdBpp; > + > + EFI_GRAPHICS_OUTPUT_MODE_INFORMATION ModeInfo; >=20 > // Set the video mode timings and other relevant information > Status =3D LcdPlatformGetTimings ( > @@ -117,13 +89,22 @@ LcdSetMode ( > ASSERT (Horizontal !=3D NULL); > ASSERT (Vertical !=3D NULL); >=20 > - Status =3D LcdPlatformGetBpp (ModeNumber, &LcdBpp); > + // Get the pixel format information. > + Status =3D LcdPlatformQueryMode (ModeNumber, &ModeInfo); > if (EFI_ERROR (Status)) { > ASSERT_EFI_ERROR (Status); > return Status; > } >=20 > - BytesPerPixel =3D GetBytesPerPixel (LcdBpp); > + if (ModeInfo.PixelFormat =3D=3D PixelBlueGreenRedReserved8BitPerColor)= { > + MmioWrite32 (HDLCD_REG_RED_SELECT, (8 << 8) | 16); > + MmioWrite32 (HDLCD_REG_BLUE_SELECT, (8 << 8) | 0); } else { > + MmioWrite32 (HDLCD_REG_BLUE_SELECT, (8 << 8) | 16); > + MmioWrite32 (HDLCD_REG_RED_SELECT, (8 << 8) | 0); } > + > + MmioWrite32 (HDLCD_REG_GREEN_SELECT, (8 << 8) | 8); >=20 > // Disable the controller > MmioWrite32 (HDLCD_REG_COMMAND, HDLCD_DISABLE); @@ -131,10 > +112,13 @@ LcdSetMode ( > // Update the frame buffer information with the new settings > MmioWrite32 ( > HDLCD_REG_FB_LINE_LENGTH, > - Horizontal->Resolution * BytesPerPixel > + Horizontal->Resolution * BYTES_PER_PIXEL > ); >=20 > - MmioWrite32 (HDLCD_REG_FB_LINE_PITCH, Horizontal->Resolution * > BytesPerPixel); > + MmioWrite32 ( > + HDLCD_REG_FB_LINE_PITCH, > + Horizontal->Resolution * BYTES_PER_PIXEL > + ); >=20 > MmioWrite32 (HDLCD_REG_FB_LINE_COUNT, Vertical->Resolution - 1); >=20 > diff --git a/ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c > b/ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c > index > c9e2736911881fc36b51562b9259b7bccf30747d..0496376fffe514651a70f > 58a3316894a4b2b319c 100644 > --- a/ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c > +++ b/ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c > @@ -76,7 +76,6 @@ LcdInitialize ( >=20 > @retval EFI_SUCCESS Display mode set successfuly. > @retval !(EFI_SUCCESS) Other errors. > - > **/ > EFI_STATUS > LcdSetMode ( > @@ -89,6 +88,8 @@ LcdSetMode ( > UINT32 LcdControl; > LCD_BPP LcdBpp; >=20 > + EFI_GRAPHICS_OUTPUT_MODE_INFORMATION ModeInfo; > + > // Set the video mode timings and other relevant information > Status =3D LcdPlatformGetTimings ( > ModeNumber, > @@ -109,6 +110,13 @@ LcdSetMode ( > return Status; > } >=20 > + // Get the pixel format information > + Status =3D LcdPlatformQueryMode (ModeNumber, &ModeInfo); if > (EFI_ERROR > + (Status)) { > + ASSERT_EFI_ERROR (Status); > + return Status; > + } > + > // Disable the CLCD_LcdEn bit > MmioAnd32 (PL111_REG_LCD_CONTROL, ~PL111_CTRL_LCD_EN); >=20 > @@ -142,7 +150,10 @@ LcdSetMode ( >=20 > // PL111_REG_LCD_CONTROL > LcdControl =3D PL111_CTRL_LCD_EN | PL111_CTRL_LCD_BPP (LcdBpp) | > - PL111_CTRL_LCD_TFT | PL111_CTRL_LCD_PWR | > PL111_CTRL_BGR; > + PL111_CTRL_LCD_TFT | PL111_CTRL_LCD_PWR; if > + (ModeInfo.PixelFormat =3D=3D PixelBlueGreenRedReserved8BitPerColor) { > + LcdControl |=3D PL111_CTRL_BGR; > + } > MmioWrite32 (PL111_REG_LCD_CONTROL, LcdControl); >=20 > return EFI_SUCCESS; > -- > 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' >=20 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel