summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Vishnu Nair <vishnun@google.com> 2023-02-14 17:58:37 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2023-02-14 17:58:37 +0000
commitbd0b40589bc30305ea5812f33cb30e2cd4602bdb (patch)
tree1fd89e2c312f94b85000ff2306a59e23f9dfdda5
parenta8cafbfb32bf9e14e6df9a68e87f74906e1ca30a (diff)
parent7fe69edeb671e90ea8a7a84e7f3ec181283b0dcd (diff)
Merge "SF: Pass latch time for bufferless surface frames"
-rw-r--r--services/surfaceflinger/Layer.cpp9
-rw-r--r--services/surfaceflinger/Layer.h4
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp4
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;
}