summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/TransactionCallbackInvoker.cpp
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2022-05-17 14:54:32 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2022-05-17 14:54:32 +0000
commit1c94d263dae07cf58f76b1612f8f0a00d6d75fe3 (patch)
treeed66cc20d1e8294bab537860923f6cd663c4fc5b /services/surfaceflinger/TransactionCallbackInvoker.cpp
parent4d0354932995489267e30d6cf265acf6d364b6ed (diff)
parentbb448ce9aa521f9574d94c9ec2d57eb7d37382cb (diff)
Merge "SF: Do not duplicate fences per layer per frame" into tm-dev
Diffstat (limited to 'services/surfaceflinger/TransactionCallbackInvoker.cpp')
-rw-r--r--services/surfaceflinger/TransactionCallbackInvoker.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/services/surfaceflinger/TransactionCallbackInvoker.cpp b/services/surfaceflinger/TransactionCallbackInvoker.cpp
index e1f348fdba..fa8cffc32a 100644
--- a/services/surfaceflinger/TransactionCallbackInvoker.cpp
+++ b/services/surfaceflinger/TransactionCallbackInvoker.cpp
@@ -133,10 +133,10 @@ status_t TransactionCallbackInvoker::addCallbackHandle(const sp<CallbackHandle>&
if (surfaceControl) {
sp<Fence> prevFence = nullptr;
- for (const auto& futureStruct : handle->previousReleaseFences) {
- sp<Fence> currentFence = sp<Fence>::make(dup(futureStruct.get().drawFence));
+ for (const auto& future : handle->previousReleaseFences) {
+ sp<Fence> currentFence = future.get().value_or(Fence::NO_FENCE);
if (prevFence == nullptr && currentFence->getStatus() != Fence::Status::Invalid) {
- prevFence = currentFence;
+ prevFence = std::move(currentFence);
handle->previousReleaseFence = prevFence;
} else if (prevFence != nullptr) {
// If both fences are signaled or both are unsignaled, we need to merge
@@ -147,7 +147,7 @@ status_t TransactionCallbackInvoker::addCallbackHandle(const sp<CallbackHandle>&
snprintf(fenceName, 32, "%.28s", handle->name.c_str());
sp<Fence> mergedFence = Fence::merge(fenceName, prevFence, currentFence);
if (mergedFence->isValid()) {
- handle->previousReleaseFence = mergedFence;
+ handle->previousReleaseFence = std::move(mergedFence);
prevFence = handle->previousReleaseFence;
}
} else if (currentFence->getStatus() == Fence::Status::Unsignaled) {
@@ -158,11 +158,12 @@ status_t TransactionCallbackInvoker::addCallbackHandle(const sp<CallbackHandle>&
// by this point, they will have both signaled and only the timestamp
// will be slightly off; any dependencies after this point will
// already have been met.
- handle->previousReleaseFence = currentFence;
+ handle->previousReleaseFence = std::move(currentFence);
}
}
}
- handle->previousReleaseFences = {};
+ handle->previousReleaseFences.clear();
+
FrameEventHistoryStats eventStats(handle->frameNumber,
handle->gpuCompositionDoneFence->getSnapshot().fence,
handle->compositorTiming, handle->refreshStartTime,