Remove unused android_experimental.
[chromium-blink-merge.git] / gpu / config / gpu_info.cc
blobc3dc16f1a0f8483a604ff7d748c902bfc9423737
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 #include "gpu/config/gpu_info.h"
7 namespace {
9 void EnumerateGPUDevice(gpu::GPUInfo::Enumerator* enumerator,
10 const gpu::GPUInfo::GPUDevice& device) {
11 enumerator->BeginGPUDevice();
12 enumerator->AddInt("vendorId", device.vendor_id);
13 enumerator->AddInt("deviceId", device.device_id);
14 enumerator->AddString("vendorString", device.vendor_string);
15 enumerator->AddString("deviceString", device.device_string);
16 enumerator->EndGPUDevice();
19 } // namespace
21 namespace gpu {
23 GPUInfo::GPUDevice::GPUDevice()
24 : vendor_id(0),
25 device_id(0) {
28 GPUInfo::GPUDevice::~GPUDevice() { }
30 GPUInfo::GPUInfo()
31 : finalized(false),
32 optimus(false),
33 amd_switchable(false),
34 lenovo_dcute(false),
35 adapter_luid(0),
36 gl_reset_notification_strategy(0),
37 can_lose_context(false),
38 software_rendering(false),
39 sandboxed(false) {
42 GPUInfo::~GPUInfo() { }
44 void GPUInfo::EnumerateFields(Enumerator* enumerator) const {
45 struct GPUInfoKnownFields {
46 bool finalized;
47 base::TimeDelta initialization_time;
48 bool optimus;
49 bool amd_switchable;
50 bool lenovo_dcute;
51 Version display_link_version;
52 GPUDevice gpu;
53 std::vector<GPUDevice> secondary_gpus;
54 uint64 adapter_luid;
55 std::string driver_vendor;
56 std::string driver_version;
57 std::string driver_date;
58 std::string pixel_shader_version;
59 std::string vertex_shader_version;
60 std::string machine_model;
61 std::string gl_version;
62 std::string gl_version_string;
63 std::string gl_vendor;
64 std::string gl_renderer;
65 std::string gl_extensions;
66 std::string gl_ws_vendor;
67 std::string gl_ws_version;
68 std::string gl_ws_extensions;
69 uint32 gl_reset_notification_strategy;
70 bool can_lose_context;
71 GpuPerformanceStats performance_stats;
72 bool software_rendering;
73 bool sandboxed;
74 #if defined(OS_WIN)
75 DxDiagNode dx_diagnostics;
76 #endif
79 // If this assert fails then most likely something below needs to be updated.
80 // Note that this assert is only approximate. If a new field is added to
81 // GPUInfo which fits within the current padding then it will not be caught.
82 COMPILE_ASSERT(
83 sizeof(GPUInfo) == sizeof(GPUInfoKnownFields),
84 Fields_Have_Changed_In_GPUInfo_So_Update_Below);
86 // Required fields (according to DevTools protocol) first.
87 enumerator->AddString("machineModel", machine_model);
88 EnumerateGPUDevice(enumerator, gpu);
89 for (size_t ii = 0; ii < secondary_gpus.size(); ++ii) {
90 EnumerateGPUDevice(enumerator, secondary_gpus[ii]);
93 enumerator->BeginAuxAttributes();
94 enumerator->AddBool("finalized", finalized);
95 enumerator->AddTimeDeltaInSecondsF("initializationTime",
96 initialization_time);
97 enumerator->AddBool("optimus", optimus);
98 enumerator->AddBool("amdSwitchable", amd_switchable);
99 enumerator->AddBool("lenovoDcute", lenovo_dcute);
100 if (display_link_version.IsValid()) {
101 enumerator->AddString("displayLinkVersion",
102 display_link_version.GetString());
104 enumerator->AddInt64("adapterLuid", adapter_luid);
105 enumerator->AddString("driverVendor", driver_vendor);
106 enumerator->AddString("driverVersion", driver_version);
107 enumerator->AddString("driverDate", driver_date);
108 enumerator->AddString("pixelShaderVersion", pixel_shader_version);
109 enumerator->AddString("vertexShaderVersion", vertex_shader_version);
110 enumerator->AddString("glVersion", gl_version);
111 enumerator->AddString("glVersionString", gl_version_string);
112 enumerator->AddString("glVendor", gl_vendor);
113 enumerator->AddString("glRenderer", gl_renderer);
114 enumerator->AddString("glExtensions", gl_extensions);
115 enumerator->AddString("glWsVendor", gl_ws_vendor);
116 enumerator->AddString("glWsVersion", gl_ws_version);
117 enumerator->AddString("glWsExtensions", gl_ws_extensions);
118 enumerator->AddInt(
119 "glResetNotificationStrategy",
120 static_cast<int>(gl_reset_notification_strategy));
121 enumerator->AddBool("can_lose_context", can_lose_context);
122 // TODO(kbr): add performance_stats.
123 enumerator->AddBool("softwareRendering", software_rendering);
124 enumerator->AddBool("sandboxed", sandboxed);
125 // TODO(kbr): add dx_diagnostics on Windows.
126 enumerator->EndAuxAttributes();
129 } // namespace gpu