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) | 25 #if defined(USE_OZONE) |
26 #include "ui/ozone/public/ozone_platform.h" | 26 #include "ui/ozone/public/ozone_platform.h" |
27 #endif | 27 #endif |
28 | 28 |
| 29 #if defined(OS_WIN) |
| 30 #include "gpu/ipc/service/direct_composition_surface_win.h" |
| 31 #endif |
| 32 |
29 namespace gpu { | 33 namespace gpu { |
30 | 34 |
31 namespace { | 35 namespace { |
32 | 36 |
33 void GetGpuInfoFromCommandLine(gpu::GPUInfo& gpu_info, | 37 void GetGpuInfoFromCommandLine(gpu::GPUInfo& gpu_info, |
34 const base::CommandLine& command_line) { | 38 const base::CommandLine& command_line) { |
35 if (!command_line.HasSwitch(switches::kGpuVendorID) || | 39 if (!command_line.HasSwitch(switches::kGpuVendorID) || |
36 !command_line.HasSwitch(switches::kGpuDeviceID) || | 40 !command_line.HasSwitch(switches::kGpuDeviceID) || |
37 !command_line.HasSwitch(switches::kGpuDriverVersion)) | 41 !command_line.HasSwitch(switches::kGpuDriverVersion)) |
38 return; | 42 return; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 break; | 95 break; |
92 case gpu::kCollectInfoNonFatalFailure: | 96 case gpu::kCollectInfoNonFatalFailure: |
93 DVLOG(1) << "gpu::CollectGraphicsInfo failed (non-fatal)."; | 97 DVLOG(1) << "gpu::CollectGraphicsInfo failed (non-fatal)."; |
94 break; | 98 break; |
95 case gpu::kCollectInfoNone: | 99 case gpu::kCollectInfoNone: |
96 NOTREACHED(); | 100 NOTREACHED(); |
97 break; | 101 break; |
98 case gpu::kCollectInfoSuccess: | 102 case gpu::kCollectInfoSuccess: |
99 break; | 103 break; |
100 } | 104 } |
| 105 |
| 106 #if defined(OS_WIN) |
| 107 if (gl::GetGLImplementation() == gl::kGLImplementationEGLGLES2 && |
| 108 gl::GLSurfaceEGL::IsDirectCompositionSupported() && |
| 109 DirectCompositionSurfaceWin::AreOverlaysSupported()) { |
| 110 gpu_info.supports_overlays = true; |
| 111 } |
| 112 #endif // defined(OS_WIN) |
101 } | 113 } |
102 #endif // defined(OS_MACOSX) | 114 #endif // defined(OS_MACOSX) |
103 | 115 |
104 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 116 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
105 bool CanAccessNvidiaDeviceFile() { | 117 bool CanAccessNvidiaDeviceFile() { |
106 bool res = true; | 118 bool res = true; |
107 base::ThreadRestrictions::AssertIOAllowed(); | 119 base::ThreadRestrictions::AssertIOAllowed(); |
108 if (access("/dev/nvidiactl", R_OK) != 0) { | 120 if (access("/dev/nvidiactl", R_OK) != 0) { |
109 DVLOG(1) << "NVIDIA device file /dev/nvidiactl access denied"; | 121 DVLOG(1) << "NVIDIA device file /dev/nvidiactl access denied"; |
110 res = false; | 122 res = false; |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 watchdog_thread_ = gpu::GpuWatchdogThread::Create(); | 258 watchdog_thread_ = gpu::GpuWatchdogThread::Create(); |
247 } | 259 } |
248 | 260 |
249 if (!gpu_info_.sandboxed) | 261 if (!gpu_info_.sandboxed) |
250 gpu_info_.sandboxed = | 262 gpu_info_.sandboxed = |
251 sandbox_helper_->EnsureSandboxInitialized(watchdog_thread_.get()); | 263 sandbox_helper_->EnsureSandboxInitialized(watchdog_thread_.get()); |
252 return true; | 264 return true; |
253 } | 265 } |
254 | 266 |
255 } // namespace gpu | 267 } // namespace gpu |
OLD | NEW |