Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: content/gpu/gpu_main.cc

Issue 2312173003: gpu: Unify code to initialize dual-gpu mode. (Closed)
Patch Set: . Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/browser/gpu/gpu_data_manager_impl_private.cc ('k') | gpu/config/gpu_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stddef.h> 5 #include <stddef.h>
6 #include <stdlib.h> 6 #include <stdlib.h>
7 7
8 #include <memory> 8 #include <memory>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 12 matching lines...) Expand all
23 #include "content/child/child_process.h" 23 #include "content/child/child_process.h"
24 #include "content/common/content_constants_internal.h" 24 #include "content/common/content_constants_internal.h"
25 #include "content/common/gpu_host_messages.h" 25 #include "content/common/gpu_host_messages.h"
26 #include "content/common/sandbox_linux/sandbox_linux.h" 26 #include "content/common/sandbox_linux/sandbox_linux.h"
27 #include "content/gpu/gpu_child_thread.h" 27 #include "content/gpu/gpu_child_thread.h"
28 #include "content/gpu/gpu_process.h" 28 #include "content/gpu/gpu_process.h"
29 #include "content/public/common/content_client.h" 29 #include "content/public/common/content_client.h"
30 #include "content/public/common/content_switches.h" 30 #include "content/public/common/content_switches.h"
31 #include "content/public/common/main_function_params.h" 31 #include "content/public/common/main_function_params.h"
32 #include "gpu/command_buffer/service/gpu_switches.h" 32 #include "gpu/command_buffer/service/gpu_switches.h"
33 #include "gpu/config/gpu_driver_bug_list.h"
33 #include "gpu/config/gpu_info_collector.h" 34 #include "gpu/config/gpu_info_collector.h"
34 #include "gpu/config/gpu_switches.h" 35 #include "gpu/config/gpu_switches.h"
35 #include "gpu/config/gpu_util.h" 36 #include "gpu/config/gpu_util.h"
36 #include "gpu/ipc/common/gpu_memory_buffer_support.h" 37 #include "gpu/ipc/common/gpu_memory_buffer_support.h"
37 #include "gpu/ipc/service/gpu_config.h" 38 #include "gpu/ipc/service/gpu_config.h"
38 #include "gpu/ipc/service/gpu_memory_buffer_factory.h" 39 #include "gpu/ipc/service/gpu_memory_buffer_factory.h"
39 #include "gpu/ipc/service/gpu_watchdog_thread.h" 40 #include "gpu/ipc/service/gpu_watchdog_thread.h"
40 #include "ui/events/platform/platform_event_source.h" 41 #include "ui/events/platform/platform_event_source.h"
41 #include "ui/gl/gl_context.h" 42 #include "ui/gl/gl_context.h"
42 #include "ui/gl/gl_implementation.h" 43 #include "ui/gl/gl_implementation.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 switches::kWindowDepth)); 153 switches::kWindowDepth));
153 DCHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( 154 DCHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
154 switches::kX11VisualID)); 155 switches::kX11VisualID));
155 #endif 156 #endif
156 157
157 #endif 158 #endif
158 159
159 logging::SetLogMessageHandler(GpuProcessLogMessageHandler); 160 logging::SetLogMessageHandler(GpuProcessLogMessageHandler);
160 161
161 if (command_line.HasSwitch(switches::kSupportsDualGpus)) { 162 if (command_line.HasSwitch(switches::kSupportsDualGpus)) {
162 std::string types = command_line.GetSwitchValueASCII(
163 switches::kGpuDriverBugWorkarounds);
164 std::set<int> workarounds; 163 std::set<int> workarounds;
165 gpu::StringToFeatureSet(types, &workarounds); 164 gpu::GpuDriverBugList::AppendWorkaroundsFromCommandLine(&workarounds,
166 if (workarounds.count(gpu::FORCE_DISCRETE_GPU) == 1) 165 command_line);
167 ui::GpuSwitchingManager::GetInstance()->ForceUseOfDiscreteGpu(); 166 gpu::InitializeDualGpusIfSupported(workarounds);
168 else if (workarounds.count(gpu::FORCE_INTEGRATED_GPU) == 1)
169 ui::GpuSwitchingManager::GetInstance()->ForceUseOfIntegratedGpu();
170 } 167 }
171 168
172 // Initialization of the OpenGL bindings may fail, in which case we 169 // Initialization of the OpenGL bindings may fail, in which case we
173 // will need to tear down this process. However, we can not do so 170 // will need to tear down this process. However, we can not do so
174 // safely until the IPC channel is set up, because the detection of 171 // safely until the IPC channel is set up, because the detection of
175 // early return of a child process is implemented using an IPC 172 // early return of a child process is implemented using an IPC
176 // channel error. If the IPC channel is not fully set up between the 173 // channel error. If the IPC channel is not fully set up between the
177 // browser and GPU process, and the GPU process crashes or exits 174 // browser and GPU process, and the GPU process crashes or exits
178 // early, the browser process will never detect it. For this reason 175 // early, the browser process will never detect it. For this reason
179 // we defer tearing down the GPU process until receiving the 176 // we defer tearing down the GPU process until receiving the
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 return true; 544 return true;
548 } 545 }
549 546
550 return false; 547 return false;
551 } 548 }
552 #endif // defined(OS_WIN) 549 #endif // defined(OS_WIN)
553 550
554 } // namespace. 551 } // namespace.
555 552
556 } // namespace content 553 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_data_manager_impl_private.cc ('k') | gpu/config/gpu_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698