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.web09.13461.1656518376562738743 for ; Wed, 29 Jun 2022 08:59:36 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: dimitrije.pavlov@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 58BA3152B; Wed, 29 Jun 2022 08:59:36 -0700 (PDT) Received: from R90X9F89.arm.com (R90X9F89.arm.com [10.118.110.138]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id F35813F66F; Wed, 29 Jun 2022 08:59:35 -0700 (PDT) From: "Dimitrije Pavlov" To: devel@edk2.groups.io Cc: G Edhaya Chandran , Jeff Booher-Kaeding , Samer El-Haj-Mahmoud , Sunny Wang , Jeremy Linton Subject: [edk2-test][PATCH v1 1/1] uefi-sct/SctPkg: Don't always check PixelInformation Date: Wed, 29 Jun 2022 10:59:28 -0500 Message-Id: <20220629155928.5703-1-Dimitrije.Pavlov@arm.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit According to UEFI 2.9 Section 12.9, the PixelInformation field of the EFI_GRAPHICS_OUTPUT_MODE_INFORMATION structure is valid only if PixelFormat is PixelBitMask. The current implementation always checks the contents of PixelInformation field of the EFI_GRAPHICS_OUTPUT_MODE_INFORMATION structure returned by QueryMode, regardless of PixelFormat. Check PixelInformation only if PixelFormat is PixelBitMask. Cc: G Edhaya Chandran Cc: Jeff Booher-Kaeding Cc: Samer El-Haj-Mahmoud Cc: Sunny Wang Cc: Jeremy Linton Signed-off-by: Dimitrije Pavlov --- uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/GraphicsOutput/BlackBoxTest/GraphicsOutputBBTestConformance.c | 30 ++++++++++++++------ uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/GraphicsOutput/BlackBoxTest/GraphicsOutputBBTestFunction.c | 19 +++++++++---- 2 files changed, 35 insertions(+), 14 deletions(-) diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/GraphicsOutput/BlackBoxTest/GraphicsOutputBBTestConformance.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/GraphicsOutput/BlackBoxTest/GraphicsOutputBBTestConformance.c index 13e7227f5845..b2bff9d756b1 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/GraphicsOutput/BlackBoxTest/GraphicsOutputBBTestConformance.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/GraphicsOutput/BlackBoxTest/GraphicsOutputBBTestConformance.c @@ -493,16 +493,28 @@ Returns: ); if (Status != EFI_SUCCESS) { AssertionType = EFI_TEST_ASSERTION_FAILED; - } else { + } else { AssertionType = EFI_TEST_ASSERTION_PASSED; - } - - if (SctCompareMem ( - (void *) info, - (void *) GraphicsOutput->Mode->Info, - sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION) - ) != 0) { - AssertionType = EFI_TEST_ASSERTION_FAILED; + if (info != NULL) { + // + // PixelInformation is checked only if PixelFormat is PixelBitMask + // + if ( info->Version != GraphicsOutput->Mode->Info->Version + || info->HorizontalResolution != GraphicsOutput->Mode->Info->HorizontalResolution + || info->VerticalResolution != GraphicsOutput->Mode->Info->VerticalResolution + || info->PixelFormat != GraphicsOutput->Mode->Info->PixelFormat + || info->PixelsPerScanLine != GraphicsOutput->Mode->Info->PixelsPerScanLine + || ( info->PixelFormat == PixelBitMask + && ( info->PixelInformation.RedMask != GraphicsOutput->Mode->Info->PixelInformation.RedMask + || info->PixelInformation.GreenMask != GraphicsOutput->Mode->Info->PixelInformation.GreenMask + || info->PixelInformation.BlueMask != GraphicsOutput->Mode->Info->PixelInformation.BlueMask + || info->PixelInformation.ReservedMask != GraphicsOutput->Mode->Info->PixelInformation.ReservedMask))) + { + AssertionType = EFI_TEST_ASSERTION_FAILED; + } + } else { + AssertionType = EFI_TEST_ASSERTION_FAILED; + } } if (info != NULL) { diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/GraphicsOutput/BlackBoxTest/GraphicsOutputBBTestFunction.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/GraphicsOutput/BlackBoxTest/GraphicsOutputBBTestFunction.c index da51fbc44596..f31ea8175af8 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/GraphicsOutput/BlackBoxTest/GraphicsOutputBBTestFunction.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/GraphicsOutput/BlackBoxTest/GraphicsOutputBBTestFunction.c @@ -125,11 +125,20 @@ Returns: } else { AssertionType = EFI_TEST_ASSERTION_PASSED; if (Info != NULL) { - if (SctCompareMem ( - (void *) Info, - (void *) GraphicsOutput->Mode->Info, - sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION) - ) != 0) { + // + // PixelInformation is checked only if PixelFormat is PixelBitMask + // + if ( Info->Version != GraphicsOutput->Mode->Info->Version + || Info->HorizontalResolution != GraphicsOutput->Mode->Info->HorizontalResolution + || Info->VerticalResolution != GraphicsOutput->Mode->Info->VerticalResolution + || Info->PixelFormat != GraphicsOutput->Mode->Info->PixelFormat + || Info->PixelsPerScanLine != GraphicsOutput->Mode->Info->PixelsPerScanLine + || ( Info->PixelFormat == PixelBitMask + && ( Info->PixelInformation.RedMask != GraphicsOutput->Mode->Info->PixelInformation.RedMask + || Info->PixelInformation.GreenMask != GraphicsOutput->Mode->Info->PixelInformation.GreenMask + || Info->PixelInformation.BlueMask != GraphicsOutput->Mode->Info->PixelInformation.BlueMask + || Info->PixelInformation.ReservedMask != GraphicsOutput->Mode->Info->PixelInformation.ReservedMask))) + { AssertionType = EFI_TEST_ASSERTION_FAILED; } } else { -- 2.34.1