summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/TransactionCallbackInvoker.cpp
diff options
context:
space:
mode:
author Melody Hsu <melodymhsu@google.com> 2024-01-08 20:00:35 +0000
committer Melody Hsu <melodymhsu@google.com> 2024-03-20 19:52:50 +0000
commit793f8366b4f6b116e794bfc93f1a9e5be4e0ab23 (patch)
tree91268521892463e059b26f0b370c32a6dd3712d1 /services/surfaceflinger/TransactionCallbackInvoker.cpp
parent00853e597203520f2dc92d5991d8bbb15a21f0c0 (diff)
Add promise for buffer releaseFence to LayerFE.
Buffers can only be released when a release fence fires. Instead of tracking and waiting for each layer's Futures to complete, LayerFE can keep track of its own Future via a promise of a fence. This cleans up the shared futures that are currently being tracked and allow us to setup for eventual goals to reduce the number of screenshot calls to the main thread. Tests using a virtual display are modified to use the mirrorDisplay API with a unique layerstack. Bug: b/294936197, b/285553970 Test: manual (screenshot, camera, rotation, picture-in-picture) Test: presubmit Test: atest CompositionEnginePostCompositionTest Test: atest SurfaceFlinger_test Change-Id: I3a0af2cd02d3d010a1ea7c860c5cb0bc20837ec2
Diffstat (limited to 'services/surfaceflinger/TransactionCallbackInvoker.cpp')
-rw-r--r--services/surfaceflinger/TransactionCallbackInvoker.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/services/surfaceflinger/TransactionCallbackInvoker.cpp b/services/surfaceflinger/TransactionCallbackInvoker.cpp
index 7b5298c82e..222ae30acb 100644
--- a/services/surfaceflinger/TransactionCallbackInvoker.cpp
+++ b/services/surfaceflinger/TransactionCallbackInvoker.cpp
@@ -30,6 +30,7 @@
#include <cinttypes>
#include <binder/IInterface.h>
+#include <common/FlagManager.h>
#include <utils/RefBase.h>
namespace android {
@@ -128,9 +129,17 @@ status_t TransactionCallbackInvoker::addCallbackHandle(const sp<CallbackHandle>&
sp<IBinder> surfaceControl = handle->surfaceControl.promote();
if (surfaceControl) {
sp<Fence> prevFence = nullptr;
- for (const auto& future : handle->previousReleaseFences) {
- mergeFence(handle->name.c_str(), future.get().value_or(Fence::NO_FENCE), prevFence);
+
+ if (FlagManager::getInstance().ce_fence_promise()) {
+ for (auto& future : handle->previousReleaseFences) {
+ mergeFence(handle->name.c_str(), future.get().value_or(Fence::NO_FENCE), prevFence);
+ }
+ } else {
+ for (const auto& future : handle->previousSharedReleaseFences) {
+ mergeFence(handle->name.c_str(), future.get().value_or(Fence::NO_FENCE), prevFence);
+ }
}
+
handle->previousReleaseFence = prevFence;
handle->previousReleaseFences.clear();