Loading media/codec2/hal/aidl/Component.cpp +17 −0 Original line number Diff line number Diff line Loading @@ -209,6 +209,22 @@ Component::Component( mInterface = SharedRefBase::make<ComponentInterface>( component->intf(), mMultiAccessUnitIntf, store->getParameterCache()); mInit = mInterface->status(); mBlockFenceSupport = false; if (mInit != C2_OK) { return; } std::shared_ptr<C2ComponentInterface> intf = component->intf(); if (!intf) { return; } c2_status_t err = C2_OK; std::vector<std::unique_ptr<C2Param>> heapParams; C2ApiFeaturesSetting features = (C2Config::api_feature_t)0; err = intf->query_vb({&features}, {}, C2_MAY_BLOCK, &heapParams); if (err == C2_OK && ((features.value & C2Config::API_BLOCK_FENCES) != 0)) { mBlockFenceSupport = true; } } c2_status_t Component::status() const { Loading Loading @@ -363,6 +379,7 @@ ScopedAStatus Component::createBlockPool( allocatorParam.igba = allocator.gbAllocator->igba; allocatorParam.waitableFd.reset( allocator.gbAllocator->waitableFd.dup().release()); allocatorParam.blockFenceSupport = mBlockFenceSupport; } break; default: { Loading media/codec2/hal/aidl/include/codec2/aidl/Component.h +1 −0 Original line number Diff line number Diff line Loading @@ -99,6 +99,7 @@ protected: // alive. These C2BlockPool objects can be deleted by calling // destroyBlockPool(), reset() or release(), or by destroying the component. std::map<uint64_t, std::shared_ptr<C2BlockPool>> mBlockPools; bool mBlockFenceSupport; void initListener(const std::shared_ptr<Component>& self); Loading media/codec2/vndk/C2Store.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -576,11 +576,13 @@ private: res = allocatorStore->fetchAllocator( C2PlatformAllocatorStore::IGBA, &allocator); if (res == C2_OK) { bool blockFence = (components.size() == 1 && allocatorParam.blockFenceSupport); std::shared_ptr<C2BlockPool> ptr( new C2IgbaBlockPool(allocator, allocatorParam.igba, std::move(allocatorParam.waitableFd), poolId), deleter); blockFence, poolId), deleter); *pool = ptr; mBlockPools[poolId] = ptr; mComponents[poolId].insert( Loading media/codec2/vndk/include/C2IgbaBufferPriv.h +3 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ public: const std::shared_ptr<::aidl::android::hardware::media::c2::IGraphicBufferAllocator> &igba, ::android::base::unique_fd &&ufd, const bool blockFence, const local_id_t localId); virtual ~C2IgbaBlockPool() = default; Loading Loading @@ -75,12 +76,14 @@ private: uint32_t format, C2MemoryUsage usage, c2_nsecs_t timeoutNs, bool blockFence, uint64_t *origId /* nonnull */, std::shared_ptr<C2GraphicBlock> *block /* nonnull */, C2Fence *fence /* nonnull */); const std::shared_ptr<C2Allocator> mAllocator; const std::shared_ptr<::aidl::android::hardware::media::c2::IGraphicBufferAllocator> mIgba; const bool mBlockFence; const local_id_t mLocalId; std::atomic<bool> mValid; C2Fence mWaitFence; Loading media/codec2/vndk/include/C2PlatformSupport.h +4 −0 Original line number Diff line number Diff line Loading @@ -180,6 +180,10 @@ struct C2PlatformAllocatorDesc { std::shared_ptr<::aidl::android::hardware::media::c2::IGraphicBufferAllocator> igba; ::android::base::unique_fd waitableFd; // This will be passed and moved to C2Fence // implementation. bool blockFenceSupport; C2PlatformAllocatorDesc() : allocatorId(C2AllocatorStore::DEFAULT_LINEAR), blockFenceSupport(false) {} }; /** Loading Loading
media/codec2/hal/aidl/Component.cpp +17 −0 Original line number Diff line number Diff line Loading @@ -209,6 +209,22 @@ Component::Component( mInterface = SharedRefBase::make<ComponentInterface>( component->intf(), mMultiAccessUnitIntf, store->getParameterCache()); mInit = mInterface->status(); mBlockFenceSupport = false; if (mInit != C2_OK) { return; } std::shared_ptr<C2ComponentInterface> intf = component->intf(); if (!intf) { return; } c2_status_t err = C2_OK; std::vector<std::unique_ptr<C2Param>> heapParams; C2ApiFeaturesSetting features = (C2Config::api_feature_t)0; err = intf->query_vb({&features}, {}, C2_MAY_BLOCK, &heapParams); if (err == C2_OK && ((features.value & C2Config::API_BLOCK_FENCES) != 0)) { mBlockFenceSupport = true; } } c2_status_t Component::status() const { Loading Loading @@ -363,6 +379,7 @@ ScopedAStatus Component::createBlockPool( allocatorParam.igba = allocator.gbAllocator->igba; allocatorParam.waitableFd.reset( allocator.gbAllocator->waitableFd.dup().release()); allocatorParam.blockFenceSupport = mBlockFenceSupport; } break; default: { Loading
media/codec2/hal/aidl/include/codec2/aidl/Component.h +1 −0 Original line number Diff line number Diff line Loading @@ -99,6 +99,7 @@ protected: // alive. These C2BlockPool objects can be deleted by calling // destroyBlockPool(), reset() or release(), or by destroying the component. std::map<uint64_t, std::shared_ptr<C2BlockPool>> mBlockPools; bool mBlockFenceSupport; void initListener(const std::shared_ptr<Component>& self); Loading
media/codec2/vndk/C2Store.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -576,11 +576,13 @@ private: res = allocatorStore->fetchAllocator( C2PlatformAllocatorStore::IGBA, &allocator); if (res == C2_OK) { bool blockFence = (components.size() == 1 && allocatorParam.blockFenceSupport); std::shared_ptr<C2BlockPool> ptr( new C2IgbaBlockPool(allocator, allocatorParam.igba, std::move(allocatorParam.waitableFd), poolId), deleter); blockFence, poolId), deleter); *pool = ptr; mBlockPools[poolId] = ptr; mComponents[poolId].insert( Loading
media/codec2/vndk/include/C2IgbaBufferPriv.h +3 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ public: const std::shared_ptr<::aidl::android::hardware::media::c2::IGraphicBufferAllocator> &igba, ::android::base::unique_fd &&ufd, const bool blockFence, const local_id_t localId); virtual ~C2IgbaBlockPool() = default; Loading Loading @@ -75,12 +76,14 @@ private: uint32_t format, C2MemoryUsage usage, c2_nsecs_t timeoutNs, bool blockFence, uint64_t *origId /* nonnull */, std::shared_ptr<C2GraphicBlock> *block /* nonnull */, C2Fence *fence /* nonnull */); const std::shared_ptr<C2Allocator> mAllocator; const std::shared_ptr<::aidl::android::hardware::media::c2::IGraphicBufferAllocator> mIgba; const bool mBlockFence; const local_id_t mLocalId; std::atomic<bool> mValid; C2Fence mWaitFence; Loading
media/codec2/vndk/include/C2PlatformSupport.h +4 −0 Original line number Diff line number Diff line Loading @@ -180,6 +180,10 @@ struct C2PlatformAllocatorDesc { std::shared_ptr<::aidl::android::hardware::media::c2::IGraphicBufferAllocator> igba; ::android::base::unique_fd waitableFd; // This will be passed and moved to C2Fence // implementation. bool blockFenceSupport; C2PlatformAllocatorDesc() : allocatorId(C2AllocatorStore::DEFAULT_LINEAR), blockFenceSupport(false) {} }; /** Loading