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

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

Issue 10909221: Implement blacklist's force GPU capability in dual GPU machines. (Closed) Base URL: svn://chrome-svn/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
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"
(...skipping 12 matching lines...) Expand all
23 const char kGpuFeatureNameAcceleratedCompositing[] = "accelerated_compositing"; 23 const char kGpuFeatureNameAcceleratedCompositing[] = "accelerated_compositing";
24 const char kGpuFeatureNameWebgl[] = "webgl"; 24 const char kGpuFeatureNameWebgl[] = "webgl";
25 const char kGpuFeatureNameMultisampling[] = "multisampling"; 25 const char kGpuFeatureNameMultisampling[] = "multisampling";
26 const char kGpuFeatureNameFlash3d[] = "flash_3d"; 26 const char kGpuFeatureNameFlash3d[] = "flash_3d";
27 const char kGpuFeatureNameFlashStage3d[] = "flash_stage3d"; 27 const char kGpuFeatureNameFlashStage3d[] = "flash_stage3d";
28 const char kGpuFeatureNameTextureSharing[] = "texture_sharing"; 28 const char kGpuFeatureNameTextureSharing[] = "texture_sharing";
29 const char kGpuFeatureNameAcceleratedVideoDecode[] = "accelerated_video_decode"; 29 const char kGpuFeatureNameAcceleratedVideoDecode[] = "accelerated_video_decode";
30 const char kGpuFeatureNameAll[] = "all"; 30 const char kGpuFeatureNameAll[] = "all";
31 const char kGpuFeatureNameUnknown[] = "unknown"; 31 const char kGpuFeatureNameUnknown[] = "unknown";
32 32
33 const char kGpuSwitchingNameAutomatic[] = "automatic";
34 const char kGpuSwitchingNameForceIntegrated[] = "force_integrated";
35 const char kGpuSwitchingNameForceDiscrete[] = "force_discrete";
36 const char kGpuSwitchingNameUnknown[] = "unknown";
37
38 enum GpuFeatureStatus { 33 enum GpuFeatureStatus {
39 kGpuFeatureEnabled = 0, 34 kGpuFeatureEnabled = 0,
40 kGpuFeatureBlacklisted = 1, 35 kGpuFeatureBlacklisted = 1,
41 kGpuFeatureDisabled = 2, // disabled by user but not blacklisted 36 kGpuFeatureDisabled = 2, // disabled by user but not blacklisted
42 kGpuFeatureNumStatus 37 kGpuFeatureNumStatus
43 }; 38 };
44 39
45 #if defined(OS_WIN) 40 #if defined(OS_WIN)
46 41
47 enum WinSubVersion { 42 enum WinSubVersion {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 if (type & content::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE) 129 if (type & content::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE)
135 matches.push_back(kGpuFeatureNameAcceleratedVideoDecode); 130 matches.push_back(kGpuFeatureNameAcceleratedVideoDecode);
136 if (!matches.size()) 131 if (!matches.size())
137 matches.push_back(kGpuFeatureNameUnknown); 132 matches.push_back(kGpuFeatureNameUnknown);
138 } 133 }
139 return JoinString(matches, ','); 134 return JoinString(matches, ',');
140 } 135 }
141 136
142 GpuSwitchingOption StringToGpuSwitchingOption( 137 GpuSwitchingOption StringToGpuSwitchingOption(
143 const std::string& switching_string) { 138 const std::string& switching_string) {
144 if (switching_string == kGpuSwitchingNameAutomatic) 139 if (switching_string == kGpuSwitchingOptionNameAutomatic)
145 return content::GPU_SWITCHING_AUTOMATIC; 140 return content::GPU_SWITCHING_OPTION_AUTOMATIC;
146 if (switching_string == kGpuSwitchingNameForceIntegrated) 141 if (switching_string == kGpuSwitchingOptionNameForceIntegrated)
147 return content::GPU_SWITCHING_FORCE_INTEGRATED; 142 return content::GPU_SWITCHING_OPTION_FORCE_INTEGRATED;
148 if (switching_string == kGpuSwitchingNameForceDiscrete) 143 if (switching_string == kGpuSwitchingOptionNameForceDiscrete)
149 return content::GPU_SWITCHING_FORCE_DISCRETE; 144 return content::GPU_SWITCHING_OPTION_FORCE_DISCRETE;
150 return content::GPU_SWITCHING_UNKNOWN; 145 return content::GPU_SWITCHING_OPTION_UNKNOWN;
146 }
147
148 std::string GpuSwitchingOptionToString(GpuSwitchingOption option) {
149 switch (option) {
150 case content::GPU_SWITCHING_OPTION_AUTOMATIC:
151 return kGpuSwitchingOptionNameAutomatic;
152 case content::GPU_SWITCHING_OPTION_FORCE_INTEGRATED:
153 return kGpuSwitchingOptionNameForceIntegrated;
154 case content::GPU_SWITCHING_OPTION_FORCE_DISCRETE:
155 return kGpuSwitchingOptionNameForceDiscrete;
156 default:
157 return "unknown";
158 }
151 } 159 }
152 160
153 void UpdateStats(const GpuBlacklist* blacklist, 161 void UpdateStats(const GpuBlacklist* blacklist,
154 uint32 blacklisted_features) { 162 uint32 blacklisted_features) {
155 uint32 max_entry_id = blacklist->max_entry_id(); 163 uint32 max_entry_id = blacklist->max_entry_id();
156 if (max_entry_id == 0) { 164 if (max_entry_id == 0) {
157 // GPU Blacklist was not loaded. No need to go further. 165 // GPU Blacklist was not loaded. No need to go further.
158 return; 166 return;
159 } 167 }
160 168
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 kGpuBlacklistFeatureHistogramNamesWin[i], 237 kGpuBlacklistFeatureHistogramNamesWin[i],
230 1, kNumWinSubVersions * kGpuFeatureNumStatus, 238 1, kNumWinSubVersions * kGpuFeatureNumStatus,
231 kNumWinSubVersions * kGpuFeatureNumStatus + 1, 239 kNumWinSubVersions * kGpuFeatureNumStatus + 1,
232 base::Histogram::kUmaTargetedHistogramFlag); 240 base::Histogram::kUmaTargetedHistogramFlag);
233 histogram_pointer->Add(GetGpuBlacklistHistogramValueWin(value)); 241 histogram_pointer->Add(GetGpuBlacklistHistogramValueWin(value));
234 #endif 242 #endif
235 } 243 }
236 } 244 }
237 245
238 } // namespace gpu_util; 246 } // namespace gpu_util;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698