| 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" | |
| 21 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" | 20 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" |
| 22 #include "content/common/gpu/media/gpu_video_encode_accelerator.h" | |
| 23 #include "content/common/gpu/media/media_service.h" | 21 #include "content/common/gpu/media/media_service.h" |
| 24 #include "content/gpu/gpu_process_control_impl.h" | 22 #include "content/gpu/gpu_process_control_impl.h" |
| 25 #include "content/gpu/gpu_watchdog_thread.h" | 23 #include "content/gpu/gpu_watchdog_thread.h" |
| 26 #include "content/public/common/content_client.h" | 24 #include "content/public/common/content_client.h" |
| 27 #include "content/public/common/content_switches.h" | 25 #include "content/public/common/content_switches.h" |
| 28 #include "content/public/gpu/content_gpu_client.h" | 26 #include "content/public/gpu/content_gpu_client.h" |
| 29 #include "gpu/command_buffer/service/gpu_switches.h" | 27 #include "gpu/command_buffer/service/gpu_switches.h" |
| 30 #include "gpu/config/gpu_info_collector.h" | 28 #include "gpu/config/gpu_info_collector.h" |
| 31 #include "gpu/config/gpu_switches.h" | 29 #include "gpu/config/gpu_switches.h" |
| 32 #include "gpu/config/gpu_util.h" | 30 #include "gpu/config/gpu_util.h" |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 in_browser_process_(true), | 182 in_browser_process_(true), |
| 185 gpu_memory_buffer_factory_(gpu_memory_buffer_factory) { | 183 gpu_memory_buffer_factory_(gpu_memory_buffer_factory) { |
| 186 #if defined(OS_WIN) | 184 #if defined(OS_WIN) |
| 187 target_services_ = NULL; | 185 target_services_ = NULL; |
| 188 #endif | 186 #endif |
| 189 DCHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( | 187 DCHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 190 switches::kSingleProcess) || | 188 switches::kSingleProcess) || |
| 191 base::CommandLine::ForCurrentProcess()->HasSwitch( | 189 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 192 switches::kInProcessGPU)); | 190 switches::kInProcessGPU)); |
| 193 | 191 |
| 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 |
| 194 #if defined(ENABLE_VULKAN) | 197 #if defined(ENABLE_VULKAN) |
| 195 // Temporary Vulkan initialization injection. | 198 // Temporary Vulkan initialization injection. |
| 196 gpu::VulkanSurface::InitializeOneOff(); | 199 gpu::VulkanSurface::InitializeOneOff(); |
| 197 #endif | 200 #endif |
| 198 | 201 |
| 199 if (!gfx::GLSurface::InitializeOneOff()) | 202 if (!gfx::GLSurface::InitializeOneOff()) |
| 200 VLOG(1) << "gfx::GLSurface::InitializeOneOff failed"; | 203 VLOG(1) << "gfx::GLSurface::InitializeOneOff failed"; |
| 201 | 204 |
| 202 g_thread_safe_sender.Get() = thread_safe_sender(); | 205 g_thread_safe_sender.Get() = thread_safe_sender(); |
| 203 } | 206 } |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 #endif | 342 #endif |
| 340 | 343 |
| 341 void GpuChildThread::StoreShaderToDisk(int32_t client_id, | 344 void GpuChildThread::StoreShaderToDisk(int32_t client_id, |
| 342 const std::string& key, | 345 const std::string& key, |
| 343 const std::string& shader) { | 346 const std::string& shader) { |
| 344 Send(new GpuHostMsg_CacheShader(client_id, key, shader)); | 347 Send(new GpuHostMsg_CacheShader(client_id, key, shader)); |
| 345 } | 348 } |
| 346 | 349 |
| 347 void GpuChildThread::OnInitialize(const gpu::GpuPreferences& gpu_preferences) { | 350 void GpuChildThread::OnInitialize(const gpu::GpuPreferences& gpu_preferences) { |
| 348 gpu_preferences_ = gpu_preferences; | 351 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 | |
| 358 // Record initialization only after collecting the GPU info because that can | 352 // Record initialization only after collecting the GPU info because that can |
| 359 // take a significant amount of time. | 353 // take a significant amount of time. |
| 360 gpu_info_.initialization_time = base::Time::Now() - process_start_time_; | 354 gpu_info_.initialization_time = base::Time::Now() - process_start_time_; |
| 361 Send(new GpuHostMsg_Initialized(!dead_on_arrival_, gpu_info_)); | 355 Send(new GpuHostMsg_Initialized(!dead_on_arrival_, gpu_info_)); |
| 362 while (!deferred_messages_.empty()) { | 356 while (!deferred_messages_.empty()) { |
| 363 Send(deferred_messages_.front()); | 357 Send(deferred_messages_.front()); |
| 364 deferred_messages_.pop(); | 358 deferred_messages_.pop(); |
| 365 } | 359 } |
| 366 | 360 |
| 367 if (dead_on_arrival_) { | 361 if (dead_on_arrival_) { |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 | 550 |
| 557 void GpuChildThread::BindProcessControlRequest( | 551 void GpuChildThread::BindProcessControlRequest( |
| 558 mojo::InterfaceRequest<ProcessControl> request) { | 552 mojo::InterfaceRequest<ProcessControl> request) { |
| 559 DVLOG(1) << "GPU: Binding ProcessControl request"; | 553 DVLOG(1) << "GPU: Binding ProcessControl request"; |
| 560 DCHECK(process_control_); | 554 DCHECK(process_control_); |
| 561 process_control_bindings_.AddBinding(process_control_.get(), | 555 process_control_bindings_.AddBinding(process_control_.get(), |
| 562 std::move(request)); | 556 std::move(request)); |
| 563 } | 557 } |
| 564 | 558 |
| 565 } // namespace content | 559 } // namespace content |
| OLD | NEW |