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" |
11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
12 #include "base/metrics/sparse_histogram.h" | 12 #include "base/metrics/sparse_histogram.h" |
| 13 #include "base/stl_util.h" |
13 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
14 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
15 #include "base/sys_info.h" | 16 #include "base/sys_info.h" |
16 #include "base/trace_event/trace_event.h" | 17 #include "base/trace_event/trace_event.h" |
17 #include "base/version.h" | 18 #include "base/version.h" |
18 #include "cc/base/switches.h" | 19 #include "cc/base/switches.h" |
19 #include "content/browser/gpu/gpu_process_host.h" | 20 #include "content/browser/gpu/gpu_process_host.h" |
20 #include "content/common/gpu/gpu_messages.h" | 21 #include "content/common/gpu/gpu_messages.h" |
21 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.h" |
22 #include "content/public/browser/gpu_data_manager_observer.h" | 23 #include "content/public/browser/gpu_data_manager_observer.h" |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 | 564 |
564 if (gpu_blacklist_) { | 565 if (gpu_blacklist_) { |
565 std::set<int> features = gpu_blacklist_->MakeDecision( | 566 std::set<int> features = gpu_blacklist_->MakeDecision( |
566 gpu::GpuControlList::kOsAny, std::string(), gpu_info_); | 567 gpu::GpuControlList::kOsAny, std::string(), gpu_info_); |
567 if (update_histograms_) | 568 if (update_histograms_) |
568 UpdateStats(gpu_info_, gpu_blacklist_.get(), features); | 569 UpdateStats(gpu_info_, gpu_blacklist_.get(), features); |
569 | 570 |
570 UpdateBlacklistedFeatures(features); | 571 UpdateBlacklistedFeatures(features); |
571 } | 572 } |
572 if (gpu_driver_bug_list_) { | 573 if (gpu_driver_bug_list_) { |
| 574 // XXX Maybe just do gpu_driver_bugs_ = gpu_info_.driver_bugs_workarounds |
| 575 // instead of recomputing. |
573 gpu_driver_bugs_ = gpu_driver_bug_list_->MakeDecision( | 576 gpu_driver_bugs_ = gpu_driver_bug_list_->MakeDecision( |
574 gpu::GpuControlList::kOsAny, std::string(), gpu_info_); | 577 gpu::GpuControlList::kOsAny, std::string(), gpu_info_); |
575 | 578 |
576 disabled_extensions_ = | 579 disabled_extensions_ = |
577 base::JoinString(gpu_driver_bug_list_->GetDisabledExtensions(), " "); | 580 base::JoinString(gpu_driver_bug_list_->GetDisabledExtensions(), " "); |
578 } | 581 } |
579 gpu::GpuDriverBugList::AppendWorkaroundsFromCommandLine( | 582 gpu::GpuDriverBugList::AppendWorkaroundsFromCommandLine( |
580 &gpu_driver_bugs_, *base::CommandLine::ForCurrentProcess()); | 583 &gpu_driver_bugs_, *base::CommandLine::ForCurrentProcess()); |
581 | 584 |
| 585 // XXX Follwing block is not necesarry if above XXX is applied. |
| 586 if (!gpu_info_.driver_bugs_workarounds.empty()) { |
| 587 std::set<int> diff_gpu_driver_bugs = base::STLSetDifference<std::set<int>>( |
| 588 gpu_driver_bugs_, gpu_info_.driver_bugs_workarounds); |
| 589 if (!diff_gpu_driver_bugs.empty()) { |
| 590 LOG(ERROR) << "gpu driver bug workarounds not in sync, force it"; |
| 591 gpu_driver_bugs_ = gpu_info_.driver_bugs_workarounds; |
| 592 } |
| 593 } |
| 594 |
582 // We have to update GpuFeatureType before notify all the observers. | 595 // We have to update GpuFeatureType before notify all the observers. |
583 NotifyGpuInfoUpdate(); | 596 NotifyGpuInfoUpdate(); |
584 } | 597 } |
585 | 598 |
586 void GpuDataManagerImplPrivate::UpdateGpuInfo(const gpu::GPUInfo& gpu_info) { | 599 void GpuDataManagerImplPrivate::UpdateGpuInfo(const gpu::GPUInfo& gpu_info) { |
587 // No further update of gpu_info if falling back to SwiftShader. | 600 // No further update of gpu_info if falling back to SwiftShader. |
588 if (use_swiftshader_ || ShouldUseWarp()) | 601 if (use_swiftshader_ || ShouldUseWarp()) |
589 return; | 602 return; |
590 | 603 |
591 bool was_info_available = IsCompleteGpuInfoAvailable(); | 604 bool was_info_available = IsCompleteGpuInfoAvailable(); |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1206 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; | 1219 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; |
1207 #if defined(OS_WIN) | 1220 #if defined(OS_WIN) |
1208 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; | 1221 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; |
1209 #endif | 1222 #endif |
1210 complete_gpu_info_already_requested_ = true; | 1223 complete_gpu_info_already_requested_ = true; |
1211 // Some observers might be waiting. | 1224 // Some observers might be waiting. |
1212 NotifyGpuInfoUpdate(); | 1225 NotifyGpuInfoUpdate(); |
1213 } | 1226 } |
1214 | 1227 |
1215 } // namespace content | 1228 } // namespace content |
OLD | NEW |