diff options
author | fischman@chromium.org <fischman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-29 17:47:01 +0000 |
---|---|---|
committer | fischman@chromium.org <fischman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-29 17:47:01 +0000 |
commit | 890e8966414165e59418b7886778cbd16cc194ac (patch) | |
tree | 3e0de593dd21b86879bd09d228a090f8af105564 /content/common/gpu/gpu_command_buffer_stub.cc | |
parent | 32fcb896c5d34a483c3adbdec90badbddd54d7d8 (diff) | |
download | chromium_src-890e8966414165e59418b7886778cbd16cc194ac.zip chromium_src-890e8966414165e59418b7886778cbd16cc194ac.tar.gz chromium_src-890e8966414165e59418b7886778cbd16cc194ac.tar.bz2 |
Implement proper synchronization between HW video decode IPC and CommandBuffer.
This is done by inserting tokens into the command-buffer stream
when synchronization is needed, and adding a
last-read/last-written token pair to each IPC message. This
allowed me to remove the bogus FinishGL() calls from the gles2
sample pepper plugin.
As part of this CL, the return value for VideoDecodeAccelerator::{Decode,Flush,Abort} changed from bool to void. These are all async methods so errors ought to be signaled using callbacks.
BUG=none
TEST=gles2 works, no crashes; trybots
Review URL: http://codereview.chromium.org/7260008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90971 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common/gpu/gpu_command_buffer_stub.cc')
-rw-r--r-- | content/common/gpu/gpu_command_buffer_stub.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc index a6b378e..0060831 100644 --- a/content/common/gpu/gpu_command_buffer_stub.cc +++ b/content/common/gpu/gpu_command_buffer_stub.cc @@ -5,6 +5,7 @@ #if defined(ENABLE_GPU) #include "base/bind.h" +#include "base/callback.h" #include "base/debug/trace_event.h" #include "base/process_util.h" #include "base/shared_memory.h" @@ -152,6 +153,8 @@ void GpuCommandBufferStub::OnInitialize( &GpuChannel::OnLatchCallback, base::Unretained(channel_), route_id_)); scheduler_->SetScheduledCallback( NewCallback(this, &GpuCommandBufferStub::OnScheduled)); + scheduler_->SetTokenCallback(base::Bind( + &GpuCommandBufferStub::OnSetToken, base::Unretained(this))); if (watchdog_) scheduler_->SetCommandProcessedCallback( NewCallback(this, &GpuCommandBufferStub::OnCommandProcessed)); @@ -488,6 +491,16 @@ void GpuCommandBufferStub::CommandBufferWasDestroyed() { HandleDeferredMessages(); } +void GpuCommandBufferStub::AddSetTokenCallback( + const base::Callback<void(int32)>& callback) { + set_token_callbacks_.push_back(callback); +} + +void GpuCommandBufferStub::OnSetToken(int32 token) { + for (size_t i = 0; i < set_token_callbacks_.size(); ++i) + set_token_callbacks_[i].Run(token); +} + void GpuCommandBufferStub::ResizeCallback(gfx::Size size) { if (handle_ == gfx::kNullPluginWindow) { scheduler_->decoder()->ResizeOffscreenFrameBuffer(size); |