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

Commit 56cffe5b authored by John Reck's avatar John Reck
Browse files

Adjust present time calculation

Adjust the target present time when using
render_ahead to better fit in the gaps between
vsync pulses. This prevents small clock
drifts from causing jank.

Bug: 143540628
Test: manual, looked at systrace
Change-Id: I26ae6ebf16a3dea48dfd8e1c420d9e5e43e42bcb
parent d1ab7670
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -429,7 +429,8 @@ void CanvasContext::setPresentTime() {

    if (renderAhead) {
        presentTime = mCurrentFrameInfo->get(FrameInfoIndex::Vsync) +
                (frameIntervalNanos * (renderAhead + 1));
                (frameIntervalNanos * (renderAhead + 1)) - DeviceInfo::get()->getAppOffset() +
                (frameIntervalNanos / 2);
    }
    native_window_set_buffers_timestamp(mNativeSurface->getNativeWindow(), presentTime);
}