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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
384 std::set<int> feature_diffs; | 384 std::set<int> feature_diffs; |
385 std::set_difference(blacklisted_features_.begin(), | 385 std::set_difference(blacklisted_features_.begin(), |
386 blacklisted_features_.end(), | 386 blacklisted_features_.end(), |
387 preliminary_blacklisted_features_.begin(), | 387 preliminary_blacklisted_features_.begin(), |
388 preliminary_blacklisted_features_.end(), | 388 preliminary_blacklisted_features_.end(), |
389 std::inserter(feature_diffs, feature_diffs.begin())); | 389 std::inserter(feature_diffs, feature_diffs.begin())); |
390 if (feature_diffs.size()) { | 390 if (feature_diffs.size()) { |
391 // TODO(zmo): Other features might also be OK to ignore here. | 391 // TODO(zmo): Other features might also be OK to ignore here. |
392 feature_diffs.erase(gpu::GPU_FEATURE_TYPE_ACCELERATED_WEBGL); | 392 feature_diffs.erase(gpu::GPU_FEATURE_TYPE_ACCELERATED_WEBGL); |
393 feature_diffs.erase(gpu::GPU_FEATURE_TYPE_WEBGL2); | 393 feature_diffs.erase(gpu::GPU_FEATURE_TYPE_WEBGL2); |
394 feature_diffs.erase(gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS); | |
394 } | 395 } |
395 if (feature_diffs.size()) { | 396 if (feature_diffs.size()) { |
396 if (reason) { | 397 if (reason) { |
397 *reason = "Features are disabled on full but not preliminary GPU info."; | 398 *reason = "Features are disabled on full but not preliminary GPU info."; |
398 } | 399 } |
399 return false; | 400 return false; |
400 } | 401 } |
401 } | 402 } |
402 | 403 |
403 if (blacklisted_features_.size() == gpu::NUMBER_OF_GPU_FEATURE_TYPES) { | 404 if (blacklisted_features_.size() == gpu::NUMBER_OF_GPU_FEATURE_TYPES) { |
(...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1264 } | 1265 } |
1265 | 1266 |
1266 void GpuDataManagerImplPrivate::EnableSwiftShaderIfNecessary() { | 1267 void GpuDataManagerImplPrivate::EnableSwiftShaderIfNecessary() { |
1267 #if BUILDFLAG(ENABLE_SWIFTSHADER) | 1268 #if BUILDFLAG(ENABLE_SWIFTSHADER) |
1268 if ((!GpuAccessAllowed(nullptr) || | 1269 if ((!GpuAccessAllowed(nullptr) || |
1269 blacklisted_features_.count(gpu::GPU_FEATURE_TYPE_ACCELERATED_WEBGL)) && | 1270 blacklisted_features_.count(gpu::GPU_FEATURE_TYPE_ACCELERATED_WEBGL)) && |
1270 !base::CommandLine::ForCurrentProcess()->HasSwitch( | 1271 !base::CommandLine::ForCurrentProcess()->HasSwitch( |
1271 switches::kDisableSoftwareRasterizer)) { | 1272 switches::kDisableSoftwareRasterizer)) { |
1272 use_swiftshader_ = true; | 1273 use_swiftshader_ = true; |
1273 | 1274 |
1274 // Remove all previously recorded GPU info | 1275 // Adjust GPU info for SwiftShader. Most of this data only affects the |
1275 gpu_info_ = gpu::GPUInfo(); | 1276 // chrome://gpu page, so it doesn't require querying the implementation. |
1276 // Set some basic info to identify the GPU as SwiftShader | 1277 // It is important to reset the video and image decode/encode capabilities, |
1278 // to prevent attempts to use them (crbug.com/702417). | |
piman
2017/04/10 23:58:55
Could we add a method on GPUInfo to do these thing
| |
1279 gpu_info_.driver_vendor = "Google Inc."; | |
1280 gpu_info_.driver_version = "3.3.0.2"; | |
1281 gpu_info_.driver_date = "2017/04/07"; | |
1282 gpu_info_.pixel_shader_version = "3.0"; | |
1283 gpu_info_.vertex_shader_version = "3.0"; | |
1284 gpu_info_.max_msaa_samples = "4"; | |
1285 gpu_info_.gl_version = "OpenGL ES 2.0 SwiftShader"; | |
1277 gpu_info_.gl_vendor = "Google Inc."; | 1286 gpu_info_.gl_vendor = "Google Inc."; |
1278 gpu_info_.gl_renderer = "Google SwiftShader"; | 1287 gpu_info_.gl_renderer = "Google SwiftShader"; |
1288 gpu_info_.gl_extensions = ""; | |
1289 gpu_info_.gl_reset_notification_strategy = 0; | |
1279 gpu_info_.software_rendering = true; | 1290 gpu_info_.software_rendering = true; |
1291 gpu_info_.passthrough_cmd_decoder = false; | |
1292 gpu_info_.supports_overlays = false; | |
1293 gpu_info_.basic_info_state = gpu::kCollectInfoNone; | |
1294 gpu_info_.context_info_state = gpu::kCollectInfoNone; | |
piman
2017/04/10 23:58:55
nit: kCollectInfoSuccess for both of these, since
| |
1295 gpu_info_.video_decode_accelerator_capabilities = {}; | |
1296 gpu_info_.video_encode_accelerator_supported_profiles = {}; | |
1297 gpu_info_.jpeg_decode_accelerator_supported = false; | |
1298 | |
1299 gpu_info_.gpu.active = false; | |
1300 for (auto& secondary_gpu : gpu_info_.secondary_gpus) | |
1301 secondary_gpu.active = false; | |
1280 | 1302 |
1281 for (auto& status : gpu_feature_info_.status_values) | 1303 for (auto& status : gpu_feature_info_.status_values) |
1282 status = gpu::kGpuFeatureStatusBlacklisted; | 1304 status = gpu::kGpuFeatureStatusBlacklisted; |
1283 } | 1305 } |
1284 #endif | 1306 #endif |
1285 } | 1307 } |
1286 | 1308 |
1287 std::string GpuDataManagerImplPrivate::GetDomainFromURL( | 1309 std::string GpuDataManagerImplPrivate::GetDomainFromURL( |
1288 const GURL& url) const { | 1310 const GURL& url) const { |
1289 // For the moment, we just use the host, or its IP address, as the | 1311 // For the moment, we just use the host, or its IP address, as the |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1390 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; | 1412 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; |
1391 #if defined(OS_WIN) | 1413 #if defined(OS_WIN) |
1392 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; | 1414 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; |
1393 #endif | 1415 #endif |
1394 complete_gpu_info_already_requested_ = true; | 1416 complete_gpu_info_already_requested_ = true; |
1395 // Some observers might be waiting. | 1417 // Some observers might be waiting. |
1396 NotifyGpuInfoUpdate(); | 1418 NotifyGpuInfoUpdate(); |
1397 } | 1419 } |
1398 | 1420 |
1399 } // namespace content | 1421 } // namespace content |
OLD | NEW |