Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ff7b3ac4 authored by Sungtak Lee's avatar Sungtak Lee Committed by Gerrit Code Review
Browse files

Merge "C2IgbaBlockPool: pass fence with blocks fetched from video decoder HAL" into main

parents 31d9a1ab 45fa42d7
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -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 {
@@ -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: {
+1 −0
Original line number Diff line number Diff line
@@ -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);

+3 −1
Original line number Diff line number Diff line
@@ -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(
+3 −0
Original line number Diff line number Diff line
@@ -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;
@@ -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;
+4 −0
Original line number Diff line number Diff line
@@ -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