summaryrefslogtreecommitdiffstats
path: root/services/surfaceflinger/BufferQueueLayer.cpp
diff options
context:
space:
mode:
authorLloyd Pique <lpique@google.com>2018-12-04 17:25:27 -0800
committerLloyd Pique <lpique@google.com>2019-02-13 14:28:38 -0800
commit0b785d86a036383e6173d4680cf02554e7851d33 (patch)
treef312010060afb53f91e63583abe2347fe39a563f /services/surfaceflinger/BufferQueueLayer.cpp
parent37c2c9b2d02204010f65742f02a8e73553bf78a8 (diff)
downloadandroid_frameworks_native-0b785d86a036383e6173d4680cf02554e7851d33.tar.gz
android_frameworks_native-0b785d86a036383e6173d4680cf02554e7851d33.tar.bz2
android_frameworks_native-0b785d86a036383e6173d4680cf02554e7851d33.zip
SF: Introduce LayerCompositionState
This moves the remaining display-independent state from LayerBE.h to a new LayerFECompositionState state structure. LayerFECompositionState is also set up as a subset of a new LayerCompositionState structure, which is owned by each compositionengine::Layer. The existing front-end SurfaceFlinger code is minimally adjusted to store the state in the new structures. Test: atest libsurfaceflinger_unittest libcompositionengine_test Bug: 121291683 Change-Id: I20e4aa1a51b2ccbb19d5a1f0a1fad42ee9b7f41a
Diffstat (limited to 'services/surfaceflinger/BufferQueueLayer.cpp')
-rw-r--r--services/surfaceflinger/BufferQueueLayer.cpp25
1 files changed, 15 insertions, 10 deletions
diff --git a/services/surfaceflinger/BufferQueueLayer.cpp b/services/surfaceflinger/BufferQueueLayer.cpp
index b66a46a30..cdcbcd94f 100644
--- a/services/surfaceflinger/BufferQueueLayer.cpp
+++ b/services/surfaceflinger/BufferQueueLayer.cpp
@@ -15,7 +15,9 @@
*/
#include <compositionengine/Display.h>
+#include <compositionengine/Layer.h>
#include <compositionengine/OutputLayer.h>
+#include <compositionengine/impl/LayerCompositionState.h>
#include <compositionengine/impl/OutputLayerCompositionState.h>
#include <system/window.h>
@@ -198,8 +200,9 @@ bool BufferQueueLayer::latchSidebandStream(bool& recomputeVisibleRegions) {
if (mSidebandStreamChanged.compare_exchange_strong(sidebandStreamChanged, false)) {
// mSidebandStreamChanged was changed to false
// replicated in LayerBE until FE/BE is ready to be synchronized
- getBE().compositionInfo.hwc.sidebandStream = mConsumer->getSidebandStream();
- if (getBE().compositionInfo.hwc.sidebandStream != nullptr) {
+ auto& layerCompositionState = getCompositionLayer()->editState().frontEnd;
+ layerCompositionState.sidebandStream = mConsumer->getSidebandStream();
+ if (layerCompositionState.sidebandStream != nullptr) {
setTransactionFlags(eTransactionNeeded);
mFlinger->setTransactionFlags(eTraversalNeeded);
}
@@ -328,8 +331,9 @@ status_t BufferQueueLayer::updateTexImage(bool& recomputeVisibleRegions, nsecs_t
status_t BufferQueueLayer::updateActiveBuffer() {
// update the active buffer
mActiveBuffer = mConsumer->getCurrentBuffer(&mActiveBufferSlot, &mActiveBufferFence);
- getBE().compositionInfo.mBuffer = mActiveBuffer;
- getBE().compositionInfo.mBufferSlot = mActiveBufferSlot;
+ auto& layerCompositionState = getCompositionLayer()->editState().frontEnd;
+ layerCompositionState.buffer = mActiveBuffer;
+ layerCompositionState.bufferSlot = mActiveBufferSlot;
if (mActiveBuffer == nullptr) {
// this can only happen if the very first buffer was rejected.
@@ -367,13 +371,14 @@ void BufferQueueLayer::setHwcLayerBuffer(const sp<const DisplayDevice>& display)
auto acquireFence = mConsumer->getCurrentFence();
auto error = hwcLayer->setBuffer(hwcSlot, hwcBuffer, acquireFence);
if (error != HWC2::Error::None) {
- ALOGE("[%s] Failed to set buffer %p: %s (%d)", mName.string(),
- getBE().compositionInfo.mBuffer->handle, to_string(error).c_str(),
- static_cast<int32_t>(error));
+ ALOGE("[%s] Failed to set buffer %p: %s (%d)", mName.string(), mActiveBuffer->handle,
+ to_string(error).c_str(), static_cast<int32_t>(error));
}
- getBE().compositionInfo.mBufferSlot = mActiveBufferSlot;
- getBE().compositionInfo.mBuffer = mActiveBuffer;
- getBE().compositionInfo.hwc.fence = acquireFence;
+
+ auto& layerCompositionState = getCompositionLayer()->editState().frontEnd;
+ layerCompositionState.bufferSlot = mActiveBufferSlot;
+ layerCompositionState.buffer = mActiveBuffer;
+ layerCompositionState.acquireFence = acquireFence;
}
// -----------------------------------------------------------------------