diff options
author | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-07 20:42:30 +0000 |
---|---|---|
committer | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-07 20:42:30 +0000 |
commit | 9069b6074b4746ee48f53907f5b5205a373fa26c (patch) | |
tree | 0d7cf0486b54dff857f8855f33e96bca6a53c310 /ui/surface | |
parent | dc8b0fc2646775cc91ed9d76ef0efc5dfb3708d2 (diff) | |
download | chromium_src-9069b6074b4746ee48f53907f5b5205a373fa26c.zip chromium_src-9069b6074b4746ee48f53907f5b5205a373fa26c.tar.gz chromium_src-9069b6074b4746ee48f53907f5b5205a373fa26c.tar.bz2 |
Revert 174920
> Reland 174257 with fix for win_aura
>
> win: AcceleratedPresenter replies to the GPU process as soon as shared texture is copied.
>
> This means the GPU does not deschedule for as long waiting until it can render to the back buffer safely.
>
> TBR=apatrick@chromium.org
>
> Review URL: https://chromiumcodereview.appspot.com/11642051
Reverting to isolate performance regression on gpu_frame_rate tests on windows
TBR=apatrick@chromium.org
BUG=168470
Review URL: https://codereview.chromium.org/11782018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@175379 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/surface')
-rw-r--r-- | ui/surface/accelerated_surface_win.cc | 59 | ||||
-rw-r--r-- | ui/surface/accelerated_surface_win.h | 13 |
2 files changed, 27 insertions, 45 deletions
diff --git a/ui/surface/accelerated_surface_win.cc b/ui/surface/accelerated_surface_win.cc index 0ac8f1c..6b4e1b1 100644 --- a/ui/surface/accelerated_surface_win.cc +++ b/ui/surface/accelerated_surface_win.cc @@ -269,13 +269,11 @@ scoped_refptr<AcceleratedPresenter> AcceleratedPresenter::GetForWindow( void AcceleratedPresenter::AsyncPresentAndAcknowledge( const gfx::Size& size, int64 surface_handle, - const CopyCompletionTask& copy_completion_task, - const PresentCompletionTask& present_completion_task) { + const CompletionTask& completion_task) { if (!surface_handle) { TRACE_EVENT1("gpu", "EarlyOut_ZeroSurfaceHandle", "surface_handle", surface_handle); - copy_completion_task.Run(true); - present_completion_task.Run(base::TimeTicks(), base::TimeDelta()); + completion_task.Run(true, base::TimeTicks(), base::TimeDelta()); return; } @@ -285,8 +283,7 @@ void AcceleratedPresenter::AsyncPresentAndAcknowledge( this, size, surface_handle, - copy_completion_task, - present_completion_task)); + completion_task)); } void AcceleratedPresenter::Present(HDC dc) { @@ -472,8 +469,7 @@ static base::TimeDelta GetSwapDelay() { void AcceleratedPresenter::DoPresentAndAcknowledge( const gfx::Size& size, int64 surface_handle, - const CopyCompletionTask& copy_completion_task, - const PresentCompletionTask& present_completion_task) { + const CompletionTask& completion_task) { TRACE_EVENT2( "gpu", "DoPresentAndAcknowledge", "width", size.width(), @@ -487,21 +483,15 @@ void AcceleratedPresenter::DoPresentAndAcknowledge( present_thread_->InitDevice(); if (!present_thread_->device()) { - if (!copy_completion_task.is_null()) - copy_completion_task.Run(false); - if (!present_completion_task.is_null()) - present_completion_task.Run(base::TimeTicks(), base::TimeDelta()); + if (!completion_task.is_null()) + completion_task.Run(false, base::TimeTicks(), base::TimeDelta()); TRACE_EVENT0("gpu", "EarlyOut_NoDevice"); return; } // Ensure the task is always run and while the lock is taken. - base::ScopedClosureRunner scoped_copy_completion_runner( - base::Bind(copy_completion_task, true)); - base::ScopedClosureRunner scoped_present_completion_runner( - base::Bind(present_completion_task, - base::TimeTicks(), - base::TimeDelta())); + base::ScopedClosureRunner scoped_completion_runner( + base::Bind(completion_task, true, base::TimeTicks(), base::TimeDelta())); // If invalidated, do nothing, the window is gone. if (!window_) { @@ -604,23 +594,6 @@ void AcceleratedPresenter::DoPresentAndAcknowledge( if (FAILED(hr)) return; - // Wait for the StretchRect to complete before notifying the GPU process - // that it is safe to write to its backing store again. - { - TRACE_EVENT0("gpu", "spin"); - do { - hr = present_thread_->query()->GetData(NULL, 0, D3DGETDATA_FLUSH); - - if (hr == S_FALSE) - Sleep(1); - } while (hr == S_FALSE); - } - - // Acknowledge that the copy is complete and it is safe to modify the shared - // texture. - scoped_copy_completion_runner.Release(); - copy_completion_task.Run(true); - present_size_ = size; static const base::TimeDelta swap_delay = GetSwapDelay(); @@ -686,8 +659,20 @@ void AcceleratedPresenter::DoPresentAndAcknowledge( 1000000 / display_mode.RefreshRate); } - scoped_present_completion_runner.Release(); - present_completion_task.Run(last_vsync_time, refresh_period); + // Wait for the StretchRect to complete before notifying the GPU process + // that it is safe to write to its backing store again. + { + TRACE_EVENT0("gpu", "spin"); + do { + hr = present_thread_->query()->GetData(NULL, 0, D3DGETDATA_FLUSH); + + if (hr == S_FALSE) + Sleep(1); + } while (hr == S_FALSE); + } + + scoped_completion_runner.Release(); + completion_task.Run(true, last_vsync_time, refresh_period); } void AcceleratedPresenter::DoSuspend() { diff --git a/ui/surface/accelerated_surface_win.h b/ui/surface/accelerated_surface_win.h index e077aae..166bf5b 100644 --- a/ui/surface/accelerated_surface_win.h +++ b/ui/surface/accelerated_surface_win.h @@ -26,10 +26,9 @@ class Rect; class SURFACE_EXPORT AcceleratedPresenter : public base::RefCountedThreadSafe<AcceleratedPresenter> { public: - typedef base::Callback<void(bool)> CopyCompletionTask; - - typedef base::Callback<void(base::TimeTicks, - base::TimeDelta)> PresentCompletionTask; + typedef base::Callback<void(bool, + base::TimeTicks, + base::TimeDelta)> CompletionTask; explicit AcceleratedPresenter(gfx::PluginWindowHandle window); @@ -46,8 +45,7 @@ class SURFACE_EXPORT AcceleratedPresenter void AsyncPresentAndAcknowledge( const gfx::Size& size, int64 surface_handle, - const CopyCompletionTask& copy_completion_task, - const PresentCompletionTask& present_completion_task); + const CompletionTask& completion_task); // Schedule the presenter to free all its resources. This can be called on any // thread. @@ -83,8 +81,7 @@ class SURFACE_EXPORT AcceleratedPresenter void DoPresentAndAcknowledge( const gfx::Size& size, int64 surface_handle, - const CopyCompletionTask& copy_completion_task, - const PresentCompletionTask& present_completion_task); + const CompletionTask& completion_task); void DoSuspend(); void DoPresent(const base::Closure& composite_task); void DoReleaseSurface(); |