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 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 710 } else if (was_info_available) { | 710 } else if (was_info_available) { |
| 711 // Allow future requests to go through properly. | 711 // Allow future requests to go through properly. |
| 712 complete_gpu_info_already_requested_ = false; | 712 complete_gpu_info_already_requested_ = false; |
| 713 } | 713 } |
| 714 | 714 |
| 715 UpdateGpuInfoHelper(); | 715 UpdateGpuInfoHelper(); |
| 716 } | 716 } |
| 717 | 717 |
| 718 void GpuDataManagerImplPrivate::UpdateGpuFeatureInfo( | 718 void GpuDataManagerImplPrivate::UpdateGpuFeatureInfo( |
| 719 const gpu::GpuFeatureInfo& gpu_feature_info) { | 719 const gpu::GpuFeatureInfo& gpu_feature_info) { |
| 720 gpu_feature_info_ = gpu_feature_info; | 720 if (!use_swiftshader_) { |
| 721 gpu_feature_info_ = gpu_feature_info; | |
| 722 } | |
| 721 } | 723 } |
| 722 | 724 |
| 723 void GpuDataManagerImplPrivate::UpdateVideoMemoryUsageStats( | 725 void GpuDataManagerImplPrivate::UpdateVideoMemoryUsageStats( |
| 724 const gpu::VideoMemoryUsageStats& video_memory_usage_stats) { | 726 const gpu::VideoMemoryUsageStats& video_memory_usage_stats) { |
| 725 GpuDataManagerImpl::UnlockedSession session(owner_); | 727 GpuDataManagerImpl::UnlockedSession session(owner_); |
| 726 observer_list_->Notify(FROM_HERE, | 728 observer_list_->Notify(FROM_HERE, |
| 727 &GpuDataManagerObserver::OnVideoMemoryUsageStatsUpdate, | 729 &GpuDataManagerObserver::OnVideoMemoryUsageStatsUpdate, |
| 728 video_memory_usage_stats); | 730 video_memory_usage_stats); |
| 729 } | 731 } |
| 730 | 732 |
| (...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1262 ui::GpuSwitchingManager::GetInstance()->SetGpuVendorIds(vendor_ids); | 1264 ui::GpuSwitchingManager::GetInstance()->SetGpuVendorIds(vendor_ids); |
| 1263 gpu::InitializeDualGpusIfSupported(gpu_driver_bugs_); | 1265 gpu::InitializeDualGpusIfSupported(gpu_driver_bugs_); |
| 1264 } | 1266 } |
| 1265 | 1267 |
| 1266 void GpuDataManagerImplPrivate::NotifyGpuInfoUpdate() { | 1268 void GpuDataManagerImplPrivate::NotifyGpuInfoUpdate() { |
| 1267 observer_list_->Notify(FROM_HERE, &GpuDataManagerObserver::OnGpuInfoUpdate); | 1269 observer_list_->Notify(FROM_HERE, &GpuDataManagerObserver::OnGpuInfoUpdate); |
| 1268 } | 1270 } |
| 1269 | 1271 |
| 1270 void GpuDataManagerImplPrivate::EnableSwiftShaderIfNecessary() { | 1272 void GpuDataManagerImplPrivate::EnableSwiftShaderIfNecessary() { |
| 1271 #if BUILDFLAG(ENABLE_SWIFTSHADER) | 1273 #if BUILDFLAG(ENABLE_SWIFTSHADER) |
| 1272 if (!GpuAccessAllowed(nullptr) || | 1274 if ((!GpuAccessAllowed(nullptr) || |
| 1273 blacklisted_features_.count(gpu::GPU_FEATURE_TYPE_ACCELERATED_WEBGL)) { | 1275 blacklisted_features_.count(gpu::GPU_FEATURE_TYPE_ACCELERATED_WEBGL)) && |
| 1274 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 1276 !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 1275 switches::kDisableSoftwareRasterizer)) | 1277 switches::kDisableSoftwareRasterizer)) { |
| 1276 use_swiftshader_ = true; | 1278 use_swiftshader_ = true; |
| 1279 | |
| 1280 // Remove all previously recorded GPU info | |
| 1281 gpu_info_ = gpu::GPUInfo(); | |
| 1282 // Set some basic info to identify the GPU as SwiftShader | |
| 1283 gpu_info_.gl_vendor = "Google Inc."; | |
| 1284 gpu_info_.gl_renderer = "Google SwiftShader"; | |
| 1285 | |
| 1286 for (auto& status : gpu_feature_info_.status_values) | |
| 1287 status = gpu::kGpuFeatureStatusBlacklisted; | |
|
Ken Russell (switch to Gerrit)
2017/03/29 17:29:22
Is this status update correct? Isn't WebGL still s
sugoi1
2017/03/29 17:39:47
Yes, but the feature is now called "GPU_FEATURE_TY
Zhenyao Mo
2017/03/29 17:48:48
In theory the webgl status should be hardware_acce
| |
| 1277 } | 1288 } |
| 1278 #endif | 1289 #endif |
| 1279 } | 1290 } |
| 1280 | 1291 |
| 1281 std::string GpuDataManagerImplPrivate::GetDomainFromURL( | 1292 std::string GpuDataManagerImplPrivate::GetDomainFromURL( |
| 1282 const GURL& url) const { | 1293 const GURL& url) const { |
| 1283 // For the moment, we just use the host, or its IP address, as the | 1294 // For the moment, we just use the host, or its IP address, as the |
| 1284 // entry in the set, rather than trying to figure out the top-level | 1295 // entry in the set, rather than trying to figure out the top-level |
| 1285 // domain. This does mean that a.foo.com and b.foo.com will be | 1296 // domain. This does mean that a.foo.com and b.foo.com will be |
| 1286 // treated independently in the blocking of a given domain, but it | 1297 // treated independently in the blocking of a given domain, but it |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1384 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; | 1395 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; |
| 1385 #if defined(OS_WIN) | 1396 #if defined(OS_WIN) |
| 1386 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; | 1397 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; |
| 1387 #endif | 1398 #endif |
| 1388 complete_gpu_info_already_requested_ = true; | 1399 complete_gpu_info_already_requested_ = true; |
| 1389 // Some observers might be waiting. | 1400 // Some observers might be waiting. |
| 1390 NotifyGpuInfoUpdate(); | 1401 NotifyGpuInfoUpdate(); |
| 1391 } | 1402 } |
| 1392 | 1403 |
| 1393 } // namespace content | 1404 } // namespace content |
| OLD | NEW |