diff options
| -rw-r--r-- | services/surfaceflinger/Layer.cpp | 9 | ||||
| -rw-r--r-- | services/surfaceflinger/Layer.h | 4 | ||||
| -rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 4 |
3 files changed, 9 insertions, 8 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index 8c484f0039..704f336544 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -770,7 +770,7 @@ void Layer::transferAvailableJankData(const std::deque<sp<CallbackHandle>>& hand // transaction // ---------------------------------------------------------------------------- -uint32_t Layer::doTransaction(uint32_t flags) { +uint32_t Layer::doTransaction(uint32_t flags, nsecs_t latchTime) { ATRACE_CALL(); // TODO: This is unfortunate. @@ -798,23 +798,24 @@ uint32_t Layer::doTransaction(uint32_t flags) { mFlinger->mUpdateInputInfo = true; } - commitTransaction(mDrawingState); + commitTransaction(mDrawingState, latchTime); return flags; } -void Layer::commitTransaction(State&) { +void Layer::commitTransaction(State&, nsecs_t currentLatchTime) { // Set the present state for all bufferlessSurfaceFramesTX to Presented. The // bufferSurfaceFrameTX will be presented in latchBuffer. for (auto& [token, surfaceFrame] : mDrawingState.bufferlessSurfaceFramesTX) { if (surfaceFrame->getPresentState() != PresentState::Presented) { // With applyPendingStates, we could end up having presented surfaceframes from previous // states - surfaceFrame->setPresentState(PresentState::Presented); + surfaceFrame->setPresentState(PresentState::Presented, mLastLatchTime); mFlinger->mFrameTimeline->addSurfaceFrame(surfaceFrame); } } mDrawingState.bufferlessSurfaceFramesTX.clear(); + mLastLatchTime = currentLatchTime; } uint32_t Layer::clearTransactionFlags(uint32_t mask) { diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h index bf8cc7e36b..2955dafa0f 100644 --- a/services/surfaceflinger/Layer.h +++ b/services/surfaceflinger/Layer.h @@ -620,7 +620,7 @@ public: * doTransaction - process the transaction. This is a good place to figure * out which attributes of the surface have changed. */ - virtual uint32_t doTransaction(uint32_t transactionFlags); + virtual uint32_t doTransaction(uint32_t transactionFlags, nsecs_t currentLatchTime); /* * Remove relative z for the layer if its relative parent is not part of the @@ -857,7 +857,7 @@ protected: void preparePerFrameCompositionState(); void preparePerFrameBufferCompositionState(); void preparePerFrameEffectsCompositionState(); - virtual void commitTransaction(State& stateToCommit); + virtual void commitTransaction(State& stateToCommit, nsecs_t currentLatchTime = 0); void gatherBufferInfo(); void onSurfaceFrameCreated(const std::shared_ptr<frametimeline::SurfaceFrame>&); diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 792d1101fb..b42576fd8e 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -3863,7 +3863,7 @@ void SurfaceFlinger::commitOffscreenLayers() { for (Layer* offscreenLayer : mOffscreenLayers) { offscreenLayer->traverse(LayerVector::StateSet::Drawing, [](Layer* layer) { if (layer->clearTransactionFlags(eTransactionNeeded)) { - layer->doTransaction(0); + layer->doTransaction(0, 0); layer->commitChildList(); } }); @@ -3899,7 +3899,7 @@ bool SurfaceFlinger::latchBuffers() { // second frame. But layer 0's second frame could be waiting on display. mDrawingState.traverse([&](Layer* layer) { if (layer->clearTransactionFlags(eTransactionNeeded) || mForceTransactionDisplayChange) { - const uint32_t flags = layer->doTransaction(0); + const uint32_t flags = layer->doTransaction(0, latchTime); if (flags & Layer::eVisibleRegion) { mVisibleRegionsDirty = true; } |