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 <algorithm> | 7 #include <algorithm> |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 27 #include "content/common/gpu_host_messages.h" | 27 #include "content/common/gpu_host_messages.h" |
| 28 #include "content/public/browser/browser_thread.h" | 28 #include "content/public/browser/browser_thread.h" |
| 29 #include "content/public/browser/gpu_data_manager_observer.h" | 29 #include "content/public/browser/gpu_data_manager_observer.h" |
| 30 #include "content/public/common/content_client.h" | 30 #include "content/public/common/content_client.h" |
| 31 #include "content/public/common/content_constants.h" | 31 #include "content/public/common/content_constants.h" |
| 32 #include "content/public/common/content_features.h" | 32 #include "content/public/common/content_features.h" |
| 33 #include "content/public/common/content_switches.h" | 33 #include "content/public/common/content_switches.h" |
| 34 #include "content/public/common/web_preferences.h" | 34 #include "content/public/common/web_preferences.h" |
| 35 #include "gpu/command_buffer/service/gpu_preferences.h" | 35 #include "gpu/command_buffer/service/gpu_preferences.h" |
| 36 #include "gpu/command_buffer/service/gpu_switches.h" | 36 #include "gpu/command_buffer/service/gpu_switches.h" |
| 37 #include "gpu/config/gpu_control_list_jsons.h" | 37 #include "gpu/config/gpu_driver_bug_list_autogen.h" |
| 38 #include "gpu/config/gpu_driver_bug_workaround_type.h" | |
| 39 #include "gpu/config/gpu_feature_type.h" | |
| 40 #include "gpu/config/gpu_info_collector.h" | 38 #include "gpu/config/gpu_info_collector.h" |
| 41 #include "gpu/config/gpu_switches.h" | 39 #include "gpu/config/gpu_switches.h" |
| 42 #include "gpu/config/gpu_util.h" | 40 #include "gpu/config/gpu_util.h" |
| 41 #include "gpu/config/software_rendering_list_autogen.h" | |
| 43 #include "gpu/ipc/common/memory_stats.h" | 42 #include "gpu/ipc/common/memory_stats.h" |
| 44 #include "gpu/ipc/service/switches.h" | 43 #include "gpu/ipc/service/switches.h" |
| 45 #include "media/media_features.h" | 44 #include "media/media_features.h" |
| 46 #include "ui/base/ui_base_switches.h" | 45 #include "ui/base/ui_base_switches.h" |
| 47 #include "ui/gl/gl_features.h" | 46 #include "ui/gl/gl_features.h" |
| 48 #include "ui/gl/gl_implementation.h" | 47 #include "ui/gl/gl_implementation.h" |
| 49 #include "ui/gl/gl_switches.h" | 48 #include "ui/gl/gl_switches.h" |
| 50 #include "ui/gl/gpu_switching_manager.h" | 49 #include "ui/gl/gpu_switching_manager.h" |
| 51 | 50 |
| 52 #if defined(USE_OZONE) | 51 #if defined(USE_OZONE) |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 129 const gpu::GpuBlacklist* blacklist, | 128 const gpu::GpuBlacklist* blacklist, |
| 130 const std::set<int>& blacklisted_features) { | 129 const std::set<int>& blacklisted_features) { |
| 131 uint32_t max_entry_id = blacklist->max_entry_id(); | 130 uint32_t max_entry_id = blacklist->max_entry_id(); |
| 132 if (max_entry_id == 0) { | 131 if (max_entry_id == 0) { |
| 133 // GPU Blacklist was not loaded. No need to go further. | 132 // GPU Blacklist was not loaded. No need to go further. |
| 134 return; | 133 return; |
| 135 } | 134 } |
| 136 | 135 |
| 137 const base::CommandLine& command_line = | 136 const base::CommandLine& command_line = |
| 138 *base::CommandLine::ForCurrentProcess(); | 137 *base::CommandLine::ForCurrentProcess(); |
| 139 bool disabled = false; | |
| 140 | 138 |
| 141 // Use entry 0 to capture the total number of times that data | 139 // Use entry 0 to capture the total number of times that data |
| 142 // was recorded in this histogram in order to have a convenient | 140 // was recorded in this histogram in order to have a convenient |
| 143 // denominator to compute blacklist percentages for the rest of the | 141 // denominator to compute blacklist percentages for the rest of the |
| 144 // entries. | 142 // entries. |
| 145 UMA_HISTOGRAM_ENUMERATION("GPU.BlacklistTestResultsPerEntry", | 143 UMA_HISTOGRAM_ENUMERATION("GPU.BlacklistTestResultsPerEntry", |
| 146 0, max_entry_id + 1); | 144 0, max_entry_id + 1); |
| 147 | 145 |
| 148 if (blacklisted_features.size() != 0) { | 146 if (blacklisted_features.size() != 0) { |
| 149 std::vector<uint32_t> flag_entries; | 147 std::vector<uint32_t> flag_entries; |
| 150 blacklist->GetDecisionEntries(&flag_entries, disabled); | 148 blacklist->GetDecisionEntries(&flag_entries); |
| 151 DCHECK_GT(flag_entries.size(), 0u); | 149 DCHECK_GT(flag_entries.size(), 0u); |
| 152 for (size_t i = 0; i < flag_entries.size(); ++i) { | 150 for (size_t i = 0; i < flag_entries.size(); ++i) { |
| 153 UMA_HISTOGRAM_ENUMERATION("GPU.BlacklistTestResultsPerEntry", | 151 UMA_HISTOGRAM_ENUMERATION("GPU.BlacklistTestResultsPerEntry", |
| 154 flag_entries[i], max_entry_id + 1); | 152 flag_entries[i], max_entry_id + 1); |
| 155 } | 153 } |
| 156 } | 154 } |
| 157 | 155 |
| 158 // This counts how many users are affected by a disabled entry - this allows | |
| 159 // us to understand the impact of an entry before enable it. | |
| 160 std::vector<uint32_t> flag_disabled_entries; | |
| 161 disabled = true; | |
| 162 blacklist->GetDecisionEntries(&flag_disabled_entries, disabled); | |
| 163 for (uint32_t disabled_entry : flag_disabled_entries) { | |
| 164 UMA_HISTOGRAM_ENUMERATION("GPU.BlacklistTestResultsPerDisabledEntry", | |
| 165 disabled_entry, max_entry_id + 1); | |
|
Ken Russell (switch to Gerrit)
2017/03/31 02:37:06
Is there a problem with losing this UMA histogram?
Zhenyao Mo
2017/03/31 19:14:14
No, it hasn't been used for a long long time.
| |
| 166 } | |
| 167 | |
| 168 const gpu::GpuFeatureType kGpuFeatures[] = { | 156 const gpu::GpuFeatureType kGpuFeatures[] = { |
| 169 gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS, | 157 gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS, |
| 170 gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING, | 158 gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING, |
| 171 gpu::GPU_FEATURE_TYPE_GPU_RASTERIZATION, | 159 gpu::GPU_FEATURE_TYPE_GPU_RASTERIZATION, |
| 172 gpu::GPU_FEATURE_TYPE_ACCELERATED_WEBGL, gpu::GPU_FEATURE_TYPE_WEBGL2}; | 160 gpu::GPU_FEATURE_TYPE_ACCELERATED_WEBGL, gpu::GPU_FEATURE_TYPE_WEBGL2}; |
| 173 const std::string kGpuBlacklistFeatureHistogramNames[] = { | 161 const std::string kGpuBlacklistFeatureHistogramNames[] = { |
| 174 "GPU.BlacklistFeatureTestResults.Accelerated2dCanvas", | 162 "GPU.BlacklistFeatureTestResults.Accelerated2dCanvas", |
| 175 "GPU.BlacklistFeatureTestResults.GpuCompositing", | 163 "GPU.BlacklistFeatureTestResults.GpuCompositing", |
| 176 "GPU.BlacklistFeatureTestResults.GpuRasterization", | 164 "GPU.BlacklistFeatureTestResults.GpuRasterization", |
| 177 "GPU.BlacklistFeatureTestResults.Webgl", | 165 "GPU.BlacklistFeatureTestResults.Webgl", |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 293 [](const gpu::GPUInfo& gpu_info) { | 281 [](const gpu::GPUInfo& gpu_info) { |
| 294 TRACE_EVENT0("test_gpu", "OnGraphicsInfoCollected"); | 282 TRACE_EVENT0("test_gpu", "OnGraphicsInfoCollected"); |
| 295 GpuDataManagerImpl::GetInstance()->UpdateGpuInfo(gpu_info); | 283 GpuDataManagerImpl::GetInstance()->UpdateGpuInfo(gpu_info); |
| 296 }, | 284 }, |
| 297 gpu_info)); | 285 gpu_info)); |
| 298 } | 286 } |
| 299 | 287 |
| 300 } // namespace anonymous | 288 } // namespace anonymous |
| 301 | 289 |
| 302 void GpuDataManagerImplPrivate::InitializeForTesting( | 290 void GpuDataManagerImplPrivate::InitializeForTesting( |
| 303 const std::string& gpu_blacklist_json, | 291 const gpu::GpuControlListData& gpu_blacklist_data, |
| 304 const gpu::GPUInfo& gpu_info) { | 292 const gpu::GPUInfo& gpu_info) { |
| 305 // This function is for testing only, so disable histograms. | 293 // This function is for testing only, so disable histograms. |
| 306 update_histograms_ = false; | 294 update_histograms_ = false; |
| 307 | 295 |
| 308 // Prevent all further initialization. | 296 // Prevent all further initialization. |
| 309 finalized_ = true; | 297 finalized_ = true; |
| 310 | 298 |
| 311 InitializeImpl(gpu_blacklist_json, std::string(), gpu_info); | 299 gpu::GpuControlListData gpu_driver_bug_list_data; |
| 300 InitializeImpl(gpu_blacklist_data, gpu_driver_bug_list_data, gpu_info); | |
| 312 } | 301 } |
| 313 | 302 |
| 314 bool GpuDataManagerImplPrivate::IsFeatureBlacklisted(int feature) const { | 303 bool GpuDataManagerImplPrivate::IsFeatureBlacklisted(int feature) const { |
| 315 #if defined(OS_CHROMEOS) | 304 #if defined(OS_CHROMEOS) |
| 316 if (feature == gpu::GPU_FEATURE_TYPE_PANEL_FITTING && | 305 if (feature == gpu::GPU_FEATURE_TYPE_PANEL_FITTING && |
| 317 base::CommandLine::ForCurrentProcess()->HasSwitch( | 306 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 318 switches::kDisablePanelFitting)) { | 307 switches::kDisablePanelFitting)) { |
| 319 return true; | 308 return true; |
| 320 } | 309 } |
| 321 #endif // OS_CHROMEOS | 310 #endif // OS_CHROMEOS |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 613 } | 602 } |
| 614 #if defined(ARCH_CPU_X86_FAMILY) | 603 #if defined(ARCH_CPU_X86_FAMILY) |
| 615 if (!gpu_info.gpu.vendor_id || !gpu_info.gpu.device_id) { | 604 if (!gpu_info.gpu.vendor_id || !gpu_info.gpu.device_id) { |
| 616 gpu_info.context_info_state = gpu::kCollectInfoNonFatalFailure; | 605 gpu_info.context_info_state = gpu::kCollectInfoNonFatalFailure; |
| 617 #if defined(OS_WIN) | 606 #if defined(OS_WIN) |
| 618 gpu_info.dx_diagnostics_info_state = gpu::kCollectInfoNonFatalFailure; | 607 gpu_info.dx_diagnostics_info_state = gpu::kCollectInfoNonFatalFailure; |
| 619 #endif // OS_WIN | 608 #endif // OS_WIN |
| 620 } | 609 } |
| 621 #endif // ARCH_CPU_X86_FAMILY | 610 #endif // ARCH_CPU_X86_FAMILY |
| 622 | 611 |
| 623 std::string gpu_blacklist_string; | 612 gpu::GpuControlListData gpu_blacklist_data; |
| 624 std::string gpu_driver_bug_list_string; | |
| 625 if (!force_software_gl && | 613 if (!force_software_gl && |
| 626 !command_line->HasSwitch(switches::kIgnoreGpuBlacklist) && | 614 !command_line->HasSwitch(switches::kIgnoreGpuBlacklist) && |
| 627 !command_line->HasSwitch(switches::kUseGpuInTests)) { | 615 !command_line->HasSwitch(switches::kUseGpuInTests)) { |
| 628 gpu_blacklist_string = gpu::kSoftwareRenderingListJson; | 616 gpu_blacklist_data = {gpu::kSoftwareRenderingListVersion, |
| 617 gpu::kSoftwareRenderingListEntryCount, | |
| 618 gpu::kSoftwareRenderingListEntries}; | |
| 629 } | 619 } |
| 620 gpu::GpuControlListData gpu_driver_bug_list_data; | |
| 630 if (!force_software_gl && | 621 if (!force_software_gl && |
| 631 !command_line->HasSwitch(switches::kDisableGpuDriverBugWorkarounds)) { | 622 !command_line->HasSwitch(switches::kDisableGpuDriverBugWorkarounds)) { |
| 632 gpu_driver_bug_list_string = gpu::kGpuDriverBugListJson; | 623 gpu_driver_bug_list_data = {gpu::kGpuDriverBugListVersion, |
| 624 gpu::kGpuDriverBugListEntryCount, | |
| 625 gpu::kGpuDriverBugListEntries}; | |
| 633 } | 626 } |
| 634 InitializeImpl(gpu_blacklist_string, | 627 InitializeImpl(gpu_blacklist_data, gpu_driver_bug_list_data, gpu_info); |
| 635 gpu_driver_bug_list_string, | |
| 636 gpu_info); | |
| 637 | 628 |
| 638 if (in_process_gpu_) { | 629 if (in_process_gpu_) { |
| 639 command_line->AppendSwitch(switches::kDisableGpuWatchdog); | 630 command_line->AppendSwitch(switches::kDisableGpuWatchdog); |
| 640 AppendGpuCommandLine(command_line, nullptr); | 631 AppendGpuCommandLine(command_line, nullptr); |
| 641 } | 632 } |
| 642 } | 633 } |
| 643 | 634 |
| 644 void GpuDataManagerImplPrivate::UpdateGpuInfoHelper() { | 635 void GpuDataManagerImplPrivate::UpdateGpuInfoHelper() { |
| 645 GetContentClient()->SetGpuInfo(gpu_info_); | 636 GetContentClient()->SetGpuInfo(gpu_info_); |
| 646 | 637 |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1186 } | 1177 } |
| 1187 } | 1178 } |
| 1188 | 1179 |
| 1189 GpuDataManagerImplPrivate::~GpuDataManagerImplPrivate() { | 1180 GpuDataManagerImplPrivate::~GpuDataManagerImplPrivate() { |
| 1190 #if defined(OS_MACOSX) | 1181 #if defined(OS_MACOSX) |
| 1191 CGDisplayRemoveReconfigurationCallback(DisplayReconfigCallback, owner_); | 1182 CGDisplayRemoveReconfigurationCallback(DisplayReconfigCallback, owner_); |
| 1192 #endif | 1183 #endif |
| 1193 } | 1184 } |
| 1194 | 1185 |
| 1195 void GpuDataManagerImplPrivate::InitializeImpl( | 1186 void GpuDataManagerImplPrivate::InitializeImpl( |
| 1196 const std::string& gpu_blacklist_json, | 1187 const gpu::GpuControlListData& gpu_blacklist_data, |
| 1197 const std::string& gpu_driver_bug_list_json, | 1188 const gpu::GpuControlListData& gpu_driver_bug_list_data, |
| 1198 const gpu::GPUInfo& gpu_info) { | 1189 const gpu::GPUInfo& gpu_info) { |
| 1199 const bool log_gpu_control_list_decisions = | 1190 const bool log_gpu_control_list_decisions = |
| 1200 base::CommandLine::ForCurrentProcess()->HasSwitch( | 1191 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 1201 switches::kLogGpuControlListDecisions); | 1192 switches::kLogGpuControlListDecisions); |
| 1202 | 1193 |
| 1203 if (!gpu_blacklist_json.empty()) { | 1194 if (gpu_blacklist_data.entry_count) { |
| 1204 gpu_blacklist_.reset(gpu::GpuBlacklist::Create()); | 1195 gpu_blacklist_.reset(gpu::GpuBlacklist::Create(gpu_blacklist_data)); |
| 1205 if (log_gpu_control_list_decisions) | 1196 if (log_gpu_control_list_decisions) |
| 1206 gpu_blacklist_->enable_control_list_logging("gpu_blacklist"); | 1197 gpu_blacklist_->EnableControlListLogging("gpu_blacklist"); |
| 1207 bool success = gpu_blacklist_->LoadList( | |
| 1208 gpu_blacklist_json, gpu::GpuControlList::kCurrentOsOnly); | |
| 1209 DCHECK(success); | |
| 1210 } | 1198 } |
| 1211 if (!gpu_driver_bug_list_json.empty()) { | 1199 if (gpu_driver_bug_list_data.entry_count) { |
| 1212 gpu_driver_bug_list_.reset(gpu::GpuDriverBugList::Create()); | 1200 gpu_driver_bug_list_.reset( |
| 1201 gpu::GpuDriverBugList::Create(gpu_driver_bug_list_data)); | |
| 1213 if (log_gpu_control_list_decisions) | 1202 if (log_gpu_control_list_decisions) |
| 1214 gpu_driver_bug_list_->enable_control_list_logging("gpu_driver_bug_list"); | 1203 gpu_driver_bug_list_->EnableControlListLogging("gpu_driver_bug_list"); |
| 1215 bool success = gpu_driver_bug_list_->LoadList( | |
| 1216 gpu_driver_bug_list_json, gpu::GpuControlList::kCurrentOsOnly); | |
| 1217 DCHECK(success); | |
| 1218 } | 1204 } |
| 1219 | 1205 |
| 1220 gpu_info_ = gpu_info; | 1206 gpu_info_ = gpu_info; |
| 1221 UpdateGpuInfo(gpu_info); | 1207 UpdateGpuInfo(gpu_info); |
| 1222 UpdateGpuSwitchingManager(gpu_info); | 1208 UpdateGpuSwitchingManager(gpu_info); |
| 1223 UpdatePreliminaryBlacklistedFeatures(); | 1209 UpdatePreliminaryBlacklistedFeatures(); |
| 1224 | 1210 |
| 1225 RunPostInitTasks(); | 1211 RunPostInitTasks(); |
| 1226 } | 1212 } |
| 1227 | 1213 |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1388 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; | 1374 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; |
| 1389 #if defined(OS_WIN) | 1375 #if defined(OS_WIN) |
| 1390 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; | 1376 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; |
| 1391 #endif | 1377 #endif |
| 1392 complete_gpu_info_already_requested_ = true; | 1378 complete_gpu_info_already_requested_ = true; |
| 1393 // Some observers might be waiting. | 1379 // Some observers might be waiting. |
| 1394 NotifyGpuInfoUpdate(); | 1380 NotifyGpuInfoUpdate(); |
| 1395 } | 1381 } |
| 1396 | 1382 |
| 1397 } // namespace content | 1383 } // namespace content |
| OLD | NEW |