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

Side by Side Diff: content/browser/gpu/gpu_data_manager_impl.cc

Issue 11574049: Only collect GL/D3D context specific GPUInfo in GPU process (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | content/content_tests.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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::CollectPreliminaryGraphicsInfo(&gpu_info); 135 gpu_info_collector::CollectBasicGraphicsInfo(&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
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)
193 GpuProcessHost::GPU_PROCESS_KIND_UNSANDBOXED, 194 GpuProcessHost::GPU_PROCESS_KIND_UNSANDBOXED,
195 #else
196 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED,
197 #endif
194 CAUSE_FOR_GPU_LAUNCH_GPUDATAMANAGER_REQUESTCOMPLETEGPUINFOIFNEEDED, 198 CAUSE_FOR_GPU_LAUNCH_GPUDATAMANAGER_REQUESTCOMPLETEGPUINFOIFNEEDED,
195 new GpuMsg_CollectGraphicsInfo()); 199 new GpuMsg_CollectGraphicsInfo());
196 } 200 }
197 201
198 bool GpuDataManagerImpl::IsCompleteGpuInfoAvailable() const { 202 bool GpuDataManagerImpl::IsCompleteGpuInfoAvailable() const {
199 return gpu_info_.finalized; 203 return gpu_info_.finalized;
200 } 204 }
201 205
202 void GpuDataManagerImpl::UpdateGpuInfo(const GPUInfo& gpu_info) { 206 void GpuDataManagerImpl::UpdateGpuInfo(const GPUInfo& gpu_info) {
203 // No further update of gpu_info if falling back to software renderer. 207 // No further update of gpu_info if falling back to software renderer.
(...skipping 13 matching lines...) Expand all
217 if (decision.gpu_switching != GPU_SWITCHING_OPTION_UNKNOWN) { 221 if (decision.gpu_switching != GPU_SWITCHING_OPTION_UNKNOWN) {
218 // Blacklist decision should not overwrite commandline switch from users. 222 // Blacklist decision should not overwrite commandline switch from users.
219 CommandLine* command_line = CommandLine::ForCurrentProcess(); 223 CommandLine* command_line = CommandLine::ForCurrentProcess();
220 if (!command_line->HasSwitch(switches::kGpuSwitching)) 224 if (!command_line->HasSwitch(switches::kGpuSwitching))
221 gpu_switching_ = decision.gpu_switching; 225 gpu_switching_ = decision.gpu_switching;
222 } 226 }
223 } 227 }
224 228
225 { 229 {
226 base::AutoLock auto_lock(gpu_info_lock_); 230 base::AutoLock auto_lock(gpu_info_lock_);
227 gpu_info_ = gpu_info; 231 gpu_info_collector::MergeGPUInfo(&gpu_info_, gpu_info);
228 complete_gpu_info_already_requested_ = 232 complete_gpu_info_already_requested_ =
229 complete_gpu_info_already_requested_ || gpu_info_.finalized; 233 complete_gpu_info_already_requested_ || gpu_info_.finalized;
230 } 234 }
231 235
232 // We have to update GpuFeatureType before notify all the observers. 236 // We have to update GpuFeatureType before notify all the observers.
233 NotifyGpuInfoUpdate(); 237 NotifyGpuInfoUpdate();
234 } 238 }
235 239
236 GPUInfo GpuDataManagerImpl::GetGPUInfo() const { 240 GPUInfo GpuDataManagerImpl::GetGPUInfo() const {
237 GPUInfo gpu_info; 241 GPUInfo gpu_info;
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 switches::kGpuSwitchingOptionNameForceIntegrated); 467 switches::kGpuSwitchingOptionNameForceIntegrated);
464 break; 468 break;
465 case GPU_SWITCHING_OPTION_AUTOMATIC: 469 case GPU_SWITCHING_OPTION_AUTOMATIC:
466 case GPU_SWITCHING_OPTION_UNKNOWN: 470 case GPU_SWITCHING_OPTION_UNKNOWN:
467 break; 471 break;
468 } 472 }
469 } else { 473 } else {
470 command_line->AppendSwitchASCII(switches::kSupportsDualGpus, "false"); 474 command_line->AppendSwitchASCII(switches::kSupportsDualGpus, "false");
471 } 475 }
472 476
473 if (!gpu_blacklist_.get() || !gpu_blacklist_->needs_more_info())
474 command_line->AppendSwitch(switches::kSkipGpuFullInfoCollection);
475
476 if (!swiftshader_path.empty()) 477 if (!swiftshader_path.empty())
477 command_line->AppendSwitchPath(switches::kSwiftShaderPath, 478 command_line->AppendSwitchPath(switches::kSwiftShaderPath,
478 swiftshader_path); 479 swiftshader_path);
479 480
480 { 481 {
481 base::AutoLock auto_lock(gpu_info_lock_); 482 base::AutoLock auto_lock(gpu_info_lock_);
482 if (gpu_info_.optimus) 483 if (gpu_info_.optimus)
483 command_line->AppendSwitch(switches::kReduceGpuSandbox); 484 command_line->AppendSwitch(switches::kReduceGpuSandbox);
484 if (gpu_info_.amd_switchable) { 485 if (gpu_info_.amd_switchable) {
485 // The image transport surface currently doesn't work with AMD Dynamic 486 // The image transport surface currently doesn't work with AMD Dynamic
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 BLOCK_STATUS_MAX); 723 BLOCK_STATUS_MAX);
723 724
724 return DOMAIN_BLOCK_STATUS_NOT_BLOCKED; 725 return DOMAIN_BLOCK_STATUS_NOT_BLOCKED;
725 } 726 }
726 727
727 int64 GpuDataManagerImpl::GetBlockAllDomainsDurationInMs() const { 728 int64 GpuDataManagerImpl::GetBlockAllDomainsDurationInMs() const {
728 return kBlockAllDomainsMs; 729 return kBlockAllDomainsMs;
729 } 730 }
730 731
731 } // namespace content 732 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/content_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698