summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/SurfaceFlinger.cpp
diff options
context:
space:
mode:
author Marissa Wall <marissaw@google.com> 2019-03-26 15:38:50 -0700
committer Marissa Wall <marissaw@google.com> 2019-03-29 09:42:52 -0700
commitd600d57da59244af8f94145558debe7f1acad998 (patch)
treebd5b0683125e7cfa4d276235269f4bab9b357fb1 /services/surfaceflinger/SurfaceFlinger.cpp
parenteccfc576b3f90c2ee818de7c10eea6fdbbe2d166 (diff)
blast: in order no-op transaction callbacks
Transactions callbacks were being sent as soon as they were ready instead of in order. To fix this, keep a deque of Transaction callbacks and do not send a callback until all the callbacks before it have been sent. Bug: 128519264 Test: Transaction_test Change-Id: Ia363b3aca85bc1cd71d0fd915de79b44f786e09f
Diffstat (limited to 'services/surfaceflinger/SurfaceFlinger.cpp')
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index fae4b8168e..2aac8f05d1 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -3651,18 +3651,22 @@ void SurfaceFlinger::applyTransactionState(const Vector<ComposerState>& states,
transactionFlags |= setDisplayStateLocked(display);
}
- uint32_t clientStateFlags = 0;
- for (const ComposerState& state : states) {
- clientStateFlags |= setClientStateLocked(state, desiredPresentTime, listenerCallbacks,
- postTime, privileged);
- }
-
// In case the client has sent a Transaction that should receive callbacks but without any
// SurfaceControls that should be included in the callback, send the listener and callbackIds
// to the callback thread so it can send an empty callback
+ if (!listenerCallbacks.empty()) {
+ mTransactionCompletedThread.run();
+ }
for (const auto& [listener, callbackIds] : listenerCallbacks) {
mTransactionCompletedThread.addCallback(listener, callbackIds);
}
+
+ uint32_t clientStateFlags = 0;
+ for (const ComposerState& state : states) {
+ clientStateFlags |= setClientStateLocked(state, desiredPresentTime, listenerCallbacks,
+ postTime, privileged);
+ }
+
// If the state doesn't require a traversal and there are callbacks, send them now
if (!(clientStateFlags & eTraversalNeeded)) {
mTransactionCompletedThread.sendCallbacks();
@@ -4019,7 +4023,6 @@ uint32_t SurfaceFlinger::setClientStateLocked(
}
std::vector<sp<CallbackHandle>> callbackHandles;
if ((what & layer_state_t::eHasListenerCallbacksChanged) && (!listenerCallbacks.empty())) {
- mTransactionCompletedThread.run();
for (const auto& [listener, callbackIds] : listenerCallbacks) {
callbackHandles.emplace_back(new CallbackHandle(listener, callbackIds, s.surface));
}