Chromium Code Reviews| 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 gpu::CollectDriverInfoGL(&gpu_info); | 480 |
| 481 // Give a chance to IsEssentialGpuInfoAvailable() to return true. Useful | |
| 482 // to prevent launching the gpu process from SystemInfoHandler::GetInfo | |
| 483 // from DevToolsHttpHandler when running python browser tests. | |
| 484 gpu_info.context_info_state = gpu::CollectDriverInfoGL(&gpu_info); | |
|
Zhenyao Mo
2016/02/01 20:25:39
Sorry that I didn't realize this in the first plac
| |
| 481 | 485 |
| 482 UpdateGpuInfo(gpu_info); | 486 UpdateGpuInfo(gpu_info); |
| 483 UpdateGpuSwitchingManager(gpu_info); | 487 UpdateGpuSwitchingManager(gpu_info); |
| 484 UpdatePreliminaryBlacklistedFeatures(); | 488 UpdatePreliminaryBlacklistedFeatures(); |
| 485 } | 489 } |
| 486 | 490 |
| 487 void GpuDataManagerImplPrivate::GetGLStrings(std::string* gl_vendor, | 491 void GpuDataManagerImplPrivate::GetGLStrings(std::string* gl_vendor, |
| 488 std::string* gl_renderer, | 492 std::string* gl_renderer, |
| 489 std::string* gl_version) { | 493 std::string* gl_version) { |
| 490 DCHECK(gl_vendor && gl_renderer && gl_version); | 494 DCHECK(gl_vendor && gl_renderer && gl_version); |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 516 gpu_info.gpu.vendor_id = 0xffff; | 520 gpu_info.gpu.vendor_id = 0xffff; |
| 517 gpu_info.gpu.device_id = 0xffff; | 521 gpu_info.gpu.device_id = 0xffff; |
| 518 | 522 |
| 519 // Also declare the driver_vendor to be osmesa to be able to specify | 523 // Also declare the driver_vendor to be osmesa to be able to specify |
| 520 // exceptions based on driver_vendor==osmesa for some blacklist rules. | 524 // exceptions based on driver_vendor==osmesa for some blacklist rules. |
| 521 gpu_info.driver_vendor = gfx::kGLImplementationOSMesaName; | 525 gpu_info.driver_vendor = gfx::kGLImplementationOSMesaName; |
| 522 } else { | 526 } else { |
| 523 TRACE_EVENT0("startup", | 527 TRACE_EVENT0("startup", |
| 524 "GpuDataManagerImpl::Initialize:CollectBasicGraphicsInfo"); | 528 "GpuDataManagerImpl::Initialize:CollectBasicGraphicsInfo"); |
| 525 gpu::CollectBasicGraphicsInfo(&gpu_info); | 529 gpu::CollectBasicGraphicsInfo(&gpu_info); |
| 530 | |
| 531 if (command_line->HasSwitch(switches::kGpuTestingVendorId)) { | |
|
Zhenyao Mo
2016/02/01 20:19:36
It should always be the case that we either specif
| |
| 532 base::HexStringToUInt( | |
| 533 command_line->GetSwitchValueASCII(switches::kGpuTestingVendorId), | |
| 534 &gpu_info.gpu.vendor_id); | |
| 535 gpu_info.gpu.active = true; | |
| 536 } | |
| 537 | |
| 538 if (command_line->HasSwitch(switches::kGpuTestingDeviceId)) { | |
| 539 base::HexStringToUInt( | |
| 540 command_line->GetSwitchValueASCII(switches::kGpuTestingDeviceId), | |
| 541 &gpu_info.gpu.device_id); | |
| 542 gpu_info.gpu.active = true; | |
| 543 } | |
| 526 } | 544 } |
| 527 #if defined(ARCH_CPU_X86_FAMILY) | 545 #if defined(ARCH_CPU_X86_FAMILY) |
| 528 if (!gpu_info.gpu.vendor_id || !gpu_info.gpu.device_id) { | 546 if (!gpu_info.gpu.vendor_id || !gpu_info.gpu.device_id) { |
| 529 gpu_info.context_info_state = gpu::kCollectInfoNonFatalFailure; | 547 gpu_info.context_info_state = gpu::kCollectInfoNonFatalFailure; |
| 530 #if defined(OS_WIN) | 548 #if defined(OS_WIN) |
| 531 gpu_info.dx_diagnostics_info_state = gpu::kCollectInfoNonFatalFailure; | 549 gpu_info.dx_diagnostics_info_state = gpu::kCollectInfoNonFatalFailure; |
| 532 #endif // OS_WIN | 550 #endif // OS_WIN |
| 533 } | 551 } |
| 534 #endif // ARCH_CPU_X86_FAMILY | 552 #endif // ARCH_CPU_X86_FAMILY |
| 535 | 553 |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 549 if (command_line->HasSwitch(switches::kSingleProcess) || | 567 if (command_line->HasSwitch(switches::kSingleProcess) || |
| 550 command_line->HasSwitch(switches::kInProcessGPU)) { | 568 command_line->HasSwitch(switches::kInProcessGPU)) { |
| 551 command_line->AppendSwitch(switches::kDisableGpuWatchdog); | 569 command_line->AppendSwitch(switches::kDisableGpuWatchdog); |
| 552 AppendGpuCommandLine(command_line); | 570 AppendGpuCommandLine(command_line); |
| 553 } | 571 } |
| 554 } | 572 } |
| 555 | 573 |
| 556 void GpuDataManagerImplPrivate::UpdateGpuInfoHelper() { | 574 void GpuDataManagerImplPrivate::UpdateGpuInfoHelper() { |
| 557 GetContentClient()->SetGpuInfo(gpu_info_); | 575 GetContentClient()->SetGpuInfo(gpu_info_); |
| 558 | 576 |
| 577 const base::CommandLine* command_line = | |
| 578 base::CommandLine::ForCurrentProcess(); | |
| 579 | |
| 580 std::string os_version; | |
| 581 if (command_line->HasSwitch(switches::kGpuTestingOsVersion)) | |
| 582 os_version = | |
| 583 command_line->GetSwitchValueASCII(switches::kGpuTestingOsVersion); | |
| 584 | |
| 559 if (gpu_blacklist_) { | 585 if (gpu_blacklist_) { |
| 560 std::set<int> features = gpu_blacklist_->MakeDecision( | 586 std::set<int> features = gpu_blacklist_->MakeDecision( |
| 561 gpu::GpuControlList::kOsAny, std::string(), gpu_info_); | 587 gpu::GpuControlList::kOsAny, os_version, gpu_info_); |
| 562 if (update_histograms_) | 588 if (update_histograms_) |
| 563 UpdateStats(gpu_info_, gpu_blacklist_.get(), features); | 589 UpdateStats(gpu_info_, gpu_blacklist_.get(), features); |
| 564 | 590 |
| 565 UpdateBlacklistedFeatures(features); | 591 UpdateBlacklistedFeatures(features); |
| 566 } | 592 } |
| 567 if (gpu_driver_bug_list_) { | 593 if (gpu_driver_bug_list_) { |
| 568 gpu_driver_bugs_ = gpu_driver_bug_list_->MakeDecision( | 594 gpu_driver_bugs_ = gpu_driver_bug_list_->MakeDecision( |
| 569 gpu::GpuControlList::kOsAny, std::string(), gpu_info_); | 595 gpu::GpuControlList::kOsAny, os_version, gpu_info_); |
| 570 | 596 |
| 571 std::set<std::string> disabled_ext_set; | 597 std::set<std::string> disabled_ext_set; |
| 572 | 598 |
| 573 // Merge disabled extensions from the command line with gpu driver bug list. | 599 // 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) { | 600 if (command_line) { |
| 577 const std::vector<std::string>& disabled_command_line_exts = | 601 const std::vector<std::string>& disabled_command_line_exts = |
| 578 base::SplitString( | 602 base::SplitString( |
| 579 command_line->GetSwitchValueASCII(switches::kDisableGLExtensions), | 603 command_line->GetSwitchValueASCII(switches::kDisableGLExtensions), |
| 580 ", ;", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY); | 604 ", ;", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY); |
| 581 disabled_ext_set.insert(disabled_command_line_exts.begin(), | 605 disabled_ext_set.insert(disabled_command_line_exts.begin(), |
| 582 disabled_command_line_exts.end()); | 606 disabled_command_line_exts.end()); |
| 583 } | 607 } |
| 584 const std::vector<std::string>& disabled_driver_bug_exts = | 608 const std::vector<std::string>& disabled_driver_bug_exts = |
| 585 gpu_driver_bug_list_->GetDisabledExtensions(); | 609 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; | 1217 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; |
| 1194 #if defined(OS_WIN) | 1218 #if defined(OS_WIN) |
| 1195 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; | 1219 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; |
| 1196 #endif | 1220 #endif |
| 1197 complete_gpu_info_already_requested_ = true; | 1221 complete_gpu_info_already_requested_ = true; |
| 1198 // Some observers might be waiting. | 1222 // Some observers might be waiting. |
| 1199 NotifyGpuInfoUpdate(); | 1223 NotifyGpuInfoUpdate(); |
| 1200 } | 1224 } |
| 1201 | 1225 |
| 1202 } // namespace content | 1226 } // namespace content |
| OLD | NEW |