| 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 in_browser_process_(true), | 184 in_browser_process_(true), |
| 183 gpu_memory_buffer_factory_(gpu_memory_buffer_factory) { | 185 gpu_memory_buffer_factory_(gpu_memory_buffer_factory) { |
| 184 #if defined(OS_WIN) | 186 #if defined(OS_WIN) |
| 185 target_services_ = NULL; | 187 target_services_ = NULL; |
| 186 #endif | 188 #endif |
| 187 DCHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( | 189 DCHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 188 switches::kSingleProcess) || | 190 switches::kSingleProcess) || |
| 189 base::CommandLine::ForCurrentProcess()->HasSwitch( | 191 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 190 switches::kInProcessGPU)); | 192 switches::kInProcessGPU)); |
| 191 | 193 |
| 192 // Populate accelerator capabilities (normally done during GpuMain, which is | |
| 193 // not called for single process or in process gpu). | |
| 194 gpu_info_.video_decode_accelerator_capabilities = | |
| 195 content::GpuVideoDecodeAccelerator::GetCapabilities(); | |
| 196 | |
| 197 #if defined(ENABLE_VULKAN) | 194 #if defined(ENABLE_VULKAN) |
| 198 // Temporary Vulkan initialization injection. | 195 // Temporary Vulkan initialization injection. |
| 199 gpu::VulkanSurface::InitializeOneOff(); | 196 gpu::VulkanSurface::InitializeOneOff(); |
| 200 #endif | 197 #endif |
| 201 | 198 |
| 202 if (!gfx::GLSurface::InitializeOneOff()) | 199 if (!gfx::GLSurface::InitializeOneOff()) |
| 203 VLOG(1) << "gfx::GLSurface::InitializeOneOff failed"; | 200 VLOG(1) << "gfx::GLSurface::InitializeOneOff failed"; |
| 204 | 201 |
| 205 g_thread_safe_sender.Get() = thread_safe_sender(); | 202 g_thread_safe_sender.Get() = thread_safe_sender(); |
| 206 } | 203 } |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 #endif | 339 #endif |
| 343 | 340 |
| 344 void GpuChildThread::StoreShaderToDisk(int32_t client_id, | 341 void GpuChildThread::StoreShaderToDisk(int32_t client_id, |
| 345 const std::string& key, | 342 const std::string& key, |
| 346 const std::string& shader) { | 343 const std::string& shader) { |
| 347 Send(new GpuHostMsg_CacheShader(client_id, key, shader)); | 344 Send(new GpuHostMsg_CacheShader(client_id, key, shader)); |
| 348 } | 345 } |
| 349 | 346 |
| 350 void GpuChildThread::OnInitialize(const gpu::GpuPreferences& gpu_preferences) { | 347 void GpuChildThread::OnInitialize(const gpu::GpuPreferences& gpu_preferences) { |
| 351 gpu_preferences_ = gpu_preferences; | 348 gpu_preferences_ = gpu_preferences; |
| 349 |
| 350 gpu_info_.video_decode_accelerator_capabilities = |
| 351 content::GpuVideoDecodeAccelerator::GetCapabilities(gpu_preferences_); |
| 352 gpu_info_.video_encode_accelerator_supported_profiles = |
| 353 content::GpuVideoEncodeAccelerator::GetSupportedProfiles( |
| 354 gpu_preferences_); |
| 355 gpu_info_.jpeg_decode_accelerator_supported = |
| 356 content::GpuJpegDecodeAccelerator::IsSupported(); |
| 357 |
| 352 // Record initialization only after collecting the GPU info because that can | 358 // Record initialization only after collecting the GPU info because that can |
| 353 // take a significant amount of time. | 359 // take a significant amount of time. |
| 354 gpu_info_.initialization_time = base::Time::Now() - process_start_time_; | 360 gpu_info_.initialization_time = base::Time::Now() - process_start_time_; |
| 355 Send(new GpuHostMsg_Initialized(!dead_on_arrival_, gpu_info_)); | 361 Send(new GpuHostMsg_Initialized(!dead_on_arrival_, gpu_info_)); |
| 356 while (!deferred_messages_.empty()) { | 362 while (!deferred_messages_.empty()) { |
| 357 Send(deferred_messages_.front()); | 363 Send(deferred_messages_.front()); |
| 358 deferred_messages_.pop(); | 364 deferred_messages_.pop(); |
| 359 } | 365 } |
| 360 | 366 |
| 361 if (dead_on_arrival_) { | 367 if (dead_on_arrival_) { |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 | 556 |
| 551 void GpuChildThread::BindProcessControlRequest( | 557 void GpuChildThread::BindProcessControlRequest( |
| 552 mojo::InterfaceRequest<ProcessControl> request) { | 558 mojo::InterfaceRequest<ProcessControl> request) { |
| 553 DVLOG(1) << "GPU: Binding ProcessControl request"; | 559 DVLOG(1) << "GPU: Binding ProcessControl request"; |
| 554 DCHECK(process_control_); | 560 DCHECK(process_control_); |
| 555 process_control_bindings_.AddBinding(process_control_.get(), | 561 process_control_bindings_.AddBinding(process_control_.get(), |
| 556 std::move(request)); | 562 std::move(request)); |
| 557 } | 563 } |
| 558 | 564 |
| 559 } // namespace content | 565 } // namespace content |
| OLD | NEW |