From 6bfe2640a1bf832041f8dbde266b0384e018846e Mon Sep 17 00:00:00 2001 From: Vishnu Nair Date: Fri, 7 Jun 2019 14:53:14 -0700 Subject: 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: I2d77334f616cb4c34e6a57c84ca97425f7983152 Merged-In: I32a59475ced80d7eaa062181c732ce0f9a81cca5 --- services/surfaceflinger/SurfaceFlinger.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'services/surfaceflinger/SurfaceFlinger.cpp') diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index ca33bb8b47..9778af0722 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -1767,6 +1767,12 @@ void SurfaceFlinger::handleMessageRefresh() { mVsyncModulator.onRefreshed(mHadClientComposition); mLayersWithQueuedFrames.clear(); + if (mVisibleRegionsDirty) { + mVisibleRegionsDirty = false; + if (mTracingEnabled) { + mTracing.notify("visibleRegionsDirty"); + } + } } @@ -1776,9 +1782,6 @@ bool SurfaceFlinger::handleMessageInvalidate() { if (mVisibleRegionsDirty) { computeLayerBounds(); - if (mTracingEnabled) { - mTracing.notify("visibleRegionsDirty"); - } } for (auto& layer : mLayersPendingRefresh) { @@ -2180,7 +2183,6 @@ void SurfaceFlinger::rebuildLayerStacks() { // rebuild the visible layer list per screen if (CC_UNLIKELY(mVisibleRegionsDirty)) { ATRACE_NAME("rebuildLayerStacks VR Dirty"); - mVisibleRegionsDirty = false; invalidateHwcGeometry(); for (const auto& pair : mDisplays) { -- cgit v1.2.3-59-g8ed1b