Fix surface tracing thread sync issues
Tracing thread was incorrectly reading the drawing state while it was being
updated by the surface flinger main thread. Move the notify to after
composition.
Fixes: 134752356
Test: capture surface flinger trace
Change-Id: I32a59475ced80d7eaa062181c732ce0f9a81cca5
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 87c1bf9..f9af9ba 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -1783,6 +1783,12 @@
mVsyncModulator.onRefreshed(mHadClientComposition);
mLayersWithQueuedFrames.clear();
+ if (mVisibleRegionsDirty) {
+ mVisibleRegionsDirty = false;
+ if (mTracingEnabled) {
+ mTracing.notify("visibleRegionsDirty");
+ }
+ }
}
@@ -1792,9 +1798,6 @@
if (mVisibleRegionsDirty) {
computeLayerBounds();
- if (mTracingEnabled) {
- mTracing.notify("visibleRegionsDirty");
- }
}
for (auto& layer : mLayersPendingRefresh) {
@@ -2189,7 +2192,6 @@
// rebuild the visible layer list per screen
if (CC_UNLIKELY(mVisibleRegionsDirty)) {
ATRACE_NAME("rebuildLayerStacks VR Dirty");
- mVisibleRegionsDirty = false;
invalidateHwcGeometry();
for (const auto& pair : mDisplays) {