| 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 | |
| 127 // Load the GL implementation and locate the bindings before starting the GPU | 112 // Load the GL implementation and locate the bindings before starting the GPU |
| 128 // watchdog because this can take a lot of time and the GPU watchdog might | 113 // watchdog because this can take a lot of time and the GPU watchdog might |
| 129 // terminate the GPU process. | 114 // terminate the GPU process. |
| 130 if (!gfx::GLContext::InitializeOneOff()) { | 115 if (!gfx::GLContext::InitializeOneOff()) { |
| 131 LOG(INFO) << "GLContext::InitializeOneOff failed"; | 116 LOG(INFO) << "GLContext::InitializeOneOff failed"; |
| 132 MessageLoop::current()->Quit(); | 117 MessageLoop::current()->Quit(); |
| 133 return; | 118 return; |
| 134 } | 119 } |
| 135 bool gpu_info_result = gpu_info_collector::CollectGraphicsInfo(&gpu_info_); | 120 bool gpu_info_result = gpu_info_collector::CollectGraphicsInfo(&gpu_info_); |
| 136 if (!gpu_info_result) { | 121 if (!gpu_info_result) { |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 } | 317 } |
| 333 | 318 |
| 334 // Runs on the GPU thread. | 319 // Runs on the GPU thread. |
| 335 void GpuThread::SetDxDiagnostics(GpuThread* thread, const DxDiagNode& node) { | 320 void GpuThread::SetDxDiagnostics(GpuThread* thread, const DxDiagNode& node) { |
| 336 thread->gpu_info_.SetDxDiagnostics(node); | 321 thread->gpu_info_.SetDxDiagnostics(node); |
| 337 thread->gpu_info_.SetLevel(GPUInfo::kComplete); | 322 thread->gpu_info_.SetLevel(GPUInfo::kComplete); |
| 338 thread->Send(new GpuHostMsg_GraphicsInfoCollected(thread->gpu_info_)); | 323 thread->Send(new GpuHostMsg_GraphicsInfoCollected(thread->gpu_info_)); |
| 339 } | 324 } |
| 340 | 325 |
| 341 #endif | 326 #endif |
| OLD | NEW |