| 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) | 29 #if defined(OS_WIN) |
| 30 #include "gpu/ipc/service/child_window_surface_win.h" |
| 30 #include "gpu/ipc/service/direct_composition_surface_win.h" | 31 #include "gpu/ipc/service/direct_composition_surface_win.h" |
| 31 #endif | 32 #endif |
| 32 | 33 |
| 33 namespace gpu { | 34 namespace gpu { |
| 34 | 35 |
| 35 namespace { | 36 namespace { |
| 36 | 37 |
| 37 void GetGpuInfoFromCommandLine(gpu::GPUInfo& gpu_info, | 38 void GetGpuInfoFromCommandLine(gpu::GPUInfo& gpu_info, |
| 38 const base::CommandLine& command_line) { | 39 const base::CommandLine& command_line) { |
| 39 if (!command_line.HasSwitch(switches::kGpuVendorID) || | 40 if (!command_line.HasSwitch(switches::kGpuVendorID) || |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 case gpu::kCollectInfoSuccess: | 103 case gpu::kCollectInfoSuccess: |
| 103 break; | 104 break; |
| 104 } | 105 } |
| 105 | 106 |
| 106 #if defined(OS_WIN) | 107 #if defined(OS_WIN) |
| 107 if (gl::GetGLImplementation() == gl::kGLImplementationEGLGLES2 && | 108 if (gl::GetGLImplementation() == gl::kGLImplementationEGLGLES2 && |
| 108 gl::GLSurfaceEGL::IsDirectCompositionSupported() && | 109 gl::GLSurfaceEGL::IsDirectCompositionSupported() && |
| 109 DirectCompositionSurfaceWin::AreOverlaysSupported()) { | 110 DirectCompositionSurfaceWin::AreOverlaysSupported()) { |
| 110 gpu_info.supports_overlays = true; | 111 gpu_info.supports_overlays = true; |
| 111 } | 112 } |
| 113 if (ChildWindowSurfaceWin::IsHDRSupported()) { |
| 114 gpu_info.hdr = true; |
| 115 } |
| 112 #endif // defined(OS_WIN) | 116 #endif // defined(OS_WIN) |
| 113 } | 117 } |
| 114 #endif // defined(OS_MACOSX) | 118 #endif // defined(OS_MACOSX) |
| 115 | 119 |
| 116 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 120 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 117 bool CanAccessNvidiaDeviceFile() { | 121 bool CanAccessNvidiaDeviceFile() { |
| 118 bool res = true; | 122 bool res = true; |
| 119 base::ThreadRestrictions::AssertIOAllowed(); | 123 base::ThreadRestrictions::AssertIOAllowed(); |
| 120 if (access("/dev/nvidiactl", R_OK) != 0) { | 124 if (access("/dev/nvidiactl", R_OK) != 0) { |
| 121 DVLOG(1) << "NVIDIA device file /dev/nvidiactl access denied"; | 125 DVLOG(1) << "NVIDIA device file /dev/nvidiactl access denied"; |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 | 282 |
| 279 if (!gpu_info_.sandboxed && !attempted_startsandbox) { | 283 if (!gpu_info_.sandboxed && !attempted_startsandbox) { |
| 280 gpu_info_.sandboxed = | 284 gpu_info_.sandboxed = |
| 281 sandbox_helper_->EnsureSandboxInitialized(watchdog_thread_.get()); | 285 sandbox_helper_->EnsureSandboxInitialized(watchdog_thread_.get()); |
| 282 } | 286 } |
| 283 | 287 |
| 284 return true; | 288 return true; |
| 285 } | 289 } |
| 286 | 290 |
| 287 } // namespace gpu | 291 } // namespace gpu |
| OLD | NEW |