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

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

Issue 534043002: Add bits to indicate which parts of GPUInfo are collected. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months 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
« no previous file with comments | « content/browser/gpu/gpu_data_manager_impl_private.h ('k') | content/common/gpu/gpu_messages.h » ('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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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_private.h" 5 #include "content/browser/gpu/gpu_data_manager_impl_private.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 CGGetActiveDisplayList(0, NULL, &displayCount); 219 CGGetActiveDisplayList(0, NULL, &displayCount);
220 if (displayCount != manager->GetDisplayCount()) { 220 if (displayCount != manager->GetDisplayCount()) {
221 manager->SetDisplayCount(displayCount); 221 manager->SetDisplayCount(displayCount);
222 display_changed = true; 222 display_changed = true;
223 } 223 }
224 224
225 // Gpu change. 225 // Gpu change.
226 bool gpu_changed = false; 226 bool gpu_changed = false;
227 if (flags & kCGDisplayAddFlag) { 227 if (flags & kCGDisplayAddFlag) {
228 uint32 vendor_id, device_id; 228 uint32 vendor_id, device_id;
229 if (gpu::CollectGpuID(&vendor_id, &device_id) == gpu::kGpuIDSuccess) { 229 if (gpu::CollectGpuID(&vendor_id, &device_id) == gpu::kCollectInfoSuccess) {
230 gpu_changed = manager->UpdateActiveGpu(vendor_id, device_id); 230 gpu_changed = manager->UpdateActiveGpu(vendor_id, device_id);
231 } 231 }
232 } 232 }
233 233
234 if (display_changed || gpu_changed) 234 if (display_changed || gpu_changed)
235 manager->HandleGpuSwitch(); 235 manager->HandleGpuSwitch();
236 } 236 }
237 #endif // OS_MACOSX 237 #endif // OS_MACOSX
238 238
239 // Block all domains' use of 3D APIs for this many milliseconds if 239 // Block all domains' use of 3D APIs for this many milliseconds if
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 *reason = "All GPU features are blacklisted."; 356 *reason = "All GPU features are blacklisted.";
357 } 357 }
358 return false; 358 return false;
359 #endif 359 #endif
360 } 360 }
361 361
362 return true; 362 return true;
363 } 363 }
364 364
365 void GpuDataManagerImplPrivate::RequestCompleteGpuInfoIfNeeded() { 365 void GpuDataManagerImplPrivate::RequestCompleteGpuInfoIfNeeded() {
366 if (complete_gpu_info_already_requested_ || gpu_info_.finalized) 366 if (complete_gpu_info_already_requested_ || IsCompleteGpuInfoAvailable())
367 return; 367 return;
368 complete_gpu_info_already_requested_ = true; 368 complete_gpu_info_already_requested_ = true;
369 369
370 GpuProcessHost::SendOnIO( 370 GpuProcessHost::SendOnIO(
371 #if defined(OS_WIN) 371 #if defined(OS_WIN)
372 GpuProcessHost::GPU_PROCESS_KIND_UNSANDBOXED, 372 GpuProcessHost::GPU_PROCESS_KIND_UNSANDBOXED,
373 #else 373 #else
374 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, 374 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED,
375 #endif 375 #endif
376 CAUSE_FOR_GPU_LAUNCH_GPUDATAMANAGER_REQUESTCOMPLETEGPUINFOIFNEEDED, 376 CAUSE_FOR_GPU_LAUNCH_GPUDATAMANAGER_REQUESTCOMPLETEGPUINFOIFNEEDED,
377 new GpuMsg_CollectGraphicsInfo()); 377 new GpuMsg_CollectGraphicsInfo());
378 } 378 }
379 379
380 bool GpuDataManagerImplPrivate::IsEssentialGpuInfoAvailable() const {
381 if (gpu_info_.basic_info_state == gpu::kCollectInfoNone ||
382 gpu_info_.context_info_state == gpu::kCollectInfoNone) {
383 return false;
384 }
385 return true;
386 }
387
380 bool GpuDataManagerImplPrivate::IsCompleteGpuInfoAvailable() const { 388 bool GpuDataManagerImplPrivate::IsCompleteGpuInfoAvailable() const {
381 return gpu_info_.finalized; 389 #if defined(OS_WIN)
390 if (gpu_info_.dx_diagnostics_info_state == gpu::kCollectInfoNone)
391 return false;
392 #endif
393 return IsEssentialGpuInfoAvailable();
382 } 394 }
383 395
384 void GpuDataManagerImplPrivate::RequestVideoMemoryUsageStatsUpdate() const { 396 void GpuDataManagerImplPrivate::RequestVideoMemoryUsageStatsUpdate() const {
385 GpuProcessHost::SendOnIO( 397 GpuProcessHost::SendOnIO(
386 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, 398 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED,
387 CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH, 399 CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH,
388 new GpuMsg_GetVideoMemoryUsageStats()); 400 new GpuMsg_GetVideoMemoryUsageStats());
389 } 401 }
390 402
391 bool GpuDataManagerImplPrivate::ShouldUseSwiftShader() const { 403 bool GpuDataManagerImplPrivate::ShouldUseSwiftShader() const {
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 508
497 // Also declare the driver_vendor to be osmesa to be able to specify 509 // Also declare the driver_vendor to be osmesa to be able to specify
498 // exceptions based on driver_vendor==osmesa for some blacklist rules. 510 // exceptions based on driver_vendor==osmesa for some blacklist rules.
499 gpu_info.driver_vendor = gfx::kGLImplementationOSMesaName; 511 gpu_info.driver_vendor = gfx::kGLImplementationOSMesaName;
500 } else { 512 } else {
501 TRACE_EVENT0("startup", 513 TRACE_EVENT0("startup",
502 "GpuDataManagerImpl::Initialize:CollectBasicGraphicsInfo"); 514 "GpuDataManagerImpl::Initialize:CollectBasicGraphicsInfo");
503 gpu::CollectBasicGraphicsInfo(&gpu_info); 515 gpu::CollectBasicGraphicsInfo(&gpu_info);
504 } 516 }
505 #if defined(ARCH_CPU_X86_FAMILY) 517 #if defined(ARCH_CPU_X86_FAMILY)
506 if (!gpu_info.gpu.vendor_id || !gpu_info.gpu.device_id) 518 if (!gpu_info.gpu.vendor_id || !gpu_info.gpu.device_id) {
507 gpu_info.finalized = true; 519 gpu_info.context_info_state = gpu::kCollectInfoNonFatalFailure;
508 #endif 520 #if defined(OS_WIN)
521 gpu_info.dx_diagnostics_info_state = gpu::kCollectInfoNonFatalFailure;
522 #endif // OS_WIN
523 }
524 #endif // ARCH_CPU_X86_FAMILY
509 525
510 std::string gpu_blacklist_string; 526 std::string gpu_blacklist_string;
511 std::string gpu_driver_bug_list_string; 527 std::string gpu_driver_bug_list_string;
512 if (!command_line->HasSwitch(switches::kIgnoreGpuBlacklist) && 528 if (!command_line->HasSwitch(switches::kIgnoreGpuBlacklist) &&
513 !command_line->HasSwitch(switches::kUseGpuInTests)) { 529 !command_line->HasSwitch(switches::kUseGpuInTests)) {
514 gpu_blacklist_string = gpu::kSoftwareRenderingListJson; 530 gpu_blacklist_string = gpu::kSoftwareRenderingListJson;
515 } 531 }
516 if (!command_line->HasSwitch(switches::kDisableGpuDriverBugWorkarounds)) { 532 if (!command_line->HasSwitch(switches::kDisableGpuDriverBugWorkarounds)) {
517 gpu_driver_bug_list_string = gpu::kGpuDriverBugListJson; 533 gpu_driver_bug_list_string = gpu::kGpuDriverBugListJson;
518 } 534 }
(...skipping 23 matching lines...) Expand all
542 // We have to update GpuFeatureType before notify all the observers. 558 // We have to update GpuFeatureType before notify all the observers.
543 NotifyGpuInfoUpdate(); 559 NotifyGpuInfoUpdate();
544 } 560 }
545 561
546 void GpuDataManagerImplPrivate::UpdateGpuInfo(const gpu::GPUInfo& gpu_info) { 562 void GpuDataManagerImplPrivate::UpdateGpuInfo(const gpu::GPUInfo& gpu_info) {
547 // No further update of gpu_info if falling back to SwiftShader. 563 // No further update of gpu_info if falling back to SwiftShader.
548 if (use_swiftshader_) 564 if (use_swiftshader_)
549 return; 565 return;
550 566
551 gpu::MergeGPUInfo(&gpu_info_, gpu_info); 567 gpu::MergeGPUInfo(&gpu_info_, gpu_info);
552 complete_gpu_info_already_requested_ = 568 if (IsCompleteGpuInfoAvailable())
553 complete_gpu_info_already_requested_ || gpu_info_.finalized; 569 complete_gpu_info_already_requested_ = true;
554 570
555 UpdateGpuInfoHelper(); 571 UpdateGpuInfoHelper();
556 } 572 }
557 573
558 void GpuDataManagerImplPrivate::UpdateVideoMemoryUsageStats( 574 void GpuDataManagerImplPrivate::UpdateVideoMemoryUsageStats(
559 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { 575 const GPUVideoMemoryUsageStats& video_memory_usage_stats) {
560 GpuDataManagerImpl::UnlockedSession session(owner_); 576 GpuDataManagerImpl::UnlockedSession session(owner_);
561 observer_list_->Notify(&GpuDataManagerObserver::OnVideoMemoryUsageStatsUpdate, 577 observer_list_->Notify(&GpuDataManagerObserver::OnVideoMemoryUsageStatsUpdate,
562 video_memory_usage_stats); 578 video_memory_usage_stats);
563 } 579 }
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
1066 int render_process_id, 1082 int render_process_id,
1067 int render_view_id, 1083 int render_view_id,
1068 ThreeDAPIType requester) { 1084 ThreeDAPIType requester) {
1069 GpuDataManagerImpl::UnlockedSession session(owner_); 1085 GpuDataManagerImpl::UnlockedSession session(owner_);
1070 observer_list_->Notify(&GpuDataManagerObserver::DidBlock3DAPIs, 1086 observer_list_->Notify(&GpuDataManagerObserver::DidBlock3DAPIs,
1071 url, render_process_id, render_view_id, requester); 1087 url, render_process_id, render_view_id, requester);
1072 } 1088 }
1073 1089
1074 void GpuDataManagerImplPrivate::OnGpuProcessInitFailure() { 1090 void GpuDataManagerImplPrivate::OnGpuProcessInitFailure() {
1075 gpu_process_accessible_ = false; 1091 gpu_process_accessible_ = false;
1076 gpu_info_.finalized = true; 1092 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure;
1093 #if defined(OS_WIN)
1094 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure;
1095 #endif
1077 complete_gpu_info_already_requested_ = true; 1096 complete_gpu_info_already_requested_ = true;
1078 // Some observers might be waiting. 1097 // Some observers might be waiting.
1079 NotifyGpuInfoUpdate(); 1098 NotifyGpuInfoUpdate();
1080 } 1099 }
1081 1100
1082 } // namespace content 1101 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_data_manager_impl_private.h ('k') | content/common/gpu/gpu_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698