diff options
author | brianderson <brianderson@chromium.org> | 2015-05-27 19:35:00 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-28 02:35:39 +0000 |
commit | dc9732c506ef024c0f6cc3b35e017e4b95d01263 (patch) | |
tree | 5c4aa94360149b71e3c38572946b57f7bae236f0 /cc/surfaces | |
parent | 8a79cc1a2db9476c8238c20a3e87aa853c8d079e (diff) | |
download | chromium_src-dc9732c506ef024c0f6cc3b35e017e4b95d01263.zip chromium_src-dc9732c506ef024c0f6cc3b35e017e4b95d01263.tar.gz chromium_src-dc9732c506ef024c0f6cc3b35e017e4b95d01263.tar.bz2 |
cc: Support --disable-gpu-vsync with DisplayScheduler
This gives the DisplayScheduler an unthrottled BeginFrameSource
if --disable-gpu-vsync was passed to the command line.
BUG=467750, 491387
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel
Review URL: https://codereview.chromium.org/1144073003
Cr-Commit-Position: refs/heads/master@{#331728}
Diffstat (limited to 'cc/surfaces')
-rw-r--r-- | cc/surfaces/onscreen_display_client.cc | 27 | ||||
-rw-r--r-- | cc/surfaces/onscreen_display_client.h | 8 |
2 files changed, 26 insertions, 9 deletions
diff --git a/cc/surfaces/onscreen_display_client.cc b/cc/surfaces/onscreen_display_client.cc index 6fc63ce..83db365 100644 --- a/cc/surfaces/onscreen_display_client.cc +++ b/cc/surfaces/onscreen_display_client.cc @@ -6,6 +6,7 @@ #include "base/trace_event/trace_event.h" #include "cc/output/output_surface.h" +#include "cc/output/vsync_parameter_observer.h" #include "cc/scheduler/begin_frame_source.h" #include "cc/surfaces/display_scheduler.h" #include "cc/surfaces/surface_display_output_surface.h" @@ -27,8 +28,10 @@ OnscreenDisplayClient::OnscreenDisplayClient( bitmap_manager, gpu_memory_buffer_manager, settings)), + vsync_observer_(nullptr), task_runner_(task_runner), - output_surface_lost_(false) { + output_surface_lost_(false), + disable_gpu_vsync_(settings.disable_gpu_vsync) { } OnscreenDisplayClient::~OnscreenDisplayClient() { @@ -40,11 +43,21 @@ bool OnscreenDisplayClient::Initialize() { if (max_frames_pending <= 0) max_frames_pending = OutputSurface::DEFAULT_MAX_FRAMES_PENDING; - synthetic_begin_frame_source_ = SyntheticBeginFrameSource::Create( - task_runner_.get(), base::TimeTicks(), BeginFrameArgs::DefaultInterval()); + if (disable_gpu_vsync_) { + begin_frame_source_ = + BackToBackBeginFrameSource::Create(task_runner_.get()); + } else { + scoped_ptr<SyntheticBeginFrameSource> synthetic_source = + SyntheticBeginFrameSource::Create(task_runner_.get(), base::TimeTicks(), + BeginFrameArgs::DefaultInterval()); + vsync_observer_ = synthetic_source.get(); + begin_frame_source_ = synthetic_source.Pass(); + } + scheduler_.reset(new DisplayScheduler(display_.get(), - synthetic_begin_frame_source_.get(), - task_runner_, max_frames_pending)); + begin_frame_source_.get(), task_runner_, + max_frames_pending)); + return display_->Initialize(output_surface_.Pass(), scheduler_.get()); } @@ -56,8 +69,8 @@ void OnscreenDisplayClient::CommitVSyncParameters(base::TimeTicks timebase, } surface_display_output_surface_->ReceivedVSyncParameters(timebase, interval); - if (synthetic_begin_frame_source_) - synthetic_begin_frame_source_->OnUpdateVSyncParameters(timebase, interval); + if (vsync_observer_) + vsync_observer_->OnUpdateVSyncParameters(timebase, interval); } void OnscreenDisplayClient::OutputSurfaceLost() { diff --git a/cc/surfaces/onscreen_display_client.h b/cc/surfaces/onscreen_display_client.h index c042c1b..ec147df 100644 --- a/cc/surfaces/onscreen_display_client.h +++ b/cc/surfaces/onscreen_display_client.h @@ -14,12 +14,14 @@ #include "cc/surfaces/display.h" #include "cc/surfaces/surfaces_export.h" +class VSyncParameterObserver; + namespace cc { +class BeginFrameSource; class ContextProvider; class DisplayScheduler; class SurfaceManager; class SurfaceDisplayOutputSurface; -class SyntheticBeginFrameSource; // This class provides a DisplayClient implementation for drawing directly to an // onscreen context. @@ -52,11 +54,13 @@ class CC_SURFACES_EXPORT OnscreenDisplayClient protected: scoped_ptr<OutputSurface> output_surface_; scoped_ptr<Display> display_; - scoped_ptr<SyntheticBeginFrameSource> synthetic_begin_frame_source_; + VSyncParameterObserver* vsync_observer_; + scoped_ptr<BeginFrameSource> begin_frame_source_; scoped_ptr<DisplayScheduler> scheduler_; scoped_refptr<base::SingleThreadTaskRunner> task_runner_; SurfaceDisplayOutputSurface* surface_display_output_surface_; bool output_surface_lost_; + bool disable_gpu_vsync_; DISALLOW_COPY_AND_ASSIGN(OnscreenDisplayClient); }; |