summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Bouyack <mbouyack@google.com>2016-01-12 12:01:48 -0800
committerMatthew Bouyack <mbouyack@google.com>2016-01-12 12:01:48 -0800
commit7f667e7a0823d52eed2ed64a31b125f6b8da21cb (patch)
tree8e19e45d77476fb074e7050d1b1ab2820cd676c3
parent1d3bac82b3bc59fd7225a3c27b32db2fc90b0308 (diff)
downloadframeworks_base-7f667e7a0823d52eed2ed64a31b125f6b8da21cb.zip
frameworks_base-7f667e7a0823d52eed2ed64a31b125f6b8da21cb.tar.gz
frameworks_base-7f667e7a0823d52eed2ed64a31b125f6b8da21cb.tar.bz2
In CanvasContext::doFrame, make a separate call to computeFrameTimeNanos
and save the result. Then pass that value to UiFrameInfoBuilder::setVsync as both arguments. The order of function argument evaluation is undefined in C++. Because the value returned from TimeLord::latestVsync may be changed by the preceding call to TimeLord::computeFrameTimeNanos the values of the arguments passed to UiFrameInfoBuilder::setVsync is also undefined. This change removes any ambiguity. Change-Id: Ie71ee453f9ccc725edfe5f7cc9b277f2a809dfdc
-rw-r--r--libs/hwui/renderthread/CanvasContext.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp
index 6dfb6e8..4cf8b15 100644
--- a/libs/hwui/renderthread/CanvasContext.cpp
+++ b/libs/hwui/renderthread/CanvasContext.cpp
@@ -289,11 +289,11 @@ void CanvasContext::doFrame() {
ATRACE_CALL();
+ nsecs_t vsync = mRenderThread.timeLord().computeFrameTimeNanos();
int64_t frameInfo[UI_THREAD_FRAME_INFO_SIZE];
UiFrameInfoBuilder(frameInfo)
.addFlag(FrameInfoFlags::RTAnimation)
- .setVsync(mRenderThread.timeLord().computeFrameTimeNanos(),
- mRenderThread.timeLord().latestVsync());
+ .setVsync(vsync, vsync);
TreeInfo info(TreeInfo::MODE_RT_ONLY, mRenderThread.renderState());
prepareTree(info, frameInfo, systemTime(CLOCK_MONOTONIC));