| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "services/gles2/command_buffer_driver.h" | 5 #include "services/gles2/command_buffer_driver.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/shared_memory.h" | 9 #include "base/memory/shared_memory.h" |
| 10 #include "gpu/command_buffer/common/constants.h" | 10 #include "gpu/command_buffer/common/constants.h" |
| 11 #include "gpu/command_buffer/common/value_state.h" | 11 #include "gpu/command_buffer/common/value_state.h" |
| 12 #include "gpu/command_buffer/service/command_buffer_service.h" | 12 #include "gpu/command_buffer/service/command_buffer_service.h" |
| 13 #include "gpu/command_buffer/service/context_group.h" | 13 #include "gpu/command_buffer/service/context_group.h" |
| 14 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 14 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 15 #include "gpu/command_buffer/service/gpu_scheduler.h" | 15 #include "gpu/command_buffer/service/gpu_scheduler.h" |
| 16 #include "gpu/command_buffer/service/image_manager.h" | 16 #include "gpu/command_buffer/service/image_manager.h" |
| 17 #include "gpu/command_buffer/service/mailbox_manager.h" | 17 #include "gpu/command_buffer/service/mailbox_manager.h" |
| 18 #include "gpu/command_buffer/service/memory_tracking.h" | 18 #include "gpu/command_buffer/service/memory_tracking.h" |
| 19 #include "gpu/command_buffer/service/sync_point_manager.h" | 19 #include "gpu/command_buffer/service/sync_point_manager.h" |
| 20 #include "gpu/command_buffer/service/valuebuffer_manager.h" |
| 20 #include "services/gles2/command_buffer_type_conversions.h" | 21 #include "services/gles2/command_buffer_type_conversions.h" |
| 21 #include "services/gles2/mojo_buffer_backing.h" | 22 #include "services/gles2/mojo_buffer_backing.h" |
| 22 #include "ui/gfx/vsync_provider.h" | 23 #include "ui/gfx/vsync_provider.h" |
| 23 #include "ui/gl/gl_context.h" | 24 #include "ui/gl/gl_context.h" |
| 24 #include "ui/gl/gl_surface.h" | 25 #include "ui/gl/gl_surface.h" |
| 25 | 26 |
| 26 namespace gles2 { | 27 namespace gles2 { |
| 27 | 28 |
| 28 namespace { | 29 namespace { |
| 29 | 30 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 gfx::PreferIntegratedGpu); | 116 gfx::PreferIntegratedGpu); |
| 116 if (!context_.get()) | 117 if (!context_.get()) |
| 117 return false; | 118 return false; |
| 118 | 119 |
| 119 if (!context_->MakeCurrent(surface_.get())) | 120 if (!context_->MakeCurrent(surface_.get())) |
| 120 return false; | 121 return false; |
| 121 | 122 |
| 122 // TODO(piman): ShaderTranslatorCache is currently per-ContextGroup but | 123 // TODO(piman): ShaderTranslatorCache is currently per-ContextGroup but |
| 123 // only needs to be per-thread. | 124 // only needs to be per-thread. |
| 124 scoped_refptr<gpu::gles2::ContextGroup> context_group = | 125 scoped_refptr<gpu::gles2::ContextGroup> context_group = |
| 125 new gpu::gles2::ContextGroup( | 126 new gpu::gles2::ContextGroup(mailbox_manager_.get(), |
| 126 mailbox_manager_.get(), new MemoryTrackerStub, | 127 new MemoryTrackerStub, |
| 127 new gpu::gles2::ShaderTranslatorCache, nullptr, nullptr, true); | 128 new gpu::gles2::ShaderTranslatorCache, |
| 129 nullptr, nullptr, nullptr, true); |
| 128 | 130 |
| 129 command_buffer_.reset( | 131 command_buffer_.reset( |
| 130 new gpu::CommandBufferService(context_group->transfer_buffer_manager())); | 132 new gpu::CommandBufferService(context_group->transfer_buffer_manager())); |
| 131 bool result = command_buffer_->Initialize(); | 133 bool result = command_buffer_->Initialize(); |
| 132 DCHECK(result); | 134 DCHECK(result); |
| 133 | 135 |
| 134 decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group.get())); | 136 decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group.get())); |
| 135 scheduler_.reset(new gpu::GpuScheduler(command_buffer_.get(), decoder_.get(), | 137 scheduler_.reset(new gpu::GpuScheduler(command_buffer_.get(), decoder_.get(), |
| 136 decoder_.get())); | 138 decoder_.get())); |
| 137 decoder_->set_engine(scheduler_.get()); | 139 decoder_->set_engine(scheduler_.get()); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 client_->LostContext(reason); | 240 client_->LostContext(reason); |
| 239 } | 241 } |
| 240 | 242 |
| 241 void CommandBufferDriver::OnUpdateVSyncParameters( | 243 void CommandBufferDriver::OnUpdateVSyncParameters( |
| 242 const base::TimeTicks timebase, | 244 const base::TimeTicks timebase, |
| 243 const base::TimeDelta interval) { | 245 const base::TimeDelta interval) { |
| 244 client_->UpdateVSyncParameters(timebase, interval); | 246 client_->UpdateVSyncParameters(timebase, interval); |
| 245 } | 247 } |
| 246 | 248 |
| 247 } // namespace gles2 | 249 } // namespace gles2 |
| OLD | NEW |