diff options
author | 2020-04-08 11:03:23 -0700 | |
---|---|---|
committer | 2020-04-13 11:42:57 -0700 | |
commit | a6bb2bc91914e1af8394f319911cce73b57355bf (patch) | |
tree | b81442839108f14ad865ba2a9f83b9cdcbb99394 | |
parent | 696b6c83b15397d6c6088f5be58e5f78e998d72b (diff) |
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
-rw-r--r-- | services/surfaceflinger/BufferLayer.cpp | 7 | ||||
-rw-r--r-- | services/surfaceflinger/BufferQueueLayer.cpp | 15 | ||||
-rw-r--r-- | services/surfaceflinger/BufferQueueLayer.h | 1 | ||||
-rw-r--r-- | services/surfaceflinger/BufferStateLayer.cpp | 13 | ||||
-rw-r--r-- | services/surfaceflinger/BufferStateLayer.h | 1 |
5 files changed, 7 insertions, 30 deletions
diff --git a/services/surfaceflinger/BufferLayer.cpp b/services/surfaceflinger/BufferLayer.cpp index 5f90566df2..54cd04fabb 100644 --- a/services/surfaceflinger/BufferLayer.cpp +++ b/services/surfaceflinger/BufferLayer.cpp @@ -294,6 +294,7 @@ void BufferLayer::preparePerFrameCompositionState() { 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 @@ void BufferLayer::preparePerFrameCompositionState() { ? 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) { diff --git a/services/surfaceflinger/BufferQueueLayer.cpp b/services/surfaceflinger/BufferQueueLayer.cpp index c84b15d70d..f4e630e4d8 100644 --- a/services/surfaceflinger/BufferQueueLayer.cpp +++ b/services/surfaceflinger/BufferQueueLayer.cpp @@ -365,21 +365,6 @@ status_t BufferQueueLayer::updateFrameNumber(nsecs_t latchTime) { return NO_ERROR; } -void BufferQueueLayer::preparePerFrameCompositionState() { - BufferLayer::preparePerFrameCompositionState(); - - auto* compositionState = editCompositionState(); - if (compositionState->compositionType == Hwc2::IComposerClient::Composition::SIDEBAND) { - return; - } - - compositionState->buffer = mBufferInfo.mBuffer; - compositionState->bufferSlot = (mBufferInfo.mBufferSlot == BufferQueue::INVALID_BUFFER_SLOT) - ? 0 - : mBufferInfo.mBufferSlot; - compositionState->acquireFence = mBufferInfo.mFence; -} - // ----------------------------------------------------------------------- // Interface implementation for BufferLayerConsumer::ContentsChangedListener // ----------------------------------------------------------------------- diff --git a/services/surfaceflinger/BufferQueueLayer.h b/services/surfaceflinger/BufferQueueLayer.h index ea7f203337..16b4b6e25c 100644 --- a/services/surfaceflinger/BufferQueueLayer.h +++ b/services/surfaceflinger/BufferQueueLayer.h @@ -82,7 +82,6 @@ private: status_t updateActiveBuffer() override; status_t updateFrameNumber(nsecs_t latchTime) override; - void preparePerFrameCompositionState() override; sp<Layer> createClone() override; void onFrameAvailable(const BufferItem& item); diff --git a/services/surfaceflinger/BufferStateLayer.cpp b/services/surfaceflinger/BufferStateLayer.cpp index 3e651713e4..a121ce0672 100644 --- a/services/surfaceflinger/BufferStateLayer.cpp +++ b/services/surfaceflinger/BufferStateLayer.cpp @@ -631,19 +631,6 @@ status_t BufferStateLayer::updateFrameNumber(nsecs_t latchTime) { return NO_ERROR; } -void BufferStateLayer::preparePerFrameCompositionState() { - BufferLayer::preparePerFrameCompositionState(); - - auto* compositionState = editCompositionState(); - if (compositionState->compositionType == Hwc2::IComposerClient::Composition::SIDEBAND) { - return; - } - - compositionState->buffer = mBufferInfo.mBuffer; - compositionState->bufferSlot = mBufferInfo.mBufferSlot; - compositionState->acquireFence = mBufferInfo.mFence; -} - void BufferStateLayer::HwcSlotGenerator::bufferErased(const client_cache_t& clientCacheId) { std::lock_guard lock(mMutex); if (!clientCacheId.isValid()) { diff --git a/services/surfaceflinger/BufferStateLayer.h b/services/surfaceflinger/BufferStateLayer.h index 753a74250b..5873a7314f 100644 --- a/services/surfaceflinger/BufferStateLayer.h +++ b/services/surfaceflinger/BufferStateLayer.h @@ -138,7 +138,6 @@ private: status_t updateActiveBuffer() override; status_t updateFrameNumber(nsecs_t latchTime) override; - void preparePerFrameCompositionState() override; sp<Layer> createClone() override; // Crop that applies to the buffer |