SF: Pass timestamps into layer tracing
This will allow us to recreate layer traces that
reflect the same timeline as the transaction
trace.
Test: presubmit
Bug: 200284593
Change-Id: I693c514ae56ed2137ad53b007a6722ba9396ecde
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index e765c9b..417417d 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -2179,6 +2179,11 @@
updateCursorAsync();
updateInputFlinger();
+ if (mLayerTracingEnabled && !mLayerTracing.flagIsSet(LayerTracing::TRACE_COMPOSITION)) {
+ // This will block and tracing should only be enabled for debugging.
+ mLayerTracing.notify(mVisibleRegionsDirty, frameTime);
+ }
+
MAIN_THREAD_GUARD(persistDisplayBrightness(mustComposite));
return mustComposite && CC_LIKELY(mBootStage != BootStage::BOOTLOADER);
@@ -2280,13 +2285,9 @@
modulateVsync(&VsyncModulator::onDisplayRefresh, usedGpuComposition);
mLayersWithQueuedFrames.clear();
- if (mLayerTracingEnabled) {
+ if (mLayerTracingEnabled && mLayerTracing.flagIsSet(LayerTracing::TRACE_COMPOSITION)) {
// This will block and should only be used for debugging.
- if (mVisibleRegionsDirty) {
- mLayerTracing.notify("visibleRegionsDirty");
- } else if (mLayerTracing.flagIsSet(LayerTracing::TRACE_BUFFERS)) {
- mLayerTracing.notify("bufferLatched");
- }
+ mLayerTracing.notify(mVisibleRegionsDirty, frameTime);
}
mVisibleRegionsWereDirtyThisFrame = mVisibleRegionsDirty; // Cache value for use in post-comp
@@ -5773,12 +5774,18 @@
}
case 1025: { // Set layer tracing
n = data.readInt32();
+ int64_t fixedStartingTime = data.readInt64();
bool tracingEnabledChanged;
if (n) {
ALOGD("LayerTracing enabled");
tracingEnabledChanged = mLayerTracing.enable();
if (tracingEnabledChanged) {
- mScheduler->schedule([&]() MAIN_THREAD { mLayerTracing.notify("start"); })
+ int64_t startingTime =
+ (fixedStartingTime) ? fixedStartingTime : systemTime();
+ mScheduler
+ ->schedule([&]() MAIN_THREAD {
+ mLayerTracing.notify("start", startingTime);
+ })
.wait();
}
} else {