Buffer(Queue/State)Layer: Consolidate preparePerFrameCompositionState
The only difference is the BLAST implementation fails when there is
no cached buffer. While in general we expect cacheBuffers to be called
by apply() there's no reason to add more code just to fail here.
Noticed this while investigating a bug where cacheBuffers wasn't
called.
Bug: 153561718
Test: Existing tests pass
Change-Id: If1faae68ef11de3f8b37474abeff14c42af3cd57
diff --git a/services/surfaceflinger/BufferLayer.cpp b/services/surfaceflinger/BufferLayer.cpp
index 5f90566..54cd04f 100644
--- a/services/surfaceflinger/BufferLayer.cpp
+++ b/services/surfaceflinger/BufferLayer.cpp
@@ -294,6 +294,7 @@
auto* compositionState = editCompositionState();
if (compositionState->sidebandStream.get()) {
compositionState->compositionType = Hwc2::IComposerClient::Composition::SIDEBAND;
+ return;
} else {
// Normal buffer layers
compositionState->hdrMetadata = mBufferInfo.mHdrMetadata;
@@ -301,6 +302,12 @@
? Hwc2::IComposerClient::Composition::CURSOR
: Hwc2::IComposerClient::Composition::DEVICE;
}
+
+ compositionState->buffer = mBufferInfo.mBuffer;
+ compositionState->bufferSlot = (mBufferInfo.mBufferSlot == BufferQueue::INVALID_BUFFER_SLOT)
+ ? 0
+ : mBufferInfo.mBufferSlot;
+ compositionState->acquireFence = mBufferInfo.mFence;
}
bool BufferLayer::onPreComposition(nsecs_t refreshStartTime) {