diff options
author | 2019-02-01 09:54:20 -0800 | |
---|---|---|
committer | 2019-02-04 16:47:19 -0800 | |
commit | ddbfaeb7a6b67e93f7a2519c7725561de644d671 (patch) | |
tree | 0161fdf35ad94bd2f4ee25fb25b48eee6067c4d9 /libs/ui/Gralloc3.cpp | |
parent | 3b7f2022cd288f9bfcb2ba8f775eef6caca92dad (diff) |
Adding isSupported HIDL Mapper function support to framework
Bug: 123423521
Test: build, boot, manual testing
Change-Id: Iee52de6f5610a8465b1f4435d02dc61a8064064a
Diffstat (limited to 'libs/ui/Gralloc3.cpp')
-rw-r--r-- | libs/ui/Gralloc3.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/libs/ui/Gralloc3.cpp b/libs/ui/Gralloc3.cpp index 306a74b80c..7f8e57c9cb 100644 --- a/libs/ui/Gralloc3.cpp +++ b/libs/ui/Gralloc3.cpp @@ -314,6 +314,36 @@ int Gralloc3Mapper::unlock(buffer_handle_t bufferHandle) const { return releaseFence; } +status_t Gralloc3Mapper::isSupported(uint32_t width, uint32_t height, android::PixelFormat format, + uint32_t layerCount, uint64_t usage, + bool* outSupported) const { + IMapper::BufferDescriptorInfo descriptorInfo; + sBufferDescriptorInfo(width, height, format, layerCount, usage, &descriptorInfo); + + Error error; + auto ret = mMapper->isSupported(descriptorInfo, + [&](const auto& tmpError, const auto& tmpSupported) { + error = tmpError; + if (error != Error::NONE) { + return; + } + if (outSupported) { + *outSupported = tmpSupported; + } + }); + + if (!ret.isOk()) { + error = kTransactionError; + } + + if (error != Error::NONE) { + ALOGE("isSupported(%u, %u, %d, %u, ...) failed with %d", width, height, format, layerCount, + error); + } + + return static_cast<status_t>(error); +} + Gralloc3Allocator::Gralloc3Allocator(const Gralloc3Mapper& mapper) : mMapper(mapper) { mAllocator = IAllocator::getService(); if (mAllocator == nullptr) { |