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_COLLECTOR_H_ | 5 #ifndef GPU_CONFIG_GPU_INFO_COLLECTOR_H_ |
6 #define GPU_CONFIG_GPU_INFO_COLLECTOR_H_ | 6 #define GPU_CONFIG_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 "gpu/config/gpu_info.h" | 10 #include "gpu/config/gpu_info.h" |
11 #include "gpu/gpu_export.h" | 11 #include "gpu/gpu_export.h" |
12 | 12 |
13 namespace gpu { | 13 namespace gpu { |
14 | 14 |
15 enum GpuIDResult { | 15 enum GpuIDResult { |
16 kGpuIDFailure, | 16 kGpuIDFailure, |
17 kGpuIDSuccess, | 17 kGpuIDSuccess, |
18 kGpuIDNotSupported | 18 kGpuIDNotSupported |
19 }; | 19 }; |
20 | 20 |
| 21 // Result for the various Collect*Info* functions below. |
| 22 // Fatal failures are for cases where we can't create a context at all or |
| 23 // something, making the use of the GPU impossible. |
| 24 // Non-fatal failures are for cases where we could gather most info, but maybe |
| 25 // some is missing (e.g. unable to parse a version string or to detect the exact |
| 26 // model). |
| 27 enum CollectInfoResult { |
| 28 kCollectInfoFatalFailure, |
| 29 kCollectInfoNonFatalFailure, |
| 30 kCollectInfoSuccess |
| 31 }; |
| 32 |
21 // Collect GPU vendor_id and device ID. | 33 // Collect GPU vendor_id and device ID. |
22 GPU_EXPORT GpuIDResult CollectGpuID(uint32* vendor_id, uint32* device_id); | 34 GPU_EXPORT GpuIDResult CollectGpuID(uint32* vendor_id, uint32* device_id); |
23 | 35 |
24 // Collects basic GPU info without creating a GL/DirectX context (and without | 36 // Collects basic GPU info without creating a GL/DirectX context (and without |
25 // the danger of crashing), including vendor_id and device_id. | 37 // the danger of crashing), including vendor_id and device_id. |
26 // This is called at browser process startup time. | 38 // This is called at browser process startup time. |
27 // The subset each platform collects may be different. | 39 // The subset each platform collects may be different. |
28 GPU_EXPORT bool CollectBasicGraphicsInfo(GPUInfo* gpu_info); | 40 GPU_EXPORT CollectInfoResult CollectBasicGraphicsInfo(GPUInfo* gpu_info); |
29 | 41 |
30 // Create a GL/DirectX context and collect related info. | 42 // Create a GL/DirectX context and collect related info. |
31 // This is called at GPU process startup time. | 43 // This is called at GPU process startup time. |
32 // Returns true on success. | 44 GPU_EXPORT CollectInfoResult CollectContextGraphicsInfo(GPUInfo* gpu_info); |
33 GPU_EXPORT bool CollectContextGraphicsInfo(GPUInfo* gpu_info); | |
34 | 45 |
35 #if defined(OS_WIN) | 46 #if defined(OS_WIN) |
36 // Collect the DirectX Disagnostics information about the attached displays. | 47 // Collect the DirectX Disagnostics information about the attached displays. |
37 GPU_EXPORT bool GetDxDiagnostics(DxDiagNode* output); | 48 GPU_EXPORT bool GetDxDiagnostics(DxDiagNode* output); |
38 #endif // OS_WIN | 49 #endif // OS_WIN |
39 | 50 |
40 // Create a GL context and collect GL strings and versions. | 51 // Create a GL context and collect GL strings and versions. |
41 GPU_EXPORT bool CollectGraphicsInfoGL(GPUInfo* gpu_info); | 52 GPU_EXPORT CollectInfoResult CollectGraphicsInfoGL(GPUInfo* gpu_info); |
42 | 53 |
43 // Each platform stores the driver version on the GL_VERSION string differently | 54 // Each platform stores the driver version on the GL_VERSION string differently |
44 GPU_EXPORT bool CollectDriverInfoGL(GPUInfo* gpu_info); | 55 GPU_EXPORT CollectInfoResult CollectDriverInfoGL(GPUInfo* gpu_info); |
45 | 56 |
46 // Merge GPUInfo from CollectContextGraphicsInfo into basic GPUInfo. | 57 // Merge GPUInfo from CollectContextGraphicsInfo into basic GPUInfo. |
47 // This is platform specific, depending on which info are collected at which | 58 // This is platform specific, depending on which info are collected at which |
48 // stage. | 59 // stage. |
49 GPU_EXPORT void MergeGPUInfo(GPUInfo* basic_gpu_info, | 60 GPU_EXPORT void MergeGPUInfo(GPUInfo* basic_gpu_info, |
50 const GPUInfo& context_gpu_info); | 61 const GPUInfo& context_gpu_info); |
51 | 62 |
52 // MergeGPUInfo() when GL driver is used. | 63 // MergeGPUInfo() when GL driver is used. |
53 GPU_EXPORT void MergeGPUInfoGL(GPUInfo* basic_gpu_info, | 64 GPU_EXPORT void MergeGPUInfoGL(GPUInfo* basic_gpu_info, |
54 const GPUInfo& context_gpu_info); | 65 const GPUInfo& context_gpu_info); |
55 | 66 |
56 // Advanced Micro Devices has interesting configurations on laptops were | 67 // Advanced Micro Devices has interesting configurations on laptops were |
57 // there are two videocards that can alternatively a given process output. | 68 // there are two videocards that can alternatively a given process output. |
58 enum AMDVideoCardType { | 69 enum AMDVideoCardType { |
59 UNKNOWN, | 70 UNKNOWN, |
60 STANDALONE, | 71 STANDALONE, |
61 INTEGRATED, | 72 INTEGRATED, |
62 SWITCHABLE | 73 SWITCHABLE |
63 }; | 74 }; |
64 | 75 |
65 } // namespace gpu | 76 } // namespace gpu |
66 | 77 |
67 #endif // GPU_CONFIG_GPU_INFO_COLLECTOR_H_ | 78 #endif // GPU_CONFIG_GPU_INFO_COLLECTOR_H_ |
OLD | NEW |