Fix a long standing locking issue with tracing thread
If winscope tracing is enabled, the tracing thread will read the drawing state if the visible region changes and writes the state it to a proto. This has a few issues: layer drawing state was being committed without holding the tracing lock, layers could be destroyed when finalizePendingOutputLayers (without holding the tracing lock) making access to offscreenlayers invalid, finally we could get miss a trace entry or have invalid entries. This fix takes the tracing lock while committing the layer drawing states and removes accessing the drawing states which are modified later. It also identifies any missed entries. In S, we will look at simplifying the tracing model to store a delta of changes per layer. Fixes: b/152010382, b/144918813, b/140854698 Test: w/ hwasan build and winscope enabled atest SurfaceFlinger_test libgui_test Test: w/ hwasan build and winscope enabled go/wm-tests Change-Id: I71c7b8e6567767ef97d82c5ea2e06a82ecc3c17a
Loading
Please register or sign in to comment