diff options
author | ramindani <ramindani@google.com> | 2022-06-04 00:16:44 +0000 |
---|---|---|
committer | ramindani <ramindani@google.com> | 2022-06-07 23:33:12 +0000 |
commit | b2b747ffd4b8a2fb1e1be6f8563df0de710e5cc0 (patch) | |
tree | db49ab1cc23688cb3b7acb8a454db2e7cce2f6af | |
parent | 000c0144ced9640f97d3f79024d387ef2bed81c7 (diff) |
[VTS] Update allocator name for AIDL allocator.
We used "default" value for the allocator in the test
and this value was used as is for the AIDL allocator.
This caused the test to fail because we were not able to acquire the
appropriate allocator as AIDL allocator instance is not named "default".
Update the test to use the correct instance name for AIDL allocator,
if available.
Test: atest VtsHalGraphicsComposerV2_1TargetTest
atest VtsHalGraphicsComposerV2_2TargetTest
atest VtsHalGraphicsComposerV2_3TargetTest
atest VtsHalGraphicsComposerV2_4TargetTest
atest VtsHalGraphicsComposer3_TargetTest
BUG: 234671596
test results after updates:
VTS 2.1 : http://ab/I84600010058657636
VTS 2.2 : http://ab/I51800010058498973
VTS 2.3 : http://ab/I87700010058914863
VTS 2.4 : http://ab/I88900010058592031
VTS 3.0 : http://ab/I96200010058838905
Change-Id: I04ae1a18d757cfd941d4929ad08f6bb2c8643f76
6 files changed, 35 insertions, 16 deletions
diff --git a/graphics/composer/2.1/utils/vts/ComposerVts.cpp b/graphics/composer/2.1/utils/vts/ComposerVts.cpp index e777010483..4603dd1b8c 100644 --- a/graphics/composer/2.1/utils/vts/ComposerVts.cpp +++ b/graphics/composer/2.1/utils/vts/ComposerVts.cpp @@ -316,8 +316,12 @@ NativeHandleWrapper::~NativeHandleWrapper() { Gralloc::Gralloc() { [this] { - ASSERT_NO_FATAL_FAILURE(mGralloc4 = std::make_shared<Gralloc4>("default", "default", - /*errOnFailure=*/false)); + ASSERT_NO_FATAL_FAILURE(mGralloc4 = std::make_shared<Gralloc4>( + /*aidlAllocatorServiceName*/ IAllocator::descriptor + + std::string("/default"), + /*hidlAllocatorServiceName*/ "default", + /*mapperServiceName*/ "default", + /*errOnFailure=*/false)); if (!mGralloc4->hasAllocator() || mGralloc4->getMapper() == nullptr) { mGralloc4 = nullptr; ASSERT_NO_FATAL_FAILURE(mGralloc3 = std::make_shared<Gralloc3>("default", "default", diff --git a/graphics/composer/2.1/utils/vts/include/composer-vts/2.1/ComposerVts.h b/graphics/composer/2.1/utils/vts/include/composer-vts/2.1/ComposerVts.h index 2949823364..f8ea661f12 100644 --- a/graphics/composer/2.1/utils/vts/include/composer-vts/2.1/ComposerVts.h +++ b/graphics/composer/2.1/utils/vts/include/composer-vts/2.1/ComposerVts.h @@ -49,6 +49,7 @@ using IMapper4 = android::hardware::graphics::mapper::V4_0::IMapper; using Gralloc2 = android::hardware::graphics::mapper::V2_0::vts::Gralloc; using Gralloc3 = android::hardware::graphics::mapper::V3_0::vts::Gralloc; using Gralloc4 = android::hardware::graphics::mapper::V4_0::vts::Gralloc; +using IAllocator = aidl::android::hardware::graphics::allocator::IAllocator; class ComposerClient; diff --git a/graphics/composer/2.2/utils/vts/ComposerVts.cpp b/graphics/composer/2.2/utils/vts/ComposerVts.cpp index 7de4007d01..b706596df4 100644 --- a/graphics/composer/2.2/utils/vts/ComposerVts.cpp +++ b/graphics/composer/2.2/utils/vts/ComposerVts.cpp @@ -182,8 +182,12 @@ std::array<float, 16> ComposerClient::getDataspaceSaturationMatrix(Dataspace dat Gralloc::Gralloc() { [this] { ALOGD("Attempting to initialize gralloc4"); - ASSERT_NO_FATAL_FAILURE(mGralloc4 = std::make_shared<Gralloc4>("default", "default", - /*errOnFailure=*/false)); + ASSERT_NO_FATAL_FAILURE(mGralloc4 = std::make_shared<Gralloc4>( + /*aidlAllocatorServiceName*/ IAllocator::descriptor + + std::string("/default"), + /*hidlAllocatorServiceName*/ "default", + /*mapperServiceName*/ "default", + /*errOnFailure=*/false)); if (mGralloc4->getMapper() == nullptr || !mGralloc4->hasAllocator()) { mGralloc4 = nullptr; ALOGD("Failed to initialize gralloc4, initializing gralloc3"); diff --git a/graphics/composer/2.2/utils/vts/include/composer-vts/2.2/ComposerVts.h b/graphics/composer/2.2/utils/vts/include/composer-vts/2.2/ComposerVts.h index d3bba17ed3..02d7bdb9da 100644 --- a/graphics/composer/2.2/utils/vts/include/composer-vts/2.2/ComposerVts.h +++ b/graphics/composer/2.2/utils/vts/include/composer-vts/2.2/ComposerVts.h @@ -48,6 +48,7 @@ using Gralloc2 = android::hardware::graphics::mapper::V2_0::vts::Gralloc; using Gralloc2_1 = android::hardware::graphics::mapper::V2_1::vts::Gralloc; using Gralloc3 = android::hardware::graphics::mapper::V3_0::vts::Gralloc; using Gralloc4 = android::hardware::graphics::mapper::V4_0::vts::Gralloc; +using IAllocator = aidl::android::hardware::graphics::allocator::IAllocator; class ComposerClient; diff --git a/graphics/mapper/4.0/utils/vts/MapperVts.cpp b/graphics/mapper/4.0/utils/vts/MapperVts.cpp index e4a2535a92..c6c9834eaf 100644 --- a/graphics/mapper/4.0/utils/vts/MapperVts.cpp +++ b/graphics/mapper/4.0/utils/vts/MapperVts.cpp @@ -27,21 +27,24 @@ namespace mapper { namespace V4_0 { namespace vts { -Gralloc::Gralloc(const std::string& allocatorServiceName, const std::string& mapperServiceName, +Gralloc::Gralloc(const std::string& aidlAllocatorServiceName, + const std::string& hidlAllocatorServiceName, const std::string& mapperServiceName, bool errOnFailure) { if (errOnFailure) { - init(allocatorServiceName, mapperServiceName); + init(aidlAllocatorServiceName, hidlAllocatorServiceName, mapperServiceName); } else { - initNoErr(allocatorServiceName, mapperServiceName); + initNoErr(aidlAllocatorServiceName, hidlAllocatorServiceName, mapperServiceName); } } -void Gralloc::init(const std::string& allocatorServiceName, const std::string& mapperServiceName) { +void Gralloc::init(const std::string& aidlAllocatorServiceName, + const std::string& hidlAllocatorServiceName, + const std::string& mapperServiceName) { mAidlAllocator = aidl::android::hardware::graphics::allocator::IAllocator::fromBinder( - ndk::SpAIBinder(AServiceManager_checkService(allocatorServiceName.c_str()))); + ndk::SpAIBinder(AServiceManager_checkService(aidlAllocatorServiceName.c_str()))); if (mAidlAllocator == nullptr) { - mHidlAllocator = IAllocator::getService(allocatorServiceName); + mHidlAllocator = IAllocator::getService(hidlAllocatorServiceName); } ASSERT_TRUE(nullptr != mAidlAllocator || mHidlAllocator != nullptr) << "failed to get allocator service"; @@ -51,13 +54,14 @@ void Gralloc::init(const std::string& allocatorServiceName, const std::string& m ASSERT_FALSE(mMapper->isRemote()) << "mapper is not in passthrough mode"; } -void Gralloc::initNoErr(const std::string& allocatorServiceName, +void Gralloc::initNoErr(const std::string& aidlAllocatorServiceName, + const std::string& hidlAllocatorServiceName, const std::string& mapperServiceName) { mAidlAllocator = aidl::android::hardware::graphics::allocator::IAllocator::fromBinder( - ndk::SpAIBinder(AServiceManager_checkService(allocatorServiceName.c_str()))); + ndk::SpAIBinder(AServiceManager_checkService(aidlAllocatorServiceName.c_str()))); if (mAidlAllocator == nullptr) { - mHidlAllocator = IAllocator::getService(allocatorServiceName); + mHidlAllocator = IAllocator::getService(hidlAllocatorServiceName); } mMapper = IMapper::getService(mapperServiceName); diff --git a/graphics/mapper/4.0/utils/vts/include/mapper-vts/4.0/MapperVts.h b/graphics/mapper/4.0/utils/vts/include/mapper-vts/4.0/MapperVts.h index b956e494aa..ecbbc58c42 100644 --- a/graphics/mapper/4.0/utils/vts/include/mapper-vts/4.0/MapperVts.h +++ b/graphics/mapper/4.0/utils/vts/include/mapper-vts/4.0/MapperVts.h @@ -49,7 +49,9 @@ class Gralloc { kToleranceAllErrors = ~0x0U, }; - Gralloc(const std::string& allocatorServiceName = "default", + Gralloc(const std::string& aidlAllocatorServiceName = + "android.hardware.graphics.allocator.IAllocator/default", + const std::string& hidlAllocatorServiceName = "default", const std::string& mapperServiceName = "default", bool errOnFailure = true); ~Gralloc(); @@ -164,10 +166,13 @@ class Gralloc { 0x1U << std::underlying_type_t<Error>(error)) != 0; } - void init(const std::string& allocatorServiceName, const std::string& mapperServiceName); + void init(const std::string& aidlAllocatorServiceName, + const std::string& hidlAllocatorServiceName, const std::string& mapperServiceName); // initialize without checking for failure to get service - void initNoErr(const std::string& allocatorServiceName, const std::string& mapperServiceName); + void initNoErr(const std::string& aidlAllocatorServiceName, + const std::string& hidlAllocatorServiceName, + const std::string& mapperServiceName); const native_handle_t* cloneBuffer(const hidl_handle& rawHandle, enum Tolerance tolerance); const native_handle_t* cloneBuffer(const hidl_handle& rawHandle) { return cloneBuffer(rawHandle, Tolerance::kToleranceStrict); |