Hash :
c47e3407
Author :
Date :
2017-02-13T11:24:03
gpu_test_expectations: fix compile on OSX 10.8 and 10.9 OSX10.8 deprecates Gestalt but doesn't expose a replacement in the public interface so we forward declare it. BUG=angleproject:1890 Change-Id: Ie4825c9191e81a5894dca4e394275c26a3e27853 Reviewed-on: https://chromium-review.googlesource.com/441309 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876
diff -u -rupN gpu_test_expectations_reverted/angle_config.h gpu_test_expectations/angle_config.h
--- gpu_test_expectations_reverted/angle_config.h 1969-12-31 19:00:00.000000000 -0500
+++ gpu_test_expectations/angle_config.h 2016-08-24 13:18:58.877015665 -0400
@@ -0,0 +1,66 @@
+//
+// Copyright 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// angle_config.h:
+// Helpers for importing the gpu test expectations package from Chrome.
+//
+
+#ifndef GPU_TEST_EXPECTATIONS_ANGLE_CONFIG_H_
+#define GPU_TEST_EXPECTATIONS_ANGLE_CONFIG_H_
+
+#include <stdint.h>
+
+#include <iostream>
+
+#include "common/debug.h"
+#include "common/string_utils.h"
+
+#define DCHECK_EQ(A,B) ASSERT((A) == (B))
+#define DCHECK_NE(A,B) ASSERT((A) != (B))
+#define DCHECK(X) ASSERT(X)
+#define LOG(X) std::cerr
+
+#define GPU_EXPORT
+
+typedef int32_t int32;
+typedef uint32_t uint32;
+typedef int64_t int64;
+typedef uint64_t uint64;
+
+// Shim Chromium's base by importing functions in the base namespace.
+namespace base
+{
+ using angle::kWhitespaceASCII;
+ using angle::TRIM_WHITESPACE;
+ using angle::KEEP_WHITESPACE;
+ using angle::SPLIT_WANT_ALL;
+ using angle::SPLIT_WANT_NONEMPTY;
+ using angle::SplitString;
+ using angle::SplitStringAlongWhitespace;
+ using angle::HexStringToUInt;
+ using angle::ReadFileToString;
+
+ // StringPrintf is called differently in ANGLE but using cannot change
+ // the name of the imported function. Use a define to change the name.
+ using ::FormatString;
+ #define StringPrintf FormatString
+}
+
+// TODO(jmadill): other platforms
+// clang-format off
+#if defined(_WIN32) || defined(_WIN64)
+# define OS_WIN
+#elif defined(ANDROID)
+# define OS_ANDROID
+#elif defined(__linux__)
+# define OS_LINUX
+#elif defined(__APPLE__)
+# define OS_MACOSX
+#else
+# error "Unsupported platform"
+#endif
+// clang-format on
+
+#endif
diff -u -rupN gpu_test_expectations_reverted/gpu_info.cc gpu_test_expectations/gpu_info.cc
--- gpu_test_expectations_reverted/gpu_info.cc 2017-02-13 11:15:30.922221193 -0500
+++ gpu_test_expectations/gpu_info.cc 2015-11-25 15:47:24.575592261 -0500
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "gpu/config/gpu_info.h"
+#include "gpu_info.h"
namespace {
@@ -17,31 +17,6 @@ void EnumerateGPUDevice(const gpu::GPUIn
enumerator->EndGPUDevice();
}
-void EnumerateVideoDecodeAcceleratorSupportedProfile(
- const gpu::VideoDecodeAcceleratorSupportedProfile& profile,
- gpu::GPUInfo::Enumerator* enumerator) {
- enumerator->BeginVideoDecodeAcceleratorSupportedProfile();
- enumerator->AddInt("profile", profile.profile);
- enumerator->AddInt("maxResolutionWidth", profile.max_resolution.width());
- enumerator->AddInt("maxResolutionHeight", profile.max_resolution.height());
- enumerator->AddInt("minResolutionWidth", profile.min_resolution.width());
- enumerator->AddInt("minResolutionHeight", profile.min_resolution.height());
- enumerator->EndVideoDecodeAcceleratorSupportedProfile();
-}
-
-void EnumerateVideoEncodeAcceleratorSupportedProfile(
- const gpu::VideoEncodeAcceleratorSupportedProfile& profile,
- gpu::GPUInfo::Enumerator* enumerator) {
- enumerator->BeginVideoEncodeAcceleratorSupportedProfile();
- enumerator->AddInt("profile", profile.profile);
- enumerator->AddInt("maxResolutionWidth", profile.max_resolution.width());
- enumerator->AddInt("maxResolutionHeight", profile.max_resolution.height());
- enumerator->AddInt("maxFramerateNumerator", profile.max_framerate_numerator);
- enumerator->AddInt("maxFramerateDenominator",
- profile.max_framerate_denominator);
- enumerator->EndVideoEncodeAcceleratorSupportedProfile();
-}
-
} // namespace
namespace gpu {
@@ -68,9 +43,6 @@ GPUInfo::GPUInfo()
in_process_gpu(true),
basic_info_state(kCollectInfoNone),
context_info_state(kCollectInfoNone),
-#if defined(OS_WIN)
- dx_diagnostics_info_state(kCollectInfoNone),
-#endif
jpeg_decode_accelerator_supported(false) {
}
@@ -78,11 +50,9 @@ GPUInfo::~GPUInfo() { }
void GPUInfo::EnumerateFields(Enumerator* enumerator) const {
struct GPUInfoKnownFields {
- base::TimeDelta initialization_time;
bool optimus;
bool amd_switchable;
bool lenovo_dcute;
- Version display_link_version;
GPUDevice gpu;
std::vector<GPUDevice> secondary_gpus;
uint64 adapter_luid;
@@ -110,14 +80,6 @@ void GPUInfo::EnumerateFields(Enumerator
bool in_process_gpu;
CollectInfoResult basic_info_state;
CollectInfoResult context_info_state;
-#if defined(OS_WIN)
- CollectInfoResult dx_diagnostics_info_state;
- DxDiagNode dx_diagnostics;
-#endif
- VideoDecodeAcceleratorSupportedProfiles
- video_decode_accelerator_supported_profiles;
- VideoEncodeAcceleratorSupportedProfiles
- video_encode_accelerator_supported_profiles;
bool jpeg_decode_accelerator_supported;
};
@@ -136,15 +98,9 @@ void GPUInfo::EnumerateFields(Enumerator
EnumerateGPUDevice(secondary_gpu, enumerator);
enumerator->BeginAuxAttributes();
- enumerator->AddTimeDeltaInSecondsF("initializationTime",
- initialization_time);
enumerator->AddBool("optimus", optimus);
enumerator->AddBool("amdSwitchable", amd_switchable);
enumerator->AddBool("lenovoDcute", lenovo_dcute);
- if (display_link_version.IsValid()) {
- enumerator->AddString("displayLinkVersion",
- display_link_version.GetString());
- }
enumerator->AddInt64("adapterLuid", adapter_luid);
enumerator->AddString("driverVendor", driver_vendor);
enumerator->AddString("driverVersion", driver_version);
@@ -171,14 +127,7 @@ void GPUInfo::EnumerateFields(Enumerator
enumerator->AddBool("inProcessGpu", in_process_gpu);
enumerator->AddInt("basicInfoState", basic_info_state);
enumerator->AddInt("contextInfoState", context_info_state);
-#if defined(OS_WIN)
- enumerator->AddInt("DxDiagnosticsInfoState", dx_diagnostics_info_state);
-#endif
// TODO(kbr): add dx_diagnostics on Windows.
- for (const auto& profile : video_decode_accelerator_supported_profiles)
- EnumerateVideoDecodeAcceleratorSupportedProfile(profile, enumerator);
- for (const auto& profile : video_encode_accelerator_supported_profiles)
- EnumerateVideoEncodeAcceleratorSupportedProfile(profile, enumerator);
enumerator->AddBool("jpegDecodeAcceleratorSupported",
jpeg_decode_accelerator_supported);
enumerator->EndAuxAttributes();
diff -u -rupN gpu_test_expectations_reverted/gpu_info.h gpu_test_expectations/gpu_info.h
--- gpu_test_expectations_reverted/gpu_info.h 2017-02-13 11:15:30.922221193 -0500
+++ gpu_test_expectations/gpu_info.h 2015-11-25 15:47:24.575592261 -0500
@@ -11,13 +11,7 @@
#include <string>
#include <vector>
-#include "base/basictypes.h"
-#include "base/time/time.h"
-#include "base/version.h"
-#include "build/build_config.h"
-#include "gpu/config/dx_diag_node.h"
-#include "gpu/gpu_export.h"
-#include "ui/gfx/geometry/size.h"
+#include "angle_config.h"
namespace gpu {
@@ -54,25 +48,6 @@ enum VideoCodecProfile {
VIDEO_CODEC_PROFILE_MAX = VP9PROFILE_ANY,
};
-// Specification of a decoding profile supported by a hardware decoder.
-struct GPU_EXPORT VideoDecodeAcceleratorSupportedProfile {
- VideoCodecProfile profile;
- gfx::Size max_resolution;
- gfx::Size min_resolution;
-};
-using VideoDecodeAcceleratorSupportedProfiles =
- std::vector<VideoDecodeAcceleratorSupportedProfile>;
-
-// Specification of an encoding profile supported by a hardware encoder.
-struct GPU_EXPORT VideoEncodeAcceleratorSupportedProfile {
- VideoCodecProfile profile;
- gfx::Size max_resolution;
- uint32 max_framerate_numerator;
- uint32 max_framerate_denominator;
-};
-using VideoEncodeAcceleratorSupportedProfiles =
- std::vector<VideoEncodeAcceleratorSupportedProfile>;
-
struct GPU_EXPORT GPUInfo {
struct GPU_EXPORT GPUDevice {
GPUDevice();
@@ -104,10 +79,6 @@ struct GPU_EXPORT GPUInfo {
return !can_lose_context && !software_rendering;
}
- // The amount of time taken to get from the process starting to the message
- // loop being pumped.
- base::TimeDelta initialization_time;
-
// Computer has NVIDIA Optimus
bool optimus;
@@ -117,10 +88,6 @@ struct GPU_EXPORT GPUInfo {
// Lenovo dCute is installed. http://crbug.com/181665.
bool lenovo_dcute;
- // Version of DisplayLink driver installed. Zero if not installed.
- // http://crbug.com/177611.
- Version display_link_version;
-
// Primary GPU, for exmaple, the discrete GPU in a dual GPU machine.
GPUDevice gpu;
@@ -213,17 +180,7 @@ struct GPU_EXPORT GPUInfo {
// if the collection fails or not.
CollectInfoResult basic_info_state;
CollectInfoResult context_info_state;
-#if defined(OS_WIN)
- CollectInfoResult dx_diagnostics_info_state;
- // The information returned by the DirectX Diagnostics Tool.
- DxDiagNode dx_diagnostics;
-#endif
-
- VideoDecodeAcceleratorSupportedProfiles
- video_decode_accelerator_supported_profiles;
- VideoEncodeAcceleratorSupportedProfiles
- video_encode_accelerator_supported_profiles;
bool jpeg_decode_accelerator_supported;
// Note: when adding new members, please remember to update EnumerateFields
@@ -243,8 +200,6 @@ struct GPU_EXPORT GPUInfo {
virtual void AddInt(const char* name, int value) = 0;
virtual void AddString(const char* name, const std::string& value) = 0;
virtual void AddBool(const char* name, bool value) = 0;
- virtual void AddTimeDeltaInSecondsF(const char* name,
- const base::TimeDelta& value) = 0;
// Markers indicating that a GPUDevice is being described.
virtual void BeginGPUDevice() = 0;
diff -u -rupN gpu_test_expectations_reverted/gpu_test_config.cc gpu_test_expectations/gpu_test_config.cc
--- gpu_test_expectations_reverted/gpu_test_config.cc 2017-02-13 11:15:30.922221193 -0500
+++ gpu_test_expectations/gpu_test_config.cc 2016-09-14 14:55:40.134685526 -0400
@@ -2,20 +2,205 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "gpu/config/gpu_test_config.h"
+#include "gpu_test_config.h"
-#include "base/logging.h"
-#include "base/sys_info.h"
-#include "gpu/config/gpu_info.h"
-#include "gpu/config/gpu_info_collector.h"
-#include "gpu/config/gpu_test_expectations_parser.h"
+#include "gpu_info.h"
+#include "gpu_test_expectations_parser.h"
+
+#if defined(OS_LINUX)
+extern "C" {
+# include <pci/pci.h>
+}
+#endif
#if defined(OS_MACOSX)
-#include "base/mac/mac_util.h"
-#elif defined(OS_WIN)
-#include "base/win/windows_version.h"
+#include "gpu_test_config_mac.h"
+#endif
+
+using namespace gpu;
+
+#if defined(OS_WIN)
+
+namespace base {
+
+namespace {
+
+// Disable the deprecated function warning for GetVersionEx
+#pragma warning(disable: 4996)
+
+class SysInfo
+{
+ public:
+ static void OperatingSystemVersionNumbers(
+ int32 *major_version, int32 *minor_version, int32 *bugfix_version);
+};
+
+// static
+void SysInfo::OperatingSystemVersionNumbers(
+ int32 *major_version, int32 *minor_version, int32 *bugfix_version)
+{
+ OSVERSIONINFOEX version_info = { sizeof version_info };
+ ::GetVersionEx(reinterpret_cast<OSVERSIONINFO*>(&version_info));
+ *major_version = version_info.dwMajorVersion;
+ *minor_version = version_info.dwMinorVersion;
+ *bugfix_version = version_info.dwBuildNumber;
+}
+
+} // anonymous namespace
+
+} // namespace base
+
+void DeviceIDToVendorAndDevice(const std::string& id,
+ uint32* vendor_id,
+ uint32* device_id) {
+ *vendor_id = 0;
+ *device_id = 0;
+ if (id.length() < 21)
+ return;
+ std::string vendor_id_string = id.substr(8, 4);
+ std::string device_id_string = id.substr(17, 4);
+ base::HexStringToUInt(vendor_id_string, vendor_id);
+ base::HexStringToUInt(device_id_string, device_id);
+}
+
+CollectInfoResult CollectGpuID(uint32* vendor_id, uint32* device_id) {
+ DCHECK(vendor_id && device_id);
+ *vendor_id = 0;
+ *device_id = 0;
+
+ // Taken from http://developer.nvidia.com/object/device_ids.html
+ DISPLAY_DEVICEA dd;
+ dd.cb = sizeof(DISPLAY_DEVICEA);
+ std::string id;
+ for (int i = 0; EnumDisplayDevicesA(NULL, i, &dd, 0); ++i) {
+ if (dd.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE) {
+ id = dd.DeviceID;
+ break;
+ }
+ }
+
+ if (id.length() > 20) {
+ DeviceIDToVendorAndDevice(id, vendor_id, device_id);
+ if (*vendor_id != 0 && *device_id != 0)
+ return kCollectInfoSuccess;
+ }
+ return kCollectInfoNonFatalFailure;
+}
+
+#endif // defined(OS_WIN)
+
+#if defined(OS_LINUX)
+
+const uint32 kVendorIDIntel = 0x8086;
+const uint32 kVendorIDNVidia = 0x10de;
+const uint32 kVendorIDAMD = 0x1002;
+
+CollectInfoResult CollectPCIVideoCardInfo(GPUInfo* gpu_info) {
+ DCHECK(gpu_info);
+
+ struct pci_access* access = pci_alloc();
+ DCHECK(access != NULL);
+ pci_init(access);
+ pci_scan_bus(access);
+
+ bool primary_gpu_identified = false;
+ for (pci_dev* device = access->devices;
+ device != NULL; device = device->next) {
+ pci_fill_info(device, 33);
+ bool is_gpu = false;
+ switch (device->device_class) {
+ case PCI_CLASS_DISPLAY_VGA:
+ case PCI_CLASS_DISPLAY_XGA:
+ case PCI_CLASS_DISPLAY_3D:
+ is_gpu = true;
+ break;
+ case PCI_CLASS_DISPLAY_OTHER:
+ default:
+ break;
+ }
+ if (!is_gpu)
+ continue;
+ if (device->vendor_id == 0 || device->device_id == 0)
+ continue;
+
+ GPUInfo::GPUDevice gpu;
+ gpu.vendor_id = device->vendor_id;
+ gpu.device_id = device->device_id;
+
+ if (!primary_gpu_identified) {
+ primary_gpu_identified = true;
+ gpu_info->gpu = gpu;
+ } else {
+ // TODO(zmo): if there are multiple GPUs, we assume the non Intel
+ // one is primary. Revisit this logic because we actually don't know
+ // which GPU we are using at this point.
+ if (gpu_info->gpu.vendor_id == kVendorIDIntel &&
+ gpu.vendor_id != kVendorIDIntel) {
+ gpu_info->secondary_gpus.push_back(gpu_info->gpu);
+ gpu_info->gpu = gpu;
+ } else {
+ gpu_info->secondary_gpus.push_back(gpu);
+ }
+ }
+ }
+
+ // Detect Optimus or AMD Switchable GPU.
+ if (gpu_info->secondary_gpus.size() == 1 &&
+ gpu_info->secondary_gpus[0].vendor_id == kVendorIDIntel) {
+ if (gpu_info->gpu.vendor_id == kVendorIDNVidia)
+ gpu_info->optimus = true;
+ if (gpu_info->gpu.vendor_id == kVendorIDAMD)
+ gpu_info->amd_switchable = true;
+ }
+
+ pci_cleanup(access);
+ if (!primary_gpu_identified)
+ return kCollectInfoNonFatalFailure;
+ return kCollectInfoSuccess;
+}
+
+CollectInfoResult CollectGpuID(uint32* vendor_id, uint32* device_id) {
+ DCHECK(vendor_id && device_id);
+ *vendor_id = 0;
+ *device_id = 0;
+
+ GPUInfo gpu_info;
+ CollectInfoResult result = CollectPCIVideoCardInfo(&gpu_info);
+ if (result == kCollectInfoSuccess) {
+ *vendor_id = gpu_info.gpu.vendor_id;
+ *device_id = gpu_info.gpu.device_id;
+ }
+ return result;
+}
+
+#endif // defined(OS_LINUX)
+
+#if defined(OS_MACOSX)
+
+CollectInfoResult CollectGpuID(uint32* vendor_id, uint32* device_id) {
+ DCHECK(vendor_id && device_id);
+
+ GPUInfo::GPUDevice gpu = GetActiveGPU();
+ *vendor_id = gpu.vendor_id;
+ *device_id = gpu.device_id;
+
+ if (*vendor_id != 0 && *device_id != 0)
+ return kCollectInfoSuccess;
+ return kCollectInfoNonFatalFailure;
+}
+
#endif
+#if defined(OS_ANDROID)
+CollectInfoResult CollectGpuID(uint32 *vendor_id, uint32 *device_id)
+{
+ DCHECK(vendor_id && device_id);
+ *vendor_id = 0;
+ *device_id = 0;
+ return kCollectInfoNonFatalFailure;
+}
+#endif // defined(OS_ANDROID)
+
namespace gpu {
namespace {
@@ -245,33 +430,41 @@ bool GPUTestBotConfig::Matches(const std
return Matches(config);
}
-bool GPUTestBotConfig::LoadCurrentConfig(const GPUInfo* gpu_info) {
- bool rt;
- if (gpu_info == NULL) {
- GPUInfo my_gpu_info;
- CollectInfoResult result = CollectGpuID(
- &my_gpu_info.gpu.vendor_id, &my_gpu_info.gpu.device_id);
- if (result != kCollectInfoSuccess) {
- LOG(ERROR) << "Fail to identify GPU";
- DisableGPUInfoValidation();
- rt = true;
- } else {
- rt = SetGPUInfo(my_gpu_info);
+bool GPUTestBotConfig::LoadCurrentConfig(const GPUInfo *gpu_info)
+{
+ bool rt;
+ if (gpu_info == NULL)
+ {
+ GPUInfo my_gpu_info;
+ CollectInfoResult result =
+ CollectGpuID(&my_gpu_info.gpu.vendor_id, &my_gpu_info.gpu.device_id);
+ if (result != kCollectInfoSuccess)
+ {
+ LOG(ERROR) << "Fail to identify GPU\n";
+ DisableGPUInfoValidation();
+ rt = true;
+ }
+ else
+ {
+ rt = SetGPUInfo(my_gpu_info);
+ }
+ }
+ else
+ {
+ rt = SetGPUInfo(*gpu_info);
+ }
+ set_os(GetCurrentOS());
+ if (os() == kOsUnknown)
+ {
+ LOG(ERROR) << "Unknown OS\n";
+ rt = false;
}
- } else {
- rt = SetGPUInfo(*gpu_info);
- }
- set_os(GetCurrentOS());
- if (os() == kOsUnknown) {
- LOG(ERROR) << "Unknown OS";
- rt = false;
- }
#if defined(NDEBUG)
- set_build_type(kBuildTypeRelease);
+ set_build_type(kBuildTypeRelease);
#else
- set_build_type(kBuildTypeDebug);
+ set_build_type(kBuildTypeDebug);
#endif
- return rt;
+ return rt;
}
// static
@@ -295,21 +488,5 @@ bool GPUTestBotConfig::CurrentConfigMatc
return false;
}
-// static
-bool GPUTestBotConfig::GpuBlacklistedOnBot() {
-#if defined(OS_MACOSX)
- // Blacklist rule #81 disables all Gpu acceleration on Mac < 10.8 bots.
- if (CurrentConfigMatches("MAC VMWARE") && base::mac::IsOSLionOrEarlier()) {
- return true;
- }
-#elif defined(OS_WIN)
- // Blacklist rule #79 disables all Gpu acceleration before Windows 7.
- if (base::win::GetVersion() <= base::win::VERSION_VISTA) {
- return true;
- }
-#endif
- return false;
-}
-
} // namespace gpu
diff -u -rupN gpu_test_expectations_reverted/gpu_test_config.h gpu_test_expectations/gpu_test_config.h
--- gpu_test_expectations_reverted/gpu_test_config.h 2017-02-13 11:15:30.922221193 -0500
+++ gpu_test_expectations/gpu_test_config.h 2015-11-25 15:47:24.575592261 -0500
@@ -8,9 +8,7 @@
#include <string>
#include <vector>
-#include "base/basictypes.h"
-#include "base/compiler_specific.h"
-#include "gpu/gpu_export.h"
+#include "angle_config.h"
namespace gpu {
@@ -134,9 +132,6 @@ class GPU_EXPORT GPUTestBotConfig : publ
// Check if this bot's config matches |config_data| or any of the |configs|.
static bool CurrentConfigMatches(const std::string& config_data);
static bool CurrentConfigMatches(const std::vector<std::string>& configs);
-
- // Check if the bot has blacklisted all GPU features.
- static bool GpuBlacklistedOnBot();
};
} // namespace gpu
diff -u -rupN gpu_test_expectations_reverted/gpu_test_config_mac.h gpu_test_expectations/gpu_test_config_mac.h
--- gpu_test_expectations_reverted/gpu_test_config_mac.h 1969-12-31 19:00:00.000000000 -0500
+++ gpu_test_expectations/gpu_test_config_mac.h 2015-09-16 16:05:45.788950024 -0400
@@ -0,0 +1,28 @@
+//
+// Copyright 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// gpu_test_config_mac.h:
+// Helper functions for gpu_test_config that have to be compiled in ObjectiveC++
+//
+
+#ifndef GPU_TEST_EXPECTATIONS_GPU_TEST_CONFIG_MAC_H_
+#define GPU_TEST_EXPECTATIONS_GPU_TEST_CONFIG_MAC_H_
+
+#include "gpu_info.h"
+
+namespace base {
+
+class SysInfo
+{
+ public:
+ static void OperatingSystemVersionNumbers(
+ int32 *major_version, int32 *minor_version, int32 *bugfix_version);
+};
+
+} // namespace base
+
+gpu::GPUInfo::GPUDevice GetActiveGPU();
+
+#endif // GPU_TEST_EXPECTATIONS_GPU_TEST_CONFIG_MAC_H_
diff -u -rupN gpu_test_expectations_reverted/gpu_test_config_mac.mm gpu_test_expectations/gpu_test_config_mac.mm
--- gpu_test_expectations_reverted/gpu_test_config_mac.mm 1969-12-31 19:00:00.000000000 -0500
+++ gpu_test_expectations/gpu_test_config_mac.mm 2017-02-13 11:20:54.656424702 -0500
@@ -0,0 +1,75 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// gpu_test_config_mac.mm:
+// Helper functions for gpu_test_config that have to be compiled in ObjectiveC++
+
+#include "gpu_test_config_mac.h"
+
+#import <Cocoa/Cocoa.h>
+
+namespace base {
+
+// OSX 10.8 deprecates Gestalt but doesn't make the operatingSystemVersion property part of the
+// public interface of NSProcessInfo until 10.10. Add a forward declaration.
+#if !defined(MAC_OS_X_VERSION_10_10) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_10
+@interface NSProcessInfo (YosemiteSDK)
+@property(readonly) NSOperatingSystemVersion operatingSystemVersion;
+@end
+#endif
+
+void SysInfo::OperatingSystemVersionNumbers(
+ int32 *major_version, int32 *minor_version, int32 *bugfix_version)
+{
+#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_8
+ Gestalt(gestaltSystemVersionMajor, reinterpret_cast<SInt32*>(major_version));
+ Gestalt(gestaltSystemVersionMinor, reinterpret_cast<SInt32*>(minor_version));
+ Gestalt(gestaltSystemVersionBugFix, reinterpret_cast<SInt32*>(bugfix_version));
+#else
+ NSOperatingSystemVersion version = [[NSProcessInfo processInfo] operatingSystemVersion];
+ *major_version = version.majorVersion;
+ *minor_version = version.minorVersion;
+ *bugfix_version = version.patchVersion;
+#endif
+}
+
+} // namespace base
+
+UInt32 GetEntryProperty(io_registry_entry_t entry, CFStringRef property_name) {
+ CFTypeRef type = IORegistryEntrySearchCFProperty(entry,
+ kIOServicePlane,
+ property_name,
+ kCFAllocatorDefault,
+ kIORegistryIterateRecursively | kIORegistryIterateParents);
+ CFDataRef data = reinterpret_cast<CFDataRef>(type);
+ if (!data) {
+ CFRelease(data);
+ return 0;
+ }
+
+ UInt32 value = 0;
+ const uint32_t* valuePointer = reinterpret_cast<const uint32_t*>(CFDataGetBytePtr(data));
+ if (valuePointer != NULL) {
+ value = *valuePointer;
+ }
+ CFRelease(data);
+ return value;
+}
+
+gpu::GPUInfo::GPUDevice GetActiveGPU() {
+ gpu::GPUInfo::GPUDevice gpu;
+
+ // Ignore the fact that CGDisplayIOServicePort is deprecated as Apple
+ // did not provide a good replacement for it as of 10.10.
+ // TODO(cwallez) revisit with later systems
+ #pragma clang diagnostic push
+ #pragma clang diagnostic ignored "-Wdeprecated-declarations"
+ io_registry_entry_t dsp_port = CGDisplayIOServicePort(kCGDirectMainDisplay);
+ #pragma clang diagnostic pop
+
+ gpu.vendor_id = GetEntryProperty(dsp_port, CFSTR("vendor-id"));
+ gpu.device_id = GetEntryProperty(dsp_port, CFSTR("device-id"));
+ return gpu;
+}
+
diff -u -rupN gpu_test_expectations_reverted/gpu_test_expectations_parser.cc gpu_test_expectations/gpu_test_expectations_parser.cc
--- gpu_test_expectations_reverted/gpu_test_expectations_parser.cc 2017-02-13 11:15:30.922221193 -0500
+++ gpu_test_expectations/gpu_test_expectations_parser.cc 2015-11-25 15:47:24.575592261 -0500
@@ -2,14 +2,43 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "gpu/config/gpu_test_expectations_parser.h"
+#include "gpu_test_expectations_parser.h"
-#include "base/files/file_util.h"
-#include "base/logging.h"
-#include "base/strings/string_number_conversions.h"
-#include "base/strings/string_split.h"
-#include "base/strings/string_util.h"
-#include "base/strings/stringprintf.h"
+#include "common/angleutils.h"
+
+namespace base {
+
+namespace {
+
+bool StartsWithASCII(const std::string& str,
+ const std::string& search,
+ bool case_sensitive) {
+ ASSERT(!case_sensitive);
+ return str.compare(0, search.length(), search) == 0;
+}
+
+template <class Char> inline Char ToLowerASCII(Char c) {
+ return (c >= 'A' && c <= 'Z') ? (c + ('a' - 'A')) : c;
+}
+
+template<typename Iter>
+static inline bool DoLowerCaseEqualsASCII(Iter a_begin,
+ Iter a_end,
+ const char* b) {
+ for (Iter it = a_begin; it != a_end; ++it, ++b) {
+ if (!*b || base::ToLowerASCII(*it) != *b)
+ return false;
+ }
+ return *b == 0;
+}
+
+bool LowerCaseEqualsASCII(const std::string& a, const char* b) {
+ return DoLowerCaseEqualsASCII(a.begin(), a.end(), b);
+}
+
+} // anonymous namespace
+
+} // namespace base
namespace gpu {
@@ -146,9 +175,9 @@ const char* kErrorMessage[] = {
};
Token ParseToken(const std::string& word) {
- if (base::StartsWith(word, "//", base::CompareCase::INSENSITIVE_ASCII))
+ if (base::StartsWithASCII(word, "//", false))
return kTokenComment;
- if (base::StartsWith(word, "0x", base::CompareCase::INSENSITIVE_ASCII))
+ if (base::StartsWithASCII(word, "0x", false))
return kConfigGPUDeviceID;
for (int32 i = 0; i < kNumberOfExactMatchTokens; ++i) {
@@ -176,10 +205,10 @@ bool NamesMatching(const std::string& re
GPUTestExpectationsParser::GPUTestExpectationsParser() {
// Some sanity check.
- DCHECK_EQ(static_cast<unsigned int>(kNumberOfExactMatchTokens),
- sizeof(kTokenData) / sizeof(kTokenData[0]));
- DCHECK_EQ(static_cast<unsigned int>(kNumberOfErrors),
- sizeof(kErrorMessage) / sizeof(kErrorMessage[0]));
+ static_assert(static_cast<unsigned int>(kNumberOfExactMatchTokens) ==
+ sizeof(kTokenData) / sizeof(kTokenData[0]), "sanity check");
+ static_assert(static_cast<unsigned int>(kNumberOfErrors) ==
+ sizeof(kErrorMessage) / sizeof(kErrorMessage[0]), "sanity check");
}
GPUTestExpectationsParser::~GPUTestExpectationsParser() {
@@ -204,8 +233,8 @@ bool GPUTestExpectationsParser::LoadTest
return rt;
}
-bool GPUTestExpectationsParser::LoadTestExpectations(
- const base::FilePath& path) {
+bool GPUTestExpectationsParser::LoadTestExpectationsFromFile(
+ const std::string& path) {
entries_.clear();
error_messages_.clear();
@@ -399,7 +428,7 @@ bool GPUTestExpectationsParser::ParseLin
stage++;
break;
default:
- DCHECK(false);
+ UNREACHABLE();
break;
}
}
@@ -488,7 +517,7 @@ bool GPUTestExpectationsParser::UpdateTe
config->set_api(config->api() | kTokenData[token].flag);
break;
default:
- DCHECK(false);
+ UNREACHABLE();
break;
}
return true;
diff -u -rupN gpu_test_expectations_reverted/gpu_test_expectations_parser.h gpu_test_expectations/gpu_test_expectations_parser.h
--- gpu_test_expectations_reverted/gpu_test_expectations_parser.h 2017-02-13 11:15:30.922221193 -0500
+++ gpu_test_expectations/gpu_test_expectations_parser.h 2015-06-30 09:40:06.654788989 -0400
@@ -8,10 +8,8 @@
#include <string>
#include <vector>
-#include "base/basictypes.h"
-#include "base/files/file_path.h"
-#include "gpu/config/gpu_test_config.h"
-#include "gpu/gpu_export.h"
+#include "angle_config.h"
+#include "gpu_test_config.h"
namespace gpu {
@@ -32,7 +30,7 @@ class GPU_EXPORT GPUTestExpectationsPars
// save all the entries. Otherwise, generate error messages.
// Return true if parsing succeeds.
bool LoadTestExpectations(const std::string& data);
- bool LoadTestExpectations(const base::FilePath& path);
+ bool LoadTestExpectationsFromFile(const std::string& path);
// Query error messages from the last LoadTestExpectations() call.
const std::vector<std::string>& GetErrorMessages() const;
diff -u -rupN gpu_test_expectations_reverted/HowToMakeChanges.md gpu_test_expectations/HowToMakeChanges.md
--- gpu_test_expectations_reverted/HowToMakeChanges.md 1969-12-31 19:00:00.000000000 -0500
+++ gpu_test_expectations/HowToMakeChanges.md 2016-09-14 14:55:40.134685526 -0400
@@ -0,0 +1,22 @@
+Because the ```gpu_test_expectations``` directory is based on parts of Chromium's ```gpu/config```
+directory, we want to keep a patch of the changes added to make it compile with ANGLE. This
+will allow us to merge Chromium changes easily in our ```gpu_test_expectations```.
+
+In order to make a change to this directory, do the following:
+
+ * copy the directory somewhere like in ```gpu_test_expectations_reverted```
+ * in ```gpu_test_expectations_reverted``` run ```patch -p 1 -R < angle-mods.patch```
+ * do your changes in ```gpu_test_expectations```
+ * delete angle-mods.patch in both directories
+ * run ```diff -rupN gpu_test_expectations_reverted gpu_test_expectations > angle-mods.patch```
+ * copy ```angle-mods.patch``` in ```gpu_test_expectations```
+
+How to update from Chromium:
+
+ * ```git apply -R angle-mods.patch```, ```git add . -u```, ```git commit```
+ * Copy over Chromium files, ```git add . -u```, ```git commit```
+ * ```git revert HEAD~```
+ * ```rm angle-mods.patch```
+ * ```git diff HEAD~ (`)ls(`) > angle-mods.patch```,```git add angle-mods.patch```, ```git commit --amend```
+ * ```git rebase -i``` to squash the three patches into one.
+