Clean up tracking of layers with buffers
The function to check if the transaction is ready to be applied
should not modify any state. Instead keep track of layers with
ready to be presented outside the check.
Bug: 184063141
Test: atest SurfaceFlinger_test ASurfaceControlTest
Change-Id: I671eabb36195b11c66a1aeefadc78c3d194caeca
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index e4ff6c9..02b38b4 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -329,7 +329,7 @@
// Otherwise, returns a weak reference so that callers off the main-thread
// won't accidentally hold onto the last strong reference.
wp<Layer> fromHandle(const sp<IBinder>& handle);
- wp<Layer> fromHandleLocked(const sp<IBinder>& handle) REQUIRES(mStateLock);
+ wp<Layer> fromHandleLocked(const sp<IBinder>& handle) const REQUIRES(mStateLock);
// Inherit from ClientCache::ErasedRecipient
void bufferErased(const client_cache_t& clientCacheId) override;
@@ -536,6 +536,8 @@
originUid(originUid),
id(transactionId) {}
+ void traverseStatesWithBuffers(std::function<void(const layer_state_t&)> visitor);
+
FrameTimelineInfo frameTimelineInfo;
Vector<ComposerState> states;
Vector<DisplayState> displays;
@@ -841,8 +843,8 @@
bool transactionIsReadyToBeApplied(
const FrameTimelineInfo& info, bool isAutoTimestamp, int64_t desiredPresentTime,
uid_t originUid, const Vector<ComposerState>& states,
- std::unordered_set<sp<IBinder>, ISurfaceComposer::SpHash<IBinder>>& pendingBuffers)
- REQUIRES(mStateLock);
+ const std::unordered_set<sp<IBinder>, ISurfaceComposer::SpHash<IBinder>>&
+ bufferLayersReadyToPresent) const REQUIRES(mStateLock);
uint32_t setDisplayStateLocked(const DisplayState& s) REQUIRES(mStateLock);
uint32_t addInputWindowCommands(const InputWindowCommands& inputWindowCommands)
REQUIRES(mStateLock);