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

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

Issue 10909242: Add "panel_fitting" GPU feature type and use it for mirror mode. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Reorganized code per oshima's suggestion. 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
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 16
17 using content::GpuFeatureType; 17 using content::GpuFeatureType;
18 18
19 namespace { 19 namespace {
20 20
21 const char kGpuFeatureNameAccelerated2dCanvas[] = "accelerated_2d_canvas"; 21 const char kGpuFeatureNameAccelerated2dCanvas[] = "accelerated_2d_canvas";
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 kGpuFeatureNamePanelFitting[] = "panel_fitting";
29 const char kGpuFeatureNameAll[] = "all"; 30 const char kGpuFeatureNameAll[] = "all";
30 const char kGpuFeatureNameUnknown[] = "unknown"; 31 const char kGpuFeatureNameUnknown[] = "unknown";
31 32
32 enum GpuFeatureStatus { 33 enum GpuFeatureStatus {
33 kGpuFeatureEnabled = 0, 34 kGpuFeatureEnabled = 0,
34 kGpuFeatureBlacklisted = 1, 35 kGpuFeatureBlacklisted = 1,
35 kGpuFeatureDisabled = 2, // disabled by user but not blacklisted 36 kGpuFeatureDisabled = 2, // disabled by user but not blacklisted
36 kGpuFeatureNumStatus 37 kGpuFeatureNumStatus
37 }; 38 };
38 39
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 else if (feature_string == kGpuFeatureNameMultisampling) 95 else if (feature_string == kGpuFeatureNameMultisampling)
95 return content::GPU_FEATURE_TYPE_MULTISAMPLING; 96 return content::GPU_FEATURE_TYPE_MULTISAMPLING;
96 else if (feature_string == kGpuFeatureNameFlash3d) 97 else if (feature_string == kGpuFeatureNameFlash3d)
97 return content::GPU_FEATURE_TYPE_FLASH3D; 98 return content::GPU_FEATURE_TYPE_FLASH3D;
98 else if (feature_string == kGpuFeatureNameFlashStage3d) 99 else if (feature_string == kGpuFeatureNameFlashStage3d)
99 return content::GPU_FEATURE_TYPE_FLASH_STAGE3D; 100 return content::GPU_FEATURE_TYPE_FLASH_STAGE3D;
100 else if (feature_string == kGpuFeatureNameTextureSharing) 101 else if (feature_string == kGpuFeatureNameTextureSharing)
101 return content::GPU_FEATURE_TYPE_TEXTURE_SHARING; 102 return content::GPU_FEATURE_TYPE_TEXTURE_SHARING;
102 else if (feature_string == kGpuFeatureNameAcceleratedVideoDecode) 103 else if (feature_string == kGpuFeatureNameAcceleratedVideoDecode)
103 return content::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE; 104 return content::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE;
105 else if (feature_string == kGpuFeatureNamePanelFitting)
106 return content::GPU_FEATURE_TYPE_PANEL_FITTING;
104 else if (feature_string == kGpuFeatureNameAll) 107 else if (feature_string == kGpuFeatureNameAll)
105 return content::GPU_FEATURE_TYPE_ALL; 108 return content::GPU_FEATURE_TYPE_ALL;
106 return content::GPU_FEATURE_TYPE_UNKNOWN; 109 return content::GPU_FEATURE_TYPE_UNKNOWN;
107 } 110 }
108 111
109 std::string GpuFeatureTypeToString(GpuFeatureType type) { 112 std::string GpuFeatureTypeToString(GpuFeatureType type) {
110 std::vector<std::string> matches; 113 std::vector<std::string> matches;
111 if (type == content::GPU_FEATURE_TYPE_ALL) { 114 if (type == content::GPU_FEATURE_TYPE_ALL) {
112 matches.push_back(kGpuFeatureNameAll); 115 matches.push_back(kGpuFeatureNameAll);
113 } else { 116 } else {
114 if (type & content::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS) 117 if (type & content::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS)
115 matches.push_back(kGpuFeatureNameAccelerated2dCanvas); 118 matches.push_back(kGpuFeatureNameAccelerated2dCanvas);
116 if (type & content::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING) 119 if (type & content::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING)
117 matches.push_back(kGpuFeatureNameAcceleratedCompositing); 120 matches.push_back(kGpuFeatureNameAcceleratedCompositing);
118 if (type & content::GPU_FEATURE_TYPE_WEBGL) 121 if (type & content::GPU_FEATURE_TYPE_WEBGL)
119 matches.push_back(kGpuFeatureNameWebgl); 122 matches.push_back(kGpuFeatureNameWebgl);
120 if (type & content::GPU_FEATURE_TYPE_MULTISAMPLING) 123 if (type & content::GPU_FEATURE_TYPE_MULTISAMPLING)
121 matches.push_back(kGpuFeatureNameMultisampling); 124 matches.push_back(kGpuFeatureNameMultisampling);
122 if (type & content::GPU_FEATURE_TYPE_FLASH3D) 125 if (type & content::GPU_FEATURE_TYPE_FLASH3D)
123 matches.push_back(kGpuFeatureNameFlash3d); 126 matches.push_back(kGpuFeatureNameFlash3d);
124 if (type & content::GPU_FEATURE_TYPE_FLASH_STAGE3D) 127 if (type & content::GPU_FEATURE_TYPE_FLASH_STAGE3D)
125 matches.push_back(kGpuFeatureNameFlashStage3d); 128 matches.push_back(kGpuFeatureNameFlashStage3d);
126 if (type & content::GPU_FEATURE_TYPE_TEXTURE_SHARING) 129 if (type & content::GPU_FEATURE_TYPE_TEXTURE_SHARING)
127 matches.push_back(kGpuFeatureNameTextureSharing); 130 matches.push_back(kGpuFeatureNameTextureSharing);
128 if (type & content::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE) 131 if (type & content::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE)
129 matches.push_back(kGpuFeatureNameAcceleratedVideoDecode); 132 matches.push_back(kGpuFeatureNameAcceleratedVideoDecode);
133 if (type & content::GPU_FEATURE_TYPE_PANEL_FITTING)
134 matches.push_back(kGpuFeatureNamePanelFitting);
Zhenyao Mo 2012/09/18 19:28:55 Please also update the unit test.
ynovikov 2012/09/21 18:48:27 Done.
130 if (!matches.size()) 135 if (!matches.size())
131 matches.push_back(kGpuFeatureNameUnknown); 136 matches.push_back(kGpuFeatureNameUnknown);
132 } 137 }
133 return JoinString(matches, ','); 138 return JoinString(matches, ',');
134 } 139 }
135 140
136 void UpdateStats(const GpuBlacklist* blacklist, 141 void UpdateStats(const GpuBlacklist* blacklist,
137 uint32 blacklisted_features) { 142 uint32 blacklisted_features) {
138 uint32 max_entry_id = blacklist->max_entry_id(); 143 uint32 max_entry_id = blacklist->max_entry_id();
139 if (max_entry_id == 0) { 144 if (max_entry_id == 0) {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 kGpuBlacklistFeatureHistogramNamesWin[i], 219 kGpuBlacklistFeatureHistogramNamesWin[i],
215 1, kNumWinSubVersions * kGpuFeatureNumStatus, 220 1, kNumWinSubVersions * kGpuFeatureNumStatus,
216 kNumWinSubVersions * kGpuFeatureNumStatus + 1, 221 kNumWinSubVersions * kGpuFeatureNumStatus + 1,
217 base::Histogram::kUmaTargetedHistogramFlag); 222 base::Histogram::kUmaTargetedHistogramFlag);
218 histogram_pointer->Add(GetGpuBlacklistHistogramValueWin(value)); 223 histogram_pointer->Add(GetGpuBlacklistHistogramValueWin(value));
219 #endif 224 #endif
220 } 225 }
221 } 226 }
222 227
223 } // namespace gpu_util; 228 } // namespace gpu_util;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698