diff options
author | Haamed Gheibi <haamed@google.com> | 2021-07-12 20:47:45 +0000 |
---|---|---|
committer | Haamed Gheibi <haamed@google.com> | 2021-07-14 18:21:17 +0000 |
commit | 02a7ee5d65cb8d40fd1dde9aaf6b5ead9222a5a6 (patch) | |
tree | 6fb30a5bc0d0e7fadd37d62cdba537c4d5d9237b /libs/hwui/renderthread/TimeLord.cpp | |
parent | bab7c6ab6b363574baaace4df576c1abb67f4507 (diff) | |
parent | fa0439912edd9559d7c0f46bef2b2898de68f50f (diff) |
Merge SP1A.210709.002
Change-Id: I4610885d5d770d858895057cdd9fea387a5e33dd
Diffstat (limited to 'libs/hwui/renderthread/TimeLord.cpp')
-rw-r--r-- | libs/hwui/renderthread/TimeLord.cpp | 18 |
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; |