From nobody Fri May 3 00:59:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+63040+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+63040+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1595383269; cv=none; d=zohomail.com; s=zohoarc; b=MWsP96jD/qAZbOn8RlpoZO+8VN3h+GhmpPqSJUJuc+Rfhm774eE8UYRwd6zvGhmHa8+QHMNPh6BrvJVviFcrPDUGgKIyBrFKcnvArrNXsW2RBpVifKjk0ED3v85c47foKY1eX6D4KHa3CcDEVDJ256tP5GEUwGUaxoLI8Cg3Re8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595383269; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=BV8uTgWaspA4nlNESQSo8iexNn0o2X9kItf1f9ZuAyg=; b=XQAYh8XTDcb8vTZXhVRn2vOqzq5trsfv0bB9LljvmyKR+C6MwY5jZK5i9UKtVLRqXHZe5GyvMGYXpfP8IhrNx1zVs3tX8ENc9me1v+fbW0i9NDdlyhim5KmjM9b44qGgrhRih02dOtIflRZV8COveZTygeTUzDyHjn67pZLsm0Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+63040+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1595383269929124.71653361151607; Tue, 21 Jul 2020 19:01:09 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id fhNMYY1788612xGE0hOwmzHg; Tue, 21 Jul 2020 19:01:08 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.10259.1595383265726560415 for ; Tue, 21 Jul 2020 19:01:05 -0700 X-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 9B1D21045; Tue, 21 Jul 2020 19:01:04 -0700 (PDT) X-Received: from U203705.lan (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 578873F66F; Tue, 21 Jul 2020 19:01:04 -0700 (PDT) From: "Samer El-Haj-Mahmoud" To: devel@edk2.groups.io Cc: Leif Lindholm , Pete Batard , Andrei Warkentin , Ard Biesheuvel Subject: [edk2-devel] [edk2-platform][PATCH v1 1/3] Platforms/RaspberryPi: Fix GOP parameter handling Date: Tue, 21 Jul 2020 22:01:01 -0400 Message-Id: <20200722020103.11808-2-Samer.El-Haj-Mahmoud@arm.com> In-Reply-To: <20200722020103.11808-1-Samer.El-Haj-Mahmoud@arm.com> References: <20200722020103.11808-1-Samer.El-Haj-Mahmoud@arm.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,samer.el-haj-mahmoud@arm.com X-Gm-Message-State: HDcmtn4zyGv3Nl4FMXZtZYemx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1595383268; bh=6gChKw+a09PQJ4nPutwNDimRCNPw/xPILee5Elts8hs=; h=Cc:Date:From:Reply-To:Subject:To; b=hiV/gdm8xX6qtJ7Q9vNCl5kSpRMvOzr1e2bjRN0LUO2NVYk5D7aM9qb1oxLSgZlww+k LJveMiQ5wlWxNn1TVrbP4xBAa8rMZy7w8+N3Jd8jy0muoB80U6tCZcIoqgr4Atw1KaXnw xolWTGoEH5bwFffaSDNoUJo15U33djEx3B4= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Handle incorrect parameters passed to DisplayDxe GOP functions QueryMode(), SetMode(), and Blt(). This fixes Blt_Conf and QueryMode_Conf failures 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 Reviewed-by: Andrei Warkentin Tested-by: Andrei Warkentin --- Platform/RaspberryPi/Drivers/DisplayDxe/DisplayDxe.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Platform/RaspberryPi/Drivers/DisplayDxe/DisplayDxe.c b/Platfor= m/RaspberryPi/Drivers/DisplayDxe/DisplayDxe.c index b880ca827bd6..80d0f7b2cb3c 100644 --- a/Platform/RaspberryPi/Drivers/DisplayDxe/DisplayDxe.c +++ b/Platform/RaspberryPi/Drivers/DisplayDxe/DisplayDxe.c @@ -1,5 +1,6 @@ /** @file * + * Copyright (c) 2020, ARM Limited. All rights reserved. * Copyright (c) 2017-2018, Andrei Warkentin * Copyright (c) Microsoft Corporation. All rights reserved. * @@ -170,7 +171,7 @@ DisplayQueryMode ( EFI_STATUS Status; GOP_MODE_DATA *Mode; =20 - if (ModeNumber > mLastMode) { + if (Info =3D=3D NULL || SizeOfInfo =3D=3D NULL || ModeNumber >=3D This->= Mode->MaxMode) { return EFI_INVALID_PARAMETER; } =20 @@ -227,7 +228,7 @@ DisplaySetMode ( EFI_PHYSICAL_ADDRESS FbBase; GOP_MODE_DATA *Mode =3D &mGopModeData[ModeNumber]; =20 - if (ModeNumber > mLastMode) { + if (ModeNumber >=3D This->Mode->MaxMode) { return EFI_UNSUPPORTED; } =20 @@ -299,6 +300,14 @@ DisplayBlt ( UINT8 *VidBuf, *BltBuf, *VidBuf1; UINTN i; =20 + if ((UINTN)BltOperation >=3D EfiGraphicsOutputBltOperationMax) { + return EFI_INVALID_PARAMETER; + } + + if (Width =3D=3D 0 || Height =3D=3D 0) { + return EFI_INVALID_PARAMETER; + } + switch (BltOperation) { case EfiBltVideoFill: BltBuf =3D (UINT8*)BltBuffer; @@ -349,7 +358,7 @@ DisplayBlt ( break; =20 default: - ASSERT_EFI_ERROR (EFI_SUCCESS); + return EFI_INVALID_PARAMETER; break; } =20 --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#63040): https://edk2.groups.io/g/devel/message/63040 Mute This Topic: https://groups.io/mt/75717275/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri May 3 00:59:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+63043+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+63043+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1595383272; cv=none; d=zohomail.com; s=zohoarc; b=JIL6m46StYewS+t9hgB/wOUwsK6deznCtFJRbIvzG7cv+SQ1F1l+O5B29wpoFaEGfw90GwioZGCKxXQN3wAyWijVgxpNwDJn5130/kDJp9la2soIJc4P6QEGD4CGZQtkrDPYugEyMKHFHj6Vqurg/TKIxL8S8jq0fzQ3iNQB42g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595383272; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=Wj8AL1g/8wphBRuvohyowzitkoayefX5TeGdLiRwAEc=; b=HzxQwQg0q9pPAFPJ7I/kzp0XAeOIG571dWGzO/vZ9yV4//6g+qNcKrxZeO9Jth3p2dySYK1u9xOx1F59EqnRIbMDks8eYv5VzTboe2bZ+JUSdCIokzhJ4cbSpsGyR8TyauLq9js38abPDBQGG7PKLlvK3f1t+jDG4qOyUHdBxRs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+63043+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1595383272811297.3507899375643; Tue, 21 Jul 2020 19:01:12 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id Xj2fYY1788612xIVlw4azxnB; Tue, 21 Jul 2020 19:01:11 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.10260.1595383265994414356 for ; Tue, 21 Jul 2020 19:01:06 -0700 X-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 F08D0106F; Tue, 21 Jul 2020 19:01:04 -0700 (PDT) X-Received: from U203705.lan (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id AD8203F66F; Tue, 21 Jul 2020 19:01:04 -0700 (PDT) From: "Samer El-Haj-Mahmoud" To: devel@edk2.groups.io Cc: Leif Lindholm , Pete Batard , Andrei Warkentin , Ard Biesheuvel Subject: [edk2-devel] [edk2-platform][PATCH v1 2/3] Platforms/RaspberryPi: Return GOP PixelInformation in QueryMode() Date: Tue, 21 Jul 2020 22:01:02 -0400 Message-Id: <20200722020103.11808-3-Samer.El-Haj-Mahmoud@arm.com> In-Reply-To: <20200722020103.11808-1-Samer.El-Haj-Mahmoud@arm.com> References: <20200722020103.11808-1-Samer.El-Haj-Mahmoud@arm.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,samer.el-haj-mahmoud@arm.com X-Gm-Message-State: C6j0G49ztxr78HKU3qcLrgmhx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1595383271; bh=2TGRQobdaOgO4nKCfsXpk0Z4eQOIyIID4vDlJDsp61w=; h=Cc:Date:From:Reply-To:Subject:To; b=OocM5dfy/zMQzrWCIdFrgOs4n81aoPeSyssl0mBVsS/rE/rxkHIEmvHZwhzotddVEYH EXLF8rel6L75aQqvjBeMez9comiGCGhZQ/+vq79/9CjSu0wTBB2hB/DaRWK9F6Nu2Z7pF 55G0dWxpVfXlAd6ibj0TbnKh9bMESgjmqy4= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Return correct values of PixelInformation in QueryMode(). This fixes the QueryMode_Func failures 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 Reviewed-by: Andrei Warkentin Tested-by: Andrei Warkentin --- Platform/RaspberryPi/Drivers/DisplayDxe/DisplayDxe.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Platform/RaspberryPi/Drivers/DisplayDxe/DisplayDxe.c b/Platfor= m/RaspberryPi/Drivers/DisplayDxe/DisplayDxe.c index 80d0f7b2cb3c..f50ffc816cf1 100644 --- a/Platform/RaspberryPi/Drivers/DisplayDxe/DisplayDxe.c +++ b/Platform/RaspberryPi/Drivers/DisplayDxe/DisplayDxe.c @@ -191,6 +191,10 @@ DisplayQueryMode ( (*Info)->HorizontalResolution =3D Mode->Width; (*Info)->VerticalResolution =3D Mode->Height; (*Info)->PixelFormat =3D This->Mode->Info->PixelFormat; + (*Info)->PixelInformation.RedMask =3D This->Mode->Info->PixelInformation= .RedMask; + (*Info)->PixelInformation.GreenMask =3D This->Mode->Info->PixelInformati= on.GreenMask; + (*Info)->PixelInformation.BlueMask =3D This->Mode->Info->PixelInformatio= n.BlueMask; + (*Info)->PixelInformation.ReservedMask =3D This->Mode->Info->PixelInform= ation.ReservedMask; (*Info)->PixelsPerScanLine =3D Mode->Width; =20 return EFI_SUCCESS; --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#63043): https://edk2.groups.io/g/devel/message/63043 Mute This Topic: https://groups.io/mt/75717278/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri May 3 00:59:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+63041+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+63041+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1595383272; cv=none; d=zohomail.com; s=zohoarc; b=TLDdCEAipCDehV9Xh/kZ9TEooXseMO+gIS/3JpUR/SvWP7nmKRUJHb/ro7JoOMTRP3lB1MGTATY87wqqAk0kaXkHdOZQ1mkNjKaL3WFY+0A5RfahdQytm2WvvHHolt6E0lgM8B74e6Wq5fJt6yJKzjz3x9e4J5XplVr7MACCnBU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595383272; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=88KYocuj24gTVo0ORLJPRAoVaWI8Ry4XFO47WlbbfA0=; b=UehCY51YcmnC9R3EJcqFTQAzrMrj/6TUnTlHtMitD8mTZJxwGQuikMCkekVbp2m1r0G77wZ8oas2rB5sq8/ssGC6+/pySYsihDJWXBz2Sc9cdRZkflRWgOu8AqfiwI/eTGxxIt0T9qANhcFVN7u6zeOcsgi4g+D68WytnOw3/PA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+63041+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1595383272375983.9576366917289; Tue, 21 Jul 2020 19:01:12 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id HEWrYY1788612xTUvFB7JOhW; Tue, 21 Jul 2020 19:01:10 -0700 X-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 X-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) X-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-devel] [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> In-Reply-To: <20200722020103.11808-1-Samer.El-Haj-Mahmoud@arm.com> References: <20200722020103.11808-1-Samer.El-Haj-Mahmoud@arm.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,samer.el-haj-mahmoud@arm.com X-Gm-Message-State: saWZEOUqZUH9JL6AAj2OXDZrx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1595383270; bh=+mrL+gFgQG7UnuIbsSzkmeVeOmctW1T7oLBPiSk2L9c=; h=Cc:Date:From:Reply-To:Subject:To; b=PmG/DlL3OGx6FOQTPuoari9/tMjmlUwEmvjPC1sjhJHGrE5WviAYTFVyUN+p8cBWDp8 nDZ+fTb4QPJHwEd1Hc9LwU2IkzAYdveOstW3K+OAbH+aidNWa2mrklofC/CPO9a2znYDL gtHV4Zo8XtCgJAxvl6IdpGfeXHYLXxbNKZM= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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://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 Reviewed-by: Andrei Warkentin Tested-by: Andrei Warkentin --- 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)); =20 ClearScreen (This); return EFI_SUCCESS; --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#63041): https://edk2.groups.io/g/devel/message/63041 Mute This Topic: https://groups.io/mt/75717276/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-