Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/service/gpu_init.h" | 5 #include "gpu/ipc/service/gpu_init.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" | 10 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" |
| 11 #include "base/threading/thread_restrictions.h" | 11 #include "base/threading/thread_restrictions.h" |
| 12 #include "base/trace_event/trace_event.h" | 12 #include "base/trace_event/trace_event.h" |
| 13 #include "gpu/command_buffer/service/gpu_switches.h" | 13 #include "gpu/command_buffer/service/gpu_switches.h" |
| 14 #include "gpu/config/gpu_driver_bug_list.h" | 14 #include "gpu/config/gpu_driver_bug_list.h" |
| 15 #include "gpu/config/gpu_info_collector.h" | 15 #include "gpu/config/gpu_info_collector.h" |
| 16 #include "gpu/config/gpu_switches.h" | 16 #include "gpu/config/gpu_switches.h" |
| 17 #include "gpu/config/gpu_util.h" | 17 #include "gpu/config/gpu_util.h" |
| 18 #include "gpu/ipc/service/gpu_watchdog_thread.h" | 18 #include "gpu/ipc/service/gpu_watchdog_thread.h" |
| 19 #include "gpu/ipc/service/switches.h" | 19 #include "gpu/ipc/service/switches.h" |
| 20 #include "ui/gfx/switches.h" | 20 #include "ui/gfx/switches.h" |
| 21 #include "ui/gl/gl_implementation.h" | 21 #include "ui/gl/gl_implementation.h" |
| 22 #include "ui/gl/gl_switches.h" | 22 #include "ui/gl/gl_switches.h" |
| 23 #include "ui/gl/init/gl_factory.h" | 23 #include "ui/gl/init/gl_factory.h" |
| 24 | 24 |
| 25 #if defined(USE_OZONE) | |
| 26 #include "ui/ozone/public/ozone_platform.h" | |
| 27 #endif | |
| 28 | |
| 25 namespace gpu { | 29 namespace gpu { |
| 26 | 30 |
| 27 namespace { | 31 namespace { |
| 28 | 32 |
| 29 void GetGpuInfoFromCommandLine(gpu::GPUInfo& gpu_info, | 33 void GetGpuInfoFromCommandLine(gpu::GPUInfo& gpu_info, |
| 30 const base::CommandLine& command_line) { | 34 const base::CommandLine& command_line) { |
| 31 if (!command_line.HasSwitch(switches::kGpuVendorID) || | 35 if (!command_line.HasSwitch(switches::kGpuVendorID) || |
| 32 !command_line.HasSwitch(switches::kGpuDeviceID) || | 36 !command_line.HasSwitch(switches::kGpuDeviceID) || |
| 33 !command_line.HasSwitch(switches::kGpuDriverVersion)) | 37 !command_line.HasSwitch(switches::kGpuDriverVersion)) |
| 34 return; | 38 return; |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 168 #if defined(OS_LINUX) | 172 #if defined(OS_LINUX) |
| 169 // On Chrome OS ARM Mali, GPU driver userspace creates threads when | 173 // On Chrome OS ARM Mali, GPU driver userspace creates threads when |
| 170 // initializing a GL context, so start the sandbox early. | 174 // initializing a GL context, so start the sandbox early. |
| 171 if (command_line.HasSwitch(switches::kGpuSandboxStartEarly)) | 175 if (command_line.HasSwitch(switches::kGpuSandboxStartEarly)) |
| 172 gpu_info_.sandboxed = | 176 gpu_info_.sandboxed = |
| 173 sandbox_helper_->EnsureSandboxInitialized(watchdog_thread_.get()); | 177 sandbox_helper_->EnsureSandboxInitialized(watchdog_thread_.get()); |
| 174 #endif // defined(OS_LINUX) | 178 #endif // defined(OS_LINUX) |
| 175 | 179 |
| 176 base::TimeTicks before_initialize_one_off = base::TimeTicks::Now(); | 180 base::TimeTicks before_initialize_one_off = base::TimeTicks::Now(); |
| 177 | 181 |
| 182 #if defined(USE_OZONE) | |
| 183 // Initialize Ozone GPU after the watchdog and sandbox are started. | |
|
piman
2017/03/15 19:48:21
The sandbox is generally not started at this point
kylechar
2017/03/15 20:59:08
Thanks for the clarification, I changed the commen
| |
| 184 ui::OzonePlatform::InitParams params; | |
| 185 params.single_process = false; | |
| 186 ui::OzonePlatform::InitializeForGPU(params); | |
| 187 #endif | |
| 188 | |
| 178 // Load and initialize the GL implementation and locate the GL entry points if | 189 // Load and initialize the GL implementation and locate the GL entry points if |
| 179 // needed. This initialization may have already happened if running in the | 190 // needed. This initialization may have already happened if running in the |
| 180 // browser process, for example. | 191 // browser process, for example. |
| 181 bool gl_initialized = gl::GetGLImplementation() != gl::kGLImplementationNone; | 192 bool gl_initialized = gl::GetGLImplementation() != gl::kGLImplementationNone; |
| 182 if (!gl_initialized) | 193 if (!gl_initialized) |
| 183 gl_initialized = gl::init::InitializeGLOneOff(); | 194 gl_initialized = gl::init::InitializeGLOneOff(); |
| 184 | 195 |
| 185 if (!gl_initialized) { | 196 if (!gl_initialized) { |
| 186 VLOG(1) << "gl::init::InitializeGLOneOff failed"; | 197 VLOG(1) << "gl::init::InitializeGLOneOff failed"; |
| 187 return false; | 198 return false; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 234 watchdog_thread_ = gpu::GpuWatchdogThread::Create(); | 245 watchdog_thread_ = gpu::GpuWatchdogThread::Create(); |
| 235 } | 246 } |
| 236 | 247 |
| 237 if (!gpu_info_.sandboxed) | 248 if (!gpu_info_.sandboxed) |
| 238 gpu_info_.sandboxed = | 249 gpu_info_.sandboxed = |
| 239 sandbox_helper_->EnsureSandboxInitialized(watchdog_thread_.get()); | 250 sandbox_helper_->EnsureSandboxInitialized(watchdog_thread_.get()); |
| 240 return true; | 251 return true; |
| 241 } | 252 } |
| 242 | 253 |
| 243 } // namespace gpu | 254 } // namespace gpu |
| OLD | NEW |