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 | |
15 namespace gpu_info_collector { | 13 namespace gpu_info_collector { |
16 | 14 |
17 // Populate variables with necessary graphics card information. | 15 // Collects basic GPU info without creating a GL/DirectX context (and without |
18 // Returns true on success. | 16 // the danger of crashing), including vendor_id and device_id. |
19 bool CollectGraphicsInfo(content::GPUInfo* gpu_info); | 17 // This is called at browser process startup time. |
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). | |
23 // The subset each platform collects may be different. | 18 // The subset each platform collects may be different. |
24 CONTENT_EXPORT bool CollectPreliminaryGraphicsInfo( | 19 CONTENT_EXPORT bool CollectBasicGraphicsInfo( |
25 content::GPUInfo* gpu_info); | 20 content::GPUInfo* gpu_info); |
26 | 21 |
| 22 // Create a GL/DirectX context and collect related info. |
| 23 // This is called at GPU process startup time. |
| 24 // Returns true on success. |
| 25 bool CollectContextGraphicsInfo(content::GPUInfo* gpu_info); |
| 26 |
27 #if defined(OS_WIN) | 27 #if defined(OS_WIN) |
28 // Windows provides two ways of doing graphics so we need two ways of | |
29 // collecting info based on what's on a user's machine. | |
30 // The selection between the two methods is done in the cc file. | |
31 | |
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 | |
42 // Collect the DirectX Disagnostics information about the attached displays. | 28 // Collect the DirectX Disagnostics information about the attached displays. |
43 bool GetDxDiagnostics(content::DxDiagNode* output); | 29 bool GetDxDiagnostics(content::DxDiagNode* output); |
44 #endif // OS_WIN | 30 #endif // OS_WIN |
45 | 31 |
46 // All platforms have a GL version for collecting information | 32 // Create a GL context and collect GL strings and versions. |
47 CONTENT_EXPORT bool CollectGraphicsInfoGL(content::GPUInfo* gpu_info); | 33 CONTENT_EXPORT bool CollectGraphicsInfoGL(content::GPUInfo* gpu_info); |
48 | 34 |
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 | |
55 // Each platform stores the driver version on the GL_VERSION string differently | 35 // Each platform stores the driver version on the GL_VERSION string differently |
56 bool CollectDriverInfoGL(content::GPUInfo* gpu_info); | 36 bool CollectDriverInfoGL(content::GPUInfo* gpu_info); |
57 | 37 |
58 // Advanced Micro Devices has interesting configurations on laptops were | 38 // Merge GPUInfo from CollectContextGraphicsInfo into basic GPUInfo. |
59 // there are two videocards that can alternatively a given process output. | 39 // This is platform specific, depending on which info are collected at which |
60 enum AMDVideoCardType { | 40 // stage. |
61 UNKNOWN, | 41 void MergeGPUInfo(content::GPUInfo* basic_gpu_info, |
62 STANDALONE, | 42 const content::GPUInfo& context_gpu_info); |
63 INTEGRATED, | 43 |
64 SWITCHABLE | 44 // MergeGPUInfo() when GL driver is used. |
65 }; | 45 void MergeGPUInfoGL(content::GPUInfo* basic_gpu_info, |
| 46 const content::GPUInfo& context_gpu_info); |
66 | 47 |
67 } // namespace gpu_info_collector | 48 } // namespace gpu_info_collector |
68 | 49 |
69 #endif // CONTENT_GPU_GPU_INFO_COLLECTOR_H_ | 50 #endif // CONTENT_GPU_GPU_INFO_COLLECTOR_H_ |
OLD | NEW |