Changeset 247521 in webkit
- Timestamp:
- Jul 17, 2019 10:50:45 AM (5 years ago)
- Location:
- trunk/Source
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/ThirdParty/ANGLE/BUILD.gn
r245088 r247521 290 290 291 291 angle_static_library("angle_gpu_info_util") { 292 public_configs += [ ":angle_gpu_info_util_config" ] 292 public_configs += [ 293 ":angle_gpu_info_util_config", 294 ":angle_backend_config", 295 ] 293 296 public_deps = [ 294 297 ":angle_common", … … 306 309 sources += libangle_gpu_info_util_win_sources 307 310 libs += [ "setupapi.lib" ] 308 defines += [ "GPU_INFO_USE_SETUPAPI" ]311 libs += [ "dxgi.lib" ] 309 312 } 310 313 … … 444 447 } 445 448 449 config("angle_backend_config") { 450 defines = [] 451 452 if (angle_enable_d3d9) { 453 defines += [ "ANGLE_ENABLE_D3D9" ] 454 } 455 if (angle_enable_d3d11) { 456 defines += [ "ANGLE_ENABLE_D3D11" ] 457 } 458 if (angle_enable_gl) { 459 defines += [ "ANGLE_ENABLE_OPENGL" ] 460 if (use_x11) { 461 defines += [ "ANGLE_USE_X11" ] 462 } 463 if (angle_enable_gl_null) { 464 defines += [ "ANGLE_ENABLE_OPENGL_NULL" ] 465 } 466 } 467 if (angle_enable_vulkan) { 468 defines += [ "ANGLE_ENABLE_VULKAN" ] 469 if (angle_enable_custom_vulkan_cmd_buffers) { 470 defines += [ "ANGLE_USE_CUSTOM_VULKAN_CMD_BUFFERS=1" ] 471 } 472 } 473 if (angle_enable_null) { 474 defines += [ "ANGLE_ENABLE_NULL" ] 475 } 476 } 477 446 478 config("libANGLE_config") { 447 479 cflags = [] … … 450 482 ldflags = [] 451 483 if (angle_enable_d3d9) { 452 defines += [ "ANGLE_ENABLE_D3D9" ]453 484 ldflags += [ "/DELAYLOAD:d3d9.dll" ] 454 }455 if (angle_enable_d3d11) {456 defines += [ "ANGLE_ENABLE_D3D11" ]457 }458 if (angle_enable_gl) {459 defines += [ "ANGLE_ENABLE_OPENGL" ]460 if (use_x11) {461 defines += [ "ANGLE_USE_X11" ]462 }463 if (angle_enable_gl_null) {464 defines += [ "ANGLE_ENABLE_OPENGL_NULL" ]465 }466 }467 if (angle_enable_vulkan) {468 defines += [ "ANGLE_ENABLE_VULKAN" ]469 if (angle_enable_custom_vulkan_cmd_buffers) {470 defines += [ "ANGLE_USE_CUSTOM_VULKAN_CMD_BUFFERS=1" ]471 }472 }473 if (angle_enable_null) {474 defines += [ "ANGLE_ENABLE_NULL" ]475 485 } 476 486 defines += [ "LIBANGLE_IMPLEMENTATION" ] … … 666 676 667 677 configs += [ ":debug_annotations_config" ] 668 public_configs += [ ":libANGLE_config" ] 678 public_configs += [ 679 ":libANGLE_config", 680 ":angle_backend_config", 681 ] 669 682 670 683 # Windows ARM64 is available since 10.0.16299 so no need to copy -
trunk/Source/ThirdParty/ANGLE/ChangeLog
r247324 r247521 1 2019-07-17 Kenneth Russell <kbr@chromium.org> 2 3 Make ANGLE work inside WebKit2's sandbox 4 https://bugs.webkit.org/show_bug.cgi?id=199844 5 6 Reviewed by Alex Christensen. 7 8 Cherry-pick fix for crbug.com/angleproject/3383 to eliminate use 9 of deprecated API in SystemInfo_mac.mm. 10 11 * BUILD.gn: 12 * src/gpu_info_util/SystemInfo.cpp: 13 (angle::FindActiveGPU): 14 (angle::PrintSystemInfo): 15 (angle::FindPrimaryGPU): Deleted. 16 * src/gpu_info_util/SystemInfo.h: 17 * src/gpu_info_util/SystemInfo_internal.h: 18 * src/gpu_info_util/SystemInfo_linux.cpp: 19 (angle::GetSystemInfo): 20 * src/gpu_info_util/SystemInfo_mac.mm: 21 (angle::GetSystemInfo): 22 * src/gpu_info_util/SystemInfo_win.cpp: 23 (angle::GetSystemInfo): 24 * src/tests/BUILD.gn: 25 * src/tests/test_expectations/GPUTestConfig.cpp: 26 * src/tests/test_utils/angle_test_instantiate.cpp: 27 (angle::IsConfigWhitelisted): 28 1 29 2019-07-10 Alex Christensen <achristensen@webkit.org> 2 30 -
trunk/Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo.cpp
r245248 r247521 239 239 } 240 240 241 void Find PrimaryGPU(SystemInfo *info)241 void FindActiveGPU(SystemInfo *info) 242 242 { 243 243 ASSERT(!info->gpus.empty()); 244 244 245 // On dual-GPU systems we assume the non-Intel GPU is the primaryone.246 int primary= 0;245 // On dual-GPU systems we assume the non-Intel GPU is the graphics one. 246 int active = 0; 247 247 bool hasIntel = false; 248 248 for (size_t i = 0; i < info->gpus.size(); ++i) … … 252 252 hasIntel = true; 253 253 } 254 if (IsIntel(info->gpus[ primary].vendorId))255 { 256 primary= static_cast<int>(i);254 if (IsIntel(info->gpus[active].vendorId)) 255 { 256 active = static_cast<int>(i); 257 257 } 258 258 } 259 259 260 260 // Assume that a combination of NVIDIA or AMD with Intel means Optimus or AMD Switchable 261 info->primaryGPUIndex = primary; 262 info->isOptimus = hasIntel && IsNVIDIA(info->gpus[primary].vendorId); 263 info->isAMDSwitchable = hasIntel && IsAMD(info->gpus[primary].vendorId); 261 info->activeGPUIndex = active; 262 info->primaryGPUIndex = active; 263 info->isOptimus = hasIntel && IsNVIDIA(info->gpus[active].vendorId); 264 info->isAMDSwitchable = hasIntel && IsAMD(info->gpus[active].vendorId); 264 265 } 265 266 … … 290 291 std::cout << "\n"; 291 292 std::cout << "Active GPU: " << info.activeGPUIndex << "\n"; 292 std::cout << "Primary GPU: " << info.primaryGPUIndex << "\n";293 293 294 294 std::cout << "\n"; … … 309 309 std::cout << "Machine Model Version: " << info.machineModelVersion << "\n"; 310 310 } 311 if (!info.primaryDisplayDeviceId.empty())312 {313 std::cout << "Primary Display Device: " << info.primaryDisplayDeviceId << "\n";314 }315 311 std::cout << std::endl; 316 312 } -
trunk/Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo.h
r245088 r247521 59 59 std::vector<GPUDeviceInfo> gpus; 60 60 61 // Index of the primary GPU (the discrete one on dual GPU systems) in `gpus`. 62 // Will never be -1 after a successful GetSystemInfo. 61 // Index of the GPU expected to be used for 3D graphics. Based on a best-guess heuristic on 62 // some platforms. On windows, this is accurate. 63 int activeGPUIndex = -1; 64 65 // Deprecated, same as activeGPUIndex 63 66 int primaryGPUIndex = -1; 64 // Index of the currently active GPU in `gpus`, can be -1 if the active GPU could not be65 // detected.66 int activeGPUIndex = -1;67 67 68 68 bool isOptimus = false; … … 79 79 // Only available on macOS 80 80 std::string machineModelVersion; 81 82 // Only available on Windows, set even on failure.83 std::string primaryDisplayDeviceId;84 81 }; 85 82 -
trunk/Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo_internal.h
r215490 r247521 30 30 bool CMDeviceIDToDeviceAndVendorID(const std::string &id, uint32_t *vendorId, uint32_t *deviceId); 31 31 32 // In the case there are multiple GPUs, this finds the primary one and sets Optimus or AMD33 // Switchable34 void Find PrimaryGPU(SystemInfo *info);32 // Use a heuristic to attempt to find the GPU used for 3D graphics. Sets activeGPUIndex, 33 // isOptimus, and isAMDSwitchable. Deprecated: also sets primaryGPUIndex. 34 void FindActiveGPU(SystemInfo *info); 35 35 36 36 } // namespace angle -
trunk/Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo_linux.cpp
r245088 r247521 82 82 } 83 83 84 Find PrimaryGPU(info);84 FindActiveGPU(info); 85 85 86 86 for (size_t i = 0; i < info->gpus.size(); ++i) … … 119 119 } 120 120 121 // In dual-GPU cases the PCI scan sometimes only gives us the Intel GPU. 122 // If we are able to query for the Nvidia driver version, it means there123 // was hidden Nvidia GPU, so we add it to the list and make it primary.121 // In dual-GPU cases the PCI scan sometimes only gives us the Intel GPU. If we are able to 122 // query for the Nvidia driver version, it means there was hidden Nvidia GPU, so we add it 123 // to the list. 124 124 if (IsIntel(gpu->vendorId) && info->gpus.size() == 1) 125 125 { -
trunk/Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo_mac.mm
r245248 r247521 73 73 } 74 74 75 // CGDisplayIOServicePort is deprecated as of macOS 10.9, but has no replacement, see76 // https://crbug.com/65083777 #pragma clang diagnostic push78 #pragma clang diagnostic ignored "-Wdeprecated-declarations"79 80 // Find the info of the current GPU.81 bool GetActiveGPU(VendorID *vendorId, DeviceID *deviceId)82 {83 io_registry_entry_t port = CGDisplayIOServicePort(kCGDirectMainDisplay);84 85 return GetEntryProperty(port, CFSTR("vendor-id"), vendorId) &&86 GetEntryProperty(port, CFSTR("device-id"), deviceId);87 }88 89 #pragma clang diagnostic pop90 91 75 // Gathers the vendor and device IDs for the PCI GPUs 92 76 bool GetPCIDevices(std::vector<GPUDeviceInfo> *devices) … … 146 130 } 147 131 148 // Find the active GPU 149 { 150 VendorID activeVendor; 151 DeviceID activeDevice; 152 if (!GetActiveGPU(&activeVendor, &activeDevice)) 153 { 154 return false; 155 } 156 157 for (size_t i = 0; i < info->gpus.size(); ++i) 158 { 159 if (info->gpus[i].vendorId == activeVendor && info->gpus[i].deviceId == activeDevice) 160 { 161 info->activeGPUIndex = static_cast<int>(i); 162 break; 163 } 164 } 165 } 166 167 FindPrimaryGPU(info); 132 FindActiveGPU(info); 168 133 169 134 // Figure out whether this is a dual-GPU system. -
trunk/Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo_win.cpp
r245088 r247521 15 15 #include <windows.h> 16 16 17 #if defined(GPU_INFO_USE_SETUPAPI) 18 // Remove parts of commctrl.h that have compile errors 19 # define NOTOOLBAR 20 # define NOTOOLTIPS 21 # include <cfgmgr32.h> 22 # include <setupapi.h> 23 #elif defined(GPU_INFO_USE_DXGI) 24 # include <d3d10.h> 25 # include <dxgi.h> 26 #else 27 # error "SystemInfo_win needs at least GPU_INFO_USE_SETUPAPI or GPU_INFO_USE_DXGI defined" 28 #endif 17 #include <d3d10.h> 18 #include <dxgi.h> 29 19 30 20 #include <array> … … 36 26 namespace 37 27 { 38 39 // Returns the CM device ID of the primary GPU.40 std::string GetPrimaryDisplayDeviceId()41 {42 DISPLAY_DEVICEA displayDevice;43 displayDevice.cb = sizeof(DISPLAY_DEVICEA);44 45 for (int i = 0; EnumDisplayDevicesA(nullptr, i, &displayDevice, 0); ++i)46 {47 if (displayDevice.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE)48 {49 return displayDevice.DeviceID;50 }51 }52 53 return "";54 }55 56 #if defined(GPU_INFO_USE_SETUPAPI)57 58 std::string GetRegistryStringValue(HKEY key, const char *valueName)59 {60 std::array<char, 255> value;61 DWORD valueSize = sizeof(value);62 if (RegQueryValueExA(key, valueName, nullptr, nullptr, reinterpret_cast<LPBYTE>(value.data()),63 &valueSize) == ERROR_SUCCESS)64 {65 return value.data();66 }67 return "";68 }69 70 // Gathers information about the devices from the registry. The reason why we aren't using71 // a dedicated API such as DXGI is that we need information like the driver vendor and date.72 // DXGI doesn't provide a way to know the device registry key from an IDXGIAdapter.73 bool GetDevicesFromRegistry(std::vector<GPUDeviceInfo> *devices)74 {75 // Display adapter class GUID from76 // https://msdn.microsoft.com/en-us/library/windows/hardware/ff553426%28v=vs.85%29.aspx77 GUID displayClass = {78 0x4d36e968, 0xe325, 0x11ce, {0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18}};79 80 HDEVINFO deviceInfo = SetupDiGetClassDevsW(&displayClass, nullptr, nullptr, DIGCF_PRESENT);81 82 if (deviceInfo == INVALID_HANDLE_VALUE)83 {84 return false;85 }86 87 // This iterates over the devices of the "Display adapter" class88 DWORD deviceIndex = 0;89 SP_DEVINFO_DATA deviceData;90 deviceData.cbSize = sizeof(deviceData);91 while (SetupDiEnumDeviceInfo(deviceInfo, deviceIndex++, &deviceData))92 {93 // The device and vendor IDs can be gathered directly, but information about the driver94 // requires some registry digging95 char fullDeviceID[MAX_DEVICE_ID_LEN];96 if (CM_Get_Device_IDA(deviceData.DevInst, fullDeviceID, MAX_DEVICE_ID_LEN, 0) != CR_SUCCESS)97 {98 continue;99 }100 101 GPUDeviceInfo device;102 103 if (!CMDeviceIDToDeviceAndVendorID(fullDeviceID, &device.vendorId, &device.deviceId))104 {105 continue;106 }107 108 // The driver key will end with something like {<displayClass>}/<4 digit number>.109 std::array<WCHAR, 255> value;110 if (!SetupDiGetDeviceRegistryPropertyW(deviceInfo, &deviceData, SPDRP_DRIVER, nullptr,111 reinterpret_cast<PBYTE>(value.data()), sizeof(value),112 nullptr))113 {114 continue;115 }116 117 std::wstring driverKey = L"System\\CurrentControlSet\\Control\\Class\\";118 driverKey += value.data();119 120 HKEY key;121 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, driverKey.c_str(), 0, KEY_QUERY_VALUE, &key) !=122 ERROR_SUCCESS)123 {124 continue;125 }126 127 device.driverVersion = GetRegistryStringValue(key, "DriverVersion");128 device.driverDate = GetRegistryStringValue(key, "DriverDate");129 device.driverVendor = GetRegistryStringValue(key, "ProviderName");130 131 RegCloseKey(key);132 133 devices->push_back(device);134 }135 136 SetupDiDestroyDeviceInfoList(deviceInfo);137 138 return true;139 }140 141 #elif defined(GPU_INFO_USE_DXGI)142 28 143 29 bool GetDevicesFromDXGI(std::vector<GPUDeviceInfo> *devices) … … 186 72 factory->Release(); 187 73 188 return true;74 return (i > 0); 189 75 } 190 191 #else192 # error193 #endif194 76 195 77 } // anonymous namespace … … 197 79 bool GetSystemInfo(SystemInfo *info) 198 80 { 199 // Get the CM device ID first so that it is returned even in error cases.200 info->primaryDisplayDeviceId = GetPrimaryDisplayDeviceId();201 202 #if defined(GPU_INFO_USE_SETUPAPI)203 if (!GetDevicesFromRegistry(&info->gpus))204 {205 return false;206 }207 #elif defined(GPU_INFO_USE_DXGI)208 81 if (!GetDevicesFromDXGI(&info->gpus)) 209 82 { 210 83 return false; 211 84 } 212 #else213 # error214 #endif215 85 216 86 if (info->gpus.size() == 0) … … 219 89 } 220 90 221 FindPrimaryGPU(info); 91 // Call FindActiveGPU to populate activeGPUIndex, isOptimus, and isAMDSwitchable. 92 FindActiveGPU(info); 222 93 223 // Override the primary GPU index with what we gathered from EnumDisplayDevices 224 uint32_t primaryVendorId = 0; 225 uint32_t primaryDeviceId = 0; 94 // Override activeGPUIndex. The first index returned by EnumAdapters is the active GPU. We 95 // can override the heuristic to find the active GPU 96 info->activeGPUIndex = 0; 97 // Deprecated: set primaryGPUIndex to the same index. 98 info->primaryGPUIndex = 0; 226 99 227 if (!CMDeviceIDToDeviceAndVendorID(info->primaryDisplayDeviceId, &primaryVendorId, 228 &primaryDeviceId)) 229 { 230 return false; 231 } 232 233 bool foundPrimary = false; 234 for (size_t i = 0; i < info->gpus.size(); ++i) 235 { 236 if (info->gpus[i].vendorId == primaryVendorId && info->gpus[i].deviceId == primaryDeviceId) 237 { 238 info->primaryGPUIndex = static_cast<int>(i); 239 foundPrimary = true; 240 } 241 } 242 ASSERT(foundPrimary); 243 244 // nvd3d9wrap.dll is loaded into all processes when Optimus is enabled. 100 // Override isOptimus. nvd3d9wrap.dll is loaded into all processes when Optimus is enabled. 245 101 HMODULE nvd3d9wrap = GetModuleHandleW(L"nvd3d9wrap.dll"); 246 102 info->isOptimus = nvd3d9wrap != nullptr; -
trunk/Source/ThirdParty/ANGLE/src/tests/BUILD.gn
r245088 r247521 542 542 "${angle_root}:libANGLE_config", 543 543 "${angle_root}:library_name_config", 544 "${angle_root}:angle_backend_config", 544 545 ] 545 546 -
trunk/Source/ThirdParty/ANGLE/src/tests/test_expectations/GPUTestConfig.cpp
r245088 r247521 332 332 } 333 333 334 // Get the primaryGPUDeviceInfo from the SystemInfo struct.335 // Returns false if devInfo is not guaranteed to be set to the primarydevice.336 inline bool Get PrimaryGPU(GPUDeviceInfo **devInfo)334 // Get the active GPUDeviceInfo from the SystemInfo struct. 335 // Returns false if devInfo is not guaranteed to be set to the active device. 336 inline bool GetActiveGPU(GPUDeviceInfo **devInfo) 337 337 { 338 338 SystemInfo *systemInfo = nullptr; … … 344 344 // Default to the first index 345 345 uint32_t index = 0; 346 // See if the primaryGPUIndex was set first347 if (systemInfo-> primaryGPUIndex != -1)348 { 349 index = systemInfo-> primaryGPUIndex;346 // See if the activeGPUIndex was set first 347 if (systemInfo->activeGPUIndex != -1) 348 { 349 index = systemInfo->activeGPUIndex; 350 350 } 351 351 ASSERT(index < systemInfo->gpus.size()); … … 354 354 } 355 355 356 // Get the vendor ID of the primaryGPU from the SystemInfo struct.356 // Get the vendor ID of the active GPU from the SystemInfo struct. 357 357 // Returns 0 if there is an error. 358 inline VendorID Get PrimaryGPUVendorID()359 { 360 GPUDeviceInfo * primaryGPU = nullptr;361 if (Get PrimaryGPU(&primaryGPU))362 { 363 return primaryGPU->vendorId;358 inline VendorID GetActiveGPUVendorID() 359 { 360 GPUDeviceInfo *activeGPU = nullptr; 361 if (GetActiveGPU(&activeGPU)) 362 { 363 return activeGPU->vendorId; 364 364 } 365 365 else … … 369 369 } 370 370 371 // Get the device ID of the primaryGPU from the SystemInfo struct.371 // Get the device ID of the active GPU from the SystemInfo struct. 372 372 // Returns 0 if there is an error. 373 inline DeviceID Get PrimaryGPUDeviceID()374 { 375 GPUDeviceInfo * primaryGPU = nullptr;376 if (Get PrimaryGPU(&primaryGPU))377 { 378 return primaryGPU->deviceId;373 inline DeviceID GetActiveGPUDeviceID() 374 { 375 GPUDeviceInfo *activeGPU = nullptr; 376 if (GetActiveGPU(&activeGPU)) 377 { 378 return activeGPU->deviceId; 379 379 } 380 380 else … … 384 384 } 385 385 386 // Check whether the primaryGPU is NVIDIA.386 // Check whether the active GPU is NVIDIA. 387 387 inline bool IsNVIDIA() 388 388 { 389 return angle::IsNVIDIA(Get PrimaryGPUVendorID());390 } 391 392 // Check whether the primaryGPU is AMD.389 return angle::IsNVIDIA(GetActiveGPUVendorID()); 390 } 391 392 // Check whether the active GPU is AMD. 393 393 inline bool IsAMD() 394 394 { 395 return angle::IsAMD(Get PrimaryGPUVendorID());396 } 397 398 // Check whether the primaryGPU is Intel.395 return angle::IsAMD(GetActiveGPUVendorID()); 396 } 397 398 // Check whether the active GPU is Intel. 399 399 inline bool IsIntel() 400 400 { 401 return angle::IsIntel(Get PrimaryGPUVendorID());402 } 403 404 // Check whether the primaryGPU is VMWare.401 return angle::IsIntel(GetActiveGPUVendorID()); 402 } 403 404 // Check whether the active GPU is VMWare. 405 405 inline bool IsVMWare() 406 406 { 407 return angle::IsVMWare(Get PrimaryGPUVendorID());407 return angle::IsVMWare(GetActiveGPUVendorID()); 408 408 } 409 409 … … 461 461 return false; 462 462 } 463 return (deviceId == Get PrimaryGPUDeviceID());463 return (deviceId == GetActiveGPUDeviceID()); 464 464 } 465 465 -
trunk/Source/ThirdParty/ANGLE/src/tests/test_utils/angle_test_instantiate.cpp
r245088 r247521 186 186 bool IsConfigWhitelisted(const SystemInfo &systemInfo, const PlatformParameters ¶m) 187 187 { 188 VendorID vendorID = systemInfo.gpus[systemInfo. primaryGPUIndex].vendorId;188 VendorID vendorID = systemInfo.gpus[systemInfo.activeGPUIndex].vendorId; 189 189 190 190 // We support the default and null back-ends on every platform. -
trunk/Source/WebCore/ChangeLog
r247519 r247521 1 2019-07-17 Kenneth Russell <kbr@chromium.org> 2 3 Make ANGLE work inside WebKit2's sandbox 4 https://bugs.webkit.org/show_bug.cgi?id=199844 5 6 Reviewed by Alex Christensen. 7 8 Fix missing #import introduced at the last minute while removing 9 some debugging code in the last patch. 10 11 Tested with San Angeles WebGL demo and some conformance tests. 12 13 * platform/graphics/cocoa/WebGLLayer.mm: 14 1 15 2019-07-17 Andres Gonzalez <andresg_22@apple.com> 2 16 -
trunk/Source/WebCore/platform/graphics/cocoa/WebGLLayer.mm
r247315 r247521 34 34 #import "GraphicsLayerCA.h" 35 35 #import "ImageBufferUtilitiesCG.h" 36 #import "NotImplemented.h" 36 37 #import "PlatformCALayer.h" 37 38 #import <pal/spi/cocoa/QuartzCoreSPI.h>
Note: See TracChangeset
for help on using the changeset viewer.