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

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

Merge "GLConsumer: initialize ConsumerBase in onFirstRef()." into main

parents 256dfce2 062b53ae
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -182,10 +182,7 @@ GLConsumer::GLConsumer(const sp<IGraphicBufferConsumer>& bq, uint32_t tex, uint3
        mAttached(true) {
    GLC_LOGV("GLConsumer");

    memcpy(mCurrentTransformMatrix, mtxIdentity.asArray(),
            sizeof(mCurrentTransformMatrix));

    mConsumer->setConsumerUsageBits(DEFAULT_USAGE_FLAGS);
    memcpy(mCurrentTransformMatrix, mtxIdentity.asArray(), sizeof(mCurrentTransformMatrix));
}

GLConsumer::GLConsumer(uint32_t texTarget, bool useFenceSync, bool isControlledByApp)
@@ -213,8 +210,6 @@ GLConsumer::GLConsumer(uint32_t texTarget, bool useFenceSync, bool isControlledB
    GLC_LOGV("GLConsumer");

    memcpy(mCurrentTransformMatrix, mtxIdentity.asArray(), sizeof(mCurrentTransformMatrix));

    mConsumer->setConsumerUsageBits(DEFAULT_USAGE_FLAGS);
}

GLConsumer::GLConsumer(const sp<IGraphicBufferConsumer>& bq, uint32_t texTarget, bool useFenceSync,
@@ -244,10 +239,17 @@ GLConsumer::GLConsumer(const sp<IGraphicBufferConsumer>& bq, uint32_t texTarget,

    memcpy(mCurrentTransformMatrix, mtxIdentity.asArray(),
            sizeof(mCurrentTransformMatrix));
}

void GLConsumer::initializeConsumer() {
    mConsumer->setConsumerUsageBits(DEFAULT_USAGE_FLAGS);
}

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

status_t GLConsumer::setDefaultBufferSize(uint32_t w, uint32_t h)
{
    Mutex::Autolock lock(mMutex);
+4 −0
Original line number Diff line number Diff line
@@ -245,6 +245,8 @@ public:
    // current at the time of the last call to detachFromContext.
    status_t attachToContext(uint32_t tex);

    void onFirstRef() override;

protected:

    // abandonLocked overrides the ConsumerBase method to clear
@@ -309,6 +311,8 @@ protected:
private:
    friend class sp<GLConsumer>;

    void initializeConsumer();

    GLConsumer(uint32_t tex, uint32_t textureTarget, bool useFenceSync, bool isControlledByApp);

    GLConsumer(uint32_t textureTarget, bool useFenceSync, bool isControlledByApp);