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" | 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" | 39 #include "gpu/config/gpu_info_collector.h" |
41 #include "gpu/config/gpu_switches.h" | 40 #include "gpu/config/gpu_switches.h" |
42 #include "gpu/config/gpu_util.h" | 41 #include "gpu/config/gpu_util.h" |
| 42 #include "gpu/config/software_rendering_list_autogen.h" |
43 #include "gpu/ipc/common/memory_stats.h" | 43 #include "gpu/ipc/common/memory_stats.h" |
44 #include "gpu/ipc/service/switches.h" | 44 #include "gpu/ipc/service/switches.h" |
45 #include "media/media_features.h" | 45 #include "media/media_features.h" |
46 #include "ui/base/ui_base_switches.h" | 46 #include "ui/base/ui_base_switches.h" |
47 #include "ui/gl/gl_features.h" | 47 #include "ui/gl/gl_features.h" |
48 #include "ui/gl/gl_implementation.h" | 48 #include "ui/gl/gl_implementation.h" |
49 #include "ui/gl/gl_switches.h" | 49 #include "ui/gl/gl_switches.h" |
50 #include "ui/gl/gpu_switching_manager.h" | 50 #include "ui/gl/gpu_switching_manager.h" |
51 | 51 |
52 #if defined(USE_OZONE) | 52 #if defined(USE_OZONE) |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 const gpu::GpuBlacklist* blacklist, | 133 const gpu::GpuBlacklist* blacklist, |
134 const std::set<int>& blacklisted_features) { | 134 const std::set<int>& blacklisted_features) { |
135 uint32_t max_entry_id = blacklist->max_entry_id(); | 135 uint32_t max_entry_id = blacklist->max_entry_id(); |
136 if (max_entry_id == 0) { | 136 if (max_entry_id == 0) { |
137 // GPU Blacklist was not loaded. No need to go further. | 137 // GPU Blacklist was not loaded. No need to go further. |
138 return; | 138 return; |
139 } | 139 } |
140 | 140 |
141 const base::CommandLine& command_line = | 141 const base::CommandLine& command_line = |
142 *base::CommandLine::ForCurrentProcess(); | 142 *base::CommandLine::ForCurrentProcess(); |
143 bool disabled = false; | |
144 | 143 |
145 // Use entry 0 to capture the total number of times that data | 144 // Use entry 0 to capture the total number of times that data |
146 // was recorded in this histogram in order to have a convenient | 145 // was recorded in this histogram in order to have a convenient |
147 // denominator to compute blacklist percentages for the rest of the | 146 // denominator to compute blacklist percentages for the rest of the |
148 // entries. | 147 // entries. |
149 UMA_HISTOGRAM_EXACT_LINEAR("GPU.BlacklistTestResultsPerEntry", 0, | 148 UMA_HISTOGRAM_EXACT_LINEAR("GPU.BlacklistTestResultsPerEntry", 0, |
150 max_entry_id + 1); | 149 max_entry_id + 1); |
151 | 150 |
152 if (blacklisted_features.size() != 0) { | 151 if (blacklisted_features.size() != 0) { |
153 std::vector<uint32_t> flag_entries; | 152 std::vector<uint32_t> flag_entries; |
154 blacklist->GetDecisionEntries(&flag_entries, disabled); | 153 blacklist->GetDecisionEntries(&flag_entries); |
155 DCHECK_GT(flag_entries.size(), 0u); | 154 DCHECK_GT(flag_entries.size(), 0u); |
156 for (size_t i = 0; i < flag_entries.size(); ++i) { | 155 for (size_t i = 0; i < flag_entries.size(); ++i) { |
157 UMA_HISTOGRAM_EXACT_LINEAR("GPU.BlacklistTestResultsPerEntry", | 156 UMA_HISTOGRAM_EXACT_LINEAR("GPU.BlacklistTestResultsPerEntry", |
158 flag_entries[i], max_entry_id + 1); | 157 flag_entries[i], max_entry_id + 1); |
159 } | 158 } |
160 } | 159 } |
161 | 160 |
162 // This counts how many users are affected by a disabled entry - this allows | |
163 // us to understand the impact of an entry before enable it. | |
164 std::vector<uint32_t> flag_disabled_entries; | |
165 disabled = true; | |
166 blacklist->GetDecisionEntries(&flag_disabled_entries, disabled); | |
167 for (uint32_t disabled_entry : flag_disabled_entries) { | |
168 UMA_HISTOGRAM_EXACT_LINEAR("GPU.BlacklistTestResultsPerDisabledEntry", | |
169 disabled_entry, max_entry_id + 1); | |
170 } | |
171 | |
172 const gpu::GpuFeatureType kGpuFeatures[] = { | 161 const gpu::GpuFeatureType kGpuFeatures[] = { |
173 gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS, | 162 gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS, |
174 gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING, | 163 gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING, |
175 gpu::GPU_FEATURE_TYPE_GPU_RASTERIZATION, | 164 gpu::GPU_FEATURE_TYPE_GPU_RASTERIZATION, |
176 gpu::GPU_FEATURE_TYPE_ACCELERATED_WEBGL, gpu::GPU_FEATURE_TYPE_WEBGL2}; | 165 gpu::GPU_FEATURE_TYPE_ACCELERATED_WEBGL, gpu::GPU_FEATURE_TYPE_WEBGL2}; |
177 const std::string kGpuBlacklistFeatureHistogramNames[] = { | 166 const std::string kGpuBlacklistFeatureHistogramNames[] = { |
178 "GPU.BlacklistFeatureTestResults.Accelerated2dCanvas", | 167 "GPU.BlacklistFeatureTestResults.Accelerated2dCanvas", |
179 "GPU.BlacklistFeatureTestResults.GpuCompositing", | 168 "GPU.BlacklistFeatureTestResults.GpuCompositing", |
180 "GPU.BlacklistFeatureTestResults.GpuRasterization", | 169 "GPU.BlacklistFeatureTestResults.GpuRasterization", |
181 "GPU.BlacklistFeatureTestResults.Webgl", | 170 "GPU.BlacklistFeatureTestResults.Webgl", |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 [](const gpu::GPUInfo& gpu_info) { | 286 [](const gpu::GPUInfo& gpu_info) { |
298 TRACE_EVENT0("test_gpu", "OnGraphicsInfoCollected"); | 287 TRACE_EVENT0("test_gpu", "OnGraphicsInfoCollected"); |
299 GpuDataManagerImpl::GetInstance()->UpdateGpuInfo(gpu_info); | 288 GpuDataManagerImpl::GetInstance()->UpdateGpuInfo(gpu_info); |
300 }, | 289 }, |
301 gpu_info)); | 290 gpu_info)); |
302 } | 291 } |
303 | 292 |
304 } // namespace anonymous | 293 } // namespace anonymous |
305 | 294 |
306 void GpuDataManagerImplPrivate::InitializeForTesting( | 295 void GpuDataManagerImplPrivate::InitializeForTesting( |
307 const std::string& gpu_blacklist_json, | 296 const gpu::GpuControlListData& gpu_blacklist_data, |
308 const gpu::GPUInfo& gpu_info) { | 297 const gpu::GPUInfo& gpu_info) { |
309 // This function is for testing only, so disable histograms. | 298 // This function is for testing only, so disable histograms. |
310 update_histograms_ = false; | 299 update_histograms_ = false; |
311 | 300 |
312 // Prevent all further initialization. | 301 // Prevent all further initialization. |
313 finalized_ = true; | 302 finalized_ = true; |
314 | 303 |
315 InitializeImpl(gpu_blacklist_json, std::string(), gpu_info); | 304 gpu::GpuControlListData gpu_driver_bug_list_data; |
| 305 InitializeImpl(gpu_blacklist_data, gpu_driver_bug_list_data, gpu_info); |
316 } | 306 } |
317 | 307 |
318 bool GpuDataManagerImplPrivate::IsFeatureBlacklisted(int feature) const { | 308 bool GpuDataManagerImplPrivate::IsFeatureBlacklisted(int feature) const { |
319 #if defined(OS_CHROMEOS) | 309 #if defined(OS_CHROMEOS) |
320 if (feature == gpu::GPU_FEATURE_TYPE_PANEL_FITTING && | 310 if (feature == gpu::GPU_FEATURE_TYPE_PANEL_FITTING && |
321 base::CommandLine::ForCurrentProcess()->HasSwitch( | 311 base::CommandLine::ForCurrentProcess()->HasSwitch( |
322 switches::kDisablePanelFitting)) { | 312 switches::kDisablePanelFitting)) { |
323 return true; | 313 return true; |
324 } | 314 } |
325 #endif // OS_CHROMEOS | 315 #endif // OS_CHROMEOS |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 } | 607 } |
618 #if defined(ARCH_CPU_X86_FAMILY) | 608 #if defined(ARCH_CPU_X86_FAMILY) |
619 if (!gpu_info.gpu.vendor_id || !gpu_info.gpu.device_id) { | 609 if (!gpu_info.gpu.vendor_id || !gpu_info.gpu.device_id) { |
620 gpu_info.context_info_state = gpu::kCollectInfoNonFatalFailure; | 610 gpu_info.context_info_state = gpu::kCollectInfoNonFatalFailure; |
621 #if defined(OS_WIN) | 611 #if defined(OS_WIN) |
622 gpu_info.dx_diagnostics_info_state = gpu::kCollectInfoNonFatalFailure; | 612 gpu_info.dx_diagnostics_info_state = gpu::kCollectInfoNonFatalFailure; |
623 #endif // OS_WIN | 613 #endif // OS_WIN |
624 } | 614 } |
625 #endif // ARCH_CPU_X86_FAMILY | 615 #endif // ARCH_CPU_X86_FAMILY |
626 | 616 |
627 std::string gpu_blacklist_string; | 617 gpu::GpuControlListData gpu_blacklist_data; |
628 std::string gpu_driver_bug_list_string; | |
629 if (!force_software_gl && | 618 if (!force_software_gl && |
630 !command_line->HasSwitch(switches::kIgnoreGpuBlacklist) && | 619 !command_line->HasSwitch(switches::kIgnoreGpuBlacklist) && |
631 !command_line->HasSwitch(switches::kUseGpuInTests)) { | 620 !command_line->HasSwitch(switches::kUseGpuInTests)) { |
632 gpu_blacklist_string = gpu::kSoftwareRenderingListJson; | 621 gpu_blacklist_data = {gpu::kSoftwareRenderingListVersion, |
| 622 gpu::kSoftwareRenderingListEntryCount, |
| 623 gpu::kSoftwareRenderingListEntries}; |
633 } | 624 } |
| 625 gpu::GpuControlListData gpu_driver_bug_list_data; |
634 if (!force_software_gl && | 626 if (!force_software_gl && |
635 !command_line->HasSwitch(switches::kDisableGpuDriverBugWorkarounds)) { | 627 !command_line->HasSwitch(switches::kDisableGpuDriverBugWorkarounds)) { |
636 gpu_driver_bug_list_string = gpu::kGpuDriverBugListJson; | 628 gpu_driver_bug_list_data = {gpu::kGpuDriverBugListVersion, |
| 629 gpu::kGpuDriverBugListEntryCount, |
| 630 gpu::kGpuDriverBugListEntries}; |
637 } | 631 } |
638 InitializeImpl(gpu_blacklist_string, | 632 InitializeImpl(gpu_blacklist_data, gpu_driver_bug_list_data, gpu_info); |
639 gpu_driver_bug_list_string, | |
640 gpu_info); | |
641 | 633 |
642 if (in_process_gpu_) { | 634 if (in_process_gpu_) { |
643 command_line->AppendSwitch(switches::kDisableGpuWatchdog); | 635 command_line->AppendSwitch(switches::kDisableGpuWatchdog); |
644 AppendGpuCommandLine(command_line, nullptr); | 636 AppendGpuCommandLine(command_line, nullptr); |
645 } | 637 } |
646 } | 638 } |
647 | 639 |
648 void GpuDataManagerImplPrivate::UpdateGpuInfoHelper() { | 640 void GpuDataManagerImplPrivate::UpdateGpuInfoHelper() { |
649 GetContentClient()->SetGpuInfo(gpu_info_); | 641 GetContentClient()->SetGpuInfo(gpu_info_); |
650 | 642 |
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1190 } | 1182 } |
1191 } | 1183 } |
1192 | 1184 |
1193 GpuDataManagerImplPrivate::~GpuDataManagerImplPrivate() { | 1185 GpuDataManagerImplPrivate::~GpuDataManagerImplPrivate() { |
1194 #if defined(OS_MACOSX) | 1186 #if defined(OS_MACOSX) |
1195 CGDisplayRemoveReconfigurationCallback(DisplayReconfigCallback, owner_); | 1187 CGDisplayRemoveReconfigurationCallback(DisplayReconfigCallback, owner_); |
1196 #endif | 1188 #endif |
1197 } | 1189 } |
1198 | 1190 |
1199 void GpuDataManagerImplPrivate::InitializeImpl( | 1191 void GpuDataManagerImplPrivate::InitializeImpl( |
1200 const std::string& gpu_blacklist_json, | 1192 const gpu::GpuControlListData& gpu_blacklist_data, |
1201 const std::string& gpu_driver_bug_list_json, | 1193 const gpu::GpuControlListData& gpu_driver_bug_list_data, |
1202 const gpu::GPUInfo& gpu_info) { | 1194 const gpu::GPUInfo& gpu_info) { |
1203 const bool log_gpu_control_list_decisions = | 1195 const bool log_gpu_control_list_decisions = |
1204 base::CommandLine::ForCurrentProcess()->HasSwitch( | 1196 base::CommandLine::ForCurrentProcess()->HasSwitch( |
1205 switches::kLogGpuControlListDecisions); | 1197 switches::kLogGpuControlListDecisions); |
1206 | 1198 |
1207 if (!gpu_blacklist_json.empty()) { | 1199 if (gpu_blacklist_data.entry_count) { |
1208 gpu_blacklist_.reset(gpu::GpuBlacklist::Create()); | 1200 gpu_blacklist_ = gpu::GpuBlacklist::Create(gpu_blacklist_data); |
1209 if (log_gpu_control_list_decisions) | 1201 if (log_gpu_control_list_decisions) |
1210 gpu_blacklist_->enable_control_list_logging("gpu_blacklist"); | 1202 gpu_blacklist_->EnableControlListLogging("gpu_blacklist"); |
1211 bool success = gpu_blacklist_->LoadList( | |
1212 gpu_blacklist_json, gpu::GpuControlList::kCurrentOsOnly); | |
1213 DCHECK(success); | |
1214 } | 1203 } |
1215 if (!gpu_driver_bug_list_json.empty()) { | 1204 if (gpu_driver_bug_list_data.entry_count) { |
1216 gpu_driver_bug_list_.reset(gpu::GpuDriverBugList::Create()); | 1205 gpu_driver_bug_list_ = |
| 1206 gpu::GpuDriverBugList::Create(gpu_driver_bug_list_data); |
1217 if (log_gpu_control_list_decisions) | 1207 if (log_gpu_control_list_decisions) |
1218 gpu_driver_bug_list_->enable_control_list_logging("gpu_driver_bug_list"); | 1208 gpu_driver_bug_list_->EnableControlListLogging("gpu_driver_bug_list"); |
1219 bool success = gpu_driver_bug_list_->LoadList( | |
1220 gpu_driver_bug_list_json, gpu::GpuControlList::kCurrentOsOnly); | |
1221 DCHECK(success); | |
1222 } | 1209 } |
1223 | 1210 |
1224 gpu_info_ = gpu_info; | 1211 gpu_info_ = gpu_info; |
1225 UpdateGpuInfo(gpu_info); | 1212 UpdateGpuInfo(gpu_info); |
1226 UpdateGpuSwitchingManager(gpu_info); | 1213 UpdateGpuSwitchingManager(gpu_info); |
1227 UpdatePreliminaryBlacklistedFeatures(); | 1214 UpdatePreliminaryBlacklistedFeatures(); |
1228 | 1215 |
1229 RunPostInitTasks(); | 1216 RunPostInitTasks(); |
1230 } | 1217 } |
1231 | 1218 |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1392 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; | 1379 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; |
1393 #if defined(OS_WIN) | 1380 #if defined(OS_WIN) |
1394 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; | 1381 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; |
1395 #endif | 1382 #endif |
1396 complete_gpu_info_already_requested_ = true; | 1383 complete_gpu_info_already_requested_ = true; |
1397 // Some observers might be waiting. | 1384 // Some observers might be waiting. |
1398 NotifyGpuInfoUpdate(); | 1385 NotifyGpuInfoUpdate(); |
1399 } | 1386 } |
1400 | 1387 |
1401 } // namespace content | 1388 } // namespace content |
OLD | NEW |