| 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" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 // Get vendor_id, device_id, driver_version from browser process through | 151 // Get vendor_id, device_id, driver_version from browser process through |
| 152 // commandline switches. | 152 // commandline switches. |
| 153 GetGpuInfoFromCommandLine(gpu_info_, command_line); | 153 GetGpuInfoFromCommandLine(gpu_info_, command_line); |
| 154 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 154 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 155 if (gpu_info_.gpu.vendor_id == 0x10de && // NVIDIA | 155 if (gpu_info_.gpu.vendor_id == 0x10de && // NVIDIA |
| 156 gpu_info_.driver_vendor == "NVIDIA" && !CanAccessNvidiaDeviceFile()) | 156 gpu_info_.driver_vendor == "NVIDIA" && !CanAccessNvidiaDeviceFile()) |
| 157 return false; | 157 return false; |
| 158 #endif | 158 #endif |
| 159 gpu_info_.in_process_gpu = false; | 159 gpu_info_.in_process_gpu = false; |
| 160 | 160 |
| 161 gpu_info_.passthrough_cmd_decoder = |
| 162 command_line.HasSwitch(switches::kUsePassthroughCmdDecoder); |
| 163 |
| 161 sandbox_helper_->PreSandboxStartup(); | 164 sandbox_helper_->PreSandboxStartup(); |
| 162 | 165 |
| 163 #if defined(OS_LINUX) | 166 #if defined(OS_LINUX) |
| 164 // On Chrome OS ARM Mali, GPU driver userspace creates threads when | 167 // On Chrome OS ARM Mali, GPU driver userspace creates threads when |
| 165 // initializing a GL context, so start the sandbox early. | 168 // initializing a GL context, so start the sandbox early. |
| 166 if (command_line.HasSwitch(switches::kGpuSandboxStartEarly)) | 169 if (command_line.HasSwitch(switches::kGpuSandboxStartEarly)) |
| 167 gpu_info_.sandboxed = | 170 gpu_info_.sandboxed = |
| 168 sandbox_helper_->EnsureSandboxInitialized(watchdog_thread_.get()); | 171 sandbox_helper_->EnsureSandboxInitialized(watchdog_thread_.get()); |
| 169 #endif // defined(OS_LINUX) | 172 #endif // defined(OS_LINUX) |
| 170 | 173 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 watchdog_thread_ = gpu::GpuWatchdogThread::Create(); | 230 watchdog_thread_ = gpu::GpuWatchdogThread::Create(); |
| 228 } | 231 } |
| 229 | 232 |
| 230 if (!gpu_info_.sandboxed) | 233 if (!gpu_info_.sandboxed) |
| 231 gpu_info_.sandboxed = | 234 gpu_info_.sandboxed = |
| 232 sandbox_helper_->EnsureSandboxInitialized(watchdog_thread_.get()); | 235 sandbox_helper_->EnsureSandboxInitialized(watchdog_thread_.get()); |
| 233 return true; | 236 return true; |
| 234 } | 237 } |
| 235 | 238 |
| 236 } // namespace gpu | 239 } // namespace gpu |
| OLD | NEW |