public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Andrei Warkentin" <awarkentin@vmware.com>
To: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: Leif Lindholm <leif@nuviainc.com>, Pete Batard <pete@akeo.ie>,
	Ard Biesheuvel <ard.biesheuvel@arm.com>
Subject: Re: [edk2-platform][PATCH v1 3/3] Platforms/RaspberryPi: Fix GOP FrameBufferSize returned by SetMode()
Date: Wed, 22 Jul 2020 04:32:06 +0000	[thread overview]
Message-ID: <BN6PR05MB3411766C2C94C564B370FE6FB9790@BN6PR05MB3411.namprd05.prod.outlook.com> (raw)
In-Reply-To: <20200722020103.11808-4-Samer.El-Haj-Mahmoud@arm.com>

[-- Attachment #1: Type: text/plain, Size: 2818 bytes --]

Reviewed-by: Andrei Warkentin <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@akeo.ie>; Andrei Warkentin <awarkentin@vmware.com>; Ard Biesheuvel <ard.biesheuvel@arm.com>
Subject: [edk2-platform][PATCH v1 3/3] Platforms/RaspberryPi: Fix GOP FrameBufferSize 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 = 8355840).

This fixes the SetMode_Conf failure reported by SCT tests at
https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fpftf%2FRPi4%2Fissues%2F73&amp;data=02%7C01%7Cawarkentin%40vmware.com%7C48ef278196e648255b8a08d82de317fe%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C1%7C637309800670078866&amp;sdata=Y3sRmqyjYpzRQ8H%2BVnXPtlKZP9yaOy%2FXqBr%2B8vNMLKM%3D&amp;reserved=0

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/Platform/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 = Mode->Width;
   This->Mode->SizeOfInfo = sizeof (*This->Mode->Info);
   This->Mode->FrameBufferBase = FbBase;
-  This->Mode->FrameBufferSize = FbSize;
+  This->Mode->FrameBufferSize = Mode->Width * Mode->Height * PI3_BYTES_PER_PIXEL;
+  DEBUG((DEBUG_INFO, "Reported Mode->FrameBufferSize is %u\n", This->Mode->FrameBufferSize));

   ClearScreen (This);
   return EFI_SUCCESS;
--
2.17.1


[-- Attachment #2: Type: text/html, Size: 4415 bytes --]

  reply	other threads:[~2020-07-22  4:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-22  2:01 [edk2-platform][PATCH v1 0/3] Platform/RaspberryPi : SCT EFI_GRAPHICS_OUTPUT_PROTOCOL fixes Samer El-Haj-Mahmoud
2020-07-22  2:01 ` [edk2-platform][PATCH v1 1/3] Platforms/RaspberryPi: Fix GOP parameter handling Samer El-Haj-Mahmoud
2020-07-22  4:31   ` Andrei Warkentin
2020-07-22  2:01 ` [edk2-platform][PATCH v1 2/3] Platforms/RaspberryPi: Return GOP PixelInformation in QueryMode() Samer El-Haj-Mahmoud
2020-07-22  4:31   ` Andrei Warkentin
2020-07-22  2:01 ` [edk2-platform][PATCH v1 3/3] Platforms/RaspberryPi: Fix GOP FrameBufferSize returned by SetMode() Samer El-Haj-Mahmoud
2020-07-22  4:32   ` Andrei Warkentin [this message]
2020-07-22 19:47 ` [edk2-platform][PATCH v1 0/3] Platform/RaspberryPi : SCT EFI_GRAPHICS_OUTPUT_PROTOCOL fixes Andrei Warkentin
2020-08-13 13:50 ` Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BN6PR05MB3411766C2C94C564B370FE6FB9790@BN6PR05MB3411.namprd05.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox