Loading media/codec2/hal/aidl/BufferTypes.cpp +46 −0 Original line number Original line Diff line number Diff line Loading @@ -54,8 +54,10 @@ using ::aidl::android::hardware::media::c2::BaseBlock; using ::aidl::android::hardware::media::c2::utils::BufferPoolTypes; using ::aidl::android::hardware::media::c2::utils::BufferPoolTypes; using AidlNativeHandle = ::aidl::android::hardware::common::NativeHandle; using AidlNativeHandle = ::aidl::android::hardware::common::NativeHandle; using AidlHardwareBuffer = ::aidl::android::hardware::HardwareBuffer; constexpr BaseBlock::Tag NATIVE_BLOCK = BaseBlock::nativeBlock; constexpr BaseBlock::Tag NATIVE_BLOCK = BaseBlock::nativeBlock; constexpr BaseBlock::Tag HWB_BLOCK = BaseBlock::hwbBlock; constexpr BaseBlock::Tag POOLED_BLOCK = BaseBlock::pooledBlock; constexpr BaseBlock::Tag POOLED_BLOCK = BaseBlock::pooledBlock; // BaseBlock -> C2BaseBlock // BaseBlock -> C2BaseBlock Loading Loading @@ -97,6 +99,21 @@ bool objcpy(C2BaseBlock* d, const BaseBlock& s) { } } return false; return false; } } case HWB_BLOCK: { AHardwareBuffer *pBuf = const_cast<AidlHardwareBuffer&>( s.get<HWB_BLOCK>()).release(); d->graphic = _C2BlockFactory::CreateGraphicBlock(pBuf); if (pBuf) { AHardwareBuffer_release(pBuf); } if (d->graphic) { d->type = ::android::C2BaseBlock::GRAPHIC; return true; } LOG(ERROR) << "Improper ahwb in BaseBlock::hwbBlock."; return false; } case POOLED_BLOCK: { case POOLED_BLOCK: { const BufferStatusMessage &bpMessage = s.get<POOLED_BLOCK>(); const BufferStatusMessage &bpMessage = s.get<POOLED_BLOCK>(); std::shared_ptr<ClientManager> bp = ClientManager::getInstance(); std::shared_ptr<ClientManager> bp = ClientManager::getInstance(); Loading Loading @@ -187,6 +204,13 @@ void SetHandle(BaseBlock *block, const C2Handle *handle) { block->set<BaseBlock::nativeBlock>(makeToAidl(handle)); block->set<BaseBlock::nativeBlock>(makeToAidl(handle)); } } template<> void SetAHardwareBuffer(BaseBlock *block, AHardwareBuffer *ahwb) { AHardwareBuffer_acquire(ahwb); block->set<HWB_BLOCK>(AidlHardwareBuffer()); (block->get<HWB_BLOCK>()).reset(ahwb); } template<> template<> void SetPooledBlock<BufferPoolTypes>( void SetPooledBlock<BufferPoolTypes>( BaseBlock *baseBlock, BaseBlock *baseBlock, Loading Loading @@ -326,6 +350,28 @@ bool FromAidl(std::list<std::unique_ptr<C2Work>>* d, const WorkBundle& s) { return ::android::objcpy(d, s); return ::android::objcpy(d, s); } } void ReturnOutputBlocksToClientIfNeeded( const std::list<std::unique_ptr<C2Work>>& workList) { for (const std::unique_ptr<C2Work>& work : workList) { if (!work) { continue; } for (const std::unique_ptr<C2Worklet>& worklet : work->worklets) { if (worklet) { for (const std::shared_ptr<C2Buffer>& buffer : worklet->output.buffers) { if (buffer) { for (const C2ConstGraphicBlock& block : buffer->data().graphicBlocks()) { std::shared_ptr<_C2BlockPoolData> poolData = _C2BlockFactory::GetGraphicBlockPoolData(block); _C2BlockFactory::DisownIgbaBlock(poolData); } } } } } } } } // namespace utils } // namespace utils } // namespace c2 } // namespace c2 } // namespace media } // namespace media Loading media/codec2/hal/aidl/Component.cpp +8 −12 Original line number Original line Diff line number Diff line Loading @@ -113,26 +113,22 @@ struct Component::Listener : public C2Component::Listener { WorkBundle workBundle; WorkBundle workBundle; std::shared_ptr<Component> strongComponent = mComponent.lock(); std::shared_ptr<Component> strongComponent = mComponent.lock(); // TODO // beginTransferBufferQueueBlocks(c2workItems, true); if (!ToAidl(&workBundle, c2workItems, strongComponent ? if (!ToAidl(&workBundle, c2workItems, strongComponent ? &strongComponent->mBufferPoolSender : nullptr)) { &strongComponent->mBufferPoolSender : nullptr)) { LOG(ERROR) << "Component::Listener::onWorkDone_nb -- " LOG(ERROR) << "Component::Listener::onWorkDone_nb -- " << "received corrupted work items."; << "received corrupted work items."; // TODO // endTransferBufferQueueBlocks(c2workItems, false, true); return; return; } } ScopedAStatus transStatus = listener->onWorkDone(workBundle); ScopedAStatus transStatus = listener->onWorkDone(workBundle); if (!transStatus.isOk()) { if (!transStatus.isOk()) { LOG(ERROR) << "Component::Listener::onWorkDone_nb -- " LOG(ERROR) << "Component::Listener::onWorkDone_nb -- " << "transaction failed."; << "transaction failed."; // TODO // endTransferBufferQueueBlocks(c2workItems, false, true); return; return; } } // TODO // If output blocks are originally owned by the client(not by HAL), // endTransferBufferQueueBlocks(c2workItems, true, true); // return the ownership to the client. (Since the blocks are // transferred to the client here.) ReturnOutputBlocksToClientIfNeeded(c2workItems); } } } } Loading Loading @@ -210,15 +206,15 @@ ScopedAStatus Component::flush(WorkBundle *flushedWorkBundle) { } } } } // TODO // beginTransferBufferQueueBlocks(c2flushedWorks, true); if (c2res == C2_OK) { if (c2res == C2_OK) { if (!ToAidl(flushedWorkBundle, c2flushedWorks, &mBufferPoolSender)) { if (!ToAidl(flushedWorkBundle, c2flushedWorks, &mBufferPoolSender)) { c2res = C2_CORRUPTED; c2res = C2_CORRUPTED; } } } } // TODO // If output blocks are originally owned by the client(not by HAL), // endTransferBufferQueueBlocks(c2flushedWorks, true, true); // return the ownership to the client. (Since the blocks are // transferred to the client here.) ReturnOutputBlocksToClientIfNeeded(c2flushedWorks); if (c2res == C2_OK) { if (c2res == C2_OK) { return ScopedAStatus::ok(); return ScopedAStatus::ok(); } } Loading media/codec2/hal/aidl/include/codec2/aidl/BufferTypes.h +6 −0 Original line number Original line Diff line number Diff line Loading @@ -115,6 +115,12 @@ bool FromAidl( std::list<std::unique_ptr<C2Work>>* d, std::list<std::unique_ptr<C2Work>>* d, const WorkBundle& s); const WorkBundle& s); // Return the ownership of output blocks to the client if it is originally // created from the client, after C2Work is returned to the client. // (e.g. C2BqPool / C2IgbaBlockPool) void ReturnOutputBlocksToClientIfNeeded( const std::list<std::unique_ptr<C2Work>>& workList); /** /** * Converts a BufferPool status value to c2_status_t. * Converts a BufferPool status value to c2_status_t. * \param BufferPool status * \param BufferPool status Loading media/codec2/hal/client/GraphicsTracker.cpp +29 −13 Original line number Original line Diff line number Diff line Loading @@ -20,6 +20,7 @@ #include <private/android/AHardwareBufferHelpers.h> #include <private/android/AHardwareBufferHelpers.h> #include <vndk/hardware_buffer.h> #include <vndk/hardware_buffer.h> #include <C2BlockInternal.h> #include <codec2/aidl/GraphicsTracker.h> #include <codec2/aidl/GraphicsTracker.h> namespace aidl::android::hardware::media::c2::implementation { namespace aidl::android::hardware::media::c2::implementation { Loading @@ -30,10 +31,23 @@ static constexpr int kMaxDequeueMin = 1; static constexpr int kMaxDequeueMax = ::android::BufferQueueDefs::NUM_BUFFER_SLOTS - 2; static constexpr int kMaxDequeueMax = ::android::BufferQueueDefs::NUM_BUFFER_SLOTS - 2; c2_status_t retrieveAHardwareBufferId(const C2ConstGraphicBlock &blk, uint64_t *bid) { c2_status_t retrieveAHardwareBufferId(const C2ConstGraphicBlock &blk, uint64_t *bid) { // TODO std::shared_ptr<const _C2BlockPoolData> bpData = _C2BlockFactory::GetGraphicBlockPoolData(blk); (void)blk; if (bpData->getType() != _C2BlockPoolData::TYPE_AHWBUFFER) { (void)bid; return C2_BAD_VALUE; } if (__builtin_available(android __ANDROID_API_T__, *)) { AHardwareBuffer *pBuf; if (!_C2BlockFactory::GetAHardwareBuffer(bpData, &pBuf)) { return C2_CORRUPTED; } int ret = AHardwareBuffer_getId(pBuf, bid); if (ret != ::android::OK) { return C2_CORRUPTED; } return C2_OK; return C2_OK; } else { return C2_OMITTED; } } } } // anonymous namespace } // anonymous namespace Loading @@ -44,6 +58,7 @@ GraphicsTracker::BufferItem::BufferItem( if (!buf) { if (!buf) { return; return; } } if (__builtin_available(android __ANDROID_API_T__, *)) { AHardwareBuffer *pBuf = AHardwareBuffer_from_GraphicBuffer(buf.get()); AHardwareBuffer *pBuf = AHardwareBuffer_from_GraphicBuffer(buf.get()); int ret = AHardwareBuffer_getId(pBuf, &mId); int ret = AHardwareBuffer_getId(pBuf, &mId); if (ret != ::android::OK) { if (ret != ::android::OK) { Loading @@ -55,6 +70,7 @@ GraphicsTracker::BufferItem::BufferItem( mFence = fence; mFence = fence; mInit = true; mInit = true; } } } GraphicsTracker::BufferItem::BufferItem( GraphicsTracker::BufferItem::BufferItem( uint32_t generation, uint32_t generation, Loading media/codec2/hal/common/include/codec2/common/BufferTypes.h +37 −0 Original line number Original line Diff line number Diff line Loading @@ -63,6 +63,9 @@ typedef C2GlobalParam<C2Info, C2Hal_Rect, 1> C2Hal_RectInfo; template <typename BaseBlock> template <typename BaseBlock> void SetHandle(BaseBlock *baseBlock, const C2Handle *handle); void SetHandle(BaseBlock *baseBlock, const C2Handle *handle); template <typename BaseBlock> void SetAHardwareBuffer(BaseBlock *baseBlock, AHardwareBuffer *pBuf); template <typename BufferPoolTypes, typename BaseBlock> template <typename BufferPoolTypes, typename BaseBlock> void SetPooledBlock( void SetPooledBlock( BaseBlock *baseBlock, BaseBlock *baseBlock, Loading Loading @@ -100,6 +103,31 @@ bool _addBaseBlock( return true; return true; } } // Find or add a HAL BaseBlock object from a given AHardwareBuffer* to a list and an // associated map. template <typename BaseBlock> bool _addBaseBlock( uint32_t* index, AHardwareBuffer* pBuf, std::list<BaseBlock>* baseBlocks, std::map<const void*, uint32_t>* baseBlockIndices) { if (!pBuf) { LOG(ERROR) << "addBaseBlock called on a null AHardwareBuffer."; } auto it = baseBlockIndices->find(pBuf); if (it != baseBlockIndices->end()) { *index = it->second; } else { *index = baseBlocks->size(); baseBlockIndices->emplace(pBuf, *index); baseBlocks->emplace_back(); BaseBlock &dBaseBlock = baseBlocks->back(); SetAHardwareBuffer(&dBaseBlock, pBuf); } return true; } // Find or add a hidl BaseBlock object from a given BufferPoolData to a list and // Find or add a hidl BaseBlock object from a given BufferPoolData to a list and // an associated map. // an associated map. template <typename BufferPoolTypes, typename BaseBlock> template <typename BufferPoolTypes, typename BaseBlock> Loading Loading @@ -179,6 +207,15 @@ bool addBaseBlock( return _addBaseBlock( return _addBaseBlock( index, handle, index, handle, baseBlocks, baseBlockIndices); baseBlocks, baseBlockIndices); case _C2BlockPoolData::TYPE_AHWBUFFER: AHardwareBuffer *pBuf; if (!_C2BlockFactory::GetAHardwareBuffer(blockPoolData, &pBuf)) { LOG(ERROR) << "AHardwareBuffer unavailable in a block."; return false; } return _addBaseBlock( index, pBuf, baseBlocks, baseBlockIndices); default: default: LOG(ERROR) << "Unknown C2BlockPoolData type."; LOG(ERROR) << "Unknown C2BlockPoolData type."; return false; return false; Loading Loading
media/codec2/hal/aidl/BufferTypes.cpp +46 −0 Original line number Original line Diff line number Diff line Loading @@ -54,8 +54,10 @@ using ::aidl::android::hardware::media::c2::BaseBlock; using ::aidl::android::hardware::media::c2::utils::BufferPoolTypes; using ::aidl::android::hardware::media::c2::utils::BufferPoolTypes; using AidlNativeHandle = ::aidl::android::hardware::common::NativeHandle; using AidlNativeHandle = ::aidl::android::hardware::common::NativeHandle; using AidlHardwareBuffer = ::aidl::android::hardware::HardwareBuffer; constexpr BaseBlock::Tag NATIVE_BLOCK = BaseBlock::nativeBlock; constexpr BaseBlock::Tag NATIVE_BLOCK = BaseBlock::nativeBlock; constexpr BaseBlock::Tag HWB_BLOCK = BaseBlock::hwbBlock; constexpr BaseBlock::Tag POOLED_BLOCK = BaseBlock::pooledBlock; constexpr BaseBlock::Tag POOLED_BLOCK = BaseBlock::pooledBlock; // BaseBlock -> C2BaseBlock // BaseBlock -> C2BaseBlock Loading Loading @@ -97,6 +99,21 @@ bool objcpy(C2BaseBlock* d, const BaseBlock& s) { } } return false; return false; } } case HWB_BLOCK: { AHardwareBuffer *pBuf = const_cast<AidlHardwareBuffer&>( s.get<HWB_BLOCK>()).release(); d->graphic = _C2BlockFactory::CreateGraphicBlock(pBuf); if (pBuf) { AHardwareBuffer_release(pBuf); } if (d->graphic) { d->type = ::android::C2BaseBlock::GRAPHIC; return true; } LOG(ERROR) << "Improper ahwb in BaseBlock::hwbBlock."; return false; } case POOLED_BLOCK: { case POOLED_BLOCK: { const BufferStatusMessage &bpMessage = s.get<POOLED_BLOCK>(); const BufferStatusMessage &bpMessage = s.get<POOLED_BLOCK>(); std::shared_ptr<ClientManager> bp = ClientManager::getInstance(); std::shared_ptr<ClientManager> bp = ClientManager::getInstance(); Loading Loading @@ -187,6 +204,13 @@ void SetHandle(BaseBlock *block, const C2Handle *handle) { block->set<BaseBlock::nativeBlock>(makeToAidl(handle)); block->set<BaseBlock::nativeBlock>(makeToAidl(handle)); } } template<> void SetAHardwareBuffer(BaseBlock *block, AHardwareBuffer *ahwb) { AHardwareBuffer_acquire(ahwb); block->set<HWB_BLOCK>(AidlHardwareBuffer()); (block->get<HWB_BLOCK>()).reset(ahwb); } template<> template<> void SetPooledBlock<BufferPoolTypes>( void SetPooledBlock<BufferPoolTypes>( BaseBlock *baseBlock, BaseBlock *baseBlock, Loading Loading @@ -326,6 +350,28 @@ bool FromAidl(std::list<std::unique_ptr<C2Work>>* d, const WorkBundle& s) { return ::android::objcpy(d, s); return ::android::objcpy(d, s); } } void ReturnOutputBlocksToClientIfNeeded( const std::list<std::unique_ptr<C2Work>>& workList) { for (const std::unique_ptr<C2Work>& work : workList) { if (!work) { continue; } for (const std::unique_ptr<C2Worklet>& worklet : work->worklets) { if (worklet) { for (const std::shared_ptr<C2Buffer>& buffer : worklet->output.buffers) { if (buffer) { for (const C2ConstGraphicBlock& block : buffer->data().graphicBlocks()) { std::shared_ptr<_C2BlockPoolData> poolData = _C2BlockFactory::GetGraphicBlockPoolData(block); _C2BlockFactory::DisownIgbaBlock(poolData); } } } } } } } } // namespace utils } // namespace utils } // namespace c2 } // namespace c2 } // namespace media } // namespace media Loading
media/codec2/hal/aidl/Component.cpp +8 −12 Original line number Original line Diff line number Diff line Loading @@ -113,26 +113,22 @@ struct Component::Listener : public C2Component::Listener { WorkBundle workBundle; WorkBundle workBundle; std::shared_ptr<Component> strongComponent = mComponent.lock(); std::shared_ptr<Component> strongComponent = mComponent.lock(); // TODO // beginTransferBufferQueueBlocks(c2workItems, true); if (!ToAidl(&workBundle, c2workItems, strongComponent ? if (!ToAidl(&workBundle, c2workItems, strongComponent ? &strongComponent->mBufferPoolSender : nullptr)) { &strongComponent->mBufferPoolSender : nullptr)) { LOG(ERROR) << "Component::Listener::onWorkDone_nb -- " LOG(ERROR) << "Component::Listener::onWorkDone_nb -- " << "received corrupted work items."; << "received corrupted work items."; // TODO // endTransferBufferQueueBlocks(c2workItems, false, true); return; return; } } ScopedAStatus transStatus = listener->onWorkDone(workBundle); ScopedAStatus transStatus = listener->onWorkDone(workBundle); if (!transStatus.isOk()) { if (!transStatus.isOk()) { LOG(ERROR) << "Component::Listener::onWorkDone_nb -- " LOG(ERROR) << "Component::Listener::onWorkDone_nb -- " << "transaction failed."; << "transaction failed."; // TODO // endTransferBufferQueueBlocks(c2workItems, false, true); return; return; } } // TODO // If output blocks are originally owned by the client(not by HAL), // endTransferBufferQueueBlocks(c2workItems, true, true); // return the ownership to the client. (Since the blocks are // transferred to the client here.) ReturnOutputBlocksToClientIfNeeded(c2workItems); } } } } Loading Loading @@ -210,15 +206,15 @@ ScopedAStatus Component::flush(WorkBundle *flushedWorkBundle) { } } } } // TODO // beginTransferBufferQueueBlocks(c2flushedWorks, true); if (c2res == C2_OK) { if (c2res == C2_OK) { if (!ToAidl(flushedWorkBundle, c2flushedWorks, &mBufferPoolSender)) { if (!ToAidl(flushedWorkBundle, c2flushedWorks, &mBufferPoolSender)) { c2res = C2_CORRUPTED; c2res = C2_CORRUPTED; } } } } // TODO // If output blocks are originally owned by the client(not by HAL), // endTransferBufferQueueBlocks(c2flushedWorks, true, true); // return the ownership to the client. (Since the blocks are // transferred to the client here.) ReturnOutputBlocksToClientIfNeeded(c2flushedWorks); if (c2res == C2_OK) { if (c2res == C2_OK) { return ScopedAStatus::ok(); return ScopedAStatus::ok(); } } Loading
media/codec2/hal/aidl/include/codec2/aidl/BufferTypes.h +6 −0 Original line number Original line Diff line number Diff line Loading @@ -115,6 +115,12 @@ bool FromAidl( std::list<std::unique_ptr<C2Work>>* d, std::list<std::unique_ptr<C2Work>>* d, const WorkBundle& s); const WorkBundle& s); // Return the ownership of output blocks to the client if it is originally // created from the client, after C2Work is returned to the client. // (e.g. C2BqPool / C2IgbaBlockPool) void ReturnOutputBlocksToClientIfNeeded( const std::list<std::unique_ptr<C2Work>>& workList); /** /** * Converts a BufferPool status value to c2_status_t. * Converts a BufferPool status value to c2_status_t. * \param BufferPool status * \param BufferPool status Loading
media/codec2/hal/client/GraphicsTracker.cpp +29 −13 Original line number Original line Diff line number Diff line Loading @@ -20,6 +20,7 @@ #include <private/android/AHardwareBufferHelpers.h> #include <private/android/AHardwareBufferHelpers.h> #include <vndk/hardware_buffer.h> #include <vndk/hardware_buffer.h> #include <C2BlockInternal.h> #include <codec2/aidl/GraphicsTracker.h> #include <codec2/aidl/GraphicsTracker.h> namespace aidl::android::hardware::media::c2::implementation { namespace aidl::android::hardware::media::c2::implementation { Loading @@ -30,10 +31,23 @@ static constexpr int kMaxDequeueMin = 1; static constexpr int kMaxDequeueMax = ::android::BufferQueueDefs::NUM_BUFFER_SLOTS - 2; static constexpr int kMaxDequeueMax = ::android::BufferQueueDefs::NUM_BUFFER_SLOTS - 2; c2_status_t retrieveAHardwareBufferId(const C2ConstGraphicBlock &blk, uint64_t *bid) { c2_status_t retrieveAHardwareBufferId(const C2ConstGraphicBlock &blk, uint64_t *bid) { // TODO std::shared_ptr<const _C2BlockPoolData> bpData = _C2BlockFactory::GetGraphicBlockPoolData(blk); (void)blk; if (bpData->getType() != _C2BlockPoolData::TYPE_AHWBUFFER) { (void)bid; return C2_BAD_VALUE; } if (__builtin_available(android __ANDROID_API_T__, *)) { AHardwareBuffer *pBuf; if (!_C2BlockFactory::GetAHardwareBuffer(bpData, &pBuf)) { return C2_CORRUPTED; } int ret = AHardwareBuffer_getId(pBuf, bid); if (ret != ::android::OK) { return C2_CORRUPTED; } return C2_OK; return C2_OK; } else { return C2_OMITTED; } } } } // anonymous namespace } // anonymous namespace Loading @@ -44,6 +58,7 @@ GraphicsTracker::BufferItem::BufferItem( if (!buf) { if (!buf) { return; return; } } if (__builtin_available(android __ANDROID_API_T__, *)) { AHardwareBuffer *pBuf = AHardwareBuffer_from_GraphicBuffer(buf.get()); AHardwareBuffer *pBuf = AHardwareBuffer_from_GraphicBuffer(buf.get()); int ret = AHardwareBuffer_getId(pBuf, &mId); int ret = AHardwareBuffer_getId(pBuf, &mId); if (ret != ::android::OK) { if (ret != ::android::OK) { Loading @@ -55,6 +70,7 @@ GraphicsTracker::BufferItem::BufferItem( mFence = fence; mFence = fence; mInit = true; mInit = true; } } } GraphicsTracker::BufferItem::BufferItem( GraphicsTracker::BufferItem::BufferItem( uint32_t generation, uint32_t generation, Loading
media/codec2/hal/common/include/codec2/common/BufferTypes.h +37 −0 Original line number Original line Diff line number Diff line Loading @@ -63,6 +63,9 @@ typedef C2GlobalParam<C2Info, C2Hal_Rect, 1> C2Hal_RectInfo; template <typename BaseBlock> template <typename BaseBlock> void SetHandle(BaseBlock *baseBlock, const C2Handle *handle); void SetHandle(BaseBlock *baseBlock, const C2Handle *handle); template <typename BaseBlock> void SetAHardwareBuffer(BaseBlock *baseBlock, AHardwareBuffer *pBuf); template <typename BufferPoolTypes, typename BaseBlock> template <typename BufferPoolTypes, typename BaseBlock> void SetPooledBlock( void SetPooledBlock( BaseBlock *baseBlock, BaseBlock *baseBlock, Loading Loading @@ -100,6 +103,31 @@ bool _addBaseBlock( return true; return true; } } // Find or add a HAL BaseBlock object from a given AHardwareBuffer* to a list and an // associated map. template <typename BaseBlock> bool _addBaseBlock( uint32_t* index, AHardwareBuffer* pBuf, std::list<BaseBlock>* baseBlocks, std::map<const void*, uint32_t>* baseBlockIndices) { if (!pBuf) { LOG(ERROR) << "addBaseBlock called on a null AHardwareBuffer."; } auto it = baseBlockIndices->find(pBuf); if (it != baseBlockIndices->end()) { *index = it->second; } else { *index = baseBlocks->size(); baseBlockIndices->emplace(pBuf, *index); baseBlocks->emplace_back(); BaseBlock &dBaseBlock = baseBlocks->back(); SetAHardwareBuffer(&dBaseBlock, pBuf); } return true; } // Find or add a hidl BaseBlock object from a given BufferPoolData to a list and // Find or add a hidl BaseBlock object from a given BufferPoolData to a list and // an associated map. // an associated map. template <typename BufferPoolTypes, typename BaseBlock> template <typename BufferPoolTypes, typename BaseBlock> Loading Loading @@ -179,6 +207,15 @@ bool addBaseBlock( return _addBaseBlock( return _addBaseBlock( index, handle, index, handle, baseBlocks, baseBlockIndices); baseBlocks, baseBlockIndices); case _C2BlockPoolData::TYPE_AHWBUFFER: AHardwareBuffer *pBuf; if (!_C2BlockFactory::GetAHardwareBuffer(blockPoolData, &pBuf)) { LOG(ERROR) << "AHardwareBuffer unavailable in a block."; return false; } return _addBaseBlock( index, pBuf, baseBlocks, baseBlockIndices); default: default: LOG(ERROR) << "Unknown C2BlockPoolData type."; LOG(ERROR) << "Unknown C2BlockPoolData type."; return false; return false; Loading