diff options
author | piman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-15 03:53:30 +0000 |
---|---|---|
committer | piman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-15 03:53:30 +0000 |
commit | 35a0b4bfc922f8ab2c711f615a5dc3d6ec34e1d1 (patch) | |
tree | 2d10fd1a149a293841120e485fa80fc06126f86b /content/common | |
parent | fe851ac8cef90123ddea39da365208546325a88c (diff) | |
download | chromium_src-35a0b4bfc922f8ab2c711f615a5dc3d6ec34e1d1.zip chromium_src-35a0b4bfc922f8ab2c711f615a5dc3d6ec34e1d1.tar.gz chromium_src-35a0b4bfc922f8ab2c711f615a5dc3d6ec34e1d1.tar.bz2 |
Aura: switch use of finish() into sync points when initializing surface
BUG=none
TEST=manual
Review URL: https://chromiumcodereview.appspot.com/10532153
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@142339 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common')
-rw-r--r-- | content/common/gpu/gpu_command_buffer_stub.cc | 29 | ||||
-rw-r--r-- | content/common/gpu/gpu_command_buffer_stub.h | 1 | ||||
-rw-r--r-- | content/common/gpu/gpu_messages.h | 1 |
3 files changed, 23 insertions, 8 deletions
diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc index 3bbe3b2..8a70149 100644 --- a/content/common/gpu/gpu_command_buffer_stub.cc +++ b/content/common/gpu/gpu_command_buffer_stub.cc @@ -63,7 +63,8 @@ GpuCommandBufferStub::GpuCommandBufferStub( last_flush_count_(0), parent_stub_for_initialization_(), parent_texture_for_initialization_(0), - watchdog_(watchdog) { + watchdog_(watchdog), + sync_point_wait_count_(0) { if (share_group) { context_group_ = share_group->context_group_; } else { @@ -72,6 +73,8 @@ GpuCommandBufferStub::GpuCommandBufferStub( if (surface_id != 0) surface_state_.reset(new GpuCommandBufferStubBase::SurfaceState( surface_id, true, base::TimeTicks::Now())); + if (handle_.sync_point) + OnWaitSyncPoint(handle_.sync_point); } GpuCommandBufferStub::~GpuCommandBufferStub() { @@ -153,7 +156,8 @@ bool GpuCommandBufferStub::Send(IPC::Message* message) { } bool GpuCommandBufferStub::IsScheduled() { - return !scheduler_.get() || scheduler_->IsScheduled(); + return sync_point_wait_count_ == 0 && + (!scheduler_.get() || scheduler_->IsScheduled()); } bool GpuCommandBufferStub::HasMoreWork() { @@ -196,6 +200,8 @@ void GpuCommandBufferStub::DelayEcho(IPC::Message* message) { } void GpuCommandBufferStub::OnReschedule() { + if (!IsScheduled()) + return; while (!delayed_echos_.empty()) { scoped_ptr<IPC::Message> message(delayed_echos_.front()); delayed_echos_.pop_front(); @@ -309,6 +315,8 @@ void GpuCommandBufferStub::OnInitialize( } if (!context_->MakeCurrent(surface_.get())) { + // Ensure the decoder is not destroyed if it is not initialized. + decoder_.reset(); LOG(ERROR) << "Failed to make context current."; OnInitializeFailed(reply_message); return; @@ -628,9 +636,11 @@ void GpuCommandBufferStub::OnRetireSyncPoint(uint32 sync_point) { } void GpuCommandBufferStub::OnWaitSyncPoint(uint32 sync_point) { - if (!scheduler_.get()) - return; - scheduler_->SetScheduled(false); + if (sync_point_wait_count_ == 0) { + TRACE_EVENT_ASYNC_BEGIN1("gpu", "WaitSyncPoint", this, + "GpuCommandBufferStub", this); + } + ++sync_point_wait_count_; GpuChannelManager* manager = channel_->gpu_channel_manager(); manager->sync_point_manager()->AddSyncPointCallback( sync_point, @@ -639,9 +649,12 @@ void GpuCommandBufferStub::OnWaitSyncPoint(uint32 sync_point) { } void GpuCommandBufferStub::OnSyncPointRetired() { - if (!scheduler_.get()) - return; - scheduler_->SetScheduled(true); + --sync_point_wait_count_; + if (sync_point_wait_count_ == 0) { + TRACE_EVENT_ASYNC_END1("gpu", "WaitSyncPoint", this, + "GpuCommandBufferStub", this); + } + OnReschedule(); } void GpuCommandBufferStub::OnSetClientHasMemoryAllocationChangedCallback( diff --git a/content/common/gpu/gpu_command_buffer_stub.h b/content/common/gpu/gpu_command_buffer_stub.h index 5c9e912..5061a7d 100644 --- a/content/common/gpu/gpu_command_buffer_stub.h +++ b/content/common/gpu/gpu_command_buffer_stub.h @@ -267,6 +267,7 @@ class GpuCommandBufferStub // A queue of sync points associated with this stub. std::deque<uint32> sync_points_; + int sync_point_wait_count_; scoped_refptr<gpu::RefCountedCounter> preempt_by_counter_; diff --git a/content/common/gpu/gpu_messages.h b/content/common/gpu/gpu_messages.h index 049785f..3d61a72 100644 --- a/content/common/gpu/gpu_messages.h +++ b/content/common/gpu/gpu_messages.h @@ -146,6 +146,7 @@ IPC_STRUCT_TRAITS_BEGIN(gfx::GLSurfaceHandle) IPC_STRUCT_TRAITS_MEMBER(parent_context_id) IPC_STRUCT_TRAITS_MEMBER(parent_texture_id[0]) IPC_STRUCT_TRAITS_MEMBER(parent_texture_id[1]) + IPC_STRUCT_TRAITS_MEMBER(sync_point) IPC_STRUCT_TRAITS_END() IPC_ENUM_TRAITS(content::CauseForGpuLaunch) |