Skip to content

Commit

Permalink
DelayBasedBeginFrameSourceMac: Handle VSync parameter skew
Browse files Browse the repository at this point in the history
The VSync parameters on macOS change over time. In compensation for
this, we re-compute them every 10 seconds (see the initial
implementation in crrev.com/343739).

This function to trigger to update update code wasn't copied
when creating DelayBasedBeginFrameSourceMac, re-introducing the the
VSync skew bug.

Re-add the function (note that all of the supporting variables, like
DelayBasedBeginFrameSourceMac::time_source_next_update_time_ were
correctly copied).

Bug: 1450617
Change-Id: Id383b64e9c9d87c1c105aa260a1f3434ced85b80
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4705225
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Commit-Queue: Prudhvikumar Bommana <pbommana@google.com>
Cr-Commit-Position: refs/branch-heads/5790@{#1790}
Cr-Branched-From: 1d71a33-refs/heads/main@{#1148114}
  • Loading branch information
ccameron-chromium authored and Chromium LUCI CQ committed Jul 21, 2023
1 parent 2126955 commit fc1f225
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Expand Up @@ -135,4 +135,14 @@ void DelayBasedBeginFrameSourceMac::OnTimeSourceParamsUpdate(
OnUpdateVSyncParameters(params.display_timebase, params.display_interval);
}

void DelayBasedBeginFrameSourceMac::OnTimerTick() {
// The VSync parameters skew over time (astonishingly quickly -- 0.1 msec per
// second). If too much time has elapsed since the last time the vsync
// parameters were calculated, re-calculate them.
if (base::TimeTicks::Now() >= time_source_next_update_time_) {
RequestTimeSourceParamsUpdate();
}
DelayBasedBeginFrameSource::OnTimerTick();
}

} // namespace viz
Expand Up @@ -86,6 +86,7 @@ class VIZ_COMMON_EXPORT DelayBasedBeginFrameSourceMac

// BeginFrameSource implementation.
void SetVSyncDisplayID(int64_t display_id) override;
void OnTimerTick() override;

private:
// Request a callback from DisplayLinkMac, and the callback function.
Expand Down

0 comments on commit fc1f225

Please sign in to comment.