summaryrefslogtreecommitdiff
path: root/libs/hwui/renderthread/DrawFrameTask.cpp
diff options
context:
space:
mode:
authorChris Gross <chrisgross@google.com>2021-05-19 11:39:13 -0700
committerScott Lobdell <slobdell@google.com>2021-05-21 00:34:23 +0000
commit219787565ff982848d596fa8743cd132af113e6b (patch)
tree93bd3c94771fb966fdf611d38865e712fb83e969 /libs/hwui/renderthread/DrawFrameTask.cpp
parent7b4a006d559a571313e36799d93af7e3c6b69c82 (diff)
parent75eb1dd292d1800d660c5146464264b25854d318 (diff)
Merge SP1A.210513.004
Change-Id: Ic23aece12c3bbd2b4dcf3205fdbcdd1601deabec
Diffstat (limited to 'libs/hwui/renderthread/DrawFrameTask.cpp')
-rw-r--r--libs/hwui/renderthread/DrawFrameTask.cpp13
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) {