| 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 "content/gpu/gpu_child_thread.h" | 5 #include "content/gpu/gpu_child_thread.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
| 12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
| 13 #include "base/threading/worker_pool.h" | 13 #include "base/threading/worker_pool.h" |
| 14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 15 #include "content/child/child_process.h" | 15 #include "content/child/child_process.h" |
| 16 #include "content/child/thread_safe_sender.h" | 16 #include "content/child/thread_safe_sender.h" |
| 17 #include "content/common/gpu/establish_channel_params.h" | 17 #include "content/common/gpu/establish_channel_params.h" |
| 18 #include "content/common/gpu/gpu_host_messages.h" | 18 #include "content/common/gpu/gpu_host_messages.h" |
| 19 #include "content/common/gpu/gpu_memory_buffer_factory.h" | 19 #include "content/common/gpu/gpu_memory_buffer_factory.h" |
| 20 #include "content/common/gpu/media/gpu_jpeg_decode_accelerator.h" |
| 20 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" | 21 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" |
| 22 #include "content/common/gpu/media/gpu_video_encode_accelerator.h" |
| 21 #include "content/common/gpu/media/media_service.h" | 23 #include "content/common/gpu/media/media_service.h" |
| 22 #include "content/gpu/gpu_process_control_impl.h" | 24 #include "content/gpu/gpu_process_control_impl.h" |
| 23 #include "content/gpu/gpu_watchdog_thread.h" | 25 #include "content/gpu/gpu_watchdog_thread.h" |
| 24 #include "content/public/common/content_client.h" | 26 #include "content/public/common/content_client.h" |
| 25 #include "content/public/common/content_switches.h" | 27 #include "content/public/common/content_switches.h" |
| 26 #include "content/public/gpu/content_gpu_client.h" | 28 #include "content/public/gpu/content_gpu_client.h" |
| 27 #include "gpu/command_buffer/service/gpu_switches.h" | 29 #include "gpu/command_buffer/service/gpu_switches.h" |
| 28 #include "gpu/config/gpu_info_collector.h" | 30 #include "gpu/config/gpu_info_collector.h" |
| 29 #include "gpu/config/gpu_switches.h" | 31 #include "gpu/config/gpu_switches.h" |
| 30 #include "gpu/config/gpu_util.h" | 32 #include "gpu/config/gpu_util.h" |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 in_browser_process_(true), | 185 in_browser_process_(true), |
| 184 gpu_memory_buffer_factory_(gpu_memory_buffer_factory) { | 186 gpu_memory_buffer_factory_(gpu_memory_buffer_factory) { |
| 185 #if defined(OS_WIN) | 187 #if defined(OS_WIN) |
| 186 target_services_ = NULL; | 188 target_services_ = NULL; |
| 187 #endif | 189 #endif |
| 188 DCHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( | 190 DCHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 189 switches::kSingleProcess) || | 191 switches::kSingleProcess) || |
| 190 base::CommandLine::ForCurrentProcess()->HasSwitch( | 192 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 191 switches::kInProcessGPU)); | 193 switches::kInProcessGPU)); |
| 192 | 194 |
| 193 // Populate accelerator capabilities (normally done during GpuMain, which is | |
| 194 // not called for single process or in process gpu). | |
| 195 gpu_info_.video_decode_accelerator_capabilities = | |
| 196 content::GpuVideoDecodeAccelerator::GetCapabilities(); | |
| 197 | |
| 198 #if defined(ENABLE_VULKAN) | 195 #if defined(ENABLE_VULKAN) |
| 199 // Temporary Vulkan initialization injection. | 196 // Temporary Vulkan initialization injection. |
| 200 gpu::VulkanSurface::InitializeOneOff(); | 197 gpu::VulkanSurface::InitializeOneOff(); |
| 201 #endif | 198 #endif |
| 202 | 199 |
| 203 if (!gfx::GLSurface::InitializeOneOff()) | 200 if (!gfx::GLSurface::InitializeOneOff()) |
| 204 VLOG(1) << "gfx::GLSurface::InitializeOneOff failed"; | 201 VLOG(1) << "gfx::GLSurface::InitializeOneOff failed"; |
| 205 | 202 |
| 206 g_thread_safe_sender.Get() = thread_safe_sender(); | 203 g_thread_safe_sender.Get() = thread_safe_sender(); |
| 207 } | 204 } |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 #endif | 344 #endif |
| 348 | 345 |
| 349 void GpuChildThread::StoreShaderToDisk(int32_t client_id, | 346 void GpuChildThread::StoreShaderToDisk(int32_t client_id, |
| 350 const std::string& key, | 347 const std::string& key, |
| 351 const std::string& shader) { | 348 const std::string& shader) { |
| 352 Send(new GpuHostMsg_CacheShader(client_id, key, shader)); | 349 Send(new GpuHostMsg_CacheShader(client_id, key, shader)); |
| 353 } | 350 } |
| 354 | 351 |
| 355 void GpuChildThread::OnInitialize(const gpu::GpuPreferences& gpu_preferences) { | 352 void GpuChildThread::OnInitialize(const gpu::GpuPreferences& gpu_preferences) { |
| 356 gpu_preferences_ = gpu_preferences; | 353 gpu_preferences_ = gpu_preferences; |
| 354 |
| 355 gpu_info_.video_decode_accelerator_capabilities = |
| 356 content::GpuVideoDecodeAccelerator::GetCapabilities(gpu_preferences_); |
| 357 gpu_info_.video_encode_accelerator_supported_profiles = |
| 358 content::GpuVideoEncodeAccelerator::GetSupportedProfiles( |
| 359 gpu_preferences_); |
| 360 gpu_info_.jpeg_decode_accelerator_supported = |
| 361 content::GpuJpegDecodeAccelerator::IsSupported(); |
| 362 |
| 357 // Record initialization only after collecting the GPU info because that can | 363 // Record initialization only after collecting the GPU info because that can |
| 358 // take a significant amount of time. | 364 // take a significant amount of time. |
| 359 gpu_info_.initialization_time = base::Time::Now() - process_start_time_; | 365 gpu_info_.initialization_time = base::Time::Now() - process_start_time_; |
| 360 Send(new GpuHostMsg_Initialized(!dead_on_arrival_, gpu_info_)); | 366 Send(new GpuHostMsg_Initialized(!dead_on_arrival_, gpu_info_)); |
| 361 while (!deferred_messages_.empty()) { | 367 while (!deferred_messages_.empty()) { |
| 362 Send(deferred_messages_.front()); | 368 Send(deferred_messages_.front()); |
| 363 deferred_messages_.pop(); | 369 deferred_messages_.pop(); |
| 364 } | 370 } |
| 365 | 371 |
| 366 if (dead_on_arrival_) { | 372 if (dead_on_arrival_) { |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 | 561 |
| 556 void GpuChildThread::BindProcessControlRequest( | 562 void GpuChildThread::BindProcessControlRequest( |
| 557 mojo::InterfaceRequest<ProcessControl> request) { | 563 mojo::InterfaceRequest<ProcessControl> request) { |
| 558 DVLOG(1) << "GPU: Binding ProcessControl request"; | 564 DVLOG(1) << "GPU: Binding ProcessControl request"; |
| 559 DCHECK(process_control_); | 565 DCHECK(process_control_); |
| 560 process_control_bindings_.AddBinding(process_control_.get(), | 566 process_control_bindings_.AddBinding(process_control_.get(), |
| 561 std::move(request)); | 567 std::move(request)); |
| 562 } | 568 } |
| 563 | 569 |
| 564 } // namespace content | 570 } // namespace content |
| OLD | NEW |