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

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

Issue 11047011: Figure out whether we have enough information to make the final GPU blacklisting decision. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 2 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 | Annotate | Revision Log
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 <stdlib.h> 5 #include <stdlib.h>
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #endif 9 #endif
10 10
(...skipping 30 matching lines...) Expand all
41 #if defined(USE_X11) 41 #if defined(USE_X11)
42 #include "ui/base/x/x11_util.h" 42 #include "ui/base/x/x11_util.h"
43 #endif 43 #endif
44 44
45 #if defined(OS_LINUX) 45 #if defined(OS_LINUX)
46 #include "content/public/common/sandbox_init.h" 46 #include "content/public/common/sandbox_init.h"
47 #endif 47 #endif
48 48
49 namespace { 49 namespace {
50 void WarmUpSandbox(const content::GPUInfo&, bool); 50 void WarmUpSandbox(const content::GPUInfo&, bool);
51 #if defined(OS_LINUX)
52 void CollectGraphicsInfo(content::GPUInfo*);
53 #endif
54 } 51 }
55 52
56 // Main function for starting the Gpu process. 53 // Main function for starting the Gpu process.
57 int GpuMain(const content::MainFunctionParams& parameters) { 54 int GpuMain(const content::MainFunctionParams& parameters) {
58 TRACE_EVENT0("gpu", "GpuMain"); 55 TRACE_EVENT0("gpu", "GpuMain");
59 56
60 base::Time start_time = base::Time::Now(); 57 base::Time start_time = base::Time::Now();
61 58
62 const CommandLine& command_line = parameters.command_line; 59 const CommandLine& command_line = parameters.command_line;
63 if (command_line.HasSwitch(switches::kGpuStartupDialog)) { 60 if (command_line.HasSwitch(switches::kGpuStartupDialog)) {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 gpu_info.driver_vendor = 112 gpu_info.driver_vendor =
116 command_line.GetSwitchValueASCII(switches::kGpuDriverVendor); 113 command_line.GetSwitchValueASCII(switches::kGpuDriverVendor);
117 gpu_info.driver_version = 114 gpu_info.driver_version =
118 command_line.GetSwitchValueASCII(switches::kGpuDriverVersion); 115 command_line.GetSwitchValueASCII(switches::kGpuDriverVersion);
119 content::GetContentClient()->SetGpuInfo(gpu_info); 116 content::GetContentClient()->SetGpuInfo(gpu_info);
120 117
121 // We need to track that information for the WarmUpSandbox function. 118 // We need to track that information for the WarmUpSandbox function.
122 bool initialized_gl_context = false; 119 bool initialized_gl_context = false;
123 // Load and initialize the GL implementation and locate the GL entry points. 120 // Load and initialize the GL implementation and locate the GL entry points.
124 if (gfx::GLSurface::InitializeOneOff()) { 121 if (gfx::GLSurface::InitializeOneOff()) {
125 #if defined(OS_LINUX) 122 if (!command_line.HasSwitch(switches::kSkipGpuFullInfoCollection)) {
126 // We collect full GPU info on demand in Win/Mac, i.e., when about:gpu 123 if (!gpu_info_collector::CollectGraphicsInfo(&gpu_info))
127 // page opens. This is because we can make blacklist decisions based on 124 VLOG(1) << "gpu_info_collector::CollectGraphicsInfo failed";
128 // preliminary GPU info. 125 content::GetContentClient()->SetGpuInfo(gpu_info);
129 // However, on Linux, we may not have enough info for blacklisting. 126
130 if (!gpu_info.gpu.vendor_id || !gpu_info.gpu.device_id ||
131 gpu_info.driver_vendor.empty() || gpu_info.driver_version.empty()) {
132 CollectGraphicsInfo(&gpu_info);
133 // We know that CollectGraphicsInfo will initialize a GLContext. 127 // We know that CollectGraphicsInfo will initialize a GLContext.
134 initialized_gl_context = true; 128 initialized_gl_context = true;
Ken Russell (switch to Gerrit) 2012/10/09 18:52:55 Now CollectGraphicsInfo might have failed above, s
Zhenyao Mo 2012/10/09 19:20:47 For this we need to evaluate the effects of this v
135 } 129 }
136 130
137 #if !defined(OS_CHROMEOS) 131 #if !defined(OS_CHROMEOS)
138 if (gpu_info.gpu.vendor_id == 0x10de && // NVIDIA 132 if (gpu_info.gpu.vendor_id == 0x10de && // NVIDIA
139 gpu_info.driver_vendor == "NVIDIA") { 133 gpu_info.driver_vendor == "NVIDIA") {
140 base::ThreadRestrictions::AssertIOAllowed(); 134 base::ThreadRestrictions::AssertIOAllowed();
141 if (access("/dev/nvidiactl", R_OK) != 0) { 135 if (access("/dev/nvidiactl", R_OK) != 0) {
142 VLOG(1) << "NVIDIA device file /dev/nvidiactl access denied"; 136 VLOG(1) << "NVIDIA device file /dev/nvidiactl access denied";
143 gpu_info.gpu_accessible = false; 137 gpu_info.gpu_accessible = false;
144 dead_on_arrival = true; 138 dead_on_arrival = true;
145 } 139 }
146 } 140 }
147 #endif // OS_CHROMEOS 141 #endif // OS_CHROMEOS
148 #endif // OS_LINUX
149 } else { 142 } else {
150 VLOG(1) << "gfx::GLSurface::InitializeOneOff failed"; 143 VLOG(1) << "gfx::GLSurface::InitializeOneOff failed";
151 gpu_info.gpu_accessible = false; 144 gpu_info.gpu_accessible = false;
152 gpu_info.finalized = true; 145 gpu_info.finalized = true;
153 dead_on_arrival = true; 146 dead_on_arrival = true;
154 } 147 }
155 148
156 { 149 {
157 const bool should_initialize_gl_context = !initialized_gl_context && 150 const bool should_initialize_gl_context = !initialized_gl_context &&
158 !dead_on_arrival; 151 !dead_on_arrival;
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 } 299 }
307 300
308 { 301 {
309 TRACE_EVENT0("gpu", "Initialize DXVA"); 302 TRACE_EVENT0("gpu", "Initialize DXVA");
310 // Initialize H/W video decoding stuff which fails in the sandbox. 303 // Initialize H/W video decoding stuff which fails in the sandbox.
311 DXVAVideoDecodeAccelerator::PreSandboxInitialization(); 304 DXVAVideoDecodeAccelerator::PreSandboxInitialization();
312 } 305 }
313 #endif 306 #endif
314 } 307 }
315 308
316 #if defined(OS_LINUX)
317 void CollectGraphicsInfo(content::GPUInfo* gpu_info) {
318 if (!gpu_info_collector::CollectGraphicsInfo(gpu_info))
319 VLOG(1) << "gpu_info_collector::CollectGraphicsInfo failed";
320 content::GetContentClient()->SetGpuInfo(*gpu_info);
321 }
322 #endif
323
324 } // namespace. 309 } // namespace.
325 310
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698