Merge "Tweak IMapper 4.0 VTS to run with AIDL IAllocator" into tm-dev
This commit is contained in:
commit
412f907bd3
14 changed files with 180 additions and 58 deletions
|
@ -32,6 +32,7 @@ cc_library_static {
|
|||
"TestCommandReader.cpp",
|
||||
],
|
||||
static_libs: [
|
||||
"android.hardware.graphics.allocator-V1-ndk",
|
||||
"android.hardware.graphics.composer@2.1",
|
||||
"android.hardware.graphics.mapper@2.0-vts",
|
||||
"android.hardware.graphics.mapper@3.0-vts",
|
||||
|
@ -39,6 +40,7 @@ cc_library_static {
|
|||
"libgtest",
|
||||
],
|
||||
export_static_lib_headers: [
|
||||
"android.hardware.graphics.allocator-V1-ndk",
|
||||
"android.hardware.graphics.composer@2.1",
|
||||
"android.hardware.graphics.mapper@2.0-vts",
|
||||
"android.hardware.graphics.mapper@3.0-vts",
|
||||
|
|
|
@ -318,7 +318,7 @@ Gralloc::Gralloc() {
|
|||
[this] {
|
||||
ASSERT_NO_FATAL_FAILURE(mGralloc4 = std::make_shared<Gralloc4>("default", "default",
|
||||
/*errOnFailure=*/false));
|
||||
if (mGralloc4->getAllocator() == nullptr || mGralloc4->getMapper() == nullptr) {
|
||||
if (!mGralloc4->hasAllocator() || mGralloc4->getMapper() == nullptr) {
|
||||
mGralloc4 = nullptr;
|
||||
ASSERT_NO_FATAL_FAILURE(mGralloc3 = std::make_shared<Gralloc3>("default", "default",
|
||||
/*errOnFailure=*/false));
|
||||
|
|
|
@ -32,14 +32,17 @@ cc_test {
|
|||
// TODO(b/64437680): Assume these libs are always available on the device.
|
||||
shared_libs: [
|
||||
"libbase",
|
||||
"libbinder_ndk",
|
||||
"libfmq",
|
||||
"libsync",
|
||||
"android.hardware.common-V2-ndk",
|
||||
"android.hardware.graphics.mapper@2.0",
|
||||
"android.hardware.graphics.mapper@2.1",
|
||||
"android.hardware.graphics.mapper@3.0",
|
||||
"android.hardware.graphics.mapper@4.0",
|
||||
],
|
||||
static_libs: [
|
||||
"android.hardware.graphics.allocator-V1-ndk",
|
||||
"android.hardware.graphics.allocator@2.0",
|
||||
"android.hardware.graphics.allocator@3.0",
|
||||
"android.hardware.graphics.allocator@4.0",
|
||||
|
@ -49,10 +52,14 @@ cc_test {
|
|||
"android.hardware.graphics.mapper@2.1-vts",
|
||||
"android.hardware.graphics.mapper@3.0-vts",
|
||||
"android.hardware.graphics.mapper@4.0-vts",
|
||||
"libaidlcommonsupport",
|
||||
],
|
||||
header_libs: [
|
||||
"android.hardware.graphics.composer@2.1-command-buffer",
|
||||
],
|
||||
disable_framework: true,
|
||||
test_suites: ["general-tests", "vts"],
|
||||
test_suites: [
|
||||
"general-tests",
|
||||
"vts",
|
||||
],
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ cc_library_static {
|
|||
"libui",
|
||||
],
|
||||
static_libs: [
|
||||
"android.hardware.graphics.allocator-V1-ndk",
|
||||
"android.hardware.graphics.composer@2.1-vts",
|
||||
"android.hardware.graphics.composer@2.2",
|
||||
"android.hardware.graphics.composer3-V1-ndk",
|
||||
|
@ -52,6 +53,7 @@ cc_library_static {
|
|||
"android.hardware.graphics.mapper@4.0-vts",
|
||||
],
|
||||
export_static_lib_headers: [
|
||||
"android.hardware.graphics.allocator-V1-ndk",
|
||||
"android.hardware.graphics.composer@2.1-vts",
|
||||
"android.hardware.graphics.composer@2.2",
|
||||
"android.hardware.graphics.mapper@2.1-vts",
|
||||
|
|
|
@ -184,7 +184,7 @@ Gralloc::Gralloc() {
|
|||
ALOGD("Attempting to initialize gralloc4");
|
||||
ASSERT_NO_FATAL_FAILURE(mGralloc4 = std::make_shared<Gralloc4>("default", "default",
|
||||
/*errOnFailure=*/false));
|
||||
if (mGralloc4->getMapper() == nullptr || mGralloc4->getAllocator() == nullptr) {
|
||||
if (mGralloc4->getMapper() == nullptr || !mGralloc4->hasAllocator()) {
|
||||
mGralloc4 = nullptr;
|
||||
ALOGD("Failed to initialize gralloc4, initializing gralloc3");
|
||||
ASSERT_NO_FATAL_FAILURE(mGralloc3 = std::make_shared<Gralloc3>("default", "default",
|
||||
|
|
|
@ -45,18 +45,21 @@ cc_test {
|
|||
"libGLESv1_CM",
|
||||
"libGLESv2",
|
||||
"libbase",
|
||||
"libbinder_ndk",
|
||||
"libfmq",
|
||||
"libgui",
|
||||
"libhidlbase",
|
||||
"libprocessgroup",
|
||||
"libsync",
|
||||
"libui",
|
||||
"android.hardware.common-V2-ndk",
|
||||
"android.hardware.graphics.mapper@2.0",
|
||||
"android.hardware.graphics.mapper@2.1",
|
||||
"android.hardware.graphics.mapper@3.0",
|
||||
"android.hardware.graphics.mapper@4.0",
|
||||
],
|
||||
static_libs: [
|
||||
"android.hardware.graphics.allocator-V1-ndk",
|
||||
"android.hardware.graphics.allocator@2.0",
|
||||
"android.hardware.graphics.allocator@3.0",
|
||||
"android.hardware.graphics.allocator@4.0",
|
||||
|
@ -70,6 +73,7 @@ cc_test {
|
|||
"android.hardware.graphics.mapper@2.1-vts",
|
||||
"android.hardware.graphics.mapper@3.0-vts",
|
||||
"android.hardware.graphics.mapper@4.0-vts",
|
||||
"libaidlcommonsupport",
|
||||
"libgtest",
|
||||
"librenderengine",
|
||||
"libshaders",
|
||||
|
|
|
@ -32,15 +32,18 @@ cc_test {
|
|||
// TODO(b/64437680): Assume these libs are always available on the device.
|
||||
shared_libs: [
|
||||
"libbase",
|
||||
"libbinder_ndk",
|
||||
"libfmq",
|
||||
"libhidlbase",
|
||||
"libsync",
|
||||
"android.hardware.common-V2-ndk",
|
||||
"android.hardware.graphics.mapper@2.0",
|
||||
"android.hardware.graphics.mapper@2.1",
|
||||
"android.hardware.graphics.mapper@3.0",
|
||||
"android.hardware.graphics.mapper@4.0",
|
||||
],
|
||||
static_libs: [
|
||||
"android.hardware.graphics.allocator-V1-ndk",
|
||||
"android.hardware.graphics.allocator@2.0",
|
||||
"android.hardware.graphics.allocator@3.0",
|
||||
"android.hardware.graphics.allocator@4.0",
|
||||
|
@ -54,6 +57,7 @@ cc_test {
|
|||
"android.hardware.graphics.mapper@2.1-vts",
|
||||
"android.hardware.graphics.mapper@3.0-vts",
|
||||
"android.hardware.graphics.mapper@4.0-vts",
|
||||
"libaidlcommonsupport",
|
||||
],
|
||||
header_libs: [
|
||||
"android.hardware.graphics.composer@2.1-command-buffer",
|
||||
|
@ -61,5 +65,8 @@ cc_test {
|
|||
"android.hardware.graphics.composer@2.3-command-buffer",
|
||||
],
|
||||
disable_framework: true,
|
||||
test_suites: ["general-tests", "vts"],
|
||||
test_suites: [
|
||||
"general-tests",
|
||||
"vts",
|
||||
],
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ cc_library_static {
|
|||
"TestCommandReader.cpp",
|
||||
],
|
||||
static_libs: [
|
||||
"android.hardware.graphics.allocator-V1-ndk",
|
||||
"android.hardware.graphics.composer@2.1",
|
||||
"android.hardware.graphics.composer@2.2",
|
||||
"android.hardware.graphics.composer@2.3-vts",
|
||||
|
|
|
@ -32,14 +32,17 @@ cc_test {
|
|||
// TODO(b/64437680): Assume these libs are always available on the device.
|
||||
shared_libs: [
|
||||
"libbase",
|
||||
"libbinder_ndk",
|
||||
"libfmq",
|
||||
"libsync",
|
||||
"android.hardware.common-V2-ndk",
|
||||
"android.hardware.graphics.mapper@2.0",
|
||||
"android.hardware.graphics.mapper@2.1",
|
||||
"android.hardware.graphics.mapper@3.0",
|
||||
"android.hardware.graphics.mapper@4.0",
|
||||
],
|
||||
static_libs: [
|
||||
"android.hardware.graphics.allocator-V1-ndk",
|
||||
"android.hardware.graphics.allocator@2.0",
|
||||
"android.hardware.graphics.allocator@3.0",
|
||||
"android.hardware.graphics.allocator@4.0",
|
||||
|
@ -55,6 +58,7 @@ cc_test {
|
|||
"android.hardware.graphics.mapper@2.1-vts",
|
||||
"android.hardware.graphics.mapper@3.0-vts",
|
||||
"android.hardware.graphics.mapper@4.0-vts",
|
||||
"libaidlcommonsupport",
|
||||
],
|
||||
header_libs: [
|
||||
"android.hardware.graphics.composer@2.1-command-buffer",
|
||||
|
@ -63,5 +67,8 @@ cc_test {
|
|||
"android.hardware.graphics.composer@2.4-command-buffer",
|
||||
],
|
||||
disable_framework: true,
|
||||
test_suites: ["general-tests", "vts"],
|
||||
test_suites: [
|
||||
"general-tests",
|
||||
"vts",
|
||||
],
|
||||
}
|
||||
|
|
|
@ -32,14 +32,21 @@ cc_library_static {
|
|||
"-g",
|
||||
],
|
||||
static_libs: [
|
||||
"android.hardware.graphics.allocator-V1-ndk",
|
||||
"android.hardware.graphics.allocator@4.0",
|
||||
"android.hardware.graphics.common-V3-ndk",
|
||||
"android.hardware.graphics.mapper@4.0",
|
||||
"libaidlcommonsupport",
|
||||
],
|
||||
shared_libs: [
|
||||
"libbinder_ndk",
|
||||
"libgralloctypes",
|
||||
"libvndksupport",
|
||||
],
|
||||
export_static_lib_headers: [
|
||||
"android.hardware.graphics.allocator-V1-ndk",
|
||||
"android.hardware.graphics.allocator@4.0",
|
||||
"android.hardware.graphics.common-V3-ndk",
|
||||
"android.hardware.graphics.mapper@4.0",
|
||||
],
|
||||
export_include_dirs: ["include"],
|
||||
|
|
|
@ -14,7 +14,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <aidlcommonsupport/NativeHandle.h>
|
||||
#include <android-base/properties.h>
|
||||
#include <android/binder_manager.h>
|
||||
#include <gralloctypes/Gralloc4.h>
|
||||
#include <mapper-vts/4.0/MapperVts.h>
|
||||
|
||||
|
@ -35,8 +37,14 @@ Gralloc::Gralloc(const std::string& allocatorServiceName, const std::string& map
|
|||
}
|
||||
|
||||
void Gralloc::init(const std::string& allocatorServiceName, const std::string& mapperServiceName) {
|
||||
mAllocator = IAllocator::getService(allocatorServiceName);
|
||||
ASSERT_NE(nullptr, mAllocator.get()) << "failed to get allocator service";
|
||||
mAidlAllocator = aidl::android::hardware::graphics::allocator::IAllocator::fromBinder(
|
||||
ndk::SpAIBinder(AServiceManager_checkService(allocatorServiceName.c_str())));
|
||||
|
||||
if (mAidlAllocator == nullptr) {
|
||||
mHidlAllocator = IAllocator::getService(allocatorServiceName);
|
||||
}
|
||||
ASSERT_TRUE(nullptr != mAidlAllocator || mHidlAllocator != nullptr)
|
||||
<< "failed to get allocator service";
|
||||
|
||||
mMapper = IMapper::getService(mapperServiceName);
|
||||
ASSERT_NE(nullptr, mMapper.get()) << "failed to get mapper service";
|
||||
|
@ -45,7 +53,12 @@ void Gralloc::init(const std::string& allocatorServiceName, const std::string& m
|
|||
|
||||
void Gralloc::initNoErr(const std::string& allocatorServiceName,
|
||||
const std::string& mapperServiceName) {
|
||||
mAllocator = IAllocator::getService(allocatorServiceName);
|
||||
mAidlAllocator = aidl::android::hardware::graphics::allocator::IAllocator::fromBinder(
|
||||
ndk::SpAIBinder(AServiceManager_checkService(allocatorServiceName.c_str())));
|
||||
|
||||
if (mAidlAllocator == nullptr) {
|
||||
mHidlAllocator = IAllocator::getService(allocatorServiceName);
|
||||
}
|
||||
|
||||
mMapper = IMapper::getService(mapperServiceName);
|
||||
if (mMapper.get()) {
|
||||
|
@ -68,10 +81,6 @@ Gralloc::~Gralloc() {
|
|||
mImportedBuffers.clear();
|
||||
}
|
||||
|
||||
sp<IAllocator> Gralloc::getAllocator() const {
|
||||
return mAllocator;
|
||||
}
|
||||
|
||||
const native_handle_t* Gralloc::cloneBuffer(const hidl_handle& rawHandle,
|
||||
enum Tolerance /*tolerance*/) {
|
||||
const native_handle_t* bufferHandle = native_handle_clone(rawHandle.getNativeHandle());
|
||||
|
@ -90,30 +99,28 @@ std::vector<const native_handle_t*> Gralloc::allocate(const BufferDescriptor& de
|
|||
uint32_t* outStride) {
|
||||
std::vector<const native_handle_t*> bufferHandles;
|
||||
bufferHandles.reserve(count);
|
||||
mAllocator->allocate(descriptor, count,
|
||||
[&](const auto& tmpError, const auto& tmpStride, const auto& tmpBuffers) {
|
||||
if (canTolerate(tolerance, tmpError)) {
|
||||
|
||||
auto callback = [&](Error error, uint32_t stride,
|
||||
const hidl_vec<hidl_handle>& buffers) -> void {
|
||||
if (canTolerate(tolerance, error)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (tmpError != Error::NONE) {
|
||||
if (base::GetIntProperty("ro.vendor.build.version.sdk", 0, 0,
|
||||
INT_MAX) < 33) {
|
||||
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";
|
||||
}
|
||||
}
|
||||
ASSERT_EQ(count, tmpBuffers.size()) << "invalid buffer array";
|
||||
ASSERT_EQ(count, buffers.size()) << "invalid buffer array";
|
||||
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
const native_handle_t* bufferHandle = nullptr;
|
||||
if (import) {
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
bufferHandle = importBuffer(tmpBuffers[i], tolerance));
|
||||
ASSERT_NO_FATAL_FAILURE(bufferHandle = importBuffer(buffers[i], tolerance));
|
||||
} else {
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
bufferHandle = cloneBuffer(tmpBuffers[i], tolerance));
|
||||
ASSERT_NO_FATAL_FAILURE(bufferHandle = cloneBuffer(buffers[i], tolerance));
|
||||
}
|
||||
if (bufferHandle) {
|
||||
bufferHandles.push_back(bufferHandle);
|
||||
|
@ -121,9 +128,11 @@ std::vector<const native_handle_t*> Gralloc::allocate(const BufferDescriptor& de
|
|||
}
|
||||
|
||||
if (outStride) {
|
||||
*outStride = tmpStride;
|
||||
*outStride = stride;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
rawAllocate(descriptor, count, callback);
|
||||
|
||||
if (::testing::Test::HasFatalFailure()) {
|
||||
bufferHandles.clear();
|
||||
|
@ -147,6 +156,23 @@ const native_handle_t* Gralloc::allocate(const IMapper::BufferDescriptorInfo& de
|
|||
return buffers[0];
|
||||
}
|
||||
|
||||
void Gralloc::rawAllocate(
|
||||
const BufferDescriptor& descriptor, uint32_t count,
|
||||
std::function<void(Error, uint32_t, const hidl_vec<hidl_handle>&)> callback) {
|
||||
if (mAidlAllocator) {
|
||||
aidl::android::hardware::graphics::allocator::AllocationResult result;
|
||||
auto status = mAidlAllocator->allocate(descriptor, count, &result);
|
||||
const Error error = toHidlError(status);
|
||||
std::vector<hidl_handle> handles;
|
||||
for (const auto& aidlHandle : result.buffers) {
|
||||
handles.push_back(hidl_handle(makeFromAidl(aidlHandle)));
|
||||
}
|
||||
callback(error, result.stride, handles);
|
||||
} else {
|
||||
mHidlAllocator->allocate(descriptor, count, callback);
|
||||
}
|
||||
}
|
||||
|
||||
sp<IMapper> Gralloc::getMapper() const {
|
||||
return mMapper;
|
||||
}
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
#include <aidl/android/hardware/graphics/allocator/AllocationError.h>
|
||||
#include <aidl/android/hardware/graphics/allocator/IAllocator.h>
|
||||
#include <android/hardware/graphics/allocator/4.0/IAllocator.h>
|
||||
#include <android/hardware/graphics/mapper/4.0/IMapper.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
@ -51,9 +53,33 @@ class Gralloc {
|
|||
const std::string& mapperServiceName = "default", bool errOnFailure = true);
|
||||
~Gralloc();
|
||||
|
||||
static Error toHidlError(aidl::android::hardware::graphics::allocator::AllocationError error) {
|
||||
switch (error) {
|
||||
case aidl::android::hardware::graphics::allocator::AllocationError::BAD_DESCRIPTOR:
|
||||
return Error::BAD_DESCRIPTOR;
|
||||
case aidl::android::hardware::graphics::allocator::AllocationError::NO_RESOURCES:
|
||||
return Error::NO_RESOURCES;
|
||||
case aidl::android::hardware::graphics::allocator::AllocationError::UNSUPPORTED:
|
||||
return Error::UNSUPPORTED;
|
||||
}
|
||||
}
|
||||
static Error toHidlError(const ndk::ScopedAStatus& status) {
|
||||
if (status.isOk()) {
|
||||
return Error::NONE;
|
||||
}
|
||||
|
||||
if (status.getExceptionCode() != EX_SERVICE_SPECIFIC) {
|
||||
return Error::NO_RESOURCES;
|
||||
}
|
||||
|
||||
return toHidlError(
|
||||
static_cast<aidl::android::hardware::graphics::allocator::AllocationError>(
|
||||
status.getServiceSpecificError()));
|
||||
}
|
||||
|
||||
// IAllocator methods
|
||||
|
||||
sp<IAllocator> getAllocator() const;
|
||||
bool hasAllocator() { return mHidlAllocator != nullptr || mAidlAllocator != nullptr; }
|
||||
|
||||
// When import is false, this simply calls IAllocator::allocate. When import
|
||||
// is true, the returned buffers are also imported into the mapper.
|
||||
|
@ -81,6 +107,10 @@ class Gralloc {
|
|||
return allocate(descriptorInfo, import, Tolerance::kToleranceStrict, outStride);
|
||||
}
|
||||
|
||||
// Dispatches directly to the allocator
|
||||
void rawAllocate(const BufferDescriptor& descriptor, uint32_t count,
|
||||
std::function<void(Error, uint32_t, const hidl_vec<hidl_handle>&)> callback);
|
||||
|
||||
// IMapper methods
|
||||
|
||||
sp<IMapper> getMapper() const;
|
||||
|
@ -143,7 +173,8 @@ class Gralloc {
|
|||
return cloneBuffer(rawHandle, Tolerance::kToleranceStrict);
|
||||
}
|
||||
|
||||
sp<IAllocator> mAllocator;
|
||||
sp<IAllocator> mHidlAllocator;
|
||||
std::shared_ptr<aidl::android::hardware::graphics::allocator::IAllocator> mAidlAllocator;
|
||||
sp<IMapper> mMapper;
|
||||
|
||||
// Keep track of all cloned and imported handles. When a test fails with
|
||||
|
|
|
@ -25,20 +25,27 @@ package {
|
|||
|
||||
cc_test {
|
||||
name: "VtsHalGraphicsMapperV4_0TargetTest",
|
||||
defaults: ["VtsHalTargetTestDefaults"],
|
||||
defaults: [
|
||||
"VtsHalTargetTestDefaults",
|
||||
"use_libaidlvintf_gtest_helper_static",
|
||||
],
|
||||
srcs: ["VtsHalGraphicsMapperV4_0TargetTest.cpp"],
|
||||
static_libs: [
|
||||
"android.hardware.graphics.common-V3-ndk",
|
||||
"android.hardware.graphics.mapper@4.0-vts",
|
||||
"libaidlcommonsupport",
|
||||
"libgralloctypes",
|
||||
"libsync",
|
||||
],
|
||||
shared_libs: [
|
||||
"android.hardware.graphics.allocator-V1-ndk",
|
||||
"android.hardware.graphics.allocator@4.0",
|
||||
"android.hardware.graphics.common@1.0",
|
||||
"android.hardware.graphics.common@1.1",
|
||||
"android.hardware.graphics.common@1.2",
|
||||
"android.hardware.graphics.mapper@4.0",
|
||||
"libbinder_ndk",
|
||||
"libvndksupport",
|
||||
],
|
||||
header_libs: [
|
||||
"libsystem_headers",
|
||||
|
|
|
@ -21,8 +21,12 @@
|
|||
#include <thread>
|
||||
#include <vector>
|
||||
|
||||
#include <aidl/Vintf.h>
|
||||
#include <aidl/android/hardware/graphics/allocator/AllocationError.h>
|
||||
#include <aidl/android/hardware/graphics/allocator/AllocationResult.h>
|
||||
#include <aidl/android/hardware/graphics/common/PixelFormat.h>
|
||||
#include <aidl/android/hardware/graphics/common/PlaneLayoutComponentType.h>
|
||||
#include <aidlcommonsupport/NativeHandle.h>
|
||||
|
||||
#include <android-base/logging.h>
|
||||
#include <android-base/unique_fd.h>
|
||||
|
@ -72,7 +76,7 @@ class GraphicsMapperHidlTest
|
|||
void SetUp() override {
|
||||
ASSERT_NO_FATAL_FAILURE(mGralloc = std::make_unique<Gralloc>(std::get<0>(GetParam()),
|
||||
std::get<1>(GetParam())));
|
||||
ASSERT_NE(nullptr, mGralloc->getAllocator().get());
|
||||
ASSERT_TRUE(mGralloc->hasAllocator());
|
||||
ASSERT_NE(nullptr, mGralloc->getMapper().get());
|
||||
|
||||
mDummyDescriptorInfo.name = "dummy";
|
||||
|
@ -504,8 +508,8 @@ TEST_P(GraphicsMapperHidlTest, AllocatorAllocate) {
|
|||
TEST_P(GraphicsMapperHidlTest, AllocatorAllocateNegative) {
|
||||
// this assumes any valid descriptor is non-empty
|
||||
BufferDescriptor descriptor;
|
||||
mGralloc->getAllocator()->allocate(descriptor, 1,
|
||||
[&](const auto& tmpError, const auto&, const auto&) {
|
||||
|
||||
mGralloc->rawAllocate(descriptor, 1, [&](const auto& tmpError, const auto&, const auto&) {
|
||||
EXPECT_EQ(Error::BAD_DESCRIPTOR, tmpError);
|
||||
});
|
||||
}
|
||||
|
@ -535,9 +539,9 @@ TEST_P(GraphicsMapperHidlTest, AllocatorAllocateThreaded) {
|
|||
std::atomic<uint64_t> allocationCount(0);
|
||||
auto threadLoop = [&]() {
|
||||
while (!timeUp) {
|
||||
mGralloc->getAllocator()->allocate(
|
||||
descriptor, 1,
|
||||
[&](const auto&, const auto&, const auto&) { allocationCount++; });
|
||||
mGralloc->rawAllocate(descriptor, 1, [&](const auto&, const auto&, const auto&) {
|
||||
allocationCount++;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -2755,8 +2759,9 @@ TEST_P(GraphicsMapperHidlTest, GetLargeReservedRegion) {
|
|||
BufferDescriptor descriptor;
|
||||
ASSERT_NO_FATAL_FAILURE(descriptor = mGralloc->createDescriptor(info));
|
||||
|
||||
Error err;
|
||||
mGralloc->getAllocator()->allocate(
|
||||
Error err = Error::NONE;
|
||||
|
||||
mGralloc->rawAllocate(
|
||||
descriptor, 1, [&](const auto& tmpError, const auto&, const auto& tmpBuffers) {
|
||||
err = tmpError;
|
||||
if (err == Error::NONE) {
|
||||
|
@ -2827,11 +2832,27 @@ TEST_P(GraphicsMapperHidlTest, GetReservedRegionBadBuffer) {
|
|||
}
|
||||
|
||||
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GraphicsMapperHidlTest);
|
||||
|
||||
namespace {
|
||||
std::vector<std::string> getAllocatorInstances() {
|
||||
std::vector<std::string> instances;
|
||||
for (auto halInstance : android::hardware::getAllHalInstanceNames(IAllocator::descriptor)) {
|
||||
instances.emplace_back(std::move(halInstance));
|
||||
}
|
||||
|
||||
for (auto aidlInstance : getAidlHalInstanceNames(
|
||||
aidl::android::hardware::graphics::allocator::IAllocator::descriptor)) {
|
||||
instances.emplace_back(std::move(aidlInstance));
|
||||
}
|
||||
|
||||
return instances;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
PerInstance, GraphicsMapperHidlTest,
|
||||
testing::Combine(
|
||||
testing::ValuesIn(
|
||||
android::hardware::getAllHalInstanceNames(IAllocator::descriptor)),
|
||||
testing::ValuesIn(getAllocatorInstances()),
|
||||
testing::ValuesIn(android::hardware::getAllHalInstanceNames(IMapper::descriptor))),
|
||||
android::hardware::PrintInstanceTupleNameToString<>);
|
||||
|
||||
|
|
Loading…
Reference in a new issue