From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (NAM12-MW2-obe.outbound.protection.outlook.com [40.107.244.55]) by mx.groups.io with SMTP id smtpd.web11.12094.1595392328435848692 for ; Tue, 21 Jul 2020 21:32:08 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@vmware.com header.s=selector2 header.b=evOnPqRj; spf=pass (domain: vmware.com, ip: 40.107.244.55, mailfrom: awarkentin@vmware.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QRtzI+K5A5KReRWBwWPDi2Ddc7Lzb0WEcswVH9kNVBff0LQUONxJEmXA7gJy3OeYivAFrZFksrx5/EvjlG5nr9BE2hgb3tNzA5xca9mpriI7fnfM1WxlrXZNeGLZhWC1V0L0rQynToCouj53xNGMoaMfAJ7l3BX15OOQeDp+Rv1F0TtGMkNu3wdVxe6gjLcP2DzvMpkVROimnRgwlXZeKA+jPzE8ZbgLORsOlgmxqDr3JPioiNivTsH0ehEBswammSY0MqStgrsC1Q1GTEqwKppHNaJ5rRMBp9K+AYseT2YIZcgjuPwDdUiUPbRUQphd4CU5OSzVou9leCKwCJDEdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RAJqb0w1+MIxyZpaagFMI6coKE1nflwrMSzhw0hu5MQ=; b=UzmuiVmNuSECmu7DJqIrntYCfg7MHuYOwFdGmJRw19rqoXbQCkddEF+w3nURps2PP8DIOdFKVgqMmXTBtMlX4lARXY5z0vPu/BT4iJw7z7NOIuw7SFTJTVV85eSEn46R89seIEuSEP382irMZN6obOsjG0JZHMtlpI6HU13LWGZfmt6964sFg2ukDm9lBrzf4MY7KR9yHrlAX5h9NSRwxBKkt0DgTZ1ZW5/oqxUrD54FvlpJXMNLF1MX8YdTFT6/gX7shqKuF8JZfXm/faBHzZ9NFkpCSLTUHBwdBChizw4nbp+lY7pfLoON4nTFYYhCDCtLVuyVc4CdfV9o/5kQnw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vmware.com; dmarc=pass action=none header.from=vmware.com; dkim=pass header.d=vmware.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vmware.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RAJqb0w1+MIxyZpaagFMI6coKE1nflwrMSzhw0hu5MQ=; b=evOnPqRjL2W5r6i8AwGxWKOtxfTu32TWTzadzF5K/ruOS1tHhT84v0RDNabb6Q4YIkzUxAn7RpkfdBMAkHS9r7bhZFcEBKRoADz+9T/Xj6vLA3VCFOYLWbUau1q0W+yzyEi8egE7PSO8sk8Lt5jTzk2FDVNsG2Caib48m8ttUb8= Received: from BN6PR05MB3411.namprd05.prod.outlook.com (2603:10b6:405:43::23) by BN8PR05MB5986.namprd05.prod.outlook.com (2603:10b6:408:42::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.17; Wed, 22 Jul 2020 04:32:06 +0000 Received: from BN6PR05MB3411.namprd05.prod.outlook.com ([fe80::e1ef:31eb:c802:aef0]) by BN6PR05MB3411.namprd05.prod.outlook.com ([fe80::e1ef:31eb:c802:aef0%3]) with mapi id 15.20.3216.017; Wed, 22 Jul 2020 04:32:06 +0000 From: "Andrei Warkentin" To: Samer El-Haj-Mahmoud , "devel@edk2.groups.io" CC: Leif Lindholm , Pete Batard , Ard Biesheuvel Subject: Re: [edk2-platform][PATCH v1 3/3] Platforms/RaspberryPi: Fix GOP FrameBufferSize returned by SetMode() Thread-Topic: [edk2-platform][PATCH v1 3/3] Platforms/RaspberryPi: Fix GOP FrameBufferSize returned by SetMode() Thread-Index: AQHWX8v2ZF+TdkzzokmDjCgudbhs1KkTAn0e Date: Wed, 22 Jul 2020 04:32:06 +0000 Message-ID: References: <20200722020103.11808-1-Samer.El-Haj-Mahmoud@arm.com>,<20200722020103.11808-4-Samer.El-Haj-Mahmoud@arm.com> In-Reply-To: <20200722020103.11808-4-Samer.El-Haj-Mahmoud@arm.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=vmware.com; x-originating-ip: [98.214.99.181] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: f1d050fb-1160-4b90-47aa-08d82df830aa x-ms-traffictypediagnostic: BN8PR05MB5986: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: L8O4nV27aRNo/Yf+W2EnjpiEMUlMKHeidMkQQQ6/Qz8s7bgakbQx0HOAIpqCPPoLKf3A4EoZdwsCJEDK/wbpeBUFZUDst2i869mDvyVX9btwoJIUIo6+3nhI7R+h52Xa7Jw4AHpjA3eZDyWT0va5l+clkNguUuUyG0Bu8BZbhzqJbO5uevPCIAMHBxSC6MSZnmkYlLV4BXGC5s/7ZPrg6JRI+w3r7sYbJafyxYMVatLMGU0XifYawhwTwGf4y4hsMZ7/1+8110jSo2BpFrxDSbZLr6qDQIgJm+6EIUEyRN7pwqKB9rT3NYA/64DidheEY0oD1Z3+KARRzz3sxBjoaPM+ayTNStFu+WJBhEpN9myUwa5B1nhRpWL2kFgzFG4odLmxBeXbsFJZoS4enNmOug== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN6PR05MB3411.namprd05.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(396003)(366004)(376002)(136003)(346002)(39860400002)(83380400001)(7696005)(45080400002)(71200400001)(55016002)(166002)(9686003)(4326008)(66946007)(8936002)(33656002)(66556008)(66446008)(19627405001)(76116006)(86362001)(5660300002)(316002)(2906002)(8676002)(66476007)(186003)(6506007)(966005)(53546011)(64756008)(110136005)(478600001)(54906003)(52536014)(26005);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata: D4QqZWY1tsOM8nq0Mvt3sTq8rGuxmhRx3duiy1kPiP5JcjZ3bsPlc9o8XejJm3PLVj8DflLQKNue79MP2CPrlfk+pxE0rAUEX7rsi+KpW5eOMqzg84Klb9+fGdfhtq3FsLTuwrAu4pkFik0j9ZD6WcgFVAt4lLWwDRcfwOk5FSWkWNOfj/wPm2VYq+gMWhD6TO4lZYeZDpzXA5czimNocFMkjbh4WnIf88DbcpHYsepMzjFuE/JuG/5surwms0z6m2C6VctV/FCLOrFuWYFUvUY5Da3AeTy+D8l26DP0i1Q4306fTew7uJi5SgC5tNmDvaFgMiqcGYMIuds/MVq7AV+GI1QpeX+eiT/++pK83QbP5SrjmhcUg7VaHMYAn/+nlWd+msOG/vMvR5uZUIeHMagLCKWZjlE1ZQAg0wGdthJZgPIZTE50mBEWXor+JuCu+/MLReqEv8UI6mZnuSj/a7HWJ4/zUGIsepOzAxu7i7z4aaAtHa3HOIUU+4YeAOWy x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN6PR05MB3411.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f1d050fb-1160-4b90-47aa-08d82df830aa X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Jul 2020 04:32:06.2811 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 6MLuIjT5IpQlEq5YZzs6maAp6j1z4oFjbu2gOnhPw8eahVBEYepSeq8FuVx5XK0ew6xzsj+usc18PiA0XAwmbQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR05MB5986 Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_BN6PR05MB3411766C2C94C564B370FE6FB9790BN6PR05MB3411namp_" --_000_BN6PR05MB3411766C2C94C564B370FE6FB9790BN6PR05MB3411namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Andrei Warkentin ________________________________ From: Samer El-Haj-Mahmoud Sent: Tuesday, July 21, 2020 9:01 PM To: devel@edk2.groups.io Cc: Leif Lindholm ; Pete Batard ; Andrei W= arkentin ; Ard Biesheuvel Subject: [edk2-platform][PATCH v1 3/3] Platforms/RaspberryPi: Fix GOP Frame= BufferSize returned by SetMode() GOP SetMode() returns the frame buffer size in FrameBufferSize. The value is obtained from the RPi mailbox call to AllocateBuffer (tag RPI_MBOX_ALLOC_FB), which for a native resolution of 1920 x 1080 returns 8355840 bytes. The size should be 1920 x 1080 x 4 (bytes/pixel), or 8294400 bytes, as defined by the UEFI Spec: "FrameBufferSize : Amount of frame buffer needed to support the active mode as defined by PixelsPerScanLine x VerticalResolution x PixelElementSize". This change forces the returned FrameBufferSize to match the value required by UEFI Spec. The actual buffer allocted by the VPU is larger due to the alignment request when calling RPI_MBOX_ALLOC_FB (32 bytes). A vertical resolution of 1080 aligns to 1088 on 32-bytes, resulting in the increased buffer size (1920 x 1088 x 4 =3D 8355840). This fixes the SetMode_Conf failure reported by SCT tests at https://nam04.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fgithub.= com%2Fpftf%2FRPi4%2Fissues%2F73&data=3D02%7C01%7Cawarkentin%40vmware.co= m%7C48ef278196e648255b8a08d82de317fe%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0= %7C1%7C637309800670078866&sdata=3DY3sRmqyjYpzRQ8H%2BVnXPtlKZP9yaOy%2FXq= Br%2B8vNMLKM%3D&reserved=3D0 Cc: Leif Lindholm Cc: Pete Batard Cc: Andrei Warkentin Cc: Ard Biesheuvel Signed-off-by: Samer El-Haj-Mahmoud --- Platform/RaspberryPi/Drivers/DisplayDxe/DisplayDxe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Platform/RaspberryPi/Drivers/DisplayDxe/DisplayDxe.c b/Platfor= m/RaspberryPi/Drivers/DisplayDxe/DisplayDxe.c index f50ffc816cf1..a42e4d9b8a1b 100644 --- a/Platform/RaspberryPi/Drivers/DisplayDxe/DisplayDxe.c +++ b/Platform/RaspberryPi/Drivers/DisplayDxe/DisplayDxe.c @@ -279,7 +279,8 @@ DisplaySetMode ( This->Mode->Info->PixelsPerScanLine =3D Mode->Width; This->Mode->SizeOfInfo =3D sizeof (*This->Mode->Info); This->Mode->FrameBufferBase =3D FbBase; - This->Mode->FrameBufferSize =3D FbSize; + This->Mode->FrameBufferSize =3D Mode->Width * Mode->Height * PI3_BYTES_P= ER_PIXEL; + DEBUG((DEBUG_INFO, "Reported Mode->FrameBufferSize is %u\n", This->Mode-= >FrameBufferSize)); ClearScreen (This); return EFI_SUCCESS; -- 2.17.1 --_000_BN6PR05MB3411766C2C94C564B370FE6FB9790BN6PR05MB3411namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
Reviewed-by: Andrei Warken= tin <awarkentin@vmware.com>

From: Samer El-Haj-Mahmoud = <Samer.El-Haj-Mahmoud@arm.com>
Sent: Tuesday, July 21, 2020 9:01 PM
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: Leif Lindholm <leif@nuviainc.com>; Pete Batard <pete@ak= eo.ie>; Andrei Warkentin <awarkentin@vmware.com>; Ard Biesheuvel &= lt;ard.biesheuvel@arm.com>
Subject: [edk2-platform][PATCH v1 3/3] Platforms/RaspberryPi: Fix GO= P FrameBufferSize returned by SetMode()
 
GOP SetMode() returns the frame buffer size in Fra= meBufferSize.
The value is obtained from the RPi mailbox call to AllocateBuffer
(tag RPI_MBOX_ALLOC_FB), which for a native resolution of 1920 x 1080
returns 8355840 bytes. The size should be 1920 x 1080 x 4 (bytes/pixel), or 8294400 bytes, as defined by the UEFI Spec: "FrameBufferSize :
Amount of frame buffer needed to support the active mode as defined by
PixelsPerScanLine x VerticalResolution x PixelElementSize".

This change forces the returned FrameBufferSize to match the value
required by UEFI Spec. The actual buffer allocted by the VPU is larger
due to the alignment request when calling RPI_MBOX_ALLOC_FB
(32 bytes). A vertical resolution of 1080 aligns to 1088 on 32-bytes,
resulting in the increased buffer size (1920 x 1088 x 4 =3D 8355840).

This fixes the SetMode_Conf failure reported by SCT tests at
https://nam04.safe= links.protection.outlook.com/?url=3Dhttps%3A%2F%2Fgithub.com%2Fpftf%2FRPi4%= 2Fissues%2F73&amp;data=3D02%7C01%7Cawarkentin%40vmware.com%7C48ef278196= e648255b8a08d82de317fe%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C1%7C6373098= 00670078866&amp;sdata=3DY3sRmqyjYpzRQ8H%2BVnXPtlKZP9yaOy%2FXqBr%2B8vNML= KM%3D&amp;reserved=3D0

Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Pete Batard <pete@akeo.ie>
Cc: Andrei Warkentin <awarkentin@vmware.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Signed-off-by: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com> ---
 Platform/RaspberryPi/Drivers/DisplayDxe/DisplayDxe.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Platform/RaspberryPi/Drivers/DisplayDxe/DisplayDxe.c b/Platfor= m/RaspberryPi/Drivers/DisplayDxe/DisplayDxe.c
index f50ffc816cf1..a42e4d9b8a1b 100644
--- a/Platform/RaspberryPi/Drivers/DisplayDxe/DisplayDxe.c
+++ b/Platform/RaspberryPi/Drivers/DisplayDxe/DisplayDxe.c
@@ -279,7 +279,8 @@ DisplaySetMode (
   This->Mode->Info->PixelsPerScanLine =3D Mode->Widt= h;
   This->Mode->SizeOfInfo =3D sizeof (*This->Mode->In= fo);
   This->Mode->FrameBufferBase =3D FbBase;
-  This->Mode->FrameBufferSize =3D FbSize;
+  This->Mode->FrameBufferSize =3D Mode->Width * Mode->Hei= ght * PI3_BYTES_PER_PIXEL;
+  DEBUG((DEBUG_INFO, "Reported Mode->FrameBufferSize is %u\n&= quot;, This->Mode->FrameBufferSize));
 
   ClearScreen (This);
   return EFI_SUCCESS;
--
2.17.1

--_000_BN6PR05MB3411766C2C94C564B370FE6FB9790BN6PR05MB3411namp_--