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

Commit 85b21766 authored by Eino-Ville Talvala's avatar Eino-Ville Talvala
Browse files

Remove fixed USAGE_HW_TEXTURE flag from BufferQueue.

USAGE_HW_TEXTURE applies to SurfaceTexture, not to all uses of
BufferQueue. Refactor accordingly.

Change-Id: Ic7add5e1f2bbec3d3e796ba7f15eaa0633945d8f
parent aa1667f0
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line Diff line number Diff line
@@ -257,6 +257,12 @@ private:
    // before the outstanding accesses have completed.
    // before the outstanding accesses have completed.
    status_t syncForReleaseLocked(EGLDisplay dpy);
    status_t syncForReleaseLocked(EGLDisplay dpy);


    // The default consumer usage flags that SurfaceTexture always sets on its
    // BufferQueue instance; these will be OR:d with any additional flags passed
    // from the SurfaceTexture user. In particular, SurfaceTexture will always
    // consume buffers as hardware textures.
    static const uint32_t DEFAULT_USAGE_FLAGS = GraphicBuffer::USAGE_HW_TEXTURE;

    // mCurrentTextureBuf is the graphic buffer of the current texture. It's
    // mCurrentTextureBuf is the graphic buffer of the current texture. It's
    // possible that this buffer is not associated with any buffer slot, so we
    // possible that this buffer is not associated with any buffer slot, so we
    // must track it separately in order to support the getCurrentBuffer method.
    // must track it separately in order to support the getCurrentBuffer method.
+0 −1
Original line number Original line Diff line number Diff line
@@ -450,7 +450,6 @@ status_t BufferQueue::dequeueBuffer(int *outBuf, uint32_t w, uint32_t h,
            (uint32_t(buffer->format) != format) ||
            (uint32_t(buffer->format) != format) ||
            ((uint32_t(buffer->usage) & usage) != usage))
            ((uint32_t(buffer->usage) & usage) != usage))
        {
        {
            usage |= GraphicBuffer::USAGE_HW_TEXTURE;
            status_t error;
            status_t error;
            sp<GraphicBuffer> graphicBuffer(
            sp<GraphicBuffer> graphicBuffer(
                    mGraphicBufferAlloc->createGraphicBuffer(
                    mGraphicBufferAlloc->createGraphicBuffer(
+2 −0
Original line number Original line Diff line number Diff line
@@ -150,6 +150,7 @@ SurfaceTexture::SurfaceTexture(GLuint tex, bool allowSynchronousMode,
                strerror(-err), err);
                strerror(-err), err);
    } else {
    } else {
        mBufferQueue->setConsumerName(mName);
        mBufferQueue->setConsumerName(mName);
        mBufferQueue->setConsumerUsageBits(DEFAULT_USAGE_FLAGS);
    }
    }
}
}


@@ -720,6 +721,7 @@ status_t SurfaceTexture::setDefaultBufferFormat(uint32_t defaultFormat) {


status_t SurfaceTexture::setConsumerUsageBits(uint32_t usage) {
status_t SurfaceTexture::setConsumerUsageBits(uint32_t usage) {
    Mutex::Autolock lock(mMutex);
    Mutex::Autolock lock(mMutex);
    usage |= DEFAULT_USAGE_FLAGS;
    return mBufferQueue->setConsumerUsageBits(usage);
    return mBufferQueue->setConsumerUsageBits(usage);
}
}