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

Unified Diff: content/gpu/gpu_child_thread.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/gpu/gpu_child_thread.h ('k') | content/gpu/gpu_main.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/gpu/gpu_child_thread.cc
===================================================================
--- content/gpu/gpu_child_thread.cc (revision 137174)
+++ content/gpu/gpu_child_thread.cc (working copy)
@@ -47,10 +47,7 @@
} // namespace
-GpuChildThread::GpuChildThread(bool dead_on_arrival,
- const content::GPUInfo& gpu_info)
- : dead_on_arrival_(dead_on_arrival),
- gpu_info_(gpu_info) {
+GpuChildThread::GpuChildThread() {
#if defined(OS_WIN)
target_services_ = NULL;
collecting_dx_diagnostics_ = false;
@@ -58,18 +55,13 @@
}
GpuChildThread::GpuChildThread(const std::string& channel_id)
- : ChildThread(channel_id),
- dead_on_arrival_(false) {
+ : ChildThread(channel_id) {
#if defined(OS_WIN)
target_services_ = NULL;
collecting_dx_diagnostics_ = false;
#endif
- if (!gpu_info_collector::CollectGraphicsInfo(&gpu_info_)) {
- LOG(INFO) << "gpu_info_collector::CollectGraphicsInfo failed";
- }
}
-
GpuChildThread::~GpuChildThread() {
logging::SetLogMessageHandler(NULL);
}
@@ -106,12 +98,6 @@
}
void GpuChildThread::OnInitialize() {
- if (dead_on_arrival_) {
- LOG(INFO) << "Exiting GPU process due to errors during initialization";
- MessageLoop::current()->Quit();
- return;
- }
-
// We don't need to pipe log messages if we are running the GPU thread in
// the browser process.
if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess) &&
@@ -163,9 +149,9 @@
ChildProcess::current()->io_message_loop_proxy(),
ChildProcess::current()->GetShutDownEvent()));
- // Ensure the browser process receives the GPU info before a reply to any
- // subsequent IPC it might send.
- Send(new GpuHostMsg_GraphicsInfoCollected(gpu_info_));
+#if defined(OS_LINUX)
+ OnCollectGraphicsInfo();
+#endif
}
void GpuChildThread::StopWatchdog() {
@@ -175,26 +161,48 @@
}
void GpuChildThread::OnCollectGraphicsInfo() {
+ DCHECK(CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableGpuSandbox));
+ if (!gpu_info_.finalized) {
+ // Load and initialize the GL implementation and locate the GL entry points.
+ if (gfx::GLSurface::InitializeOneOff()) {
+ // Collect information about the GPU.
+ if (!gpu_info_collector::CollectGraphicsInfo(&gpu_info_)) {
+ LOG(INFO) << "gpu_info_collector::CollectGraphicsInfo failed";
jochen (gone - plz use gerrit) 2012/05/16 07:34:19 please use VLOG(1) instead of LOG(INFO)
+ }
+
+#if defined(OS_LINUX)
+ if (gpu_info.gpu.vendor_id == 0x10de && // NVIDIA
+ gpu_info.driver_vendor == "NVIDIA") {
+ base::ThreadRestrictions::AssertIOAllowed();
+ if (access("/dev/nvidiactl", R_OK) != 0) {
+ LOG(INFO) << "NVIDIA device file /dev/nvidiactl access denied";
+ gpu_info_.gpu_accessible = false;
+ }
+ }
+#endif
+ } else {
+ LOG(INFO) << "gfx::GLSurface::InitializeOneOff failed";
+ gpu_info_.gpu_accessible = false;
+ }
+#if !defined(OS_WIN)
+ gpu_info_.finalized = true;
+#endif
+ }
#if defined(OS_WIN)
if (!gpu_info_.finalized && !collecting_dx_diagnostics_) {
// Prevent concurrent collection of DirectX diagnostics.
collecting_dx_diagnostics_ = true;
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kDisableGpuSandbox)) {
- // Asynchronously collect the DirectX diagnostics because this can take a
- // couple of seconds.
- if (!base::WorkerPool::PostTask(
- FROM_HERE, base::Bind(&GpuChildThread::CollectDxDiagnostics, this),
- true)) {
- // Flag GPU info as complete if the DirectX diagnostics cannot be
- // collected.
- collecting_dx_diagnostics_ = false;
- gpu_info_.finalized = true;
- } else {
- // Do not send response if we are still completing the GPUInfo struct
- return;
- }
+ // Asynchronously collect the DirectX diagnostics because this can take a
+ // couple of seconds.
+ if (!base::WorkerPool::PostTask(
+ FROM_HERE, base::Bind(&GpuChildThread::CollectDxDiagnostics, this),
+ true)) {
+ // Flag GPU info as complete if the DirectX diagnostics cannot be
+ // collected.
+ collecting_dx_diagnostics_ = false;
+ gpu_info_.finalized = true;
}
}
#endif
« no previous file with comments | « content/gpu/gpu_child_thread.h ('k') | content/gpu/gpu_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698