summaryrefslogtreecommitdiff
path: root/libs/hwui
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2021-06-28 23:58:30 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2021-06-28 23:58:30 +0000
commit544b5f5b2e4c5c93abaa37e2324c7b79a1cd27e3 (patch)
treebf462cf0a9d3fd9f04485f0a82d98eb43e42d144 /libs/hwui
parenteb87d4ea37fe1409e90832082b453aa8f9041632 (diff)
parent505e730e7d67f7a068ce5b3d2384643d0e04a282 (diff)
Merge "vsyncId should always be incremental" into sc-dev
Diffstat (limited to 'libs/hwui')
-rw-r--r--libs/hwui/renderthread/TimeLord.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/libs/hwui/renderthread/TimeLord.cpp b/libs/hwui/renderthread/TimeLord.cpp
index 406066c92bab..a43fcdc6e202 100644
--- a/libs/hwui/renderthread/TimeLord.cpp
+++ b/libs/hwui/renderthread/TimeLord.cpp
@@ -15,22 +15,28 @@
*/
#include "TimeLord.h"
#include <limits>
+#include "FrameInfo.h"
namespace android {
namespace uirenderer {
namespace renderthread {
-TimeLord::TimeLord() : mFrameIntervalNanos(milliseconds_to_nanoseconds(16)),
- mFrameTimeNanos(0),
- mFrameIntendedTimeNanos(0),
- mFrameVsyncId(-1),
- mFrameDeadline(std::numeric_limits<int64_t>::max()){}
+TimeLord::TimeLord()
+ : mFrameIntervalNanos(milliseconds_to_nanoseconds(16))
+ , mFrameTimeNanos(0)
+ , mFrameIntendedTimeNanos(0)
+ , mFrameVsyncId(UiFrameInfoBuilder::INVALID_VSYNC_ID)
+ , mFrameDeadline(std::numeric_limits<int64_t>::max()) {}
bool TimeLord::vsyncReceived(nsecs_t vsync, nsecs_t intendedVsync, int64_t vsyncId,
int64_t frameDeadline, nsecs_t frameInterval) {
if (intendedVsync > mFrameIntendedTimeNanos) {
mFrameIntendedTimeNanos = intendedVsync;
- mFrameVsyncId = vsyncId;
+
+ // The intendedVsync might have been advanced to account for scheduling
+ // jitter. Since we don't have a way to advance the vsync id we just
+ // reset it.
+ mFrameVsyncId = (vsyncId > mFrameVsyncId) ? vsyncId : UiFrameInfoBuilder::INVALID_VSYNC_ID;
mFrameDeadline = frameDeadline;
if (frameInterval > 0) {
mFrameIntervalNanos = frameInterval;