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

Commit 279ae4f2 authored by Anton Ivanov's avatar Anton Ivanov Committed by Android (Google) Code Review
Browse files

Merge "CpuConsumer: intialize ConsumerBase in onFirstRef()." into main

parents 3b797e23 adc93843
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -55,9 +55,6 @@ CpuConsumer::CpuConsumer(size_t maxLockedBuffers, bool controlledByApp,
        mCurrentLockedBuffers(0) {
    // Create tracking entries for locked buffers
    mAcquiredBuffers.insertAt(0, maxLockedBuffers);

    mConsumer->setConsumerUsageBits(GRALLOC_USAGE_SW_READ_OFTEN);
    mConsumer->setMaxAcquiredBufferCount(static_cast<int32_t>(maxLockedBuffers));
}

CpuConsumer::CpuConsumer(const sp<IGraphicBufferConsumer>& bq, size_t maxLockedBuffers,
@@ -67,9 +64,16 @@ CpuConsumer::CpuConsumer(const sp<IGraphicBufferConsumer>& bq, size_t maxLockedB
        mCurrentLockedBuffers(0) {
    // Create tracking entries for locked buffers
    mAcquiredBuffers.insertAt(0, maxLockedBuffers);
}

void CpuConsumer::initializeConsumer() {
    mConsumer->setConsumerUsageBits(GRALLOC_USAGE_SW_READ_OFTEN);
    mConsumer->setMaxAcquiredBufferCount(static_cast<int32_t>(maxLockedBuffers));
    mConsumer->setMaxAcquiredBufferCount(static_cast<int32_t>(mMaxLockedBuffers));
}

void CpuConsumer::onFirstRef() {
    ConsumerBase::onFirstRef();
    initializeConsumer();
}

size_t CpuConsumer::findAcquiredBufferLocked(uintptr_t id) const {
+4 −0
Original line number Diff line number Diff line
@@ -127,6 +127,10 @@ class CpuConsumer : public ConsumerBase
                bool controlledByApp = false)
            __attribute((deprecated("Prefer ctors that create their own surface and consumer.")));

    void initializeConsumer();

    void onFirstRef() override;

    // Maximum number of buffers that can be locked at a time
    const size_t mMaxLockedBuffers;