Battery Status API: add UMA logging for Linux.
[chromium-blink-merge.git] / gpu / config / gpu_info_collector.h
blob4758aec704bdb9bb51ba24266af47ef672f178a9
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
3 // found in the LICENSE file.
5 #ifndef GPU_CONFIG_GPU_INFO_COLLECTOR_H_
6 #define GPU_CONFIG_GPU_INFO_COLLECTOR_H_
8 #include "base/basictypes.h"
9 #include "build/build_config.h"
10 #include "gpu/config/gpu_info.h"
11 #include "gpu/gpu_export.h"
13 namespace gpu {
15 enum GpuIDResult {
16 kGpuIDFailure,
17 kGpuIDSuccess,
18 kGpuIDNotSupported
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
33 // Collect GPU vendor_id and device ID.
34 GPU_EXPORT GpuIDResult CollectGpuID(uint32* vendor_id, uint32* device_id);
36 // Collects basic GPU info without creating a GL/DirectX context (and without
37 // the danger of crashing), including vendor_id and device_id.
38 // This is called at browser process startup time.
39 // The subset each platform collects may be different.
40 GPU_EXPORT CollectInfoResult CollectBasicGraphicsInfo(GPUInfo* gpu_info);
42 // Create a GL/DirectX context and collect related info.
43 // This is called at GPU process startup time.
44 GPU_EXPORT CollectInfoResult CollectContextGraphicsInfo(GPUInfo* gpu_info);
46 #if defined(OS_WIN)
47 // Collect the DirectX Disagnostics information about the attached displays.
48 GPU_EXPORT bool GetDxDiagnostics(DxDiagNode* output);
49 #endif // OS_WIN
51 // Create a GL context and collect GL strings and versions.
52 GPU_EXPORT CollectInfoResult CollectGraphicsInfoGL(GPUInfo* gpu_info);
54 // Each platform stores the driver version on the GL_VERSION string differently
55 GPU_EXPORT CollectInfoResult CollectDriverInfoGL(GPUInfo* gpu_info);
57 // Merge GPUInfo from CollectContextGraphicsInfo into basic GPUInfo.
58 // This is platform specific, depending on which info are collected at which
59 // stage.
60 GPU_EXPORT void MergeGPUInfo(GPUInfo* basic_gpu_info,
61 const GPUInfo& context_gpu_info);
63 // MergeGPUInfo() when GL driver is used.
64 GPU_EXPORT void MergeGPUInfoGL(GPUInfo* basic_gpu_info,
65 const GPUInfo& context_gpu_info);
67 } // namespace gpu
69 #endif // GPU_CONFIG_GPU_INFO_COLLECTOR_H_