summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/BufferStateLayer.cpp
diff options
context:
space:
mode:
author Vishnu Nair <vishnun@google.com> 2021-10-18 09:36:33 -0700
committer Vishnu Nair <vishnun@google.com> 2021-11-04 22:32:51 +0000
commitda1fd1508c914c7f0849e4e00a5fae5412433337 (patch)
tree6acc5a1bebfb8d144a954e3b0b4d8a4c06aa537f /services/surfaceflinger/BufferStateLayer.cpp
parentcd52e2db6c57326c1380cd53e9520adc7faf5ec9 (diff)
SurfaceFlinger: Emit callbacks for non-buffer layer transactions
Ensure we emit callbacks if the transaction contains only non-buffer layer state changes. Test: atest SurfaceFlinger_test Fixes: 205183085 Change-Id: I56bf0dcaff4312628fe2cd1d0b93db520518ec54
Diffstat (limited to 'services/surfaceflinger/BufferStateLayer.cpp')
-rw-r--r--services/surfaceflinger/BufferStateLayer.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/services/surfaceflinger/BufferStateLayer.cpp b/services/surfaceflinger/BufferStateLayer.cpp
index c213570c7f..3e09a40eba 100644
--- a/services/surfaceflinger/BufferStateLayer.cpp
+++ b/services/surfaceflinger/BufferStateLayer.cpp
@@ -549,13 +549,19 @@ bool BufferStateLayer::setSidebandStream(const sp<NativeHandle>& sidebandStream)
}
bool BufferStateLayer::setTransactionCompletedListeners(
- const std::vector<sp<CallbackHandle>>& handles) {
+ const std::vector<ListenerCallbacks>& listenerCallbacks, const sp<IBinder>& layerHandle) {
// If there is no handle, we will not send a callback so reset mReleasePreviousBuffer and return
- if (handles.empty()) {
+ if (listenerCallbacks.empty()) {
mReleasePreviousBuffer = false;
return false;
}
+ std::vector<sp<CallbackHandle>> handles;
+ handles.reserve(listenerCallbacks.size());
+ for (auto& [listener, callbackIds] : listenerCallbacks) {
+ handles.emplace_back(new CallbackHandle(listener, callbackIds, layerHandle));
+ }
+
const bool willPresent = willPresentCurrentTransaction();
for (const auto& handle : handles) {
@@ -571,9 +577,10 @@ bool BufferStateLayer::setTransactionCompletedListeners(
// Store so latched time and release fence can be set
mDrawingState.callbackHandles.push_back(handle);
- } else { // If this layer will NOT need to be relatched and presented this frame
+ } else {
+ // If this layer will NOT need to be relatched and presented this frame
// Notify the transaction completed thread this handle is done
- mFlinger->getTransactionCallbackInvoker().registerUnpresentedCallbackHandle(handle);
+ mFlinger->getTransactionCallbackInvoker().addUnpresentedCallbackHandle(handle);
}
}