Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7f667e7a authored by Matthew Bouyack's avatar Matthew Bouyack
Browse files

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
parent 1d3bac82
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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));