summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
authorValerie Hau <vhau@google.com>2019-04-17 16:17:52 -0700
committerValerie Hau <vhau@google.com>2019-04-22 17:50:02 -0700
commit69ee26a3891b8652c8c67fc8f8a262368f6fa7ff (patch)
treefb3da02f3a66c8f85730462a4d6dbf69026781f8 /graphics
parent3f99e1db08da6680bebb15ac8a0aa50b48d69f0e (diff)
downloadandroid_hardware_interfaces-69ee26a3891b8652c8c67fc8f8a262368f6fa7ff.tar.gz
android_hardware_interfaces-69ee26a3891b8652c8c67fc8f8a262368f6fa7ff.tar.bz2
android_hardware_interfaces-69ee26a3891b8652c8c67fc8f8a262368f6fa7ff.zip
Call into validateBufferSize and getTransportSize
After adding validateBufferSize and getTransportSize, call into these functions if they have been implemented Bug: 130669566 Test: build, boot Change-Id: I445cb6122107a514bc0bf433a9e140dbe3122573
Diffstat (limited to 'graphics')
-rw-r--r--graphics/mapper/2.1/utils/passthrough/include/mapper-passthrough/2.1/Gralloc0Hal.h48
1 files changed, 31 insertions, 17 deletions
diff --git a/graphics/mapper/2.1/utils/passthrough/include/mapper-passthrough/2.1/Gralloc0Hal.h b/graphics/mapper/2.1/utils/passthrough/include/mapper-passthrough/2.1/Gralloc0Hal.h
index b704fdba4..18fbb6d03 100644
--- a/graphics/mapper/2.1/utils/passthrough/include/mapper-passthrough/2.1/Gralloc0Hal.h
+++ b/graphics/mapper/2.1/utils/passthrough/include/mapper-passthrough/2.1/Gralloc0Hal.h
@@ -34,34 +34,48 @@ using V2_0::Error;
template <typename Hal>
class Gralloc0HalImpl : public V2_0::passthrough::detail::Gralloc0HalImpl<Hal> {
public:
- Error validateBufferSize(const native_handle_t* /*bufferHandle*/,
- const IMapper::BufferDescriptorInfo& /*descriptorInfo*/,
- uint32_t /*stride*/) override {
- // need a gralloc0 extension to really validate
- return Error::NONE;
- }
+ Error validateBufferSize(const native_handle_t* bufferHandle,
+ const IMapper::BufferDescriptorInfo& descriptorInfo,
+ uint32_t stride) override {
+ if (!mModule->validateBufferSize) {
+ return Error::NONE;
+ }
+
+ int32_t ret = mModule->validateBufferSize(
+ mModule, bufferHandle, descriptorInfo.width, descriptorInfo.height,
+ static_cast<int32_t>(descriptorInfo.format),
+ static_cast<uint64_t>(descriptorInfo.usage), stride);
+ return static_cast<Error>(ret);
+ }
+ Error getTransportSize(const native_handle_t* bufferHandle, uint32_t* outNumFds,
+ uint32_t* outNumInts) override {
+ if (!mModule->getTransportSize) {
+ *outNumFds = bufferHandle->numFds;
+ *outNumInts = bufferHandle->numInts;
+ return Error::NONE;
+ }
- Error getTransportSize(const native_handle_t* bufferHandle, uint32_t* outNumFds,
- uint32_t* outNumInts) override {
- // need a gralloc0 extension to get the transport size
- *outNumFds = bufferHandle->numFds;
- *outNumInts = bufferHandle->numInts;
- return Error::NONE;
+ int32_t ret = mModule->getTransportSize(mModule, bufferHandle, outNumFds, outNumInts);
+ return static_cast<Error>(ret);
}
Error createDescriptor_2_1(const IMapper::BufferDescriptorInfo& descriptorInfo,
BufferDescriptor* outDescriptor) override {
return createDescriptor(
- V2_0::IMapper::BufferDescriptorInfo{
- descriptorInfo.width, descriptorInfo.height, descriptorInfo.layerCount,
- static_cast<common::V1_0::PixelFormat>(descriptorInfo.format), descriptorInfo.usage,
- },
- outDescriptor);
+ V2_0::IMapper::BufferDescriptorInfo{
+ descriptorInfo.width,
+ descriptorInfo.height,
+ descriptorInfo.layerCount,
+ static_cast<common::V1_0::PixelFormat>(descriptorInfo.format),
+ descriptorInfo.usage,
+ },
+ outDescriptor);
}
private:
using BaseType2_0 = V2_0::passthrough::detail::Gralloc0HalImpl<Hal>;
using BaseType2_0::createDescriptor;
+ using BaseType2_0::mModule;
};
} // namespace detail