From 78d76ea43f2f1471c6076a77714e3cd559763543 Mon Sep 17 00:00:00 2001 From: Alec Mouri Date: Mon, 30 Jan 2023 22:09:42 +0000 Subject: [PATCH] Check the correct sysprop for P010 support for gralloc 3 and 4. We need to check the first api level that the vendor shipped with. Also check P010 support in the preamble of the relevant test rather than in allocate(), since otherwise either allocate() may incorrectly skip some tests or allocate() may succeed but with the wrong layout information. Bug: 257442231 Test: VtsHalGraphicsMapperV4_0TargetTest Change-Id: I00ae5aa01117704158c38f0689e91df99473e208 --- graphics/mapper/3.0/utils/vts/MapperVts.cpp | 6 +----- .../vts/functional/VtsHalGraphicsMapperV3_0TargetTest.cpp | 4 ++++ graphics/mapper/4.0/utils/vts/MapperVts.cpp | 6 +----- .../vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp | 5 +++++ 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/graphics/mapper/3.0/utils/vts/MapperVts.cpp b/graphics/mapper/3.0/utils/vts/MapperVts.cpp index c470a4aca0..48e5736f8d 100644 --- a/graphics/mapper/3.0/utils/vts/MapperVts.cpp +++ b/graphics/mapper/3.0/utils/vts/MapperVts.cpp @@ -99,11 +99,7 @@ std::vector Gralloc::allocate(const BufferDescriptor& de descriptor, count, [&](const auto& tmpError, const auto& tmpStride, const auto& tmpBuffers) { if (tmpError != Error::NONE) { - if (base::GetIntProperty("ro.vendor.build.version.sdk", 0, 0, INT_MAX) < 33) { - GTEST_SKIP() << "Old vendor grallocs may not support P010"; - } else { - GTEST_FAIL() << "failed to allocate buffers"; - } + GTEST_FAIL() << "failed to allocate buffers"; } ASSERT_EQ(count, tmpBuffers.size()) << "invalid buffer array"; diff --git a/graphics/mapper/3.0/vts/functional/VtsHalGraphicsMapperV3_0TargetTest.cpp b/graphics/mapper/3.0/vts/functional/VtsHalGraphicsMapperV3_0TargetTest.cpp index 3b1bfab867..997af97807 100644 --- a/graphics/mapper/3.0/vts/functional/VtsHalGraphicsMapperV3_0TargetTest.cpp +++ b/graphics/mapper/3.0/vts/functional/VtsHalGraphicsMapperV3_0TargetTest.cpp @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -330,6 +331,9 @@ TEST_P(GraphicsMapperHidlTest, LockUnlockBasic) { * Test IMapper::lockYCbCr. This locks a YCbCr_P010 buffer and verifies that it's initialized. */ TEST_P(GraphicsMapperHidlTest, LockYCbCrP010) { + if (base::GetIntProperty("ro.vendor.api_level", __ANDROID_API_FUTURE__) < __ANDROID_API_T__) { + GTEST_SKIP() << "Old vendor grallocs may not support P010"; + } auto info = mDummyDescriptorInfo; info.format = PixelFormat::YCBCR_P010; diff --git a/graphics/mapper/4.0/utils/vts/MapperVts.cpp b/graphics/mapper/4.0/utils/vts/MapperVts.cpp index c6c9834eaf..d70c6ef0c9 100644 --- a/graphics/mapper/4.0/utils/vts/MapperVts.cpp +++ b/graphics/mapper/4.0/utils/vts/MapperVts.cpp @@ -111,11 +111,7 @@ std::vector Gralloc::allocate(const BufferDescriptor& de } if (error != Error::NONE) { - if (base::GetIntProperty("ro.vendor.build.version.sdk", 0, 0, INT_MAX) < 33) { - GTEST_SKIP() << "Old vendor grallocs may not support P010"; - } else { - GTEST_FAIL() << "failed to allocate buffers"; - } + GTEST_FAIL() << "failed to allocate buffers"; } ASSERT_EQ(count, buffers.size()) << "invalid buffer array"; diff --git a/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp b/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp index 1e7cb8ef4c..e4a84e1caf 100644 --- a/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp +++ b/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp @@ -29,12 +29,14 @@ #include #include +#include #include #include #include #include #include #include + #include #include @@ -998,6 +1000,9 @@ TEST_P(GraphicsMapperHidlTest, Lock_RAW12) { } TEST_P(GraphicsMapperHidlTest, Lock_YCBCR_P010) { + if (base::GetIntProperty("ro.vendor.api_level", __ANDROID_API_FUTURE__) < __ANDROID_API_T__) { + GTEST_SKIP() << "Old vendor grallocs may not support P010"; + } auto info = mDummyDescriptorInfo; info.format = PixelFormat::YCBCR_P010;