| 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 { |
| 251 const char* driver_vendor; |
| 252 const char* driver_version; |
| 250 const char* gl_renderer; | 253 const char* gl_renderer; |
| 251 const char* gl_vendor; | 254 const char* gl_vendor; |
| 252 const char* gl_version; | 255 const char* gl_version; |
| 256 const char* expected_driver_vendor; |
| 253 const char* expected_driver_version; | 257 const char* expected_driver_version; |
| 254 } kTestStrings[] = { | 258 } kTestStrings[] = { |
| 255 #if defined(OS_ANDROID) | 259 #if defined(OS_ANDROID) |
| 256 {"Adreno (TM) 320", | 260 {"Unknown", |
| 261 "-1", |
| 262 "Adreno (TM) 320", |
| 257 "Qualcomm", | 263 "Qualcomm", |
| 258 "OpenGL ES 2.0 V@14.0 AU@04.02 (CL@3206)", | 264 "OpenGL ES 2.0 V@14.0 AU@04.02 (CL@3206)", |
| 265 "Unknown", |
| 259 "14.0"}, | 266 "14.0"}, |
| 260 {"Adreno (TM) 420", "Qualcomm", "OpenGL ES 3.0 V@84.0 AU@ (CL@)", "84.0"}, | 267 {"Unknown", |
| 261 {"PowerVR Rogue G6430", | 268 "-1", |
| 269 "Adreno (TM) 420", |
| 270 "Qualcomm", |
| 271 "OpenGL ES 3.0 V@84.0 AU@ (CL@)", |
| 272 "Unknown", |
| 273 "84.0"}, |
| 274 {"Unknown", |
| 275 "-1", |
| 276 "PowerVR Rogue G6430", |
| 262 "Imagination Technologies", | 277 "Imagination Technologies", |
| 263 "OpenGL ES 3.1 build 1.4@3283119", | 278 "OpenGL ES 3.1 build 1.4@3283119", |
| 279 "Unknown", |
| 264 "1.4"}, | 280 "1.4"}, |
| 265 {"Mali-T604", "ARM", "OpenGL ES 3.1", "0"}, | 281 {"Unknown", |
| 266 {"NVIDIA Tegra", | 282 "-1", |
| 283 "Mali-T604", |
| 284 "ARM", |
| 285 "OpenGL ES 3.1", |
| 286 "Unknown", |
| 287 "0"}, |
| 288 {"Unknown", |
| 289 "-1", |
| 290 "NVIDIA Tegra", |
| 267 "NVIDIA Corporation", | 291 "NVIDIA Corporation", |
| 268 "OpenGL ES 3.1 NVIDIA 343.00", | 292 "OpenGL ES 3.1 NVIDIA 343.00", |
| 293 "Unknown", |
| 269 "343.00"}, | 294 "343.00"}, |
| 270 {"NVIDIA Tegra 3", | 295 {"Unknown", |
| 296 "-1", |
| 297 "NVIDIA Tegra 3", |
| 271 "NVIDIA Corporation", | 298 "NVIDIA Corporation", |
| 272 "OpenGL ES 2.0 14.01003", | 299 "OpenGL ES 2.0 14.01003", |
| 300 "Unknown", |
| 273 "14.01003"}, | 301 "14.01003"}, |
| 274 {"random GPU", | 302 {"Unknown", |
| 303 "-1", |
| 304 "random GPU", |
| 275 "random vendor", | 305 "random vendor", |
| 276 "OpenGL ES 2.0 with_long_version_string=1.2.3.4", | 306 "OpenGL ES 2.0 with_long_version_string=1.2.3.4", |
| 307 NULL, |
| 277 "1.2"}, | 308 "1.2"}, |
| 278 {"random GPU", | 309 {"Unknown", |
| 310 "-1", |
| 311 "random GPU", |
| 279 "random vendor", | 312 "random vendor", |
| 280 "OpenGL ES 2.0 with_short_version_string=1", | 313 "OpenGL ES 2.0 with_short_version_string=1", |
| 314 NULL, |
| 281 "0"}, | 315 "0"}, |
| 282 {"random GPU", | 316 {"Unknown", |
| 317 "-1", |
| 318 "random GPU", |
| 283 "random vendor", | 319 "random vendor", |
| 284 "OpenGL ES 2.0 with_no_version_string", | 320 "OpenGL ES 2.0 with_no_version_string", |
| 321 NULL, |
| 285 "0"}, | 322 "0"}, |
| 286 #elif defined(OS_MACOSX) | 323 #elif defined(OS_MACOSX) |
| 287 {"Intel Iris Pro OpenGL Engine", | 324 {"Unknown", |
| 325 "-1", |
| 326 "Intel Iris Pro OpenGL Engine", |
| 288 "Intel Inc.", | 327 "Intel Inc.", |
| 289 "2.1 INTEL-10.6.20", | 328 "2.1 INTEL-10.6.20", |
| 329 "Unknown", |
| 290 "10.6.20"}, | 330 "10.6.20"}, |
| 291 #elif defined(OS_LINUX) | 331 #elif defined(OS_LINUX) |
| 292 {"Quadro K2000/PCIe/SSE2", | 332 {"", |
| 333 "", |
| 334 "Quadro K2000/PCIe/SSE2", |
| 293 "NVIDIA Corporation", | 335 "NVIDIA Corporation", |
| 294 "4.4.0 NVIDIA 331.79", | 336 "4.4.0 NVIDIA 331.79", |
| 337 "NVIDIA", |
| 295 "331.79"}, | 338 "331.79"}, |
| 339 {"", |
| 340 "", |
| 341 "Gallium 0.4 on NVE7", |
| 342 "nouveau", |
| 343 "3.3 (Core Profile) Mesa 10.5.9", |
| 344 "Mesa", |
| 345 "10.5.9"}, |
| 346 {"", |
| 347 "", |
| 348 "Mesa DRI Intel(R) Haswell Mobile", |
| 349 "Intel Open Source Technology Center", |
| 350 "OpenGL ES 3.0 Mesa 12.1.0-devel (git-ed9dd3b)", |
| 351 "Mesa", |
| 352 "12.1.0"}, |
| 353 {"ATI / AMD", |
| 354 "15.201.1151", |
| 355 "ASUS R5 230 Series", |
| 356 "ATI Technologies Inc.", |
| 357 "4.5.13399 Compatibility Profile Context 14.0", |
| 358 "ATI / AMD", |
| 359 "15.201.1151"}, |
| 296 #endif | 360 #endif |
| 297 {NULL, NULL, NULL, NULL} | 361 {NULL, NULL, NULL, NULL, NULL, NULL, NULL} |
| 298 }; | 362 }; |
| 363 // clang-format on |
| 299 | 364 |
| 300 GPUInfo gpu_info; | |
| 301 for (int i = 0; kTestStrings[i].gl_renderer != NULL; ++i) { | 365 for (int i = 0; kTestStrings[i].gl_renderer != NULL; ++i) { |
| 302 gpu_info.gl_renderer = kTestStrings[i].gl_renderer; | 366 GPUInfo gpu_info; |
| 303 gpu_info.gl_vendor = kTestStrings[i].gl_vendor; | 367 const auto& testStrings = kTestStrings[i]; |
| 304 gpu_info.gl_version = kTestStrings[i].gl_version; | 368 gpu_info.driver_vendor = testStrings.driver_vendor; |
| 305 EXPECT_EQ(CollectDriverInfoGL(&gpu_info), kCollectInfoSuccess); | 369 gpu_info.driver_version = testStrings.driver_version; |
| 306 EXPECT_EQ(gpu_info.driver_version, kTestStrings[i].expected_driver_version); | 370 gpu_info.gl_renderer = testStrings.gl_renderer; |
| 371 gpu_info.gl_vendor = testStrings.gl_vendor; |
| 372 gpu_info.gl_version = testStrings.gl_version; |
| 373 EXPECT_EQ(kCollectInfoSuccess, CollectDriverInfoGL(&gpu_info)); |
| 374 EXPECT_EQ(testStrings.expected_driver_version, gpu_info.driver_version); |
| 375 if (testStrings.expected_driver_vendor) { |
| 376 EXPECT_EQ(testStrings.expected_driver_vendor, gpu_info.driver_vendor); |
| 377 } |
| 307 } | 378 } |
| 308 } | 379 } |
| 309 | 380 |
| 310 TEST(MultiGPUsTest, IdentifyActiveGPU) { | 381 TEST(MultiGPUsTest, IdentifyActiveGPU) { |
| 311 GPUInfo::GPUDevice nvidia_gpu; | 382 GPUInfo::GPUDevice nvidia_gpu; |
| 312 nvidia_gpu.vendor_id = 0x10de; | 383 nvidia_gpu.vendor_id = 0x10de; |
| 313 nvidia_gpu.device_id = 0x0df8; | 384 nvidia_gpu.device_id = 0x0df8; |
| 314 GPUInfo::GPUDevice intel_gpu; | 385 GPUInfo::GPUDevice intel_gpu; |
| 315 intel_gpu.vendor_id = 0x8086; | 386 intel_gpu.vendor_id = 0x8086; |
| 316 intel_gpu.device_id = 0x0416; | 387 intel_gpu.device_id = 0x0416; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 | 425 |
| 355 gpu_info.gl_vendor = "Google Corporation"; | 426 gpu_info.gl_vendor = "Google Corporation"; |
| 356 gpu_info.gl_renderer = "Chrome GPU Team"; | 427 gpu_info.gl_renderer = "Chrome GPU Team"; |
| 357 IdentifyActiveGPU(&gpu_info); | 428 IdentifyActiveGPU(&gpu_info); |
| 358 EXPECT_FALSE(gpu_info.gpu.active); | 429 EXPECT_FALSE(gpu_info.gpu.active); |
| 359 EXPECT_FALSE(gpu_info.secondary_gpus[0].active); | 430 EXPECT_FALSE(gpu_info.secondary_gpus[0].active); |
| 360 } | 431 } |
| 361 | 432 |
| 362 } // namespace gpu | 433 } // namespace gpu |
| 363 | 434 |
| OLD | NEW |