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 #ifndef GPU_CONFIG_GPU_INFO_H_ | 5 #ifndef GPU_CONFIG_GPU_INFO_H_ |
6 #define GPU_CONFIG_GPU_INFO_H_ | 6 #define GPU_CONFIG_GPU_INFO_H_ |
7 | 7 |
8 // Provides access to the GPU information for the system | 8 // Provides access to the GPU information for the system |
9 // on which chrome is currently running. | 9 // on which chrome is currently running. |
10 | 10 |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
16 #include "base/version.h" | 16 #include "base/version.h" |
17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
18 #include "gpu/config/dx_diag_node.h" | 18 #include "gpu/config/dx_diag_node.h" |
19 #include "gpu/config/gpu_performance_stats.h" | 19 #include "gpu/config/gpu_performance_stats.h" |
20 #include "gpu/gpu_export.h" | 20 #include "gpu/gpu_export.h" |
21 #include "media/video/video_encode_accelerator.h" | 21 #include "ui/gfx/geometry/size.h" |
22 | 22 |
23 namespace gpu { | 23 namespace gpu { |
24 | 24 |
25 // Result for the various Collect*Info* functions below. | 25 // Result for the various Collect*Info* functions below. |
26 // Fatal failures are for cases where we can't create a context at all or | 26 // Fatal failures are for cases where we can't create a context at all or |
27 // something, making the use of the GPU impossible. | 27 // something, making the use of the GPU impossible. |
28 // Non-fatal failures are for cases where we could gather most info, but maybe | 28 // Non-fatal failures are for cases where we could gather most info, but maybe |
29 // some is missing (e.g. unable to parse a version string or to detect the exact | 29 // some is missing (e.g. unable to parse a version string or to detect the exact |
30 // model). | 30 // model). |
31 enum CollectInfoResult { | 31 enum CollectInfoResult { |
32 kCollectInfoNone = 0, | 32 kCollectInfoNone = 0, |
33 kCollectInfoSuccess = 1, | 33 kCollectInfoSuccess = 1, |
34 kCollectInfoNonFatalFailure = 2, | 34 kCollectInfoNonFatalFailure = 2, |
35 kCollectInfoFatalFailure = 3 | 35 kCollectInfoFatalFailure = 3 |
36 }; | 36 }; |
37 | 37 |
| 38 // Video profile. This *must* match media::VideoCodecProfile. |
| 39 enum VideoCodecProfile { |
| 40 VIDEO_CODEC_PROFILE_UNKNOWN = -1, |
| 41 VIDEO_CODEC_PROFILE_MIN = VIDEO_CODEC_PROFILE_UNKNOWN, |
| 42 H264PROFILE_BASELINE = 0, |
| 43 H264PROFILE_MAIN = 1, |
| 44 H264PROFILE_EXTENDED = 2, |
| 45 H264PROFILE_HIGH = 3, |
| 46 H264PROFILE_HIGH10PROFILE = 4, |
| 47 H264PROFILE_HIGH422PROFILE = 5, |
| 48 H264PROFILE_HIGH444PREDICTIVEPROFILE = 6, |
| 49 H264PROFILE_SCALABLEBASELINE = 7, |
| 50 H264PROFILE_SCALABLEHIGH = 8, |
| 51 H264PROFILE_STEREOHIGH = 9, |
| 52 H264PROFILE_MULTIVIEWHIGH = 10, |
| 53 VP8PROFILE_ANY = 11, |
| 54 VP9PROFILE_ANY = 12, |
| 55 VIDEO_CODEC_PROFILE_MAX = VP9PROFILE_ANY, |
| 56 }; |
| 57 |
| 58 // Specification of an encoding profile supported by a hardware encoder. |
| 59 struct GPU_EXPORT VideoEncodeAcceleratorSupportedProfile { |
| 60 VideoCodecProfile profile; |
| 61 gfx::Size max_resolution; |
| 62 uint32 max_framerate_numerator; |
| 63 uint32 max_framerate_denominator; |
| 64 }; |
| 65 |
38 struct GPU_EXPORT GPUInfo { | 66 struct GPU_EXPORT GPUInfo { |
39 struct GPU_EXPORT GPUDevice { | 67 struct GPU_EXPORT GPUDevice { |
40 GPUDevice(); | 68 GPUDevice(); |
41 ~GPUDevice(); | 69 ~GPUDevice(); |
42 | 70 |
43 // The DWORD (uint32) representing the graphics card vendor id. | 71 // The DWORD (uint32) representing the graphics card vendor id. |
44 uint32 vendor_id; | 72 uint32 vendor_id; |
45 | 73 |
46 // The DWORD (uint32) representing the graphics card device id. | 74 // The DWORD (uint32) representing the graphics card device id. |
47 // Device ids are unique to vendor, not to one another. | 75 // Device ids are unique to vendor, not to one another. |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 // if the collection fails or not. | 199 // if the collection fails or not. |
172 CollectInfoResult basic_info_state; | 200 CollectInfoResult basic_info_state; |
173 CollectInfoResult context_info_state; | 201 CollectInfoResult context_info_state; |
174 #if defined(OS_WIN) | 202 #if defined(OS_WIN) |
175 CollectInfoResult dx_diagnostics_info_state; | 203 CollectInfoResult dx_diagnostics_info_state; |
176 | 204 |
177 // The information returned by the DirectX Diagnostics Tool. | 205 // The information returned by the DirectX Diagnostics Tool. |
178 DxDiagNode dx_diagnostics; | 206 DxDiagNode dx_diagnostics; |
179 #endif | 207 #endif |
180 | 208 |
181 std::vector<media::VideoEncodeAccelerator::SupportedProfile> | 209 std::vector<VideoEncodeAcceleratorSupportedProfile> |
182 video_encode_accelerator_supported_profiles; | 210 video_encode_accelerator_supported_profiles; |
183 // Note: when adding new members, please remember to update EnumerateFields | 211 // Note: when adding new members, please remember to update EnumerateFields |
184 // in gpu_info.cc. | 212 // in gpu_info.cc. |
185 | 213 |
186 // In conjunction with EnumerateFields, this allows the embedder to | 214 // In conjunction with EnumerateFields, this allows the embedder to |
187 // enumerate the values in this structure without having to embed | 215 // enumerate the values in this structure without having to embed |
188 // references to its specific member variables. This simplifies the | 216 // references to its specific member variables. This simplifies the |
189 // addition of new fields to this type. | 217 // addition of new fields to this type. |
190 class Enumerator { | 218 class Enumerator { |
191 public: | 219 public: |
192 // The following methods apply to the "current" object. Initially this | 220 // The following methods apply to the "current" object. Initially this |
193 // is the root object, but calls to BeginGPUDevice/EndGPUDevice and | 221 // is the root object, but calls to BeginGPUDevice/EndGPUDevice and |
194 // BeginAuxAttributes/EndAuxAttributes change the object to which these | 222 // BeginAuxAttributes/EndAuxAttributes change the object to which these |
195 // calls should apply. | 223 // calls should apply. |
196 virtual void AddInt64(const char* name, int64 value) = 0; | 224 virtual void AddInt64(const char* name, int64 value) = 0; |
197 virtual void AddInt(const char* name, int value) = 0; | 225 virtual void AddInt(const char* name, int value) = 0; |
198 virtual void AddString(const char* name, const std::string& value) = 0; | 226 virtual void AddString(const char* name, const std::string& value) = 0; |
199 virtual void AddBool(const char* name, bool value) = 0; | 227 virtual void AddBool(const char* name, bool value) = 0; |
200 virtual void AddTimeDeltaInSecondsF(const char* name, | 228 virtual void AddTimeDeltaInSecondsF(const char* name, |
201 const base::TimeDelta& value) = 0; | 229 const base::TimeDelta& value) = 0; |
202 | 230 |
203 // Markers indicating that a GPUDevice is being described. | 231 // Markers indicating that a GPUDevice is being described. |
204 virtual void BeginGPUDevice() = 0; | 232 virtual void BeginGPUDevice() = 0; |
205 virtual void EndGPUDevice() = 0; | 233 virtual void EndGPUDevice() = 0; |
206 | 234 |
207 // Markers indicating that a VideoEncodeAccelerator::SupportedProfile is | 235 // Markers indicating that a VideoEncodeAcceleratorSupportedProfile is |
208 // being described. | 236 // being described. |
209 virtual void BeginVideoEncodeAcceleratorSupportedProfile() = 0; | 237 virtual void BeginVideoEncodeAcceleratorSupportedProfile() = 0; |
210 virtual void EndVideoEncodeAcceleratorSupportedProfile() = 0; | 238 virtual void EndVideoEncodeAcceleratorSupportedProfile() = 0; |
211 | 239 |
212 // Markers indicating that "auxiliary" attributes of the GPUInfo | 240 // Markers indicating that "auxiliary" attributes of the GPUInfo |
213 // (according to the DevTools protocol) are being described. | 241 // (according to the DevTools protocol) are being described. |
214 virtual void BeginAuxAttributes() = 0; | 242 virtual void BeginAuxAttributes() = 0; |
215 virtual void EndAuxAttributes() = 0; | 243 virtual void EndAuxAttributes() = 0; |
216 | 244 |
217 protected: | 245 protected: |
218 virtual ~Enumerator() {} | 246 virtual ~Enumerator() {} |
219 }; | 247 }; |
220 | 248 |
221 // Outputs the fields in this structure to the provided enumerator. | 249 // Outputs the fields in this structure to the provided enumerator. |
222 void EnumerateFields(Enumerator* enumerator) const; | 250 void EnumerateFields(Enumerator* enumerator) const; |
223 }; | 251 }; |
224 | 252 |
225 } // namespace gpu | 253 } // namespace gpu |
226 | 254 |
227 #endif // GPU_CONFIG_GPU_INFO_H_ | 255 #endif // GPU_CONFIG_GPU_INFO_H_ |
OLD | NEW |