SF: use FenceTime when possible
Fence::getSignalTime is calling a system call everytime,
where FenceTime caches the signal time.
This shows reduction in simpleperf for the main thread
2.23% -> 1.25%
Test: simpleperf for PIP + Notification shade expansion
Bug: 184378996
Change-Id: I182db2ddfcb7fdbde758f5d87357a16e60c1bb07
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index b5410fe..dbd6b32 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -116,7 +116,8 @@
mCurrentState.bufferTransform = 0;
mCurrentState.transformToDisplayInverse = false;
mCurrentState.crop.makeInvalid();
- mCurrentState.acquireFence = new Fence(-1);
+ mCurrentState.acquireFence = sp<Fence>::make(-1);
+ mCurrentState.acquireFenceTime = std::make_shared<FenceTime>(mCurrentState.acquireFence);
mCurrentState.dataspace = ui::Dataspace::UNKNOWN;
mCurrentState.hdrMetadata.validTypes = 0;
mCurrentState.surfaceDamageRegion = Region::INVALID_REGION;