Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(799)

Side by Side Diff: content/browser/gpu/gpu_util.cc

Issue 10959061: Revert 158076 - Implement blacklist's force GPU capability in dual GPU machines. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/gpu/gpu_util.h ('k') | content/browser/gpu/gpu_util_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Deleted: svn:mergeinfo
OLDNEW
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"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
12 #include "base/sys_info.h" 12 #include "base/sys_info.h"
13 #include "base/version.h" 13 #include "base/version.h"
14 #include "content/browser/gpu/gpu_blacklist.h" 14 #include "content/browser/gpu/gpu_blacklist.h"
15 #include "content/public/common/content_switches.h" 15 #include "content/public/common/content_switches.h"
16 #include "ui/gl/gl_switches.h"
17 16
18 using content::GpuFeatureType; 17 using content::GpuFeatureType;
19 using content::GpuSwitchingOption; 18 using content::GpuSwitchingOption;
20 19
21 namespace { 20 namespace {
22 21
23 const char kGpuFeatureNameAccelerated2dCanvas[] = "accelerated_2d_canvas"; 22 const char kGpuFeatureNameAccelerated2dCanvas[] = "accelerated_2d_canvas";
24 const char kGpuFeatureNameAcceleratedCompositing[] = "accelerated_compositing"; 23 const char kGpuFeatureNameAcceleratedCompositing[] = "accelerated_compositing";
25 const char kGpuFeatureNameWebgl[] = "webgl"; 24 const char kGpuFeatureNameWebgl[] = "webgl";
26 const char kGpuFeatureNameMultisampling[] = "multisampling"; 25 const char kGpuFeatureNameMultisampling[] = "multisampling";
27 const char kGpuFeatureNameFlash3d[] = "flash_3d"; 26 const char kGpuFeatureNameFlash3d[] = "flash_3d";
28 const char kGpuFeatureNameFlashStage3d[] = "flash_stage3d"; 27 const char kGpuFeatureNameFlashStage3d[] = "flash_stage3d";
29 const char kGpuFeatureNameTextureSharing[] = "texture_sharing"; 28 const char kGpuFeatureNameTextureSharing[] = "texture_sharing";
30 const char kGpuFeatureNameAcceleratedVideoDecode[] = "accelerated_video_decode"; 29 const char kGpuFeatureNameAcceleratedVideoDecode[] = "accelerated_video_decode";
31 const char kGpuFeatureNameAll[] = "all"; 30 const char kGpuFeatureNameAll[] = "all";
32 const char kGpuFeatureNameUnknown[] = "unknown"; 31 const char kGpuFeatureNameUnknown[] = "unknown";
33 32
33 const char kGpuSwitchingNameAutomatic[] = "automatic";
34 const char kGpuSwitchingNameForceIntegrated[] = "force_integrated";
35 const char kGpuSwitchingNameForceDiscrete[] = "force_discrete";
36 const char kGpuSwitchingNameUnknown[] = "unknown";
37
34 enum GpuFeatureStatus { 38 enum GpuFeatureStatus {
35 kGpuFeatureEnabled = 0, 39 kGpuFeatureEnabled = 0,
36 kGpuFeatureBlacklisted = 1, 40 kGpuFeatureBlacklisted = 1,
37 kGpuFeatureDisabled = 2, // disabled by user but not blacklisted 41 kGpuFeatureDisabled = 2, // disabled by user but not blacklisted
38 kGpuFeatureNumStatus 42 kGpuFeatureNumStatus
39 }; 43 };
40 44
41 #if defined(OS_WIN) 45 #if defined(OS_WIN)
42 46
43 enum WinSubVersion { 47 enum WinSubVersion {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 if (type & content::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE) 134 if (type & content::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE)
131 matches.push_back(kGpuFeatureNameAcceleratedVideoDecode); 135 matches.push_back(kGpuFeatureNameAcceleratedVideoDecode);
132 if (!matches.size()) 136 if (!matches.size())
133 matches.push_back(kGpuFeatureNameUnknown); 137 matches.push_back(kGpuFeatureNameUnknown);
134 } 138 }
135 return JoinString(matches, ','); 139 return JoinString(matches, ',');
136 } 140 }
137 141
138 GpuSwitchingOption StringToGpuSwitchingOption( 142 GpuSwitchingOption StringToGpuSwitchingOption(
139 const std::string& switching_string) { 143 const std::string& switching_string) {
140 if (switching_string == switches::kGpuSwitchingOptionNameAutomatic) 144 if (switching_string == kGpuSwitchingNameAutomatic)
141 return content::GPU_SWITCHING_OPTION_AUTOMATIC; 145 return content::GPU_SWITCHING_AUTOMATIC;
142 if (switching_string == switches::kGpuSwitchingOptionNameForceIntegrated) 146 if (switching_string == kGpuSwitchingNameForceIntegrated)
143 return content::GPU_SWITCHING_OPTION_FORCE_INTEGRATED; 147 return content::GPU_SWITCHING_FORCE_INTEGRATED;
144 if (switching_string == switches::kGpuSwitchingOptionNameForceDiscrete) 148 if (switching_string == kGpuSwitchingNameForceDiscrete)
145 return content::GPU_SWITCHING_OPTION_FORCE_DISCRETE; 149 return content::GPU_SWITCHING_FORCE_DISCRETE;
146 return content::GPU_SWITCHING_OPTION_UNKNOWN; 150 return content::GPU_SWITCHING_UNKNOWN;
147 }
148
149 std::string GpuSwitchingOptionToString(GpuSwitchingOption option) {
150 switch (option) {
151 case content::GPU_SWITCHING_OPTION_AUTOMATIC:
152 return switches::kGpuSwitchingOptionNameAutomatic;
153 case content::GPU_SWITCHING_OPTION_FORCE_INTEGRATED:
154 return switches::kGpuSwitchingOptionNameForceIntegrated;
155 case content::GPU_SWITCHING_OPTION_FORCE_DISCRETE:
156 return switches::kGpuSwitchingOptionNameForceDiscrete;
157 default:
158 return "unknown";
159 }
160 } 151 }
161 152
162 void UpdateStats(const GpuBlacklist* blacklist, 153 void UpdateStats(const GpuBlacklist* blacklist,
163 uint32 blacklisted_features) { 154 uint32 blacklisted_features) {
164 uint32 max_entry_id = blacklist->max_entry_id(); 155 uint32 max_entry_id = blacklist->max_entry_id();
165 if (max_entry_id == 0) { 156 if (max_entry_id == 0) {
166 // GPU Blacklist was not loaded. No need to go further. 157 // GPU Blacklist was not loaded. No need to go further.
167 return; 158 return;
168 } 159 }
169 160
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 kGpuBlacklistFeatureHistogramNamesWin[i], 229 kGpuBlacklistFeatureHistogramNamesWin[i],
239 1, kNumWinSubVersions * kGpuFeatureNumStatus, 230 1, kNumWinSubVersions * kGpuFeatureNumStatus,
240 kNumWinSubVersions * kGpuFeatureNumStatus + 1, 231 kNumWinSubVersions * kGpuFeatureNumStatus + 1,
241 base::Histogram::kUmaTargetedHistogramFlag); 232 base::Histogram::kUmaTargetedHistogramFlag);
242 histogram_pointer->Add(GetGpuBlacklistHistogramValueWin(value)); 233 histogram_pointer->Add(GetGpuBlacklistHistogramValueWin(value));
243 #endif 234 #endif
244 } 235 }
245 } 236 }
246 237
247 } // namespace gpu_util; 238 } // namespace gpu_util;
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_util.h ('k') | content/browser/gpu/gpu_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698