Merge "[VTS] Update allocator name for AIDL allocator." into tm-dev am: 82b65f9e42
am: 588b928a12
am: a1fe4c4667
Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/interfaces/+/18739824 Change-Id: Id02748ca94a67578f7f32749cfc0928a96927c6c Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
7a6d2f9d88
6 changed files with 35 additions and 16 deletions
|
@ -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",
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue