summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2016-07-21 00:26:14 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2016-07-21 00:26:15 +0000
commit433a19e8bf92accb834f703f91650bc8de776073 (patch)
treec79198534b8a622c5c087537a735deee156b8ad0 /libs
parent8c8d752851b849d40f033701c1fa203d4945a43d (diff)
parent3163568806f2f1c360f93772453f4b0b3a9b2e47 (diff)
downloadandroid-frameworks-base-433a19e8bf92accb834f703f91650bc8de776073.tar.gz
android-frameworks-base-433a19e8bf92accb834f703f91650bc8de776073.tar.xz
Merge "Change swap chain stuffed detection logic" into nyc-mr1-dev
Diffstat (limited to 'libs')
-rw-r--r--libs/hwui/renderthread/CanvasContext.cpp15
-rw-r--r--libs/hwui/renderthread/CanvasContext.h3
2 files changed, 13 insertions, 5 deletions
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp
index bfcb0e5..4b9d7d5 100644
--- a/libs/hwui/renderthread/CanvasContext.cpp
+++ b/libs/hwui/renderthread/CanvasContext.cpp
@@ -217,9 +217,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;
}
@@ -298,12 +298,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;
diff --git a/libs/hwui/renderthread/CanvasContext.h b/libs/hwui/renderthread/CanvasContext.h
index b0d980b..3eef29b 100644
--- a/libs/hwui/renderthread/CanvasContext.h
+++ b/libs/hwui/renderthread/CanvasContext.h
@@ -208,6 +208,9 @@ private:
RingBuffer<SwapHistory, 3> mSwapHistory;
int64_t mFrameNumber = -1;
+ // last vsync for a dropped frame due to stuffed queue
+ nsecs_t mLastDropVsync = 0;
+
bool mOpaque;
#if HWUI_NEW_OPS
BakedOpRenderer::LightInfo mLightInfo;