summaryrefslogtreecommitdiff
path: root/libs/hwui/renderthread/CanvasContext.cpp
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2020-02-03 16:47:12 -0800
committerJohn Reck <jreck@google.com>2020-02-03 16:47:12 -0800
commit56cffe5b6a0c4bca1b926d9d80c9298122e4a573 (patch)
tree9de4171ebc9d4ee681337d181fac4cf8fadbd9a9 /libs/hwui/renderthread/CanvasContext.cpp
parentd1ab76705a30663a81101bcf8361770c94f8330f (diff)
Adjust present time calculation
Adjust the target present time when using render_ahead to better fit in the gaps between vsync pulses. This prevents small clock drifts from causing jank. Bug: 143540628 Test: manual, looked at systrace Change-Id: I26ae6ebf16a3dea48dfd8e1c420d9e5e43e42bcb
Diffstat (limited to 'libs/hwui/renderthread/CanvasContext.cpp')
-rw-r--r--libs/hwui/renderthread/CanvasContext.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp
index 699b96a685c9..2b48c3581933 100644
--- a/libs/hwui/renderthread/CanvasContext.cpp
+++ b/libs/hwui/renderthread/CanvasContext.cpp
@@ -429,7 +429,8 @@ void CanvasContext::setPresentTime() {
if (renderAhead) {
presentTime = mCurrentFrameInfo->get(FrameInfoIndex::Vsync) +
- (frameIntervalNanos * (renderAhead + 1));
+ (frameIntervalNanos * (renderAhead + 1)) - DeviceInfo::get()->getAppOffset() +
+ (frameIntervalNanos / 2);
}
native_window_set_buffers_timestamp(mNativeSurface->getNativeWindow(), presentTime);
}