| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/hash.h" | 8 #include "base/hash.h" |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SignalSyncPoint, | 313 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SignalSyncPoint, |
| 314 OnSignalSyncPoint) | 314 OnSignalSyncPoint) |
| 315 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SignalSyncToken, | 315 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SignalSyncToken, |
| 316 OnSignalSyncToken) | 316 OnSignalSyncToken) |
| 317 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SignalQuery, | 317 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SignalQuery, |
| 318 OnSignalQuery) | 318 OnSignalQuery) |
| 319 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_CreateImage, OnCreateImage); | 319 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_CreateImage, OnCreateImage); |
| 320 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DestroyImage, OnDestroyImage); | 320 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DestroyImage, OnDestroyImage); |
| 321 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_CreateStreamTexture, | 321 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_CreateStreamTexture, |
| 322 OnCreateStreamTexture) | 322 OnCreateStreamTexture) |
| 323 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetStreamTextureSize, |
| 324 OnSetStreamTextureSize) |
| 323 IPC_MESSAGE_UNHANDLED(handled = false) | 325 IPC_MESSAGE_UNHANDLED(handled = false) |
| 324 IPC_END_MESSAGE_MAP() | 326 IPC_END_MESSAGE_MAP() |
| 325 | 327 |
| 326 CheckCompleteWaits(); | 328 CheckCompleteWaits(); |
| 327 | 329 |
| 328 // Ensure that any delayed work that was created will be handled. | 330 // Ensure that any delayed work that was created will be handled. |
| 329 if (have_context) { | 331 if (have_context) { |
| 330 if (scheduler_) | 332 if (scheduler_) |
| 331 scheduler_->ProcessPendingQueries(); | 333 scheduler_->ProcessPendingQueries(); |
| 332 ScheduleDelayedWork( | 334 ScheduleDelayedWork( |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 | 526 |
| 525 command_buffer_.reset(new gpu::CommandBufferService( | 527 command_buffer_.reset(new gpu::CommandBufferService( |
| 526 context_group_->transfer_buffer_manager())); | 528 context_group_->transfer_buffer_manager())); |
| 527 | 529 |
| 528 bool result = command_buffer_->Initialize(); | 530 bool result = command_buffer_->Initialize(); |
| 529 DCHECK(result); | 531 DCHECK(result); |
| 530 | 532 |
| 531 GpuChannelManager* manager = channel_->gpu_channel_manager(); | 533 GpuChannelManager* manager = channel_->gpu_channel_manager(); |
| 532 DCHECK(manager); | 534 DCHECK(manager); |
| 533 | 535 |
| 536 #if defined(OS_ANDROID) |
| 537 stream_texture_manager_.reset(new StreamTextureManager); |
| 538 #endif |
| 539 |
| 534 decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group_.get())); | 540 decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group_.get())); |
| 535 scheduler_.reset(new gpu::GpuScheduler(command_buffer_.get(), | 541 scheduler_.reset(new gpu::GpuScheduler(command_buffer_.get(), |
| 536 decoder_.get(), | 542 decoder_.get(), |
| 537 decoder_.get())); | 543 decoder_.get())); |
| 538 sync_point_client_ = sync_point_manager_->CreateSyncPointClient( | 544 sync_point_client_ = sync_point_manager_->CreateSyncPointClient( |
| 539 channel_->GetSyncPointOrderData(), gpu::CommandBufferNamespace::GPU_IO, | 545 channel_->GetSyncPointOrderData(), gpu::CommandBufferNamespace::GPU_IO, |
| 540 command_buffer_id_); | 546 command_buffer_id_); |
| 541 | 547 |
| 542 if (preemption_flag_.get()) | 548 if (preemption_flag_.get()) |
| 543 scheduler_->SetPreemptByFlag(preemption_flag_); | 549 scheduler_->SetPreemptByFlag(preemption_flag_); |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 manager->Send(new GpuHostMsg_DidCreateOffscreenContext( | 689 manager->Send(new GpuHostMsg_DidCreateOffscreenContext( |
| 684 active_url_)); | 690 active_url_)); |
| 685 } | 691 } |
| 686 | 692 |
| 687 initialized_ = true; | 693 initialized_ = true; |
| 688 } | 694 } |
| 689 | 695 |
| 690 void GpuCommandBufferStub::OnCreateStreamTexture( | 696 void GpuCommandBufferStub::OnCreateStreamTexture( |
| 691 uint32 texture_id, int32 stream_id, bool* succeeded) { | 697 uint32 texture_id, int32 stream_id, bool* succeeded) { |
| 692 #if defined(OS_ANDROID) | 698 #if defined(OS_ANDROID) |
| 693 *succeeded = StreamTexture::Create(this, texture_id, stream_id); | 699 *succeeded = |
| 700 stream_texture_manager_->CreateStreamTexture(this, texture_id, stream_id); |
| 694 #else | 701 #else |
| 695 *succeeded = false; | 702 *succeeded = false; |
| 696 #endif | 703 #endif |
| 697 } | 704 } |
| 698 | 705 |
| 706 void GpuCommandBufferStub::OnSetStreamTextureSize(uint32 texture_id, |
| 707 int32 stream_id, |
| 708 size_t width, |
| 709 size_t height) { |
| 710 #if defined(OS_ANDROID) |
| 711 stream_texture_manager_->SetStreamTextureSize(this, texture_id, stream_id, |
| 712 width, height); |
| 713 #endif |
| 714 } |
| 715 |
| 699 void GpuCommandBufferStub::SetLatencyInfoCallback( | 716 void GpuCommandBufferStub::SetLatencyInfoCallback( |
| 700 const LatencyInfoCallback& callback) { | 717 const LatencyInfoCallback& callback) { |
| 701 latency_info_callback_ = callback; | 718 latency_info_callback_ = callback; |
| 702 } | 719 } |
| 703 | 720 |
| 704 int32 GpuCommandBufferStub::GetRequestedAttribute(int attr) const { | 721 int32 GpuCommandBufferStub::GetRequestedAttribute(int attr) const { |
| 705 // The command buffer is pairs of enum, value | 722 // The command buffer is pairs of enum, value |
| 706 // search for the requested attribute, return the value. | 723 // search for the requested attribute, return the value. |
| 707 for (std::vector<int32>::const_iterator it = requested_attribs_.begin(); | 724 for (std::vector<int32>::const_iterator it = requested_attribs_.begin(); |
| 708 it != requested_attribs_.end(); ++it) { | 725 it != requested_attribs_.end(); ++it) { |
| (...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1275 result)); | 1292 result)); |
| 1276 } | 1293 } |
| 1277 | 1294 |
| 1278 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase, | 1295 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase, |
| 1279 base::TimeDelta interval) { | 1296 base::TimeDelta interval) { |
| 1280 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase, | 1297 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase, |
| 1281 interval)); | 1298 interval)); |
| 1282 } | 1299 } |
| 1283 | 1300 |
| 1284 } // namespace content | 1301 } // namespace content |
| OLD | NEW |