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

Side by Side Diff: gpu/ipc/service/gpu_init.cc

Issue 2814793007: Fix --no-sandbox and --disable-gpu-sandbox on Mali. (Closed)
Patch Set: Created 3 years, 8 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 gpu_info_.driver_vendor == "NVIDIA" && !CanAccessNvidiaDeviceFile()) 174 gpu_info_.driver_vendor == "NVIDIA" && !CanAccessNvidiaDeviceFile())
175 return false; 175 return false;
176 #endif 176 #endif
177 gpu_info_.in_process_gpu = false; 177 gpu_info_.in_process_gpu = false;
178 178
179 gpu_info_.passthrough_cmd_decoder = 179 gpu_info_.passthrough_cmd_decoder =
180 command_line.HasSwitch(switches::kUsePassthroughCmdDecoder); 180 command_line.HasSwitch(switches::kUsePassthroughCmdDecoder);
181 181
182 sandbox_helper_->PreSandboxStartup(); 182 sandbox_helper_->PreSandboxStartup();
183 183
184 bool attempted_startsandbox = false;
184 #if defined(OS_LINUX) 185 #if defined(OS_LINUX)
185 // On Chrome OS ARM Mali, GPU driver userspace creates threads when 186 // On Chrome OS ARM Mali, GPU driver userspace creates threads when
186 // initializing a GL context, so start the sandbox early. 187 // initializing a GL context, so start the sandbox early.
187 if (command_line.HasSwitch(switches::kGpuSandboxStartEarly)) 188 if (command_line.HasSwitch(switches::kGpuSandboxStartEarly)) {
188 gpu_info_.sandboxed = 189 gpu_info_.sandboxed =
189 sandbox_helper_->EnsureSandboxInitialized(watchdog_thread_.get()); 190 sandbox_helper_->EnsureSandboxInitialized(watchdog_thread_.get());
191 attempted_startsandbox = true;
192 }
193
190 #endif // defined(OS_LINUX) 194 #endif // defined(OS_LINUX)
191 195
192 base::TimeTicks before_initialize_one_off = base::TimeTicks::Now(); 196 base::TimeTicks before_initialize_one_off = base::TimeTicks::Now();
193 197
194 #if defined(USE_OZONE) 198 #if defined(USE_OZONE)
195 // Initialize Ozone GPU after the watchdog in case it hangs. The sandbox 199 // Initialize Ozone GPU after the watchdog in case it hangs. The sandbox
196 // may also have started at this point. 200 // may also have started at this point.
197 ui::OzonePlatform::InitParams params; 201 ui::OzonePlatform::InitParams params;
198 params.single_process = false; 202 params.single_process = false;
199 ui::OzonePlatform::InitializeForGPU(params); 203 ui::OzonePlatform::InitializeForGPU(params);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 // Software GL is expected to run slowly, so disable the watchdog 255 // Software GL is expected to run slowly, so disable the watchdog
252 // in that case. 256 // in that case.
253 if (gl::GetGLImplementation() == gl::GetSoftwareGLImplementation()) { 257 if (gl::GetGLImplementation() == gl::GetSoftwareGLImplementation()) {
254 if (watchdog_thread_) 258 if (watchdog_thread_)
255 watchdog_thread_->Stop(); 259 watchdog_thread_->Stop();
256 watchdog_thread_ = nullptr; 260 watchdog_thread_ = nullptr;
257 } else if (enable_watchdog && delayed_watchdog_enable) { 261 } else if (enable_watchdog && delayed_watchdog_enable) {
258 watchdog_thread_ = gpu::GpuWatchdogThread::Create(); 262 watchdog_thread_ = gpu::GpuWatchdogThread::Create();
259 } 263 }
260 264
261 if (!gpu_info_.sandboxed) 265 if (!gpu_info_.sandboxed && !attempted_startsandbox) {
262 gpu_info_.sandboxed = 266 gpu_info_.sandboxed =
263 sandbox_helper_->EnsureSandboxInitialized(watchdog_thread_.get()); 267 sandbox_helper_->EnsureSandboxInitialized(watchdog_thread_.get());
268 }
269
264 return true; 270 return true;
265 } 271 }
266 272
267 } // namespace gpu 273 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698