| 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 "content/browser/gpu/gpu_util.h" | 5 #include "content/browser/gpu/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/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 const char kGpuFeatureNameAcceleratedCompositing[] = "accelerated_compositing"; | 22 const char kGpuFeatureNameAcceleratedCompositing[] = "accelerated_compositing"; |
| 23 const char kGpuFeatureNameWebgl[] = "webgl"; | 23 const char kGpuFeatureNameWebgl[] = "webgl"; |
| 24 const char kGpuFeatureNameMultisampling[] = "multisampling"; | 24 const char kGpuFeatureNameMultisampling[] = "multisampling"; |
| 25 const char kGpuFeatureNameFlash3d[] = "flash_3d"; | 25 const char kGpuFeatureNameFlash3d[] = "flash_3d"; |
| 26 const char kGpuFeatureNameFlashStage3d[] = "flash_stage3d"; | 26 const char kGpuFeatureNameFlashStage3d[] = "flash_stage3d"; |
| 27 const char kGpuFeatureNameTextureSharing[] = "texture_sharing"; | 27 const char kGpuFeatureNameTextureSharing[] = "texture_sharing"; |
| 28 const char kGpuFeatureNameAcceleratedVideoDecode[] = "accelerated_video_decode"; | 28 const char kGpuFeatureNameAcceleratedVideoDecode[] = "accelerated_video_decode"; |
| 29 const char kGpuFeatureName3dCss[] = "3d_css"; | 29 const char kGpuFeatureName3dCss[] = "3d_css"; |
| 30 const char kGpuFeatureNameAcceleratedVideo[] = "accelerated_video"; | 30 const char kGpuFeatureNameAcceleratedVideo[] = "accelerated_video"; |
| 31 const char kGpuFeatureNamePanelFitting[] = "panel_fitting"; | 31 const char kGpuFeatureNamePanelFitting[] = "panel_fitting"; |
| 32 const char kGpuFeatureNameForceCompositingMode[] = "force_compositing_mode"; |
| 32 const char kGpuFeatureNameAll[] = "all"; | 33 const char kGpuFeatureNameAll[] = "all"; |
| 33 const char kGpuFeatureNameUnknown[] = "unknown"; | 34 const char kGpuFeatureNameUnknown[] = "unknown"; |
| 34 | 35 |
| 35 enum GpuFeatureStatus { | 36 enum GpuFeatureStatus { |
| 36 kGpuFeatureEnabled = 0, | 37 kGpuFeatureEnabled = 0, |
| 37 kGpuFeatureBlacklisted = 1, | 38 kGpuFeatureBlacklisted = 1, |
| 38 kGpuFeatureDisabled = 2, // disabled by user but not blacklisted | 39 kGpuFeatureDisabled = 2, // disabled by user but not blacklisted |
| 39 kGpuFeatureNumStatus | 40 kGpuFeatureNumStatus |
| 40 }; | 41 }; |
| 41 | 42 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 if (feature_string == kGpuFeatureNameTextureSharing) | 102 if (feature_string == kGpuFeatureNameTextureSharing) |
| 102 return GPU_FEATURE_TYPE_TEXTURE_SHARING; | 103 return GPU_FEATURE_TYPE_TEXTURE_SHARING; |
| 103 if (feature_string == kGpuFeatureNameAcceleratedVideoDecode) | 104 if (feature_string == kGpuFeatureNameAcceleratedVideoDecode) |
| 104 return GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE; | 105 return GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE; |
| 105 if (feature_string == kGpuFeatureName3dCss) | 106 if (feature_string == kGpuFeatureName3dCss) |
| 106 return GPU_FEATURE_TYPE_3D_CSS; | 107 return GPU_FEATURE_TYPE_3D_CSS; |
| 107 if (feature_string == kGpuFeatureNameAcceleratedVideo) | 108 if (feature_string == kGpuFeatureNameAcceleratedVideo) |
| 108 return GPU_FEATURE_TYPE_ACCELERATED_VIDEO; | 109 return GPU_FEATURE_TYPE_ACCELERATED_VIDEO; |
| 109 if (feature_string == kGpuFeatureNamePanelFitting) | 110 if (feature_string == kGpuFeatureNamePanelFitting) |
| 110 return GPU_FEATURE_TYPE_PANEL_FITTING; | 111 return GPU_FEATURE_TYPE_PANEL_FITTING; |
| 112 if (feature_string == kGpuFeatureNameForceCompositingMode) |
| 113 return GPU_FEATURE_TYPE_FORCE_COMPOSITING_MODE; |
| 111 if (feature_string == kGpuFeatureNameAll) | 114 if (feature_string == kGpuFeatureNameAll) |
| 112 return GPU_FEATURE_TYPE_ALL; | 115 return GPU_FEATURE_TYPE_ALL; |
| 113 return GPU_FEATURE_TYPE_UNKNOWN; | 116 return GPU_FEATURE_TYPE_UNKNOWN; |
| 114 } | 117 } |
| 115 | 118 |
| 116 std::string GpuFeatureTypeToString(GpuFeatureType type) { | 119 std::string GpuFeatureTypeToString(GpuFeatureType type) { |
| 117 std::vector<std::string> matches; | 120 std::vector<std::string> matches; |
| 118 if (type == GPU_FEATURE_TYPE_ALL) { | 121 if (type == GPU_FEATURE_TYPE_ALL) { |
| 119 matches.push_back(kGpuFeatureNameAll); | 122 matches.push_back(kGpuFeatureNameAll); |
| 120 } else { | 123 } else { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 133 if (type & GPU_FEATURE_TYPE_TEXTURE_SHARING) | 136 if (type & GPU_FEATURE_TYPE_TEXTURE_SHARING) |
| 134 matches.push_back(kGpuFeatureNameTextureSharing); | 137 matches.push_back(kGpuFeatureNameTextureSharing); |
| 135 if (type & GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE) | 138 if (type & GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE) |
| 136 matches.push_back(kGpuFeatureNameAcceleratedVideoDecode); | 139 matches.push_back(kGpuFeatureNameAcceleratedVideoDecode); |
| 137 if (type & GPU_FEATURE_TYPE_3D_CSS) | 140 if (type & GPU_FEATURE_TYPE_3D_CSS) |
| 138 matches.push_back(kGpuFeatureName3dCss); | 141 matches.push_back(kGpuFeatureName3dCss); |
| 139 if (type & GPU_FEATURE_TYPE_ACCELERATED_VIDEO) | 142 if (type & GPU_FEATURE_TYPE_ACCELERATED_VIDEO) |
| 140 matches.push_back(kGpuFeatureNameAcceleratedVideo); | 143 matches.push_back(kGpuFeatureNameAcceleratedVideo); |
| 141 if (type & GPU_FEATURE_TYPE_PANEL_FITTING) | 144 if (type & GPU_FEATURE_TYPE_PANEL_FITTING) |
| 142 matches.push_back(kGpuFeatureNamePanelFitting); | 145 matches.push_back(kGpuFeatureNamePanelFitting); |
| 146 if (type & GPU_FEATURE_TYPE_FORCE_COMPOSITING_MODE) |
| 147 matches.push_back(kGpuFeatureNameForceCompositingMode); |
| 143 if (!matches.size()) | 148 if (!matches.size()) |
| 144 matches.push_back(kGpuFeatureNameUnknown); | 149 matches.push_back(kGpuFeatureNameUnknown); |
| 145 } | 150 } |
| 146 return JoinString(matches, ','); | 151 return JoinString(matches, ','); |
| 147 } | 152 } |
| 148 | 153 |
| 149 GpuSwitchingOption StringToGpuSwitchingOption( | 154 GpuSwitchingOption StringToGpuSwitchingOption( |
| 150 const std::string& switching_string) { | 155 const std::string& switching_string) { |
| 151 if (switching_string == switches::kGpuSwitchingOptionNameAutomatic) | 156 if (switching_string == switches::kGpuSwitchingOptionNameAutomatic) |
| 152 return GPU_SWITCHING_OPTION_AUTOMATIC; | 157 return GPU_SWITCHING_OPTION_AUTOMATIC; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 kGpuBlacklistFeatureHistogramNamesWin[i], | 254 kGpuBlacklistFeatureHistogramNamesWin[i], |
| 250 1, kNumWinSubVersions * kGpuFeatureNumStatus, | 255 1, kNumWinSubVersions * kGpuFeatureNumStatus, |
| 251 kNumWinSubVersions * kGpuFeatureNumStatus + 1, | 256 kNumWinSubVersions * kGpuFeatureNumStatus + 1, |
| 252 base::Histogram::kUmaTargetedHistogramFlag); | 257 base::Histogram::kUmaTargetedHistogramFlag); |
| 253 histogram_pointer->Add(GetGpuBlacklistHistogramValueWin(value)); | 258 histogram_pointer->Add(GetGpuBlacklistHistogramValueWin(value)); |
| 254 #endif | 259 #endif |
| 255 } | 260 } |
| 256 } | 261 } |
| 257 | 262 |
| 258 } // namespace content | 263 } // namespace content |
| OLD | NEW |