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

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

Issue 10310180: Disable GPU info collection on GPU process startup on Win/Mac. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 7 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
« no previous file with comments | « content/gpu/gpu_child_thread.cc ('k') | content/public/common/content_switches.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 <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
11 #include "base/environment.h" 11 #include "base/environment.h"
12 #include "base/message_loop.h" 12 #include "base/message_loop.h"
13 #include "base/rand_util.h" 13 #include "base/rand_util.h"
14 #include "base/string_number_conversions.h"
14 #include "base/stringprintf.h" 15 #include "base/stringprintf.h"
15 #include "base/threading/platform_thread.h" 16 #include "base/threading/platform_thread.h"
16 #include "base/win/scoped_com_initializer.h" 17 #include "base/win/scoped_com_initializer.h"
17 #include "build/build_config.h" 18 #include "build/build_config.h"
18 #include "content/common/gpu/gpu_config.h" 19 #include "content/common/gpu/gpu_config.h"
19 #include "content/gpu/gpu_child_thread.h" 20 #include "content/gpu/gpu_child_thread.h"
20 #include "content/gpu/gpu_info_collector.h" 21 #include "content/gpu/gpu_info_collector.h"
21 #include "content/gpu/gpu_process.h" 22 #include "content/gpu/gpu_process.h"
22 #include "content/public/common/content_client.h" 23 #include "content/public/common/content_client.h"
23 #include "content/public/common/content_switches.h" 24 #include "content/public/common/content_switches.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 // will need to tear down this process. However, we can not do so 66 // will need to tear down this process. However, we can not do so
66 // safely until the IPC channel is set up, because the detection of 67 // safely until the IPC channel is set up, because the detection of
67 // early return of a child process is implemented using an IPC 68 // early return of a child process is implemented using an IPC
68 // channel error. If the IPC channel is not fully set up between the 69 // channel error. If the IPC channel is not fully set up between the
69 // browser and GPU process, and the GPU process crashes or exits 70 // browser and GPU process, and the GPU process crashes or exits
70 // early, the browser process will never detect it. For this reason 71 // early, the browser process will never detect it. For this reason
71 // we defer tearing down the GPU process until receiving the 72 // we defer tearing down the GPU process until receiving the
72 // GpuMsg_Initialize message from the browser. 73 // GpuMsg_Initialize message from the browser.
73 bool dead_on_arrival = false; 74 bool dead_on_arrival = false;
74 75
76 content::GPUInfo gpu_info;
77 // Get vendor_id, device_id, driver_version from browser process through
78 // commandline switches.
79 DCHECK(command_line.HasSwitch(switches::kGpuVendorID) &&
80 command_line.HasSwitch(switches::kGpuDeviceID) &&
81 command_line.HasSwitch(switches::kGpuDriverVersion));
82 bool success = base::HexStringToInt(
83 command_line.GetSwitchValueASCII(switches::kGpuVendorID),
84 reinterpret_cast<int*>(&(gpu_info.gpu.vendor_id)));
85 DCHECK(success);
86 success = base::HexStringToInt(
87 command_line.GetSwitchValueASCII(switches::kGpuDeviceID),
88 reinterpret_cast<int*>(&(gpu_info.gpu.device_id)));
89 gpu_info.driver_version =
90 command_line.GetSwitchValueASCII(switches::kGpuDriverVersion);
91 content::GetContentClient()->SetGpuInfo(gpu_info);
92
75 // Load and initialize the GL implementation and locate the GL entry points. 93 // Load and initialize the GL implementation and locate the GL entry points.
76 content::GPUInfo gpu_info;
77 if (gfx::GLSurface::InitializeOneOff()) { 94 if (gfx::GLSurface::InitializeOneOff()) {
78 // Collect information about the GPU. 95 #if defined(OS_LINUX)
79 if (!gpu_info_collector::CollectGraphicsInfo(&gpu_info)) { 96 // We collect full GPU info on demand in Win/Mac, i.e., when about:gpu
80 LOG(INFO) << "gpu_info_collector::CollectGraphicsInfo failed"; 97 // page opens. This is because we can make blacklist decisions based on
81 } 98 // preliminary GPU info.
99 // However, on Linux, blacklist decisions are based on full GPU info.
100 if (!gpu_info_collector::CollectGraphicsInfo(&gpu_info))
101 VLOG(1) << "gpu_info_collector::CollectGraphicsInfo failed";
102 content::GetContentClient()->SetGpuInfo(gpu_info);
82 103
83 #if defined(OS_LINUX)
84 if (gpu_info.gpu.vendor_id == 0x10de && // NVIDIA 104 if (gpu_info.gpu.vendor_id == 0x10de && // NVIDIA
85 gpu_info.driver_vendor == "NVIDIA") { 105 gpu_info.driver_vendor == "NVIDIA") {
86 base::ThreadRestrictions::AssertIOAllowed(); 106 base::ThreadRestrictions::AssertIOAllowed();
87 if (access("/dev/nvidiactl", R_OK) != 0) { 107 if (access("/dev/nvidiactl", R_OK) != 0) {
88 LOG(INFO) << "NVIDIA device file /dev/nvidiactl access denied"; 108 VLOG(1) << "NVIDIA device file /dev/nvidiactl access denied";
89 gpu_info.gpu_accessible = false; 109 gpu_info.gpu_accessible = false;
90 dead_on_arrival = true; 110 dead_on_arrival = true;
91 } 111 }
92 } 112 }
93 #endif 113 #endif
94
95 // Set the GPU info even if it failed.
96 content::GetContentClient()->SetGpuInfo(gpu_info);
97 } else { 114 } else {
98 LOG(INFO) << "gfx::GLSurface::InitializeOneOff failed"; 115 VLOG(1) << "gfx::GLSurface::InitializeOneOff failed";
99 gpu_info.gpu_accessible = false; 116 gpu_info.gpu_accessible = false;
117 gpu_info.finalized = true;
100 dead_on_arrival = true; 118 dead_on_arrival = true;
101 } 119 }
102 120
103 // Warm up the random subsystem, which needs to be done pre-sandbox on all 121 // Warm up the random subsystem, which needs to be done pre-sandbox on all
104 // platforms. 122 // platforms.
105 (void) base::RandUint64(); 123 (void) base::RandUint64();
106 124
107 // Warm up the crypto subsystem, which needs to done pre-sandbox on all 125 // Warm up the crypto subsystem, which needs to done pre-sandbox on all
108 // platforms. 126 // platforms.
109 crypto::HMAC hmac(crypto::HMAC::SHA256); 127 crypto::HMAC hmac(crypto::HMAC::SHA256);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 child_thread->Init(start_time); 175 child_thread->Init(start_time);
158 176
159 gpu_process.set_main_thread(child_thread); 177 gpu_process.set_main_thread(child_thread);
160 178
161 main_message_loop.Run(); 179 main_message_loop.Run();
162 180
163 child_thread->StopWatchdog(); 181 child_thread->StopWatchdog();
164 182
165 return 0; 183 return 0;
166 } 184 }
OLDNEW
« no previous file with comments | « content/gpu/gpu_child_thread.cc ('k') | content/public/common/content_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698