summaryrefslogtreecommitdiffstats
path: root/content/gpu/gpu_info_collector.h
blob: b0df5aab0a74de410aab0453a6e08561543eeaa7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CONTENT_GPU_GPU_INFO_COLLECTOR_H_
#define CONTENT_GPU_GPU_INFO_COLLECTOR_H_
#pragma once

#include "base/basictypes.h"
#include "build/build_config.h"
#include "content/common/content_export.h"
#include "content/public/common/gpu_info.h"

struct IDirect3D9;

namespace gpu_info_collector {

// Populate variables with necessary graphics card information.
// Returns true on success.
bool CollectGraphicsInfo(content::GPUInfo* gpu_info);

// Similar to CollectGraphicsInfo, only this collects a subset of variables
// without creating a GL/DirectX context (and without the danger of crashing).
// The subset each platform collects may be different.
bool CollectPreliminaryGraphicsInfo(content::GPUInfo* gpu_info);

#if defined(OS_WIN)
// Windows provides two ways of doing graphics so we need two ways of
// collecting info based on what's on a user's machine.
// The selection between the two methods is done in the cc file.

// A D3D argument is passed in for testing purposes
bool CONTENT_EXPORT CollectGraphicsInfoD3D(IDirect3D9* d3d,
                                           content::GPUInfo* gpu_info);

// Collects D3D driver version/date through registry lookup.
// Note that this does not require a D3D context.
// device_id here is the raw data in DISPLAY_DEVICE.
bool CONTENT_EXPORT CollectDriverInfoD3D(const std::wstring& device_id,
                                         content::GPUInfo* gpu_info);

// Collect the DirectX Disagnostics information about the attached displays.
bool GetDxDiagnostics(content::DxDiagNode* output);
#endif

// All platforms have a GL version for collecting information
bool CONTENT_EXPORT CollectGraphicsInfoGL(content::GPUInfo* gpu_info);

// Collect GL and Shading language version information
bool CollectGLVersionInfo(content::GPUInfo* gpu_info);

// Platform specific method for collecting vendor and device ids
bool CollectVideoCardInfo(content::GPUInfo* gpu_info);

// Each platform stores the driver version on the GL_VERSION string differently
bool CollectDriverInfoGL(content::GPUInfo* gpu_info);

}  // namespace gpu_info_collector

#endif  // CONTENT_GPU_GPU_INFO_COLLECTOR_H_