OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/gpu/gpu_thread.h" | 5 #include "chrome/gpu/gpu_thread.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "app/gfx/gl/gl_context.h" | 10 #include "app/gfx/gl/gl_context.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 | 102 |
103 } // namespace | 103 } // namespace |
104 | 104 |
105 void GpuThread::OnInitialize() { | 105 void GpuThread::OnInitialize() { |
106 // Redirect LOG messages to the GpuProcessHost | 106 // Redirect LOG messages to the GpuProcessHost |
107 bool single_process = CommandLine::ForCurrentProcess()->HasSwitch( | 107 bool single_process = CommandLine::ForCurrentProcess()->HasSwitch( |
108 switches::kSingleProcess); | 108 switches::kSingleProcess); |
109 if (!single_process) | 109 if (!single_process) |
110 logging::SetLogMessageHandler(GpuProcessLogMessageHandler); | 110 logging::SetLogMessageHandler(GpuProcessLogMessageHandler); |
111 | 111 |
| 112 // Collect as much GPU info as possible without creating GL/D3D context. |
| 113 gpu_info_collector::CollectPreliminaryGraphicsInfo(&gpu_info_); |
| 114 LOG(INFO) << "gpu_info_collector::CollectPreliminaryGraphicsInfo complete"; |
| 115 |
| 116 // Go through GPU blacklist with partial GPU info; if GPU is already |
| 117 // blacklisted, don't create GL/D3D context. |
| 118 bool blacklisted; |
| 119 Send(new GpuHostMsg_PreliminaryGraphicsInfoCollected(gpu_info_, |
| 120 &blacklisted)); |
| 121 if (blacklisted) { |
| 122 LOG(INFO) << "GPU is blacklisted based on preliminary GPU info collection"; |
| 123 MessageLoop::current()->Quit(); |
| 124 return; |
| 125 } |
| 126 |
112 // Load the GL implementation and locate the bindings before starting the GPU | 127 // Load the GL implementation and locate the bindings before starting the GPU |
113 // watchdog because this can take a lot of time and the GPU watchdog might | 128 // watchdog because this can take a lot of time and the GPU watchdog might |
114 // terminate the GPU process. | 129 // terminate the GPU process. |
115 if (!gfx::GLContext::InitializeOneOff()) { | 130 if (!gfx::GLContext::InitializeOneOff()) { |
116 LOG(INFO) << "GLContext::InitializeOneOff failed"; | 131 LOG(INFO) << "GLContext::InitializeOneOff failed"; |
117 MessageLoop::current()->Quit(); | 132 MessageLoop::current()->Quit(); |
118 return; | 133 return; |
119 } | 134 } |
120 gpu_info_collector::CollectGraphicsInfo(&gpu_info_); | 135 gpu_info_collector::CollectGraphicsInfo(&gpu_info_); |
121 child_process_logging::SetGpuInfo(gpu_info_); | 136 child_process_logging::SetGpuInfo(gpu_info_); |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 NewRunnableFunction(&GpuThread::SetDxDiagnostics, thread, node)); | 324 NewRunnableFunction(&GpuThread::SetDxDiagnostics, thread, node)); |
310 } | 325 } |
311 | 326 |
312 // Runs on the GPU thread. | 327 // Runs on the GPU thread. |
313 void GpuThread::SetDxDiagnostics(GpuThread* thread, const DxDiagNode& node) { | 328 void GpuThread::SetDxDiagnostics(GpuThread* thread, const DxDiagNode& node) { |
314 thread->gpu_info_.SetDxDiagnostics(node); | 329 thread->gpu_info_.SetDxDiagnostics(node); |
315 thread->gpu_info_.SetLevel(GPUInfo::kComplete); | 330 thread->gpu_info_.SetLevel(GPUInfo::kComplete); |
316 } | 331 } |
317 | 332 |
318 #endif | 333 #endif |
OLD | NEW |