From b6c93aa78970a823c2f9575f5646a60b30ca0e9e Mon Sep 17 00:00:00 2001 From: Rachel Lee Date: Tue, 22 Feb 2022 15:48:28 -0800 Subject: [PATCH] Use start time in SurfaceControl setFrameTimeline. Users of the API will see in the "Actual Timeline" the actual start time rather than expected start time. Bug: 210043506 Test: perfetto log of with & w/o CL, using Chromium apk, bug 198192946 Change-Id: I013bf6e28de32c82c9d645cc4cacf0cc01e0dd9f --- native/android/surface_control.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/native/android/surface_control.cpp b/native/android/surface_control.cpp index 6eff629a03f44..1ebdc273931b8 100644 --- a/native/android/surface_control.cpp +++ b/native/android/surface_control.cpp @@ -17,18 +17,15 @@ #include #include #include -#include - #include - #include #include #include #include #include - +#include +#include #include - #include using namespace android::hardware::configstore; @@ -671,7 +668,7 @@ void ASurfaceTransaction_setOnCommit(ASurfaceTransaction* aSurfaceTransaction, v void ASurfaceTransaction_setFrameTimeline(ASurfaceTransaction* aSurfaceTransaction, AVsyncId vsyncId) { CHECK_NOT_NULL(aSurfaceTransaction); - // TODO(b/210043506): Get start time from platform. + const auto startTime = AChoreographer_getStartTimeNanosForVsyncId(vsyncId); ASurfaceTransaction_to_Transaction(aSurfaceTransaction) - ->setFrameTimelineInfo({.vsyncId = vsyncId, .startTimeNanos = 0}); + ->setFrameTimelineInfo({.vsyncId = vsyncId, .startTimeNanos = startTime}); }