OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/gpu_util.h" | 5 #include "chrome/browser/gpu_util.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
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" |
(...skipping 22 matching lines...) Expand all Loading... | |
33 | 33 |
34 namespace { | 34 namespace { |
35 | 35 |
36 const char kGpuFeatureNameAccelerated2dCanvas[] = "accelerated_2d_canvas"; | 36 const char kGpuFeatureNameAccelerated2dCanvas[] = "accelerated_2d_canvas"; |
37 const char kGpuFeatureNameAcceleratedCompositing[] = "accelerated_compositing"; | 37 const char kGpuFeatureNameAcceleratedCompositing[] = "accelerated_compositing"; |
38 const char kGpuFeatureNameWebgl[] = "webgl"; | 38 const char kGpuFeatureNameWebgl[] = "webgl"; |
39 const char kGpuFeatureNameMultisampling[] = "multisampling"; | 39 const char kGpuFeatureNameMultisampling[] = "multisampling"; |
40 const char kGpuFeatureNameFlash3d[] = "flash_3d"; | 40 const char kGpuFeatureNameFlash3d[] = "flash_3d"; |
41 const char kGpuFeatureNameFlashStage3d[] = "flash_stage3d"; | 41 const char kGpuFeatureNameFlashStage3d[] = "flash_stage3d"; |
42 const char kGpuFeatureNameTextureSharing[] = "texture_sharing"; | 42 const char kGpuFeatureNameTextureSharing[] = "texture_sharing"; |
43 const char kGpuFeatureNameAcceleratedVideoDecode[] = "accelerated_video_decode"; | |
43 const char kGpuFeatureNameAll[] = "all"; | 44 const char kGpuFeatureNameAll[] = "all"; |
44 const char kGpuFeatureNameUnknown[] = "unknown"; | 45 const char kGpuFeatureNameUnknown[] = "unknown"; |
45 | 46 |
46 enum GpuFeatureStatus { | 47 enum GpuFeatureStatus { |
47 kGpuFeatureEnabled = 0, | 48 kGpuFeatureEnabled = 0, |
48 kGpuFeatureBlacklisted = 1, | 49 kGpuFeatureBlacklisted = 1, |
49 kGpuFeatureDisabled = 2, // disabled by user but not blacklisted | 50 kGpuFeatureDisabled = 2, // disabled by user but not blacklisted |
50 kGpuFeatureNumStatus | 51 kGpuFeatureNumStatus |
51 }; | 52 }; |
52 | 53 |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
251 else if (feature_string == kGpuFeatureNameWebgl) | 252 else if (feature_string == kGpuFeatureNameWebgl) |
252 return content::GPU_FEATURE_TYPE_WEBGL; | 253 return content::GPU_FEATURE_TYPE_WEBGL; |
253 else if (feature_string == kGpuFeatureNameMultisampling) | 254 else if (feature_string == kGpuFeatureNameMultisampling) |
254 return content::GPU_FEATURE_TYPE_MULTISAMPLING; | 255 return content::GPU_FEATURE_TYPE_MULTISAMPLING; |
255 else if (feature_string == kGpuFeatureNameFlash3d) | 256 else if (feature_string == kGpuFeatureNameFlash3d) |
256 return content::GPU_FEATURE_TYPE_FLASH3D; | 257 return content::GPU_FEATURE_TYPE_FLASH3D; |
257 else if (feature_string == kGpuFeatureNameFlashStage3d) | 258 else if (feature_string == kGpuFeatureNameFlashStage3d) |
258 return content::GPU_FEATURE_TYPE_FLASH_STAGE3D; | 259 return content::GPU_FEATURE_TYPE_FLASH_STAGE3D; |
259 else if (feature_string == kGpuFeatureNameTextureSharing) | 260 else if (feature_string == kGpuFeatureNameTextureSharing) |
260 return content::GPU_FEATURE_TYPE_TEXTURE_SHARING; | 261 return content::GPU_FEATURE_TYPE_TEXTURE_SHARING; |
262 else if (feature_string == kGpuFeatureNameAcceleratedVideoDecode) | |
263 return content::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE; | |
261 else if (feature_string == kGpuFeatureNameAll) | 264 else if (feature_string == kGpuFeatureNameAll) |
262 return content::GPU_FEATURE_TYPE_ALL; | 265 return content::GPU_FEATURE_TYPE_ALL; |
263 return content::GPU_FEATURE_TYPE_UNKNOWN; | 266 return content::GPU_FEATURE_TYPE_UNKNOWN; |
264 } | 267 } |
265 | 268 |
266 std::string GpuFeatureTypeToString(GpuFeatureType type) { | 269 std::string GpuFeatureTypeToString(GpuFeatureType type) { |
267 std::vector<std::string> matches; | 270 std::vector<std::string> matches; |
268 if (type == content::GPU_FEATURE_TYPE_ALL) { | 271 if (type == content::GPU_FEATURE_TYPE_ALL) { |
269 matches.push_back(kGpuFeatureNameAll); | 272 matches.push_back(kGpuFeatureNameAll); |
270 } else { | 273 } else { |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
364 " command line.", | 367 " command line.", |
365 false | 368 false |
366 }, | 369 }, |
367 { | 370 { |
368 "texture_sharing", | 371 "texture_sharing", |
369 flags & content::GPU_FEATURE_TYPE_TEXTURE_SHARING, | 372 flags & content::GPU_FEATURE_TYPE_TEXTURE_SHARING, |
370 command_line.HasSwitch(switches::kDisableImageTransportSurface), | 373 command_line.HasSwitch(switches::kDisableImageTransportSurface), |
371 "Sharing textures between processes has been disabled, either via" | 374 "Sharing textures between processes has been disabled, either via" |
372 " about:flags or command line.", | 375 " about:flags or command line.", |
373 false | 376 false |
377 }, | |
378 { | |
379 "video_decode", | |
380 flags & content::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE, | |
381 command_line.HasSwitch(switches::kDisableAcceleratedVideoDecode), | |
382 "Accelerated video decode has been disabled, either via about:flags" | |
383 " or command line.", | |
384 true | |
Ami GONE FROM CHROMIUM
2012/07/30 23:38:29
Not sure what the "true" here means; if it means S
Zhenyao Mo
2012/07/30 23:40:10
It means it falls back to SW path.
| |
374 } | 385 } |
375 }; | 386 }; |
376 const size_t kNumFeatures = sizeof(kGpuFeatureInfo) / sizeof(GpuFeatureInfo); | 387 const size_t kNumFeatures = sizeof(kGpuFeatureInfo) / sizeof(GpuFeatureInfo); |
377 | 388 |
378 // Build the feature_status field. | 389 // Build the feature_status field. |
379 { | 390 { |
380 ListValue* feature_status_list = new ListValue(); | 391 ListValue* feature_status_list = new ListValue(); |
381 | 392 |
382 for (size_t i = 0; i < kNumFeatures; ++i) { | 393 for (size_t i = 0; i < kNumFeatures; ++i) { |
383 std::string status; | 394 std::string status; |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
614 kGpuBlacklistFeatureHistogramNamesWin[i], | 625 kGpuBlacklistFeatureHistogramNamesWin[i], |
615 1, kNumWinSubVersions * kGpuFeatureNumStatus, | 626 1, kNumWinSubVersions * kGpuFeatureNumStatus, |
616 kNumWinSubVersions * kGpuFeatureNumStatus + 1, | 627 kNumWinSubVersions * kGpuFeatureNumStatus + 1, |
617 base::Histogram::kUmaTargetedHistogramFlag); | 628 base::Histogram::kUmaTargetedHistogramFlag); |
618 histogram_pointer->Add(GetGpuBlacklistHistogramValueWin(value)); | 629 histogram_pointer->Add(GetGpuBlacklistHistogramValueWin(value)); |
619 #endif | 630 #endif |
620 } | 631 } |
621 } | 632 } |
622 | 633 |
623 } // namespace gpu_util; | 634 } // namespace gpu_util; |
OLD | NEW |