Title: [269118] trunk/Source
Revision
269118
Author
[email protected]
Date
2020-10-28 13:26:13 -0700 (Wed, 28 Oct 2020)

Log Message

macCatalyst WebGL on Apple Silicon devices is using a software renderer
https://bugs.webkit.org/show_bug.cgi?id=218303
<rdar://problem/70587571>

Reviewed by Geoffrey Garen.

Source/ThirdParty/ANGLE:

* src/gpu_info_util/SystemInfo.h:
* src/gpu_info_util/SystemInfo_apple.mm:
(angle::GetSystemInfo):
We can just use the macOS version of GetSystemInfo in macCatalyst.

* src/gpu_info_util/SystemInfo_macos.mm:
(angle::GetSystemInfo_mac):
* src/libANGLE/Display.cpp:
* src/libANGLE/formatutils.cpp:
(gl::BuildInternalFormatInfoMap):
* src/libANGLE/renderer/gl/renderergl_utils.cpp:
(rx::nativegl_gl::GenerateCaps):
It turns out we must use EAGL in macCatalyst on Apple Silicon in all cases,
not just in-process in iOS apps (the problem is not just about coexistence
of the two GLs, but actually about our ability to load the accelerated
renderer /at all/ in macCatalyst processes).

I left the runtime switching in place, because there is a future in which
we /can/ use CGL in non-iOS-app processes, but that future is not now.

Source/WebCore:

* platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
(WebCore::needsEAGLOnMac):
(WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL):
(WebCore::GraphicsContextGLOpenGL::IOSurfaceTextureTarget):
(WebCore::GraphicsContextGLOpenGL::IOSurfaceTextureTargetQuery):
(WebCore::GraphicsContextGLOpenGL::EGLIOSurfaceTextureTarget):
(WebCore::isiOSAppOnMac): Deleted.
See ANGLE ChangeLog.

Source/WebKit:

* UIProcess/mac/HighPerformanceGPUManager.mm:
(WebKit::HighPerformanceGPUManager::addProcessRequiringHighPerformance):
(WebKit::HighPerformanceGPUManager::removeProcessRequiringHighPerformance):
(WebKit::HighPerformanceGPUManager::updateState):
(WebKit::isiOSAppOnMac): Deleted.
HighPerformanceGPUManager is PLATFORM(MAC)-only, which is not true
for MACCATALYST, so delete this dead code.

Modified Paths

Diff

Modified: trunk/Source/ThirdParty/ANGLE/ChangeLog (269117 => 269118)


--- trunk/Source/ThirdParty/ANGLE/ChangeLog	2020-10-28 20:06:50 UTC (rev 269117)
+++ trunk/Source/ThirdParty/ANGLE/ChangeLog	2020-10-28 20:26:13 UTC (rev 269118)
@@ -1,3 +1,31 @@
+2020-10-28  Tim Horton  <[email protected]>
+
+        macCatalyst WebGL on Apple Silicon devices is using a software renderer
+        https://bugs.webkit.org/show_bug.cgi?id=218303
+        <rdar://problem/70587571>
+
+        Reviewed by Geoffrey Garen.
+
+        * src/gpu_info_util/SystemInfo.h:
+        * src/gpu_info_util/SystemInfo_apple.mm:
+        (angle::GetSystemInfo):
+        We can just use the macOS version of GetSystemInfo in macCatalyst.
+
+        * src/gpu_info_util/SystemInfo_macos.mm:
+        (angle::GetSystemInfo_mac):
+        * src/libANGLE/Display.cpp:
+        * src/libANGLE/formatutils.cpp:
+        (gl::BuildInternalFormatInfoMap):
+        * src/libANGLE/renderer/gl/renderergl_utils.cpp:
+        (rx::nativegl_gl::GenerateCaps):
+        It turns out we must use EAGL in macCatalyst on Apple Silicon in all cases,
+        not just in-process in iOS apps (the problem is not just about coexistence
+        of the two GLs, but actually about our ability to load the accelerated
+        renderer /at all/ in macCatalyst processes).
+
+        I left the runtime switching in place, because there is a future in which
+        we /can/ use CGL in non-iOS-app processes, but that future is not now.
+
 2020-10-13  Keith Rollin  <[email protected]>
 
         Remove leftover MACOSX_DEPLOYMENT_TARGET_macosx support

