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
This commit is contained in:
Alec Mouri
2023-01-30 22:09:42 +00:00
parent 968ba124e0
commit 78d76ea43f
4 changed files with 11 additions and 10 deletions

View File

@@ -99,11 +99,7 @@ std::vector<const native_handle_t*> 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";

View File

@@ -21,6 +21,7 @@
#include <vector>
#include <android-base/logging.h>
#include <android-base/properties.h>
#include <gtest/gtest.h>
#include <hidl/GtestPrinter.h>
#include <hidl/ServiceManagement.h>
@@ -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;

View File

@@ -111,11 +111,7 @@ std::vector<const native_handle_t*> 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";

View File

@@ -29,12 +29,14 @@
#include <aidlcommonsupport/NativeHandle.h>
#include <android-base/logging.h>
#include <android-base/properties.h>
#include <android-base/unique_fd.h>
#include <android/sync.h>
#include <gralloctypes/Gralloc4.h>
#include <gtest/gtest.h>
#include <hidl/GtestPrinter.h>
#include <hidl/ServiceManagement.h>
#include <mapper-vts/4.0/MapperVts.h>
#include <system/graphics.h>
@@ -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;