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

Commit fc416512 authored by Robert Carr's avatar Robert Carr
Browse files

BLASTBufferQueue: Avoid duplicate calls to setDefaultBufferSize

Calling in to the consumer may acquire the BufferQueueCore mutex. We call
BLASTBufferQueue::update from the UI thread. And so we can accidentally
end up blocking the UI thread on allocateBuffers() during app start-up.

Bug: 152501005
Test: Flip BLAST. Play.
Change-Id: I89034211ed5725b5be6391cc2bac748c0acf1eb3
parent 4fda61f5
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -132,10 +132,13 @@ BLASTBufferQueue::BLASTBufferQueue(const sp<SurfaceControl>& surface, int width,
void BLASTBufferQueue::update(const sp<SurfaceControl>& surface, int width, int height) {
    std::unique_lock _lock{mMutex};
    mSurfaceControl = surface;

    if (mWidth != width || mHeight != height) {
        mWidth = width;
        mHeight = height;
        mBufferItemConsumer->setDefaultBufferSize(mWidth, mHeight);
    }
}

static void transactionCallbackThunk(void* context, nsecs_t latchTime,
                                     const sp<Fence>& presentFence,