summaryrefslogtreecommitdiff
path: root/libs/hwui/renderthread/CanvasContext.cpp
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2016-07-21 00:59:49 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-07-21 00:59:49 +0000
commitcf3e1a7fa847e6895c3bc8d9549d2ed9ce736608 (patch)
treebcc370b0013e467642cccfbaa33b0459dfe265d3 /libs/hwui/renderthread/CanvasContext.cpp
parent7d261d7e3c6e2915a78816eee7ba53f555d346f1 (diff)
parent3c37412900502fd491cc40e1df594ee1f45af1b2 (diff)
Merge \\"Change swap chain stuffed detection logic\\" into nyc-mr1-dev am: 433a19e8bf
am: 3c37412900 Change-Id: Id7e0d1d1dfb5448dd927c29361fb98aabf0cfe10
Diffstat (limited to 'libs/hwui/renderthread/CanvasContext.cpp')
-rw-r--r--libs/hwui/renderthread/CanvasContext.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp
index 841ec784e3c7..9b0be49beb07 100644
--- a/libs/hwui/renderthread/CanvasContext.cpp
+++ b/libs/hwui/renderthread/CanvasContext.cpp
@@ -219,9 +219,9 @@ bool CanvasContext::isSwapChainStuffed() {
for (size_t i = 1; i < mSwapHistory.size(); i++) {
auto& swapB = mSwapHistory[i];
- // If there's a frameInterval gap we effectively already dropped a frame,
+ // If there's a multi-frameInterval gap we effectively already dropped a frame,
// so consider the queue healthy.
- if (swapA.swapCompletedTime - swapB.swapCompletedTime > frameInterval) {
+ if (swapA.swapCompletedTime - swapB.swapCompletedTime > frameInterval * 3) {
return false;
}
@@ -296,12 +296,17 @@ void CanvasContext::prepareTree(TreeInfo& info, int64_t* uiFrameInfo,
// Already drew for this vsync pulse, UI draw request missed
// the deadline for RT animations
info.out.canDrawThisFrame = false;
- } else if (vsyncDelta >= mRenderThread.timeLord().frameIntervalNanos()) {
- // It's been at least an entire frame interval, assume
- // the buffer queue is fine
+ } else if (vsyncDelta >= mRenderThread.timeLord().frameIntervalNanos() * 3
+ || (latestVsync - mLastDropVsync) < 500_ms) {
+ // It's been several frame intervals, assume the buffer queue is fine
+ // or the last drop was too recent
info.out.canDrawThisFrame = true;
} else {
info.out.canDrawThisFrame = !isSwapChainStuffed();
+ if (!info.out.canDrawThisFrame) {
+ // dropping frame
+ mLastDropVsync = mRenderThread.timeLord().latestVsync();
+ }
}
} else {
info.out.canDrawThisFrame = true;