Add synchronous SurfaceFlinger tracing
We want to collect traces without impacting composition so by default
we collect traces in another thread while holding a tracing lock when
current state is copied over to drawing state. But this has some
issues. If the tracing thread is not scheduled before the next frame
is composed, we may miss a state. If we need to collect composition
state then we may access states that are currently being modified by
the drawing thread.
To counter this the caller can pass in a TRACE_SYNC flag which will
force the trace to be collected in the drawing thread after
composition. This can be used by tests which don't care about the perf
impact caused by the sync tracing.
This change also fixes threading bugs highlighted in b/154155922
Finally we add a flag TRACE_BUFFERS to capture buffer latches as
well. This is used for Blast buffer tests.
Bug: 169849887, 153739621
Fixes: 154155922
Test: enable tracing with flags, on hwasan builds
Change-Id: I58512cdc98745398b460fa8e7798eb809bd2b0ae
5 files changed