summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorDan Stoza <stoza@google.com>2015-07-06 12:56:50 -0700
committerDan Stoza <stoza@google.com>2015-07-06 13:15:25 -0700
commit0eb2d398669bf11207c0fb22b11439250da0c8dc (patch)
treedda1c1aff43320bb0320796a9b01bcf8888eddd5 /services
parent56105b2f72761dec62699db5d61570971fdf6580 (diff)
downloadframeworks_native-0eb2d398669bf11207c0fb22b11439250da0c8dc.zip
frameworks_native-0eb2d398669bf11207c0fb22b11439250da0c8dc.tar.gz
frameworks_native-0eb2d398669bf11207c0fb22b11439250da0c8dc.tar.bz2
SF: Ignore PTS more than one second in the future
Some of this logic already existed, but when we optimized SurfaceFlinger to avoid unnecessary wake-ups, we didn't carry the logic over into the new readiness test. shouldPresentNow now returns true if the timestamp is more than a second in the future (since it's likely a bogus timestamp and should be ignored). Bug: 21932760 Change-Id: Ib50970a4eb621588c0b60766c8d8d1a8bddf853b
Diffstat (limited to 'services')
-rw-r--r--services/surfaceflinger/Layer.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 91f80b6..e2418cc 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -1102,10 +1102,21 @@ void Layer::useEmptyDamage() {
bool Layer::shouldPresentNow(const DispSync& dispSync) const {
Mutex::Autolock lock(mQueueItemLock);
+ if (mQueueItems.empty()) {
+ return false;
+ }
+ auto timestamp = mQueueItems[0].mTimestamp;
nsecs_t expectedPresent =
mSurfaceFlingerConsumer->computeExpectedPresent(dispSync);
- return mQueueItems.empty() ?
- false : mQueueItems[0].mTimestamp < expectedPresent;
+
+ // Ignore timestamps more than a second in the future
+ bool isPlausible = timestamp < (expectedPresent + s2ns(1));
+ ALOGW_IF(!isPlausible, "[%s] Timestamp %" PRId64 " seems implausible "
+ "relative to expectedPresent %" PRId64, mName.string(), timestamp,
+ expectedPresent);
+
+ bool isDue = timestamp < expectedPresent;
+ return isDue || !isPlausible;
}
bool Layer::onPreComposition() {