| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 class CollectDriverInfoGLTest : public testing::Test { | 239 class CollectDriverInfoGLTest : public testing::Test { |
| 240 public: | 240 public: |
| 241 CollectDriverInfoGLTest() {} | 241 CollectDriverInfoGLTest() {} |
| 242 ~CollectDriverInfoGLTest() override {} | 242 ~CollectDriverInfoGLTest() override {} |
| 243 | 243 |
| 244 void SetUp() override {} | 244 void SetUp() override {} |
| 245 void TearDown() override {} | 245 void TearDown() override {} |
| 246 }; | 246 }; |
| 247 | 247 |
| 248 TEST_F(CollectDriverInfoGLTest, CollectDriverInfoGL) { | 248 TEST_F(CollectDriverInfoGLTest, CollectDriverInfoGL) { |
| 249 // clang-format off |
| 249 const struct { | 250 const struct { |
| 250 const char* gl_renderer; | 251 const char* gl_renderer; |
| 251 const char* gl_vendor; | 252 const char* gl_vendor; |
| 252 const char* gl_version; | 253 const char* gl_version; |
| 253 const char* expected_driver_version; | 254 const char* expected_driver_version; |
| 255 const char* expected_driver_vendor; |
| 254 } kTestStrings[] = { | 256 } kTestStrings[] = { |
| 255 #if defined(OS_ANDROID) | 257 #if defined(OS_ANDROID) |
| 256 {"Adreno (TM) 320", | 258 {"Adreno (TM) 320", |
| 257 "Qualcomm", | 259 "Qualcomm", |
| 258 "OpenGL ES 2.0 V@14.0 AU@04.02 (CL@3206)", | 260 "OpenGL ES 2.0 V@14.0 AU@04.02 (CL@3206)", |
| 259 "14.0"}, | 261 "14.0", |
| 260 {"Adreno (TM) 420", "Qualcomm", "OpenGL ES 3.0 V@84.0 AU@ (CL@)", "84.0"}, | 262 ""}, |
| 263 {"Adreno (TM) 420", |
| 264 "Qualcomm", |
| 265 "OpenGL ES 3.0 V@84.0 AU@ (CL@)", |
| 266 "84.0", |
| 267 ""}, |
| 261 {"PowerVR Rogue G6430", | 268 {"PowerVR Rogue G6430", |
| 262 "Imagination Technologies", | 269 "Imagination Technologies", |
| 263 "OpenGL ES 3.1 build 1.4@3283119", | 270 "OpenGL ES 3.1 build 1.4@3283119", |
| 264 "1.4"}, | 271 "1.4", |
| 265 {"Mali-T604", "ARM", "OpenGL ES 3.1", "0"}, | 272 ""}, |
| 273 {"Mali-T604", |
| 274 "ARM", |
| 275 "OpenGL ES 3.1", |
| 276 "0", |
| 277 ""}, |
| 266 {"NVIDIA Tegra", | 278 {"NVIDIA Tegra", |
| 267 "NVIDIA Corporation", | 279 "NVIDIA Corporation", |
| 268 "OpenGL ES 3.1 NVIDIA 343.00", | 280 "OpenGL ES 3.1 NVIDIA 343.00", |
| 269 "343.00"}, | 281 "343.00", |
| 282 ""}, |
| 270 {"NVIDIA Tegra 3", | 283 {"NVIDIA Tegra 3", |
| 271 "NVIDIA Corporation", | 284 "NVIDIA Corporation", |
| 272 "OpenGL ES 2.0 14.01003", | 285 "OpenGL ES 2.0 14.01003", |
| 273 "14.01003"}, | 286 "14.01003", |
| 287 ""}, |
| 274 {"random GPU", | 288 {"random GPU", |
| 275 "random vendor", | 289 "random vendor", |
| 276 "OpenGL ES 2.0 with_long_version_string=1.2.3.4", | 290 "OpenGL ES 2.0 with_long_version_string=1.2.3.4", |
| 277 "1.2"}, | 291 "1.2", |
| 292 NULL}, |
| 278 {"random GPU", | 293 {"random GPU", |
| 279 "random vendor", | 294 "random vendor", |
| 280 "OpenGL ES 2.0 with_short_version_string=1", | 295 "OpenGL ES 2.0 with_short_version_string=1", |
| 281 "0"}, | 296 "0", |
| 297 NULL}, |
| 282 {"random GPU", | 298 {"random GPU", |
| 283 "random vendor", | 299 "random vendor", |
| 284 "OpenGL ES 2.0 with_no_version_string", | 300 "OpenGL ES 2.0 with_no_version_string", |
| 285 "0"}, | 301 "0", |
| 302 NULL}, |
| 286 #elif defined(OS_MACOSX) | 303 #elif defined(OS_MACOSX) |
| 287 {"Intel Iris Pro OpenGL Engine", | 304 {"Intel Iris Pro OpenGL Engine", |
| 288 "Intel Inc.", | 305 "Intel Inc.", |
| 289 "2.1 INTEL-10.6.20", | 306 "2.1 INTEL-10.6.20", |
| 290 "10.6.20"}, | 307 "10.6.20", |
| 308 ""}, |
| 291 #elif defined(OS_LINUX) | 309 #elif defined(OS_LINUX) |
| 292 {"Quadro K2000/PCIe/SSE2", | 310 {"Quadro K2000/PCIe/SSE2", |
| 293 "NVIDIA Corporation", | 311 "NVIDIA Corporation", |
| 294 "4.4.0 NVIDIA 331.79", | 312 "4.4.0 NVIDIA 331.79", |
| 295 "331.79"}, | 313 "331.79", |
| 314 "NVIDIA"}, |
| 296 {"Gallium 0.4 on NVE7", | 315 {"Gallium 0.4 on NVE7", |
| 297 "nouveau", | 316 "nouveau", |
| 298 "3.3 (Core Profile) Mesa 10.5.9", | 317 "3.3 (Core Profile) Mesa 10.5.9", |
| 299 "10.5.9"}, | 318 "10.5.9", |
| 319 "Mesa"}, |
| 300 {"Mesa DRI Intel(R) Haswell Mobile", | 320 {"Mesa DRI Intel(R) Haswell Mobile", |
| 301 "Intel Open Source Technology Center", | 321 "Intel Open Source Technology Center", |
| 302 "OpenGL ES 3.0 Mesa 12.1.0-devel (git-ed9dd3b)", | 322 "OpenGL ES 3.0 Mesa 12.1.0-devel (git-ed9dd3b)", |
| 303 "12.1.0"}, | 323 "12.1.0", |
| 324 "Mesa"}, |
| 325 {"ASUS R5 230 Series", |
| 326 "ATI Technologies Inc.", |
| 327 "4.5.13399 Compatibility Profile Context 15.201.1151", |
| 328 "15.201.1151", |
| 329 NULL}, //TODO(j.isorce@samsung.com): this should be "ATI" or "AMD" |
| 304 #endif | 330 #endif |
| 305 {NULL, NULL, NULL, NULL} | 331 {NULL, NULL, NULL, NULL} |
| 306 }; | 332 }; |
| 333 // clang-format on |
| 307 | 334 |
| 308 GPUInfo gpu_info; | 335 GPUInfo gpu_info; |
| 309 for (int i = 0; kTestStrings[i].gl_renderer != NULL; ++i) { | 336 for (int i = 0; kTestStrings[i].gl_renderer != NULL; ++i) { |
| 310 gpu_info.gl_renderer = kTestStrings[i].gl_renderer; | 337 const auto& testStrings = kTestStrings[i]; |
| 311 gpu_info.gl_vendor = kTestStrings[i].gl_vendor; | 338 gpu_info.gl_renderer = testStrings.gl_renderer; |
| 312 gpu_info.gl_version = kTestStrings[i].gl_version; | 339 gpu_info.gl_vendor = testStrings.gl_vendor; |
| 340 gpu_info.gl_version = testStrings.gl_version; |
| 313 EXPECT_EQ(CollectDriverInfoGL(&gpu_info), kCollectInfoSuccess); | 341 EXPECT_EQ(CollectDriverInfoGL(&gpu_info), kCollectInfoSuccess); |
| 314 EXPECT_EQ(gpu_info.driver_version, kTestStrings[i].expected_driver_version); | 342 EXPECT_EQ(gpu_info.driver_version, testStrings.expected_driver_version); |
| 343 if (testStrings.expected_driver_vendor != nullptr) { |
| 344 EXPECT_EQ(gpu_info.driver_vendor, testStrings.expected_driver_vendor); |
| 345 } |
| 315 } | 346 } |
| 316 } | 347 } |
| 317 | 348 |
| 318 TEST(MultiGPUsTest, IdentifyActiveGPU) { | 349 TEST(MultiGPUsTest, IdentifyActiveGPU) { |
| 319 GPUInfo::GPUDevice nvidia_gpu; | 350 GPUInfo::GPUDevice nvidia_gpu; |
| 320 nvidia_gpu.vendor_id = 0x10de; | 351 nvidia_gpu.vendor_id = 0x10de; |
| 321 nvidia_gpu.device_id = 0x0df8; | 352 nvidia_gpu.device_id = 0x0df8; |
| 322 GPUInfo::GPUDevice intel_gpu; | 353 GPUInfo::GPUDevice intel_gpu; |
| 323 intel_gpu.vendor_id = 0x8086; | 354 intel_gpu.vendor_id = 0x8086; |
| 324 intel_gpu.device_id = 0x0416; | 355 intel_gpu.device_id = 0x0416; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 | 393 |
| 363 gpu_info.gl_vendor = "Google Corporation"; | 394 gpu_info.gl_vendor = "Google Corporation"; |
| 364 gpu_info.gl_renderer = "Chrome GPU Team"; | 395 gpu_info.gl_renderer = "Chrome GPU Team"; |
| 365 IdentifyActiveGPU(&gpu_info); | 396 IdentifyActiveGPU(&gpu_info); |
| 366 EXPECT_FALSE(gpu_info.gpu.active); | 397 EXPECT_FALSE(gpu_info.gpu.active); |
| 367 EXPECT_FALSE(gpu_info.secondary_gpus[0].active); | 398 EXPECT_FALSE(gpu_info.secondary_gpus[0].active); |
| 368 } | 399 } |
| 369 | 400 |
| 370 } // namespace gpu | 401 } // namespace gpu |
| 371 | 402 |
| OLD | NEW |