summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Vishnu Nair <vishnun@google.com> 2023-03-02 21:43:00 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2023-03-02 21:43:00 +0000
commitba87aa7f889c3ee0648eb55766c19870b0671ea9 (patch)
tree8abe21b703089a12450973df61dcfcb3e9bf2bce
parentaf7c64563ef4ae20cd37d20c1c5da07fac6e0387 (diff)
parentc09c023a9bfc3c34be38cf95d1691fd712af2d68 (diff)
Merge "[sf] only update the last latch time if the layer has a buffer" into udc-dev
-rw-r--r--services/surfaceflinger/Layer.cpp4
-rw-r--r--services/surfaceflinger/Layer.h1
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp10
3 files changed, 13 insertions, 2 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 433606a732..ded607eb49 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -3037,6 +3037,10 @@ bool Layer::setBuffer(std::shared_ptr<renderengine::ExternalTexture>& buffer,
mLastClientCompositionFence);
mLastClientCompositionFence = nullptr;
}
+ } else {
+ // if we are latching a buffer for the first time then clear the mLastLatchTime since
+ // we don't want to incorrectly classify a frame if we miss the desired present time.
+ updateLastLatchTime(0);
}
mDrawingState.producerId = bufferData.producerId;
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index 4309aca22c..a0ab4cdb75 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -852,6 +852,7 @@ public:
const sp<GraphicBuffer>& buffer, uint64_t framenumber,
const sp<Fence>& releaseFence);
bool setFrameRateForLayerTree(FrameRate);
+ bool hasBuffer() const { return mBufferInfo.mBuffer != nullptr; }
protected:
// For unit tests
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index f0f163211b..31ce30b41d 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -3954,8 +3954,14 @@ bool SurfaceFlinger::latchBuffers() {
mLayersWithQueuedFrames.emplace(sp<Layer>::fromExisting(layer));
} else {
layer->useEmptyDamage();
- // If the layer has frames we will update the latch time when latching the buffer.
- layer->updateLastLatchTime(latchTime);
+ if (!layer->hasBuffer()) {
+ // The last latch time is used to classify a missed frame as buffer stuffing
+ // instead of a missed frame. This is used to identify scenarios where we
+ // could not latch a buffer or apply a transaction due to backpressure.
+ // We only update the latch time for buffer less layers here, the latch time
+ // is updated for buffer layers when the buffer is latched.
+ layer->updateLastLatchTime(latchTime);
+ }
}
});
mForceTransactionDisplayChange = false;