status_t BufferStateLayer::updateActiveBuffer() {
const State& s(getDrawingState());
if (s.buffer == nullptr) {
return BAD_VALUE;
}
if (!mBufferInfo.mBuffer || s.buffer->getBuffer() != mBufferInfo.mBuffer->getBuffer()) {
decrementPendingBufferCount();
}
mPreviousReleaseCallbackId = {getCurrentBufferId(), mBufferInfo.mFrameNumber};
mBufferInfo.mBuffer = s.buffer;
mBufferInfo.mFence = s.acquireFence;
mBufferInfo.mFrameNumber = s.frameNumber;
return NO_ERROR;
}
getDrawingState()
返回 mDrawingState
引用。mBufferInfo.mBuffer
是空的,或 mDrawingState
的 buffer 和 mBufferInfo
的 buffer 不相同,则调用 decrementPendingBufferCount()
执行 mPendingBufferTransactions
减一,因为 mBufferInfo
的 buffer 不会显示了。mPreviousReleaseCallbackId
,它在 BufferStateLayer::addReleaseFence() 和 BufferStateLayer::releasePendingBuffer() 中会设置给 CallbackHandle 的 previousReleaseCallbackId
。mBufferInfo
的成员。