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 "gpu/ipc/in_process_command_buffer.h" | 5 #include "gpu/ipc/in_process_command_buffer.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <queue> | 10 #include <queue> |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "gpu/command_buffer/service/command_executor.h" | 31 #include "gpu/command_buffer/service/command_executor.h" |
32 #include "gpu/command_buffer/service/context_group.h" | 32 #include "gpu/command_buffer/service/context_group.h" |
33 #include "gpu/command_buffer/service/gl_context_virtual.h" | 33 #include "gpu/command_buffer/service/gl_context_virtual.h" |
34 #include "gpu/command_buffer/service/gpu_preferences.h" | 34 #include "gpu/command_buffer/service/gpu_preferences.h" |
35 #include "gpu/command_buffer/service/image_factory.h" | 35 #include "gpu/command_buffer/service/image_factory.h" |
36 #include "gpu/command_buffer/service/image_manager.h" | 36 #include "gpu/command_buffer/service/image_manager.h" |
37 #include "gpu/command_buffer/service/mailbox_manager.h" | 37 #include "gpu/command_buffer/service/mailbox_manager.h" |
38 #include "gpu/command_buffer/service/memory_program_cache.h" | 38 #include "gpu/command_buffer/service/memory_program_cache.h" |
39 #include "gpu/command_buffer/service/memory_tracking.h" | 39 #include "gpu/command_buffer/service/memory_tracking.h" |
40 #include "gpu/command_buffer/service/query_manager.h" | 40 #include "gpu/command_buffer/service/query_manager.h" |
| 41 #include "gpu/command_buffer/service/service_discardable_manager.h" |
41 #include "gpu/command_buffer/service/service_utils.h" | 42 #include "gpu/command_buffer/service/service_utils.h" |
42 #include "gpu/command_buffer/service/sync_point_manager.h" | 43 #include "gpu/command_buffer/service/sync_point_manager.h" |
43 #include "gpu/command_buffer/service/transfer_buffer_manager.h" | 44 #include "gpu/command_buffer/service/transfer_buffer_manager.h" |
44 #include "gpu/config/gpu_feature_info.h" | 45 #include "gpu/config/gpu_feature_info.h" |
45 #include "gpu/ipc/gpu_in_process_thread_service.h" | 46 #include "gpu/ipc/gpu_in_process_thread_service.h" |
46 #include "gpu/ipc/service/image_transport_surface.h" | 47 #include "gpu/ipc/service/image_transport_surface.h" |
47 #include "ui/gfx/geometry/size.h" | 48 #include "ui/gfx/geometry/size.h" |
48 #include "ui/gl/gl_context.h" | 49 #include "ui/gl/gl_context.h" |
49 #include "ui/gl/gl_image.h" | 50 #include "ui/gl/gl_image.h" |
50 #include "ui/gl/gl_image_shared_memory.h" | 51 #include "ui/gl/gl_image_shared_memory.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 gpu_preferences_.disable_gpu_shader_disk_cache || | 172 gpu_preferences_.disable_gpu_shader_disk_cache || |
172 workarounds.disable_program_disk_cache; | 173 workarounds.disable_program_disk_cache; |
173 program_cache_.reset(new gles2::MemoryProgramCache( | 174 program_cache_.reset(new gles2::MemoryProgramCache( |
174 gpu_preferences_.gpu_program_cache_size, disable_disk_cache, | 175 gpu_preferences_.gpu_program_cache_size, disable_disk_cache, |
175 workarounds.disable_program_caching_for_transform_feedback, | 176 workarounds.disable_program_caching_for_transform_feedback, |
176 &activity_flags_)); | 177 &activity_flags_)); |
177 } | 178 } |
178 return program_cache_.get(); | 179 return program_cache_.get(); |
179 } | 180 } |
180 | 181 |
| 182 ServiceDiscardableManager* |
| 183 InProcessCommandBuffer::Service::discardable_manager() { |
| 184 if (!discardable_manager_) { |
| 185 discardable_manager_.reset(new ServiceDiscardableManager()); |
| 186 } |
| 187 return discardable_manager_.get(); |
| 188 } |
| 189 |
181 InProcessCommandBuffer::InProcessCommandBuffer( | 190 InProcessCommandBuffer::InProcessCommandBuffer( |
182 const scoped_refptr<Service>& service) | 191 const scoped_refptr<Service>& service) |
183 : command_buffer_id_(CommandBufferId::FromUnsafeValue( | 192 : command_buffer_id_(CommandBufferId::FromUnsafeValue( |
184 g_next_command_buffer_id.GetNext() + 1)), | 193 g_next_command_buffer_id.GetNext() + 1)), |
185 delayed_work_pending_(false), | 194 delayed_work_pending_(false), |
186 image_factory_(nullptr), | 195 image_factory_(nullptr), |
187 latency_info_(base::MakeUnique<std::vector<ui::LatencyInfo>>()), | 196 latency_info_(base::MakeUnique<std::vector<ui::LatencyInfo>>()), |
188 gpu_control_client_(nullptr), | 197 gpu_control_client_(nullptr), |
189 #if DCHECK_IS_ON() | 198 #if DCHECK_IS_ON() |
190 context_lost_(false), | 199 context_lost_(false), |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 scoped_refptr<gles2::FeatureInfo> feature_info = | 317 scoped_refptr<gles2::FeatureInfo> feature_info = |
309 new gles2::FeatureInfo(service_->gpu_driver_bug_workarounds()); | 318 new gles2::FeatureInfo(service_->gpu_driver_bug_workarounds()); |
310 | 319 |
311 context_group_ = | 320 context_group_ = |
312 params.context_group | 321 params.context_group |
313 ? params.context_group->decoder_->GetContextGroup() | 322 ? params.context_group->decoder_->GetContextGroup() |
314 : new gles2::ContextGroup( | 323 : new gles2::ContextGroup( |
315 service_->gpu_preferences(), service_->mailbox_manager(), NULL, | 324 service_->gpu_preferences(), service_->mailbox_manager(), NULL, |
316 service_->shader_translator_cache(), | 325 service_->shader_translator_cache(), |
317 service_->framebuffer_completeness_cache(), feature_info, | 326 service_->framebuffer_completeness_cache(), feature_info, |
318 bind_generates_resource, nullptr, nullptr, GpuFeatureInfo()); | 327 bind_generates_resource, nullptr, nullptr, GpuFeatureInfo(), |
| 328 service_->discardable_manager()); |
319 | 329 |
320 decoder_.reset(gles2::GLES2Decoder::Create(context_group_.get())); | 330 decoder_.reset(gles2::GLES2Decoder::Create(context_group_.get())); |
321 | 331 |
322 executor_.reset(new CommandExecutor(command_buffer.get(), decoder_.get(), | 332 executor_.reset(new CommandExecutor(command_buffer.get(), decoder_.get(), |
323 decoder_.get())); | 333 decoder_.get())); |
324 command_buffer->SetGetBufferChangeCallback(base::Bind( | 334 command_buffer->SetGetBufferChangeCallback(base::Bind( |
325 &CommandExecutor::SetGetBuffer, base::Unretained(executor_.get()))); | 335 &CommandExecutor::SetGetBuffer, base::Unretained(executor_.get()))); |
326 command_buffer_ = std::move(command_buffer); | 336 command_buffer_ = std::move(command_buffer); |
327 | 337 |
328 decoder_->set_engine(executor_.get()); | 338 decoder_->set_engine(executor_.get()); |
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1150 return wrapped_callback; | 1160 return wrapped_callback; |
1151 } | 1161 } |
1152 | 1162 |
1153 InProcessCommandBuffer::GpuTask::GpuTask(const base::Closure& callback, | 1163 InProcessCommandBuffer::GpuTask::GpuTask(const base::Closure& callback, |
1154 uint32_t order_number) | 1164 uint32_t order_number) |
1155 : callback(callback), order_number(order_number) {} | 1165 : callback(callback), order_number(order_number) {} |
1156 | 1166 |
1157 InProcessCommandBuffer::GpuTask::~GpuTask() {} | 1167 InProcessCommandBuffer::GpuTask::~GpuTask() {} |
1158 | 1168 |
1159 } // namespace gpu | 1169 } // namespace gpu |
OLD | NEW |