Modified: trunk/Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo.h (269117 => 269118)


--- trunk/Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo.h	2020-10-28 20:06:50 UTC (rev 269117)
+++ trunk/Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo.h	2020-10-28 20:26:13 UTC (rev 269118)
@@ -67,9 +67,8 @@
     bool isAMDSwitchable = false;
     // Only true on dual-GPU Mac laptops.
     bool isMacSwitchable = false;
-    // Only true on Apple Silicon Macs when running iOS binaries.
-    // See https://developer.apple.com/documentation/foundation/nsprocessinfo/3608556-iosapponmac
-    bool isiOSAppOnMac   = false;
+    // Only true on Apple Silicon Macs when running in macCatalyst.
+    bool needsEAGLOnMac   = false;
 
     // Only available on Android
     std::string machineManufacturer;

Modified: trunk/Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo_apple.mm (269117 => 269118)


--- trunk/Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo_apple.mm	2020-10-28 20:06:50 UTC (rev 269117)
+++ trunk/Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo_apple.mm	2020-10-28 20:26:13 UTC (rev 269118)
@@ -19,26 +19,8 @@
 
 bool GetSystemInfo(SystemInfo *info)
 {
-#if defined(ANGLE_PLATFORM_MACCATALYST) && defined(ANGLE_CPU_ARM64)
-    static bool isiOSAppOnMac = false;
-    static dispatch_once_t once;
-    dispatch_once(&once, ^{
-        isiOSAppOnMac = [[NSProcessInfo processInfo] isiOSAppOnMac];
-    });
-
-    if (isiOSAppOnMac)
-    {
-        GetSystemInfo_ios(info);
-        if (info)
-        {
-            info->isiOSAppOnMac = true;
-        }
-        return info;
-    }
-
+#if defined(ANGLE_PLATFORM_MACOS) || defined(ANGLE_PLATFORM_MACCATALYST)
     return GetSystemInfo_mac(info);
-#elif defined(ANGLE_PLATFORM_MACOS) || defined(ANGLE_PLATFORM_MACCATALYST)
-    return GetSystemInfo_mac(info);
 #else
     return GetSystemInfo_ios(info);
 #endif

Modified: trunk/Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo_macos.mm (269117 => 269118)


--- trunk/Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo_macos.mm	2020-10-28 20:06:50 UTC (rev 269117)
+++ trunk/Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo_macos.mm	2020-10-28 20:26:13 UTC (rev 269118)
@@ -247,6 +247,10 @@
     {
         info->isMacSwitchable = true;
     }
+    
+#if defined(ANGLE_PLATFORM_MACCATALYST) && defined(ANGLE_CPU_ARM64)
+    info->needsEAGLOnMac = true;
+#endif
 
     return true;
 }

Modified: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Display.cpp (269117 => 269118)


--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Display.cpp	2020-10-28 20:06:50 UTC (rev 269117)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Display.cpp	2020-10-28 20:26:13 UTC (rev 269118)
@@ -279,7 +279,7 @@
                     break;
                 }
 
