| 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 | 114 |
| 115 } // namespace | 115 } // namespace |
| 116 | 116 |
| 117 void GpuThread::OnInitialize() { | 117 void GpuThread::OnInitialize() { |
| 118 // Redirect LOG messages to the GpuProcessHost | 118 // Redirect LOG messages to the GpuProcessHost |
| 119 bool single_process = CommandLine::ForCurrentProcess()->HasSwitch( | 119 bool single_process = CommandLine::ForCurrentProcess()->HasSwitch( |
| 120 switches::kSingleProcess); | 120 switches::kSingleProcess); |
| 121 if (!single_process) | 121 if (!single_process) |
| 122 logging::SetLogMessageHandler(GpuProcessLogMessageHandler); | 122 logging::SetLogMessageHandler(GpuProcessLogMessageHandler); |
| 123 | 123 |
| 124 // Collect as much GPU info as possible without creating GL/D3D context. | |
| 125 gpu_info_collector::CollectPreliminaryGraphicsInfo(&gpu_info_); | |
| 126 LOG(INFO) << "gpu_info_collector::CollectPreliminaryGraphicsInfo complete"; | |
| 127 | |
| 128 // Go through GPU blacklist with partial GPU info; if GPU is already | |
| 129 // blacklisted, don't create GL/D3D context. | |
| 130 bool blacklisted; | |
| 131 Send(new GpuHostMsg_PreliminaryGraphicsInfoCollected(gpu_info_, | |
| 132 &blacklisted)); | |
| 133 if (blacklisted) { | |
| 134 LOG(INFO) << "GPU is blacklisted based on preliminary GPU info collection"; | |
| 135 MessageLoop::current()->Quit(); | |
| 136 return; | |
| 137 } | |
| 138 | |
| 139 // Load the GL implementation and locate the bindings before starting the GPU | 124 // Load the GL implementation and locate the bindings before starting the GPU |
| 140 // watchdog because this can take a lot of time and the GPU watchdog might | 125 // watchdog because this can take a lot of time and the GPU watchdog might |
| 141 // terminate the GPU process. | 126 // terminate the GPU process. |
| 142 if (!gfx::GLContext::InitializeOneOff()) { | 127 if (!gfx::GLContext::InitializeOneOff()) { |
| 143 LOG(INFO) << "GLContext::InitializeOneOff failed"; | 128 LOG(INFO) << "GLContext::InitializeOneOff failed"; |
| 144 MessageLoop::current()->Quit(); | 129 MessageLoop::current()->Quit(); |
| 145 return; | 130 return; |
| 146 } | 131 } |
| 147 bool gpu_info_result = gpu_info_collector::CollectGraphicsInfo(&gpu_info_); | 132 bool gpu_info_result = gpu_info_collector::CollectGraphicsInfo(&gpu_info_); |
| 148 if (!gpu_info_result) { | 133 if (!gpu_info_result) { |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 } | 337 } |
| 353 | 338 |
| 354 // Runs on the GPU thread. | 339 // Runs on the GPU thread. |
| 355 void GpuThread::SetDxDiagnostics(GpuThread* thread, const DxDiagNode& node) { | 340 void GpuThread::SetDxDiagnostics(GpuThread* thread, const DxDiagNode& node) { |
| 356 thread->gpu_info_.SetDxDiagnostics(node); | 341 thread->gpu_info_.SetDxDiagnostics(node); |
| 357 thread->gpu_info_.SetLevel(GPUInfo::kComplete); | 342 thread->gpu_info_.SetLevel(GPUInfo::kComplete); |
| 358 thread->Send(new GpuHostMsg_GraphicsInfoCollected(thread->gpu_info_)); | 343 thread->Send(new GpuHostMsg_GraphicsInfoCollected(thread->gpu_info_)); |
| 359 } | 344 } |
| 360 | 345 |
| 361 #endif | 346 #endif |
| OLD | NEW |