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

Commit 8db4ae2c authored by shuanglong.wang's avatar shuanglong.wang Committed by Pengfei Zhao
Browse files

codec2: add get consumeusage for C2BufferQueueBlockPool



bufferqueue need get consumeusage to distinguish surfaceview and surfacetexture

Bug: 218606837

Change-Id: Id7a5d5728332e94e96eeb32f6b57875a5e78c47f
Signed-off-by: default avatarshuanglong.wang <shuanglong.wang@amlogic.com>
parent e846eed9
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -101,6 +101,8 @@ public:
            uint32_t generationId,
            uint64_t consumerUsage);

    virtual void getConsumerUsage(uint64_t *consumerUsage);

private:
    const std::shared_ptr<C2Allocator> mAllocator;
    const local_id_t mLocalId;
@@ -138,7 +140,6 @@ public:
                uint32_t toGeneration, uint64_t toUsage, uint64_t toBqId,
                android::sp<android::GraphicBuffer>& graphicBuffer, uint32_t oldGeneration,
                std::shared_ptr<C2SurfaceSyncMemory> syncMem);

private:
    friend struct _C2BlockFactory;

+15 −2
Original line number Diff line number Diff line
@@ -571,8 +571,8 @@ private:
public:
    Impl(const std::shared_ptr<C2Allocator> &allocator)
        : mInit(C2_OK), mProducerId(0), mGeneration(0),
          mDqFailure(0), mLastDqTs(0), mLastDqLogTs(0),
          mAllocator(allocator) {
          mConsumerUsage(0), mDqFailure(0), mLastDqTs(0),
          mLastDqLogTs(0), mAllocator(allocator) {
    }

    ~Impl() {
@@ -747,6 +747,11 @@ public:
                  "bqId: %llu migrated buffers # %d",
                  generation, (unsigned long long)producerId, migrated);
        }
        mConsumerUsage = usage;
    }

    void getConsumerUsage(uint64_t *consumeUsage) {
        *consumeUsage = mConsumerUsage;
    }

private:
@@ -755,6 +760,7 @@ private:
    c2_status_t mInit;
    uint64_t mProducerId;
    uint32_t mGeneration;
    uint64_t mConsumerUsage;
    OnRenderCallback mRenderCallback;

    size_t mDqFailure;
@@ -1086,3 +1092,10 @@ void C2BufferQueueBlockPool::setRenderCallback(const OnRenderCallback &renderCal
        mImpl->setRenderCallback(renderCallback);
    }
}

void C2BufferQueueBlockPool::getConsumerUsage(uint64_t *consumeUsage) {
    if (mImpl) {
        mImpl->getConsumerUsage(consumeUsage);
    }
}