summaryrefslogtreecommitdiff
path: root/libs/hwui/renderthread/CanvasContext.cpp
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2017-05-31 14:02:50 -0700
committerJohn Reck <jreck@google.com>2017-05-31 14:02:50 -0700
commit32414eea3e5aa55fb251255ecf84b0e54858624f (patch)
tree9f3517f46d50a730fba39fae2a54dbfda8577336 /libs/hwui/renderthread/CanvasContext.cpp
parentf220d95f543d76878aed3f7efb199a5e1c0d9e5a (diff)
Fix dequeus outside of frame drawing
Bug: 62213889 Test: Repro steps in bug Change-Id: I8fc407b280ba82c669fc2bb03750cab139adb965
Diffstat (limited to 'libs/hwui/renderthread/CanvasContext.cpp')
-rw-r--r--libs/hwui/renderthread/CanvasContext.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp
index 02a9ffa3039c..cbc5163244c1 100644
--- a/libs/hwui/renderthread/CanvasContext.cpp
+++ b/libs/hwui/renderthread/CanvasContext.cpp
@@ -436,8 +436,15 @@ void CanvasContext::draw() {
swap.vsyncTime = mRenderThread.timeLord().latestVsync();
if (mNativeSurface.get()) {
int durationUs;
- mNativeSurface->query(NATIVE_WINDOW_LAST_DEQUEUE_DURATION, &durationUs);
- swap.dequeueDuration = us2ns(durationUs);
+ nsecs_t dequeueStart = mNativeSurface->getLastDequeueStartTime();
+ if (dequeueStart < mCurrentFrameInfo->get(FrameInfoIndex::Vsync)) {
+ // Ignoring dequeue duration as it happened prior to vsync
+ // and thus is not part of the frame.
+ swap.dequeueDuration = 0;
+ } else {
+ mNativeSurface->query(NATIVE_WINDOW_LAST_DEQUEUE_DURATION, &durationUs);
+ swap.dequeueDuration = us2ns(durationUs);
+ }
mNativeSurface->query(NATIVE_WINDOW_LAST_QUEUE_DURATION, &durationUs);
swap.queueDuration = us2ns(durationUs);
} else {