OLD | NEW |
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/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 !gpu_info_.gl_version.empty()) | 470 !gpu_info_.gl_version.empty()) |
471 return; | 471 return; |
472 | 472 |
473 gpu::GPUInfo gpu_info = gpu_info_; | 473 gpu::GPUInfo gpu_info = gpu_info_; |
474 | 474 |
475 gpu_info.gl_vendor = gl_vendor; | 475 gpu_info.gl_vendor = gl_vendor; |
476 gpu_info.gl_renderer = gl_renderer; | 476 gpu_info.gl_renderer = gl_renderer; |
477 gpu_info.gl_version = gl_version; | 477 gpu_info.gl_version = gl_version; |
478 | 478 |
479 gpu::IdentifyActiveGPU(&gpu_info); | 479 gpu::IdentifyActiveGPU(&gpu_info); |
| 480 |
480 gpu::CollectDriverInfoGL(&gpu_info); | 481 gpu::CollectDriverInfoGL(&gpu_info); |
481 | 482 |
482 UpdateGpuInfo(gpu_info); | 483 UpdateGpuInfo(gpu_info); |
483 UpdateGpuSwitchingManager(gpu_info); | 484 UpdateGpuSwitchingManager(gpu_info); |
484 UpdatePreliminaryBlacklistedFeatures(); | 485 UpdatePreliminaryBlacklistedFeatures(); |
485 } | 486 } |
486 | 487 |
487 void GpuDataManagerImplPrivate::GetGLStrings(std::string* gl_vendor, | 488 void GpuDataManagerImplPrivate::GetGLStrings(std::string* gl_vendor, |
488 std::string* gl_renderer, | 489 std::string* gl_renderer, |
489 std::string* gl_version) { | 490 std::string* gl_version) { |
(...skipping 26 matching lines...) Expand all Loading... |
516 gpu_info.gpu.vendor_id = 0xffff; | 517 gpu_info.gpu.vendor_id = 0xffff; |
517 gpu_info.gpu.device_id = 0xffff; | 518 gpu_info.gpu.device_id = 0xffff; |
518 | 519 |
519 // Also declare the driver_vendor to be osmesa to be able to specify | 520 // Also declare the driver_vendor to be osmesa to be able to specify |
520 // exceptions based on driver_vendor==osmesa for some blacklist rules. | 521 // exceptions based on driver_vendor==osmesa for some blacklist rules. |
521 gpu_info.driver_vendor = gfx::kGLImplementationOSMesaName; | 522 gpu_info.driver_vendor = gfx::kGLImplementationOSMesaName; |
522 } else { | 523 } else { |
523 TRACE_EVENT0("startup", | 524 TRACE_EVENT0("startup", |
524 "GpuDataManagerImpl::Initialize:CollectBasicGraphicsInfo"); | 525 "GpuDataManagerImpl::Initialize:CollectBasicGraphicsInfo"); |
525 gpu::CollectBasicGraphicsInfo(&gpu_info); | 526 gpu::CollectBasicGraphicsInfo(&gpu_info); |
| 527 |
| 528 if (command_line->HasSwitch(switches::kGpuTestingVendorId) && |
| 529 command_line->HasSwitch(switches::kGpuTestingDeviceId)) { |
| 530 base::HexStringToUInt( |
| 531 command_line->GetSwitchValueASCII(switches::kGpuTestingVendorId), |
| 532 &gpu_info.gpu.vendor_id); |
| 533 base::HexStringToUInt( |
| 534 command_line->GetSwitchValueASCII(switches::kGpuTestingDeviceId), |
| 535 &gpu_info.gpu.device_id); |
| 536 gpu_info.gpu.active = true; |
| 537 gpu_info.secondary_gpus.clear(); |
| 538 } |
526 } | 539 } |
527 #if defined(ARCH_CPU_X86_FAMILY) | 540 #if defined(ARCH_CPU_X86_FAMILY) |
528 if (!gpu_info.gpu.vendor_id || !gpu_info.gpu.device_id) { | 541 if (!gpu_info.gpu.vendor_id || !gpu_info.gpu.device_id) { |
529 gpu_info.context_info_state = gpu::kCollectInfoNonFatalFailure; | 542 gpu_info.context_info_state = gpu::kCollectInfoNonFatalFailure; |
530 #if defined(OS_WIN) | 543 #if defined(OS_WIN) |
531 gpu_info.dx_diagnostics_info_state = gpu::kCollectInfoNonFatalFailure; | 544 gpu_info.dx_diagnostics_info_state = gpu::kCollectInfoNonFatalFailure; |
532 #endif // OS_WIN | 545 #endif // OS_WIN |
533 } | 546 } |
534 #endif // ARCH_CPU_X86_FAMILY | 547 #endif // ARCH_CPU_X86_FAMILY |
535 | 548 |
(...skipping 13 matching lines...) Expand all Loading... |
549 if (command_line->HasSwitch(switches::kSingleProcess) || | 562 if (command_line->HasSwitch(switches::kSingleProcess) || |
550 command_line->HasSwitch(switches::kInProcessGPU)) { | 563 command_line->HasSwitch(switches::kInProcessGPU)) { |
551 command_line->AppendSwitch(switches::kDisableGpuWatchdog); | 564 command_line->AppendSwitch(switches::kDisableGpuWatchdog); |
552 AppendGpuCommandLine(command_line); | 565 AppendGpuCommandLine(command_line); |
553 } | 566 } |
554 } | 567 } |
555 | 568 |
556 void GpuDataManagerImplPrivate::UpdateGpuInfoHelper() { | 569 void GpuDataManagerImplPrivate::UpdateGpuInfoHelper() { |
557 GetContentClient()->SetGpuInfo(gpu_info_); | 570 GetContentClient()->SetGpuInfo(gpu_info_); |
558 | 571 |
| 572 const base::CommandLine* command_line = |
| 573 base::CommandLine::ForCurrentProcess(); |
| 574 |
| 575 std::string os_version; |
| 576 if (command_line->HasSwitch(switches::kGpuTestingOsVersion)) |
| 577 os_version = |
| 578 command_line->GetSwitchValueASCII(switches::kGpuTestingOsVersion); |
| 579 |
559 if (gpu_blacklist_) { | 580 if (gpu_blacklist_) { |
560 std::set<int> features = gpu_blacklist_->MakeDecision( | 581 std::set<int> features = gpu_blacklist_->MakeDecision( |
561 gpu::GpuControlList::kOsAny, std::string(), gpu_info_); | 582 gpu::GpuControlList::kOsAny, os_version, gpu_info_); |
562 if (update_histograms_) | 583 if (update_histograms_) |
563 UpdateStats(gpu_info_, gpu_blacklist_.get(), features); | 584 UpdateStats(gpu_info_, gpu_blacklist_.get(), features); |
564 | 585 |
565 UpdateBlacklistedFeatures(features); | 586 UpdateBlacklistedFeatures(features); |
566 } | 587 } |
567 if (gpu_driver_bug_list_) { | 588 if (gpu_driver_bug_list_) { |
568 gpu_driver_bugs_ = gpu_driver_bug_list_->MakeDecision( | 589 gpu_driver_bugs_ = gpu_driver_bug_list_->MakeDecision( |
569 gpu::GpuControlList::kOsAny, std::string(), gpu_info_); | 590 gpu::GpuControlList::kOsAny, os_version, gpu_info_); |
570 | 591 |
571 std::set<std::string> disabled_ext_set; | 592 std::set<std::string> disabled_ext_set; |
572 | 593 |
573 // Merge disabled extensions from the command line with gpu driver bug list. | 594 // Merge disabled extensions from the command line with gpu driver bug list. |
574 const base::CommandLine* command_line = | |
575 base::CommandLine::ForCurrentProcess(); | |
576 if (command_line) { | 595 if (command_line) { |
577 const std::vector<std::string>& disabled_command_line_exts = | 596 const std::vector<std::string>& disabled_command_line_exts = |
578 base::SplitString( | 597 base::SplitString( |
579 command_line->GetSwitchValueASCII(switches::kDisableGLExtensions), | 598 command_line->GetSwitchValueASCII(switches::kDisableGLExtensions), |
580 ", ;", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY); | 599 ", ;", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY); |
581 disabled_ext_set.insert(disabled_command_line_exts.begin(), | 600 disabled_ext_set.insert(disabled_command_line_exts.begin(), |
582 disabled_command_line_exts.end()); | 601 disabled_command_line_exts.end()); |
583 } | 602 } |
584 const std::vector<std::string>& disabled_driver_bug_exts = | 603 const std::vector<std::string>& disabled_driver_bug_exts = |
585 gpu_driver_bug_list_->GetDisabledExtensions(); | 604 gpu_driver_bug_list_->GetDisabledExtensions(); |
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1193 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; | 1212 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; |
1194 #if defined(OS_WIN) | 1213 #if defined(OS_WIN) |
1195 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; | 1214 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; |
1196 #endif | 1215 #endif |
1197 complete_gpu_info_already_requested_ = true; | 1216 complete_gpu_info_already_requested_ = true; |
1198 // Some observers might be waiting. | 1217 // Some observers might be waiting. |
1199 NotifyGpuInfoUpdate(); | 1218 NotifyGpuInfoUpdate(); |
1200 } | 1219 } |
1201 | 1220 |
1202 } // namespace content | 1221 } // namespace content |
OLD | NEW |