| 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 #include <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include "gpu/config/gpu_info.h" | 7 #include "gpu/config/gpu_info.h" |
| 8 | 8 |
| 9 namespace { | 9 namespace { |
| 10 | 10 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 system_visual(0), | 86 system_visual(0), |
| 87 rgba_visual(0) | 87 rgba_visual(0) |
| 88 #endif | 88 #endif |
| 89 { | 89 { |
| 90 } | 90 } |
| 91 | 91 |
| 92 GPUInfo::GPUInfo(const GPUInfo& other) = default; | 92 GPUInfo::GPUInfo(const GPUInfo& other) = default; |
| 93 | 93 |
| 94 GPUInfo::~GPUInfo() { } | 94 GPUInfo::~GPUInfo() { } |
| 95 | 95 |
| 96 const GPUInfo::GPUDevice& GPUInfo::active_gpu() const { |
| 97 if (gpu.active) |
| 98 return gpu; |
| 99 for (const GPUDevice& secondary_gpu : secondary_gpus) { |
| 100 if (secondary_gpu.active) |
| 101 return secondary_gpu; |
| 102 } |
| 103 DLOG(ERROR) << "No active GPU found, returning primary GPU."; |
| 104 return gpu; |
| 105 } |
| 106 |
| 96 void GPUInfo::EnumerateFields(Enumerator* enumerator) const { | 107 void GPUInfo::EnumerateFields(Enumerator* enumerator) const { |
| 97 struct GPUInfoKnownFields { | 108 struct GPUInfoKnownFields { |
| 98 base::TimeDelta initialization_time; | 109 base::TimeDelta initialization_time; |
| 99 bool optimus; | 110 bool optimus; |
| 100 bool amd_switchable; | 111 bool amd_switchable; |
| 101 GPUDevice gpu; | 112 GPUDevice gpu; |
| 102 std::vector<GPUDevice> secondary_gpus; | 113 std::vector<GPUDevice> secondary_gpus; |
| 103 std::string driver_vendor; | 114 std::string driver_vendor; |
| 104 std::string driver_version; | 115 std::string driver_version; |
| 105 std::string driver_date; | 116 std::string driver_date; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 enumerator->AddBool("jpegDecodeAcceleratorSupported", | 209 enumerator->AddBool("jpegDecodeAcceleratorSupported", |
| 199 jpeg_decode_accelerator_supported); | 210 jpeg_decode_accelerator_supported); |
| 200 #if defined(USE_X11) && !defined(OS_CHROMEOS) | 211 #if defined(USE_X11) && !defined(OS_CHROMEOS) |
| 201 enumerator->AddInt64("systemVisual", system_visual); | 212 enumerator->AddInt64("systemVisual", system_visual); |
| 202 enumerator->AddInt64("rgbaVisual", rgba_visual); | 213 enumerator->AddInt64("rgbaVisual", rgba_visual); |
| 203 #endif | 214 #endif |
| 204 enumerator->EndAuxAttributes(); | 215 enumerator->EndAuxAttributes(); |
| 205 } | 216 } |
| 206 | 217 |
| 207 } // namespace gpu | 218 } // namespace gpu |
| OLD | NEW |