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 <stdlib.h> | 5 #include <stdlib.h> |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <dwmapi.h> | 8 #include <dwmapi.h> |
9 #include <windows.h> | 9 #include <windows.h> |
10 #endif | 10 #endif |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "content/common/gpu/gpu_config.h" | 22 #include "content/common/gpu/gpu_config.h" |
23 #include "content/common/gpu/gpu_messages.h" | 23 #include "content/common/gpu/gpu_messages.h" |
24 #include "content/common/sandbox_linux.h" | 24 #include "content/common/sandbox_linux.h" |
25 #include "content/gpu/gpu_child_thread.h" | 25 #include "content/gpu/gpu_child_thread.h" |
26 #include "content/gpu/gpu_process.h" | 26 #include "content/gpu/gpu_process.h" |
27 #include "content/gpu/gpu_watchdog_thread.h" | 27 #include "content/gpu/gpu_watchdog_thread.h" |
28 #include "content/public/common/content_client.h" | 28 #include "content/public/common/content_client.h" |
29 #include "content/public/common/content_switches.h" | 29 #include "content/public/common/content_switches.h" |
30 #include "content/public/common/main_function_params.h" | 30 #include "content/public/common/main_function_params.h" |
31 #include "crypto/hmac.h" | 31 #include "crypto/hmac.h" |
| 32 #include "gpu/command_buffer/service/gpu_switches.h" |
32 #include "gpu/config/gpu_info_collector.h" | 33 #include "gpu/config/gpu_info_collector.h" |
| 34 #include "gpu/config/gpu_util.h" |
33 #include "ui/gl/gl_implementation.h" | 35 #include "ui/gl/gl_implementation.h" |
34 #include "ui/gl/gl_surface.h" | 36 #include "ui/gl/gl_surface.h" |
35 #include "ui/gl/gl_switches.h" | 37 #include "ui/gl/gl_switches.h" |
36 #include "ui/gl/gpu_switching_manager.h" | 38 #include "ui/gl/gpu_switching_manager.h" |
37 | 39 |
38 #if defined(OS_WIN) | 40 #if defined(OS_WIN) |
39 #include "base/win/windows_version.h" | 41 #include "base/win/windows_version.h" |
40 #include "base/win/scoped_com_initializer.h" | 42 #include "base/win/scoped_com_initializer.h" |
41 #include "content/common/gpu/media/dxva_video_decode_accelerator.h" | 43 #include "content/common/gpu/media/dxva_video_decode_accelerator.h" |
42 #include "sandbox/win/src/sandbox.h" | 44 #include "sandbox/win/src/sandbox.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 SEM_FAILCRITICALERRORS | | 110 SEM_FAILCRITICALERRORS | |
109 SEM_NOGPFAULTERRORBOX | | 111 SEM_NOGPFAULTERRORBOX | |
110 SEM_NOOPENFILEERRORBOX); | 112 SEM_NOOPENFILEERRORBOX); |
111 #elif defined(USE_X11) | 113 #elif defined(USE_X11) |
112 ui::SetDefaultX11ErrorHandlers(); | 114 ui::SetDefaultX11ErrorHandlers(); |
113 #endif | 115 #endif |
114 | 116 |
115 logging::SetLogMessageHandler(GpuProcessLogMessageHandler); | 117 logging::SetLogMessageHandler(GpuProcessLogMessageHandler); |
116 } | 118 } |
117 | 119 |
118 if (command_line.HasSwitch(switches::kSupportsDualGpus) && | 120 if (command_line.HasSwitch(switches::kSupportsDualGpus)) { |
119 command_line.HasSwitch(switches::kGpuSwitching)) { | 121 std::string types = command_line.GetSwitchValueASCII( |
120 std::string option = command_line.GetSwitchValueASCII( | 122 switches::kGpuDriverBugWorkarounds); |
121 switches::kGpuSwitching); | 123 std::set<int> workarounds; |
122 if (option == switches::kGpuSwitchingOptionNameForceDiscrete) | 124 gpu::StringToFeatureSet(types, &workarounds); |
| 125 if (workarounds.count(gpu::FORCE_DISCRETE_GPU) == 1) |
123 ui::GpuSwitchingManager::GetInstance()->ForceUseOfDiscreteGpu(); | 126 ui::GpuSwitchingManager::GetInstance()->ForceUseOfDiscreteGpu(); |
124 else if (option == switches::kGpuSwitchingOptionNameForceIntegrated) | 127 else if (workarounds.count(gpu::FORCE_INTEGRATED_GPU) == 1) |
125 ui::GpuSwitchingManager::GetInstance()->ForceUseOfIntegratedGpu(); | 128 ui::GpuSwitchingManager::GetInstance()->ForceUseOfIntegratedGpu(); |
126 } | 129 } |
127 | 130 |
128 // Initialization of the OpenGL bindings may fail, in which case we | 131 // Initialization of the OpenGL bindings may fail, in which case we |
129 // will need to tear down this process. However, we can not do so | 132 // will need to tear down this process. However, we can not do so |
130 // safely until the IPC channel is set up, because the detection of | 133 // safely until the IPC channel is set up, because the detection of |
131 // early return of a child process is implemented using an IPC | 134 // early return of a child process is implemented using an IPC |
132 // channel error. If the IPC channel is not fully set up between the | 135 // channel error. If the IPC channel is not fully set up between the |
133 // browser and GPU process, and the GPU process crashes or exits | 136 // browser and GPU process, and the GPU process crashes or exits |
134 // early, the browser process will never detect it. For this reason | 137 // early, the browser process will never detect it. For this reason |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 return true; | 452 return true; |
450 } | 453 } |
451 | 454 |
452 return false; | 455 return false; |
453 } | 456 } |
454 #endif // defined(OS_WIN) | 457 #endif // defined(OS_WIN) |
455 | 458 |
456 } // namespace. | 459 } // namespace. |
457 | 460 |
458 } // namespace content | 461 } // namespace content |
OLD | NEW |