Check the correct sysprop for P010 support for gralloc 3 and 4. am: 960c14db22

Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2441523

Change-Id: Icaf4d03f9722c7b1593619c1153499c957630dd3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Alec Mouri 2023-02-18 02:13:20 +00:00 committed by Automerger Merge Worker
commit 1924f8cb9b
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>
@ -1000,6 +1002,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;