From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.10258.1595383265657565044 for ; Tue, 21 Jul 2020 19:01:05 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: samer.el-haj-mahmoud@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 516BE11B3; Tue, 21 Jul 2020 19:01:05 -0700 (PDT) Received: from U203705.lan (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0DA7B3F66F; Tue, 21 Jul 2020 19:01:05 -0700 (PDT) From: "Samer El-Haj-Mahmoud" To: devel@edk2.groups.io Cc: Leif Lindholm , Pete Batard , Andrei Warkentin , Ard Biesheuvel Subject: [edk2-platform][PATCH v1 3/3] Platforms/RaspberryPi: Fix GOP FrameBufferSize returned by SetMode() Date: Tue, 21 Jul 2020 22:01:03 -0400 Message-Id: <20200722020103.11808-4-Samer.El-Haj-Mahmoud@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200722020103.11808-1-Samer.El-Haj-Mahmoud@arm.com> References: <20200722020103.11808-1-Samer.El-Haj-Mahmoud@arm.com> 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://github.com/pftf/RPi4/issues/73 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/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