From 065f99f47b7ea639bd313a96db8f34dc1de9c58e Mon Sep 17 00:00:00 2001 From: "sheu@chromium.org" Date: Tue, 11 Feb 2014 00:35:28 +0000 Subject: Read compositor VSync information from platform, when possible The current query of VSync information through the GL context can be unreliable on platforms that can dynamically disable vblanks, or multi-monitor setups. Preferentially query the VSync information through the platform windowing system (presently: XRandR on CrOS) when possible. BUG=328953 TEST=local build, run on CrOS snow Review URL: https://codereview.chromium.org/138903025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@250250 0039d316-1c4b-4281-b951-d872f2087c98 --- cc/output/output_surface.cc | 13 ++++++++----- cc/output/output_surface.h | 4 ++-- cc/output/output_surface_unittest.cc | 8 ++++---- 3 files changed, 14 insertions(+), 11 deletions(-) (limited to 'cc') diff --git a/cc/output/output_surface.cc b/cc/output/output_surface.cc index 9ba6dbb..87d6e84 100644 --- a/cc/output/output_surface.cc +++ b/cc/output/output_surface.cc @@ -117,11 +117,14 @@ void OutputSurface::SetMaxFramesPending(int max_frames_pending) { max_frames_pending_ = max_frames_pending; } -void OutputSurface::OnVSyncParametersChanged(base::TimeTicks timebase, - base::TimeDelta interval) { - TRACE_EVENT2("cc", "OutputSurface::OnVSyncParametersChanged", - "timebase", (timebase - base::TimeTicks()).InSecondsF(), - "interval", interval.InSecondsF()); +void OutputSurface::CommitVSyncParameters(base::TimeTicks timebase, + base::TimeDelta interval) { + TRACE_EVENT2("cc", + "OutputSurface::CommitVSyncParameters", + "timebase", + (timebase - base::TimeTicks()).InSecondsF(), + "interval", + interval.InSecondsF()); if (frame_rate_controller_) frame_rate_controller_->SetTimebaseAndInterval(timebase, interval); } diff --git a/cc/output/output_surface.h b/cc/output/output_surface.h index 4478754..b751f06 100644 --- a/cc/output/output_surface.h +++ b/cc/output/output_surface.h @@ -159,8 +159,8 @@ class CC_EXPORT OutputSurface : public FrameRateControllerClient { // The FrameRateController is deprecated. // Platforms should move to native BeginImplFrames instead. - void OnVSyncParametersChanged(base::TimeTicks timebase, - base::TimeDelta interval); + void CommitVSyncParameters(base::TimeTicks timebase, + base::TimeDelta interval); virtual void FrameRateControllerTick(bool throttled, const BeginFrameArgs& args) OVERRIDE; scoped_ptr frame_rate_controller_; diff --git a/cc/output/output_surface_unittest.cc b/cc/output/output_surface_unittest.cc index 73a76a3..b0220fb 100644 --- a/cc/output/output_surface_unittest.cc +++ b/cc/output/output_surface_unittest.cc @@ -46,9 +46,9 @@ class TestOutputSurface : public OutputSurface { using OutputSurface::ReleaseGL; - void OnVSyncParametersChangedForTesting(base::TimeTicks timebase, - base::TimeDelta interval) { - OnVSyncParametersChanged(timebase, interval); + void CommitVSyncParametersForTesting(base::TimeTicks timebase, + base::TimeDelta interval) { + CommitVSyncParameters(timebase, interval); } void BeginImplFrameForTesting() { @@ -387,7 +387,7 @@ TEST(OutputSurfaceTest, // We need to subtract an epsilon from Now() because some platforms have // a slow clock. - output_surface.OnVSyncParametersChangedForTesting( + output_surface.CommitVSyncParametersForTesting( gfx::FrameTime::Now() - base::TimeDelta::FromSeconds(1), big_interval); output_surface.SetMaxFramesPending(2); -- cgit v1.1