-                if (info.isiOSAppOnMac)
+                if (info.needsEAGLOnMac)
                 {
                     impl = new rx::DisplayEAGL(state);
                     break;

Modified: trunk/Source/ThirdParty/ANGLE/src/libANGLE/formatutils.cpp (269117 => 269118)


--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/formatutils.cpp	2020-10-28 20:06:50 UTC (rev 269117)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/formatutils.cpp	2020-10-28 20:26:13 UTC (rev 269118)
@@ -1035,7 +1035,7 @@
     angle::SystemInfo info;
     if (angle::GetSystemInfo(&info))
     {
-        if (info.isiOSAppOnMac)
+        if (info.needsEAGLOnMac)
         {
             // Using OpenGLES.framework.
             AddRGBAFormat(&map, GL_BGRA_EXT,       false,  8,  8,  8,  8, 0, GL_BGRA_EXT,       GL_UNSIGNED_BYTE,               GL_UNSIGNED_NORMALIZED, false, RequireES<2, 0>,                                  AlwaysSupported, RequireES<2, 0>,                                NeverSupported, NeverSupported);

Modified: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/renderergl_utils.cpp (269117 => 269118)


--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/renderergl_utils.cpp	2020-10-28 20:06:50 UTC (rev 269117)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/renderergl_utils.cpp	2020-10-28 20:26:13 UTC (rev 269118)
@@ -1359,7 +1359,7 @@
     angle::SystemInfo info;
     if (angle::GetSystemInfo(&info))
     {
-        if (!info.isiOSAppOnMac)
+        if (!info.needsEAGLOnMac)
         {
             VendorID vendor = GetVendorID(functions);
             if ((IsAMD(vendor) || IsIntel(vendor)) && *maxSupportedESVersion >= gl::Version(3, 0))

Modified: trunk/Source/WebCore/ChangeLog (269117 => 269118)


--- trunk/Source/WebCore/ChangeLog	2020-10-28 20:06:50 UTC (rev 269117)
+++ trunk/Source/WebCore/ChangeLog	2020-10-28 20:26:13 UTC (rev 269118)
@@ -1,3 +1,20 @@
+2020-10-28  Tim Horton  <[email protected]>
+
+        macCatalyst WebGL on Apple Silicon devices is using a software renderer
+        https://bugs.webkit.org/show_bug.cgi?id=218303
+        <rdar://problem/70587571>
+
+        Reviewed by Geoffrey Garen.
+
+        * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
+        (WebCore::needsEAGLOnMac):
+        (WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL):
+        (WebCore::GraphicsContextGLOpenGL::IOSurfaceTextureTarget):
+        (WebCore::GraphicsContextGLOpenGL::IOSurfaceTextureTargetQuery):
+        (WebCore::GraphicsContextGLOpenGL::EGLIOSurfaceTextureTarget):
+        (WebCore::isiOSAppOnMac): Deleted.
+        See ANGLE ChangeLog.
+
 2020-10-28  Fujii Hironori  <[email protected]>
 
         TextureMapperLayer::paintWithIntermediateSurface: Reduce BitmapTextures by unifying replicaSurface and mainSurface

Modified: trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm (269117 => 269118)


--- trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm	2020-10-28 20:06:50 UTC (rev 269117)
+++ trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm	2020-10-28 20:26:13 UTC (rev 269118)
@@ -108,15 +108,10 @@
 static const unsigned statusCheckThreshold = 5;
 
 #if PLATFORM(MAC) || PLATFORM(MACCATALYST)
-static bool isiOSAppOnMac()
+static bool needsEAGLOnMac()
 {
 #if PLATFORM(MACCATALYST) && CPU(ARM64)
-    static bool isiOSAppOnMac = false;
-    static dispatch_once_t once;
-    dispatch_once(&once, ^{
-        isiOSAppOnMac = [[NSProcessInfo processInfo] isiOSAppOnMac];
-    });
-    return isiOSAppOnMac;
+    return true;
 #else
     return false;
 #endif
@@ -297,7 +292,7 @@
 #if PLATFORM(MAC) || PLATFORM(MACCATALYST)
     ExtensionsGL& extensions = getExtensions();
 
-    if (!isiOSAppOnMac()) {
+    if (!needsEAGLOnMac()) {
         static constexpr const char* requiredExtensions[] = {
             "GL_ANGLE_texture_rectangle", // For IOSurface-backed textures.
             "GL_EXT_texture_format_BGRA8888", // For creating the EGL surface from an IOSurface.
@@ -430,7 +425,7 @@
 GCGLenum GraphicsContextGLOpenGL::IOSurfaceTextureTarget()
 {
 #if PLATFORM(MACCATALYST)
-    if (isiOSAppOnMac())
+    if (needsEAGLOnMac())
         return TEXTURE_2D;
     return TEXTURE_RECTANGLE_ARB;
 #elif PLATFORM(MAC)
@@ -443,7 +438,7 @@
 GCGLenum GraphicsContextGLOpenGL::IOSurfaceTextureTargetQuery()
 {
 #if PLATFORM(MACCATALYST)
-    if (isiOSAppOnMac())
+    if (needsEAGLOnMac())
         return TEXTURE_BINDING_2D;
     return TEXTURE_BINDING_RECTANGLE_ARB;
 #elif PLATFORM(MAC)
@@ -456,7 +451,7 @@
 GCGLint GraphicsContextGLOpenGL::EGLIOSurfaceTextureTarget()
 {
 #if PLATFORM(MACCATALYST)
-    if (isiOSAppOnMac())
+    if (needsEAGLOnMac())
         return EGL_TEXTURE_2D;
     return EGL_TEXTURE_RECTANGLE_ANGLE;
 #elif PLATFORM(MAC)

Modified: trunk/Source/WebKit/ChangeLog (269117 => 269118)


--- trunk/Source/WebKit/ChangeLog	2020-10-28 20:06:50 UTC (rev 269117)
+++ trunk/Source/WebKit/ChangeLog	2020-10-28 20:26:13 UTC (rev 269118)
@@ -1,3 +1,19 @@
+2020-10-28  Tim Horton  <[email protected]>
+
+        macCatalyst WebGL on Apple Silicon devices is using a software renderer
+        https://bugs.webkit.org/show_bug.cgi?id=218303
+        <rdar://problem/70587571>
+
+        Reviewed by Geoffrey Garen.
+
+        * UIProcess/mac/HighPerformanceGPUManager.mm:
+        (WebKit::HighPerformanceGPUManager::addProcessRequiringHighPerformance):
+        (WebKit::HighPerformanceGPUManager::removeProcessRequiringHighPerformance):
+        (WebKit::HighPerformanceGPUManager::updateState):
+        (WebKit::isiOSAppOnMac): Deleted.
+        HighPerformanceGPUManager is PLATFORM(MAC)-only, which is not true
+        for MACCATALYST, so delete this dead code.
+
 2020-10-28  Sam Weinig  <[email protected]>
 
         Reduce Preference Override Methods: TabsToLinks/SpatialNavigation

Modified: trunk/Source/WebKit/UIProcess/mac/HighPerformanceGPUManager.mm (269117 => 269118)


--- trunk/Source/WebKit/UIProcess/mac/HighPerformanceGPUManager.mm	2020-10-28 20:06:50 UTC (rev 269117)
+++ trunk/Source/WebKit/UIProcess/mac/HighPerformanceGPUManager.mm	2020-10-28 20:26:13 UTC (rev 269118)
@@ -34,20 +34,6 @@
 
 namespace WebKit {
 
-static bool isiOSAppOnMac()
-{
-#if PLATFORM(MACCATALYST) && CPU(ARM64)
-    static bool isiOSAppOnMac = false;
-    static dispatch_once_t once;
-    dispatch_once(&once, ^{
-        isiOSAppOnMac = [[NSProcessInfo processInfo] isiOSAppOnMac];
-    });
-    return isiOSAppOnMac;
-#else
-    return false;
-#endif
-}
-
 // FIXME: This class is using OpenGL to control the muxing of GPUs. Ultimately
 // we want to use Metal, but currently there isn't a way to "release" a
 // discrete MTLDevice, such that the process muxes back to an integrated GPU.
@@ -60,9 +46,6 @@
 
 void HighPerformanceGPUManager::addProcessRequiringHighPerformance(WebProcessProxy* process)
 {
-    if (isiOSAppOnMac())
-        return;
-
     if (!WebCore::hasLowAndHighPowerGPUs())
         return;
 
@@ -77,9 +60,6 @@
 
 void HighPerformanceGPUManager::removeProcessRequiringHighPerformance(WebProcessProxy* process)
 {
-    if (isiOSAppOnMac())
-        return;
-
     if (!WebCore::hasLowAndHighPowerGPUs())
         return;
 
@@ -94,9 +74,6 @@
 
 void HighPerformanceGPUManager::updateState()
 {
-    if (isiOSAppOnMac())
-        return;
-
     if (m_processesRequiringHighPerformance.size()) {
         if (!m_pixelFormatObj) {
             LOG(WebGL, "HighPerformanceGPUManager - turning on high-performance GPU.");
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to