Revert "SurfaceFlinger: protect state members in Layer"
State update transactions must be atomic. The fine-grained lock on each
Layer implied otherwise. Revert the fine grained lock as being
unhelpful.
Unfortunately there does not seem to be a way to use Clang thread
annotations to specify the desired locking behavior.
Note that the parent CL addresses the locking problem that led to the
bug.
This reverts commit 83729883eecd31a9907bc79bc21998a90f17105c.
Bug: 119481871
Test: SurfaceFlinger unit tests
Test: go/wm-smoke
Change-Id: I361741f8d10102aeb57f164c847c6063ff93dd14
diff --git a/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h b/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h
index 4da08b8..8d58627 100644
--- a/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h
+++ b/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h
@@ -178,12 +178,11 @@
using HotplugEvent = SurfaceFlinger::HotplugEvent;
- auto& mutableLayerCurrentState(sp<Layer> layer) { return layer->mState.current; }
- auto& mutableLayerDrawingState(sp<Layer> layer) { return layer->mState.drawing; }
+ auto& mutableLayerCurrentState(sp<Layer> layer) { return layer->mCurrentState; }
+ auto& mutableLayerDrawingState(sp<Layer> layer) { return layer->mDrawingState; }
void setLayerSidebandStream(sp<Layer> layer, sp<NativeHandle> sidebandStream) {
- Mutex::Autolock lock(layer->mStateMutex);
- layer->mState.drawing.sidebandStream = sidebandStream;
+ layer->mDrawingState.sidebandStream = sidebandStream;
layer->getBE().compositionInfo.hwc.sidebandStream = sidebandStream;
}