summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Robert Carr <racarr@google.com> 2017-12-04 16:06:13 -0800
committer Robert Carr <racarr@google.com> 2017-12-06 07:59:06 -0800
commit56a0b9ac6a951053e283cf42e245a48d28d2624c (patch)
tree5427f63869923958346a679efbc9619a20496c07
parent503d2bd9a0c64f90fc321f9d65fc65e592f1fa2b (diff)
Avoid unnecessary calls to updateTransformHint
It was observed that this could start to take noticeable time with high layer counts, I guess due to the acquisition of one mutex per layer per call. Anyway it looks like there's no need to call it if a display transaction didn't occur. Test: Existing tests pass. Change-Id: I1918d326a6d0ed32a0a5fea4008a746d328b335d
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 142892e874..03a9df762b 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -2338,16 +2338,19 @@ void SurfaceFlinger::handleTransactionLocked(uint32_t transactionFlags)
}
}
}
- if (disp == NULL) {
- // NOTE: TEMPORARY FIX ONLY. Real fix should cause layers to
- // redraw after transform hint changes. See bug 8508397.
-
- // could be null when this layer is using a layerStack
- // that is not visible on any display. Also can occur at
- // screen off/on times.
- disp = getDefaultDisplayDeviceLocked();
+
+ if (transactionFlags & eDisplayTransactionNeeded) {
+ if (disp == NULL) {
+ // NOTE: TEMPORARY FIX ONLY. Real fix should cause layers to
+ // redraw after transform hint changes. See bug 8508397.
+
+ // could be null when this layer is using a layerStack
+ // that is not visible on any display. Also can occur at
+ // screen off/on times.
+ disp = getDefaultDisplayDeviceLocked();
+ }
+ layer->updateTransformHint(disp);
}
- layer->updateTransformHint(disp);
first = false;
});
@@ -4613,4 +4616,4 @@ void SurfaceFlinger::traverseLayersInDisplay(const sp<const DisplayDevice>& hw,
#if defined(__gl2_h_)
#error "don't include gl2/gl2.h in this file"
-#endif \ No newline at end of file
+#endif