SurfaceFlinger: Remove unnecessary state copy
State is copied without need before entering
setClientStateLocked
Bug: 214315611
Test: Existing tests pass
Change-Id: I5c687bdabfe72aae9706df2ea252eb7f35602e4f
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 4a5413b..c5dba63 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -3734,7 +3734,7 @@
int64_t vsyncId) {
bool needsTraversal = false;
// Now apply all transactions.
- for (const auto& transaction : transactions) {
+ for (auto& transaction : transactions) {
needsTraversal |=
applyTransactionState(transaction.frameTimelineInfo, transaction.states,
transaction.displays, transaction.flags,
@@ -4027,7 +4027,7 @@
}
bool SurfaceFlinger::applyTransactionState(const FrameTimelineInfo& frameTimelineInfo,
- const Vector<ComposerState>& states,
+ Vector<ComposerState>& states,
const Vector<DisplayState>& displays, uint32_t flags,
const InputWindowCommands& inputWindowCommands,
const int64_t desiredPresentTime, bool isAutoTimestamp,
@@ -4049,9 +4049,9 @@
}
uint32_t clientStateFlags = 0;
- for (const ComposerState& state : states) {
- ComposerState stateCopy = state;
- clientStateFlags |= setClientStateLocked(frameTimelineInfo, stateCopy, desiredPresentTime,
+ for (int i = 0; i < states.size(); i++) {
+ ComposerState& state = states.editItemAt(i);
+ clientStateFlags |= setClientStateLocked(frameTimelineInfo, state, desiredPresentTime,
isAutoTimestamp, postTime, permissions);
if ((flags & eAnimation) && state.state.surface) {
if (const auto layer = fromHandle(state.state.surface).promote()) {