OLD | NEW |
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 "content/browser/gpu/gpu_data_manager_impl.h" | 5 #include "content/browser/gpu/gpu_data_manager_impl.h" |
6 | 6 |
7 #if defined(OS_MACOSX) | 7 #if defined(OS_MACOSX) |
8 #include <ApplicationServices/ApplicationServices.h> | 8 #include <ApplicationServices/ApplicationServices.h> |
9 #endif // OS_MACOSX | 9 #endif // OS_MACOSX |
10 | 10 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 CGDisplayRegisterReconfigurationCallback(DisplayReconfigCallback, this); | 125 CGDisplayRegisterReconfigurationCallback(DisplayReconfigCallback, this); |
126 #endif // OS_MACOSX | 126 #endif // OS_MACOSX |
127 } | 127 } |
128 | 128 |
129 void GpuDataManagerImpl::Initialize() { | 129 void GpuDataManagerImpl::Initialize() { |
130 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 130 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
131 if (command_line->HasSwitch(switches::kSkipGpuDataLoading)) | 131 if (command_line->HasSwitch(switches::kSkipGpuDataLoading)) |
132 return; | 132 return; |
133 | 133 |
134 GPUInfo gpu_info; | 134 GPUInfo gpu_info; |
135 gpu_info_collector::CollectBasicGraphicsInfo(&gpu_info); | 135 gpu_info_collector::CollectPreliminaryGraphicsInfo(&gpu_info); |
136 #if defined(ARCH_CPU_X86_FAMILY) | 136 #if defined(ARCH_CPU_X86_FAMILY) |
137 if (!gpu_info.gpu.vendor_id || !gpu_info.gpu.device_id) | 137 if (!gpu_info.gpu.vendor_id || !gpu_info.gpu.device_id) |
138 gpu_info.finalized = true; | 138 gpu_info.finalized = true; |
139 #endif | 139 #endif |
140 | 140 |
141 std::string gpu_blacklist_string; | 141 std::string gpu_blacklist_string; |
142 if (!command_line->HasSwitch(switches::kIgnoreGpuBlacklist)) { | 142 if (!command_line->HasSwitch(switches::kIgnoreGpuBlacklist)) { |
143 const base::StringPiece gpu_blacklist_json = | 143 const base::StringPiece gpu_blacklist_json = |
144 GetContentClient()->GetDataResource( | 144 GetContentClient()->GetDataResource( |
145 IDR_GPU_BLACKLIST, ui::SCALE_FACTOR_NONE); | 145 IDR_GPU_BLACKLIST, ui::SCALE_FACTOR_NONE); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 CGDisplayRemoveReconfigurationCallback(DisplayReconfigCallback, this); | 183 CGDisplayRemoveReconfigurationCallback(DisplayReconfigCallback, this); |
184 #endif | 184 #endif |
185 } | 185 } |
186 | 186 |
187 void GpuDataManagerImpl::RequestCompleteGpuInfoIfNeeded() { | 187 void GpuDataManagerImpl::RequestCompleteGpuInfoIfNeeded() { |
188 if (complete_gpu_info_already_requested_ || gpu_info_.finalized) | 188 if (complete_gpu_info_already_requested_ || gpu_info_.finalized) |
189 return; | 189 return; |
190 complete_gpu_info_already_requested_ = true; | 190 complete_gpu_info_already_requested_ = true; |
191 | 191 |
192 GpuProcessHost::SendOnIO( | 192 GpuProcessHost::SendOnIO( |
193 #if defined(OS_WIN) | |
194 GpuProcessHost::GPU_PROCESS_KIND_UNSANDBOXED, | 193 GpuProcessHost::GPU_PROCESS_KIND_UNSANDBOXED, |
195 #else | |
196 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, | |
197 #endif | |
198 CAUSE_FOR_GPU_LAUNCH_GPUDATAMANAGER_REQUESTCOMPLETEGPUINFOIFNEEDED, | 194 CAUSE_FOR_GPU_LAUNCH_GPUDATAMANAGER_REQUESTCOMPLETEGPUINFOIFNEEDED, |
199 new GpuMsg_CollectGraphicsInfo()); | 195 new GpuMsg_CollectGraphicsInfo()); |
200 } | 196 } |
201 | 197 |
202 bool GpuDataManagerImpl::IsCompleteGpuInfoAvailable() const { | 198 bool GpuDataManagerImpl::IsCompleteGpuInfoAvailable() const { |
203 return gpu_info_.finalized; | 199 return gpu_info_.finalized; |
204 } | 200 } |
205 | 201 |
206 void GpuDataManagerImpl::UpdateGpuInfo(const GPUInfo& gpu_info) { | 202 void GpuDataManagerImpl::UpdateGpuInfo(const GPUInfo& gpu_info) { |
207 // No further update of gpu_info if falling back to software renderer. | 203 // No further update of gpu_info if falling back to software renderer. |
(...skipping 13 matching lines...) Expand all Loading... |
221 if (decision.gpu_switching != GPU_SWITCHING_OPTION_UNKNOWN) { | 217 if (decision.gpu_switching != GPU_SWITCHING_OPTION_UNKNOWN) { |
222 // Blacklist decision should not overwrite commandline switch from users. | 218 // Blacklist decision should not overwrite commandline switch from users. |
223 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 219 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
224 if (!command_line->HasSwitch(switches::kGpuSwitching)) | 220 if (!command_line->HasSwitch(switches::kGpuSwitching)) |
225 gpu_switching_ = decision.gpu_switching; | 221 gpu_switching_ = decision.gpu_switching; |
226 } | 222 } |
227 } | 223 } |
228 | 224 |
229 { | 225 { |
230 base::AutoLock auto_lock(gpu_info_lock_); | 226 base::AutoLock auto_lock(gpu_info_lock_); |
231 gpu_info_collector::MergeGPUInfo(&gpu_info_, gpu_info); | 227 gpu_info_ = gpu_info; |
232 complete_gpu_info_already_requested_ = | 228 complete_gpu_info_already_requested_ = |
233 complete_gpu_info_already_requested_ || gpu_info_.finalized; | 229 complete_gpu_info_already_requested_ || gpu_info_.finalized; |
234 } | 230 } |
235 | 231 |
236 // We have to update GpuFeatureType before notify all the observers. | 232 // We have to update GpuFeatureType before notify all the observers. |
237 NotifyGpuInfoUpdate(); | 233 NotifyGpuInfoUpdate(); |
238 } | 234 } |
239 | 235 |
240 GPUInfo GpuDataManagerImpl::GetGPUInfo() const { | 236 GPUInfo GpuDataManagerImpl::GetGPUInfo() const { |
241 GPUInfo gpu_info; | 237 GPUInfo gpu_info; |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 switches::kGpuSwitchingOptionNameForceIntegrated); | 463 switches::kGpuSwitchingOptionNameForceIntegrated); |
468 break; | 464 break; |
469 case GPU_SWITCHING_OPTION_AUTOMATIC: | 465 case GPU_SWITCHING_OPTION_AUTOMATIC: |
470 case GPU_SWITCHING_OPTION_UNKNOWN: | 466 case GPU_SWITCHING_OPTION_UNKNOWN: |
471 break; | 467 break; |
472 } | 468 } |
473 } else { | 469 } else { |
474 command_line->AppendSwitchASCII(switches::kSupportsDualGpus, "false"); | 470 command_line->AppendSwitchASCII(switches::kSupportsDualGpus, "false"); |
475 } | 471 } |
476 | 472 |
| 473 if (!gpu_blacklist_.get() || !gpu_blacklist_->needs_more_info()) |
| 474 command_line->AppendSwitch(switches::kSkipGpuFullInfoCollection); |
| 475 |
477 if (!swiftshader_path.empty()) | 476 if (!swiftshader_path.empty()) |
478 command_line->AppendSwitchPath(switches::kSwiftShaderPath, | 477 command_line->AppendSwitchPath(switches::kSwiftShaderPath, |
479 swiftshader_path); | 478 swiftshader_path); |
480 | 479 |
481 { | 480 { |
482 base::AutoLock auto_lock(gpu_info_lock_); | 481 base::AutoLock auto_lock(gpu_info_lock_); |
483 if (gpu_info_.optimus) | 482 if (gpu_info_.optimus) |
484 command_line->AppendSwitch(switches::kReduceGpuSandbox); | 483 command_line->AppendSwitch(switches::kReduceGpuSandbox); |
485 if (gpu_info_.amd_switchable) { | 484 if (gpu_info_.amd_switchable) { |
486 // The image transport surface currently doesn't work with AMD Dynamic | 485 // The image transport surface currently doesn't work with AMD Dynamic |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 BLOCK_STATUS_MAX); | 722 BLOCK_STATUS_MAX); |
724 | 723 |
725 return DOMAIN_BLOCK_STATUS_NOT_BLOCKED; | 724 return DOMAIN_BLOCK_STATUS_NOT_BLOCKED; |
726 } | 725 } |
727 | 726 |
728 int64 GpuDataManagerImpl::GetBlockAllDomainsDurationInMs() const { | 727 int64 GpuDataManagerImpl::GetBlockAllDomainsDurationInMs() const { |
729 return kBlockAllDomainsMs; | 728 return kBlockAllDomainsMs; |
730 } | 729 } |
731 | 730 |
732 } // namespace content | 731 } // namespace content |
OLD | NEW |