| Index: content/common/gpu/gpu_command_buffer_stub.cc
|
| diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc
|
| index 41c84fd1e580c8da8c3e9c053b459fd9c0776226..c167b0f1ed34338e913b2007a0c97c4dc7a5eefa 100644
|
| --- a/content/common/gpu/gpu_command_buffer_stub.cc
|
| +++ b/content/common/gpu/gpu_command_buffer_stub.cc
|
| @@ -222,7 +222,6 @@ bool GpuCommandBufferStub::OnMessageReceived(const IPC::Message& message) {
|
| devtools_gpu_instrumentation::ScopedGpuTask task(channel());
|
| FastSetActiveURL(active_url_, active_url_hash_);
|
|
|
| - bool have_context = false;
|
| // Ensure the appropriate GL context is current before handling any IPC
|
| // messages directed at the command buffer. This ensures that the message
|
| // handler can assume that the context is current (not necessary for
|
| @@ -235,11 +234,11 @@ bool GpuCommandBufferStub::OnMessageReceived(const IPC::Message& message) {
|
| message.type() != GpuCommandBufferMsg_DestroyTransferBuffer::ID &&
|
| message.type() != GpuCommandBufferMsg_RetireSyncPoint::ID &&
|
| message.type() != GpuCommandBufferMsg_SignalSyncPoint::ID &&
|
| + message.type() != GpuCommandBufferMsg_AsyncFlush::ID &&
|
| message.type() !=
|
| GpuCommandBufferMsg_SetClientHasMemoryAllocationChangedCallback::ID) {
|
| if (!MakeCurrent())
|
| return false;
|
| - have_context = true;
|
| }
|
|
|
| // Always use IPC_MESSAGE_HANDLER_DELAY_REPLY for synchronous message handlers
|
| @@ -286,10 +285,8 @@ bool GpuCommandBufferStub::OnMessageReceived(const IPC::Message& message) {
|
|
|
| CheckCompleteWaits();
|
|
|
| - if (have_context) {
|
| - // Ensure that any delayed work that was created will be handled.
|
| - ScheduleDelayedWork(kHandleMoreWorkPeriodMs);
|
| - }
|
| + // Ensure that any delayed work that was created will be handled.
|
| + ScheduleDelayedWork(kHandleMoreWorkPeriodMs);
|
|
|
| DCHECK(handled);
|
| return handled;
|
| @@ -583,9 +580,6 @@ void GpuCommandBufferStub::OnInitialize(
|
| decoder_->SetShaderCacheCallback(
|
| base::Bind(&GpuCommandBufferStub::SendCachedShader,
|
| base::Unretained(this)));
|
| - decoder_->SetWaitSyncPointCallback(
|
| - base::Bind(&GpuCommandBufferStub::OnWaitSyncPoint,
|
| - base::Unretained(this)));
|
|
|
| command_buffer_->SetPutOffsetChangeCallback(
|
| base::Bind(&GpuCommandBufferStub::PutChanged, base::Unretained(this)));
|
| @@ -749,6 +743,7 @@ void GpuCommandBufferStub::CheckCompleteWaits() {
|
| void GpuCommandBufferStub::OnAsyncFlush(
|
| int32 put_offset,
|
| uint32 flush_count,
|
| + const std::vector<uint32>& sync_points,
|
| const std::vector<ui::LatencyInfo>& latency_info) {
|
| TRACE_EVENT1(
|
| "gpu", "GpuCommandBufferStub::OnAsyncFlush", "put_offset", put_offset);
|
| @@ -758,10 +753,15 @@ void GpuCommandBufferStub::OnAsyncFlush(
|
| !latency_info_callback_.is_null()) {
|
| latency_info_callback_.Run(latency_info);
|
| }
|
| + for (uint32 sync_point : sync_points) {
|
| + WaitSyncPoint(sync_point);
|
| + }
|
| + if (scheduler_->IsScheduled())
|
| + MakeCurrent();
|
| DCHECK(command_buffer_.get());
|
| if (flush_count - last_flush_count_ < 0x8000000U) {
|
| last_flush_count_ = flush_count;
|
| - command_buffer_->Flush(put_offset);
|
| + command_buffer_->Flush(put_offset, sync_points);
|
| } else {
|
| // We received this message out-of-order. This should not happen but is here
|
| // to catch regressions. Ignore the message.
|
| @@ -773,7 +773,8 @@ void GpuCommandBufferStub::OnAsyncFlush(
|
|
|
| void GpuCommandBufferStub::OnRescheduled() {
|
| gpu::CommandBuffer::State pre_state = command_buffer_->GetLastState();
|
| - command_buffer_->Flush(command_buffer_->GetPutOffset());
|
| + command_buffer_->Flush(command_buffer_->GetPutOffset(),
|
| + std::vector<uint32>());
|
| gpu::CommandBuffer::State post_state = command_buffer_->GetLastState();
|
|
|
| if (pre_state.get_offset != post_state.get_offset)
|
| @@ -868,12 +869,12 @@ void GpuCommandBufferStub::OnRetireSyncPoint(uint32 sync_point) {
|
| manager->sync_point_manager()->RetireSyncPoint(sync_point);
|
| }
|
|
|
| -bool GpuCommandBufferStub::OnWaitSyncPoint(uint32 sync_point) {
|
| +void GpuCommandBufferStub::WaitSyncPoint(uint32 sync_point) {
|
| if (!sync_point)
|
| - return true;
|
| + return;
|
| GpuChannelManager* manager = channel_->gpu_channel_manager();
|
| if (manager->sync_point_manager()->IsSyncPointRetired(sync_point))
|
| - return true;
|
| + return;
|
|
|
| if (sync_point_wait_count_ == 0) {
|
| TRACE_EVENT_ASYNC_BEGIN1("gpu", "WaitSyncPoint", this,
|
| @@ -885,7 +886,6 @@ bool GpuCommandBufferStub::OnWaitSyncPoint(uint32 sync_point) {
|
| sync_point,
|
| base::Bind(&GpuCommandBufferStub::OnSyncPointRetired,
|
| this->AsWeakPtr()));
|
| - return scheduler_->IsScheduled();
|
| }
|
|
|
| void GpuCommandBufferStub::OnSyncPointRetired() {
|
|
|