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 "content/test/gpu/gpu_test_config.h" | 5 #include "gpu/config/gpu_test_config.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/sys_info.h" | 8 #include "base/sys_info.h" |
9 #include "content/test/gpu/gpu_test_expectations_parser.h" | |
10 #include "gpu/config/gpu_info.h" | 9 #include "gpu/config/gpu_info.h" |
11 #include "gpu/config/gpu_info_collector.h" | 10 #include "gpu/config/gpu_info_collector.h" |
| 11 #include "gpu/config/gpu_test_expectations_parser.h" |
| 12 |
| 13 namespace gpu { |
12 | 14 |
13 namespace { | 15 namespace { |
14 | 16 |
15 GPUTestConfig::OS GetCurrentOS() { | 17 GPUTestConfig::OS GetCurrentOS() { |
16 #if defined(OS_CHROMEOS) | 18 #if defined(OS_CHROMEOS) |
17 return GPUTestConfig::kOsChromeOS; | 19 return GPUTestConfig::kOsChromeOS; |
18 #elif defined(OS_LINUX) || defined(OS_OPENBSD) | 20 #elif defined(OS_LINUX) || defined(OS_OPENBSD) |
19 return GPUTestConfig::kOsLinux; | 21 return GPUTestConfig::kOsLinux; |
20 #elif defined(OS_WIN) | 22 #elif defined(OS_WIN) |
21 int32 major_version = 0; | 23 int32 major_version = 0; |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 } | 136 } |
135 | 137 |
136 GPUTestBotConfig::~GPUTestBotConfig() { | 138 GPUTestBotConfig::~GPUTestBotConfig() { |
137 } | 139 } |
138 | 140 |
139 void GPUTestBotConfig::AddGPUVendor(uint32 gpu_vendor) { | 141 void GPUTestBotConfig::AddGPUVendor(uint32 gpu_vendor) { |
140 DCHECK_EQ(0u, GPUTestConfig::gpu_vendor().size()); | 142 DCHECK_EQ(0u, GPUTestConfig::gpu_vendor().size()); |
141 GPUTestConfig::AddGPUVendor(gpu_vendor); | 143 GPUTestConfig::AddGPUVendor(gpu_vendor); |
142 } | 144 } |
143 | 145 |
144 bool GPUTestBotConfig::SetGPUInfo(const gpu::GPUInfo& gpu_info) { | 146 bool GPUTestBotConfig::SetGPUInfo(const GPUInfo& gpu_info) { |
145 DCHECK(validate_gpu_info_); | 147 DCHECK(validate_gpu_info_); |
146 if (gpu_info.gpu.device_id == 0 || gpu_info.gpu.vendor_id == 0) | 148 if (gpu_info.gpu.device_id == 0 || gpu_info.gpu.vendor_id == 0) |
147 return false; | 149 return false; |
148 ClearGPUVendor(); | 150 ClearGPUVendor(); |
149 AddGPUVendor(gpu_info.gpu.vendor_id); | 151 AddGPUVendor(gpu_info.gpu.vendor_id); |
150 set_gpu_device_id(gpu_info.gpu.device_id); | 152 set_gpu_device_id(gpu_info.gpu.device_id); |
151 return true; | 153 return true; |
152 } | 154 } |
153 | 155 |
154 bool GPUTestBotConfig::IsValid() const { | 156 bool GPUTestBotConfig::IsValid() const { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 | 213 |
212 bool GPUTestBotConfig::Matches(const std::string& config_data) const { | 214 bool GPUTestBotConfig::Matches(const std::string& config_data) const { |
213 GPUTestExpectationsParser parser; | 215 GPUTestExpectationsParser parser; |
214 GPUTestConfig config; | 216 GPUTestConfig config; |
215 | 217 |
216 if (!parser.ParseConfig(config_data, &config)) | 218 if (!parser.ParseConfig(config_data, &config)) |
217 return false; | 219 return false; |
218 return Matches(config); | 220 return Matches(config); |
219 } | 221 } |
220 | 222 |
221 bool GPUTestBotConfig::LoadCurrentConfig(const gpu::GPUInfo* gpu_info) { | 223 bool GPUTestBotConfig::LoadCurrentConfig(const GPUInfo* gpu_info) { |
222 bool rt; | 224 bool rt; |
223 if (gpu_info == NULL) { | 225 if (gpu_info == NULL) { |
224 gpu::GPUInfo my_gpu_info; | 226 GPUInfo my_gpu_info; |
225 gpu::GpuIDResult result; | 227 GpuIDResult result; |
226 result = gpu::CollectGpuID(&my_gpu_info.gpu.vendor_id, | 228 result = CollectGpuID(&my_gpu_info.gpu.vendor_id, |
227 &my_gpu_info.gpu.device_id); | 229 &my_gpu_info.gpu.device_id); |
228 if (result == gpu::kGpuIDNotSupported) { | 230 if (result == kGpuIDNotSupported) { |
229 DisableGPUInfoValidation(); | 231 DisableGPUInfoValidation(); |
230 rt = true; | 232 rt = true; |
231 } else { | 233 } else { |
232 rt = SetGPUInfo(my_gpu_info); | 234 rt = SetGPUInfo(my_gpu_info); |
233 } | 235 } |
234 } else { | 236 } else { |
235 rt = SetGPUInfo(*gpu_info); | 237 rt = SetGPUInfo(*gpu_info); |
236 } | 238 } |
237 set_os(GetCurrentOS()); | 239 set_os(GetCurrentOS()); |
238 if (os() == kOsUnknown) | 240 if (os() == kOsUnknown) |
(...skipping 20 matching lines...) Expand all Loading... |
259 GPUTestBotConfig my_config; | 261 GPUTestBotConfig my_config; |
260 if (!my_config.LoadCurrentConfig(NULL)) | 262 if (!my_config.LoadCurrentConfig(NULL)) |
261 return false; | 263 return false; |
262 for (size_t i = 0 ; i < configs.size(); ++i) { | 264 for (size_t i = 0 ; i < configs.size(); ++i) { |
263 if (my_config.Matches(configs[i])) | 265 if (my_config.Matches(configs[i])) |
264 return true; | 266 return true; |
265 } | 267 } |
266 return false; | 268 return false; |
267 } | 269 } |
268 | 270 |
| 271 } // namespace gpu |
| 272 |
OLD | NEW |