| 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 "gpu/config/gpu_info.h" |
| 12 | 12 |
| 13 namespace gpu_info_collector { | 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 // Collect GPU vendor_id and device ID. | 21 // Collect GPU vendor_id and device ID. |
| 22 CONTENT_EXPORT GpuIDResult CollectGpuID(uint32* vendor_id, uint32* device_id); | 22 CONTENT_EXPORT GpuIDResult CollectGpuID(uint32* vendor_id, uint32* device_id); |
| 23 | 23 |
| 24 // Collects basic GPU info without creating a GL/DirectX context (and without | 24 // Collects basic GPU info without creating a GL/DirectX context (and without |
| 25 // the danger of crashing), including vendor_id and device_id. | 25 // the danger of crashing), including vendor_id and device_id. |
| 26 // This is called at browser process startup time. | 26 // This is called at browser process startup time. |
| 27 // The subset each platform collects may be different. | 27 // The subset each platform collects may be different. |
| 28 CONTENT_EXPORT bool CollectBasicGraphicsInfo( | 28 CONTENT_EXPORT bool CollectBasicGraphicsInfo(GPUInfo* gpu_info); |
| 29 content::GPUInfo* gpu_info); | |
| 30 | 29 |
| 31 // Create a GL/DirectX context and collect related info. | 30 // Create a GL/DirectX context and collect related info. |
| 32 // This is called at GPU process startup time. | 31 // This is called at GPU process startup time. |
| 33 // Returns true on success. | 32 // Returns true on success. |
| 34 bool CollectContextGraphicsInfo(content::GPUInfo* gpu_info); | 33 bool CollectContextGraphicsInfo(GPUInfo* gpu_info); |
| 35 | 34 |
| 36 #if defined(OS_WIN) | 35 #if defined(OS_WIN) |
| 37 // Collect the DirectX Disagnostics information about the attached displays. | 36 // Collect the DirectX Disagnostics information about the attached displays. |
| 38 bool GetDxDiagnostics(content::DxDiagNode* output); | 37 bool GetDxDiagnostics(DxDiagNode* output); |
| 39 #endif // OS_WIN | 38 #endif // OS_WIN |
| 40 | 39 |
| 41 // Create a GL context and collect GL strings and versions. | 40 // Create a GL context and collect GL strings and versions. |
| 42 CONTENT_EXPORT bool CollectGraphicsInfoGL(content::GPUInfo* gpu_info); | 41 CONTENT_EXPORT bool CollectGraphicsInfoGL(GPUInfo* gpu_info); |
| 43 | 42 |
| 44 // Each platform stores the driver version on the GL_VERSION string differently | 43 // Each platform stores the driver version on the GL_VERSION string differently |
| 45 bool CollectDriverInfoGL(content::GPUInfo* gpu_info); | 44 bool CollectDriverInfoGL(GPUInfo* gpu_info); |
| 46 | 45 |
| 47 // Merge GPUInfo from CollectContextGraphicsInfo into basic GPUInfo. | 46 // Merge GPUInfo from CollectContextGraphicsInfo into basic GPUInfo. |
| 48 // This is platform specific, depending on which info are collected at which | 47 // This is platform specific, depending on which info are collected at which |
| 49 // stage. | 48 // stage. |
| 50 void MergeGPUInfo(content::GPUInfo* basic_gpu_info, | 49 void MergeGPUInfo(GPUInfo* basic_gpu_info, |
| 51 const content::GPUInfo& context_gpu_info); | 50 const GPUInfo& context_gpu_info); |
| 52 | 51 |
| 53 // MergeGPUInfo() when GL driver is used. | 52 // MergeGPUInfo() when GL driver is used. |
| 54 void MergeGPUInfoGL(content::GPUInfo* basic_gpu_info, | 53 void MergeGPUInfoGL(GPUInfo* basic_gpu_info, |
| 55 const content::GPUInfo& context_gpu_info); | 54 const GPUInfo& context_gpu_info); |
| 56 | 55 |
| 57 // Advanced Micro Devices has interesting configurations on laptops were | 56 // Advanced Micro Devices has interesting configurations on laptops were |
| 58 // there are two videocards that can alternatively a given process output. | 57 // there are two videocards that can alternatively a given process output. |
| 59 enum AMDVideoCardType { | 58 enum AMDVideoCardType { |
| 60 UNKNOWN, | 59 UNKNOWN, |
| 61 STANDALONE, | 60 STANDALONE, |
| 62 INTEGRATED, | 61 INTEGRATED, |
| 63 SWITCHABLE | 62 SWITCHABLE |
| 64 }; | 63 }; |
| 65 | 64 |
| 66 } // namespace gpu_info_collector | 65 } // namespace gpu |
| 67 | 66 |
| 68 #endif // CONTENT_GPU_GPU_INFO_COLLECTOR_H_ | 67 #endif // CONTENT_GPU_GPU_INFO_COLLECTOR_H_ |
| OLD | NEW |