diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2021-05-13 01:07:48 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2021-05-13 01:07:48 +0000 |
commit | 5a1367ea286405cfb596b50d2b418bdee154a6f4 (patch) | |
tree | 3a41f06b3c13fdc53519ece4d29a947c07676f08 /libs/hwui/renderthread/DrawFrameTask.cpp | |
parent | a3cae58636a3f6f331354d8bfbe1f0dcba31f535 (diff) | |
parent | 3009a4d87dee1ba5b24bed52fb74136ac2944393 (diff) |
Snap for 7357013 from 3009a4d87dee1ba5b24bed52fb74136ac2944393 to sc-release
Change-Id: I80e36a06e60537dae14e4185bc14f8040b59a310
Diffstat (limited to 'libs/hwui/renderthread/DrawFrameTask.cpp')
-rw-r--r-- | libs/hwui/renderthread/DrawFrameTask.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/libs/hwui/renderthread/DrawFrameTask.cpp b/libs/hwui/renderthread/DrawFrameTask.cpp index cb92aa191073..8448b87b5948 100644 --- a/libs/hwui/renderthread/DrawFrameTask.cpp +++ b/libs/hwui/renderthread/DrawFrameTask.cpp @@ -18,6 +18,7 @@ #include <utils/Log.h> #include <utils/TraceUtils.h> +#include <algorithm> #include "../DeferredLayerUpdater.h" #include "../DisplayList.h" @@ -91,6 +92,7 @@ void DrawFrameTask::postAndWait() { void DrawFrameTask::run() { const int64_t vsyncId = mFrameInfo[static_cast<int>(FrameInfoIndex::FrameTimelineVsyncId)]; ATRACE_FORMAT("DrawFrames %" PRId64, vsyncId); + nsecs_t syncDelayDuration = systemTime(SYSTEM_TIME_MONOTONIC) - mSyncQueued; bool canUnblockUiThread; bool canDrawThisFrame; @@ -124,8 +126,9 @@ void DrawFrameTask::run() { [callback, frameNr = context->getFrameNumber()]() { callback(frameNr); }); } + nsecs_t dequeueBufferDuration = 0; if (CC_LIKELY(canDrawThisFrame)) { - context->draw(); + dequeueBufferDuration = context->draw(); } else { // wait on fences so tasks don't overlap next frame context->waitOnFences(); @@ -149,10 +152,14 @@ void DrawFrameTask::run() { mUpdateTargetWorkDuration(targetWorkDuration); } int64_t frameDuration = systemTime(SYSTEM_TIME_MONOTONIC) - frameStartTime; - if (frameDuration > kSanityCheckLowerBound && frameDuration < kSanityCheckUpperBound) { - mReportActualWorkDuration(frameDuration); + int64_t actualDuration = frameDuration - + (std::min(syncDelayDuration, mLastDequeueBufferDuration)) - + dequeueBufferDuration; + if (actualDuration > kSanityCheckLowerBound && actualDuration < kSanityCheckUpperBound) { + mReportActualWorkDuration(actualDuration); } } + mLastDequeueBufferDuration = dequeueBufferDuration; } bool DrawFrameTask::syncFrameState(TreeInfo& info) { |