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 CONTENT_GPU_GPU_INFO_COLLECTOR_H_ | 5 #ifndef CONTENT_GPU_GPU_INFO_COLLECTOR_H_ |
6 #define CONTENT_GPU_GPU_INFO_COLLECTOR_H_ | 6 #define CONTENT_GPU_GPU_INFO_COLLECTOR_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
11 #include "content/public/common/gpu_info.h" | 11 #include "content/public/common/gpu_info.h" |
12 | 12 |
| 13 struct IDirect3D9; |
| 14 |
13 namespace gpu_info_collector { | 15 namespace gpu_info_collector { |
14 | 16 |
15 // Collects basic GPU info without creating a GL/DirectX context (and without | 17 // Populate variables with necessary graphics card information. |
16 // the danger of crashing), including vendor_id and device_id. | 18 // Returns true on success. |
17 // This is called at browser process startup time. | 19 bool CollectGraphicsInfo(content::GPUInfo* gpu_info); |
| 20 |
| 21 // Similar to CollectGraphicsInfo, only this collects a subset of variables |
| 22 // without creating a GL/DirectX context (and without the danger of crashing). |
18 // The subset each platform collects may be different. | 23 // The subset each platform collects may be different. |
19 CONTENT_EXPORT bool CollectBasicGraphicsInfo( | 24 CONTENT_EXPORT bool CollectPreliminaryGraphicsInfo( |
20 content::GPUInfo* gpu_info); | 25 content::GPUInfo* gpu_info); |
21 | 26 |
22 // Create a GL/DirectX context and collect related info. | 27 #if defined(OS_WIN) |
23 // This is called at GPU process startup time. | 28 // Windows provides two ways of doing graphics so we need two ways of |
24 // Returns true on success. | 29 // collecting info based on what's on a user's machine. |
25 bool CollectContextGraphicsInfo(content::GPUInfo* gpu_info); | 30 // The selection between the two methods is done in the cc file. |
26 | 31 |
27 #if defined(OS_WIN) | 32 // A D3D argument is passed in for testing purposes |
| 33 CONTENT_EXPORT bool CollectGraphicsInfoD3D(IDirect3D9* d3d, |
| 34 content::GPUInfo* gpu_info); |
| 35 |
| 36 // Collects D3D driver version/date through registry lookup. |
| 37 // Note that this does not require a D3D context. |
| 38 // device_id here is the raw data in DISPLAY_DEVICE. |
| 39 CONTENT_EXPORT bool CollectDriverInfoD3D(const std::wstring& device_id, |
| 40 content::GPUInfo* gpu_info); |
| 41 |
28 // Collect the DirectX Disagnostics information about the attached displays. | 42 // Collect the DirectX Disagnostics information about the attached displays. |
29 bool GetDxDiagnostics(content::DxDiagNode* output); | 43 bool GetDxDiagnostics(content::DxDiagNode* output); |
30 #endif // OS_WIN | 44 #endif // OS_WIN |
31 | 45 |
32 // Create a GL context and collect GL strings and versions. | 46 // All platforms have a GL version for collecting information |
33 CONTENT_EXPORT bool CollectGraphicsInfoGL(content::GPUInfo* gpu_info); | 47 CONTENT_EXPORT bool CollectGraphicsInfoGL(content::GPUInfo* gpu_info); |
34 | 48 |
| 49 // Collect GL and Shading language version information |
| 50 bool CollectGLVersionInfo(content::GPUInfo* gpu_info); |
| 51 |
| 52 // Platform specific method for collecting vendor and device ids |
| 53 bool CollectVideoCardInfo(content::GPUInfo* gpu_info); |
| 54 |
35 // Each platform stores the driver version on the GL_VERSION string differently | 55 // Each platform stores the driver version on the GL_VERSION string differently |
36 bool CollectDriverInfoGL(content::GPUInfo* gpu_info); | 56 bool CollectDriverInfoGL(content::GPUInfo* gpu_info); |
37 | 57 |
38 // Merge GPUInfo from CollectContextGraphicsInfo into basic GPUInfo. | 58 // Advanced Micro Devices has interesting configurations on laptops were |
39 // This is platform specific, depending on which info are collected at which | 59 // there are two videocards that can alternatively a given process output. |
40 // stage. | 60 enum AMDVideoCardType { |
41 void MergeGPUInfo(content::GPUInfo* basic_gpu_info, | 61 UNKNOWN, |
42 const content::GPUInfo& context_gpu_info); | 62 STANDALONE, |
43 | 63 INTEGRATED, |
44 // MergeGPUInfo() when GL driver is used. | 64 SWITCHABLE |
45 void MergeGPUInfoGL(content::GPUInfo* basic_gpu_info, | 65 }; |
46 const content::GPUInfo& context_gpu_info); | |
47 | 66 |
48 } // namespace gpu_info_collector | 67 } // namespace gpu_info_collector |
49 | 68 |
50 #endif // CONTENT_GPU_GPU_INFO_COLLECTOR_H_ | 69 #endif // CONTENT_GPU_GPU_INFO_COLLECTOR_H_ |
OLD | NEW |