Title: [292174] branches/safari-614.1.8-branch/Source/WebCore
Revision
292174
Author
alanc...@apple.com
Date
2022-03-31 14:03:43 -0700 (Thu, 31 Mar 2022)

Log Message

Cherry-pick r291983. rdar://problem/90706660

    Accessing WebGL content crashes in macOS Recovery OS, workaround 2
    https://bugs.webkit.org/show_bug.cgi?id=238448

    Patch by Kimmo Kinnunen <kkinnu...@apple.com> on 2022-03-28
    Reviewed by Dean Jackson.

    Add a two new quick workarounds to try fix a recovery OS crash when
    WebKit tries to use ANGLE that is not present in the OS image.
    Compare explicitly against NULL as instructed in weak linking documentation.
    Check for the EGL_GetPlatformDisplayEXT, this is nullptr in the
    recovery OS.

    Remove the previous workaround. The environment variable is
    not available in WP or GPUP. The Metal symbol is not the problem.

    * platform/graphics/cocoa/GraphicsContextGLCocoa.mm:
    (WebCore::platformSupportsMetal):
    (WebCore::initializeEGLDisplay):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@291983 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-614.1.8-branch/Source/WebCore/ChangeLog (292173 => 292174)


--- branches/safari-614.1.8-branch/Source/WebCore/ChangeLog	2022-03-31 21:03:01 UTC (rev 292173)
+++ branches/safari-614.1.8-branch/Source/WebCore/ChangeLog	2022-03-31 21:03:43 UTC (rev 292174)
@@ -1,3 +1,48 @@
+2022-03-31  Russell Epstein  <repst...@apple.com>
+
+        Cherry-pick r291983. rdar://problem/90706660
+
+    Accessing WebGL content crashes in macOS Recovery OS, workaround 2
+    https://bugs.webkit.org/show_bug.cgi?id=238448
+    
+    Patch by Kimmo Kinnunen <kkinnu...@apple.com> on 2022-03-28
+    Reviewed by Dean Jackson.
+    
+    Add a two new quick workarounds to try fix a recovery OS crash when
+    WebKit tries to use ANGLE that is not present in the OS image.
+    Compare explicitly against NULL as instructed in weak linking documentation.
+    Check for the EGL_GetPlatformDisplayEXT, this is nullptr in the
+    recovery OS.
+    
+    Remove the previous workaround. The environment variable is
+    not available in WP or GPUP. The Metal symbol is not the problem.
+    
+    * platform/graphics/cocoa/GraphicsContextGLCocoa.mm:
+    (WebCore::platformSupportsMetal):
+    (WebCore::initializeEGLDisplay):
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@291983 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-03-28  Kimmo Kinnunen  <kkinnu...@apple.com>
+
+            Accessing WebGL content crashes in macOS Recovery OS, workaround 2
+            https://bugs.webkit.org/show_bug.cgi?id=238448
+
+            Reviewed by Dean Jackson.
+
+            Add a two new quick workarounds to try fix a recovery OS crash when
+            WebKit tries to use ANGLE that is not present in the OS image.
+            Compare explicitly against NULL as instructed in weak linking documentation.
+            Check for the EGL_GetPlatformDisplayEXT, this is nullptr in the
+            recovery OS.
+
+            Remove the previous workaround. The environment variable is
+            not available in WP or GPUP. The Metal symbol is not the problem.
+
+            * platform/graphics/cocoa/GraphicsContextGLCocoa.mm:
+            (WebCore::platformSupportsMetal):
+            (WebCore::initializeEGLDisplay):
+
 2022-03-29  Russell Epstein  <repst...@apple.com>
 
         Cherry-pick r292042. rdar://problem/90999175

Modified: branches/safari-614.1.8-branch/Source/WebCore/platform/graphics/cocoa/ANGLEUtilitiesCocoa.cpp (292173 => 292174)


--- branches/safari-614.1.8-branch/Source/WebCore/platform/graphics/cocoa/ANGLEUtilitiesCocoa.cpp	2022-03-31 21:03:01 UTC (rev 292173)
+++ branches/safari-614.1.8-branch/Source/WebCore/platform/graphics/cocoa/ANGLEUtilitiesCocoa.cpp	2022-03-31 21:03:43 UTC (rev 292174)
@@ -40,7 +40,7 @@
 {
     // The ANGLE is weak linked in full, and the EGL_Initialize is explicitly weak linked above
     // so that we can detect the case where ANGLE is not present.
-    return !!EGL_Initialize;
+    return EGL_Initialize != NULL; // NOLINT
 }
 
 void* createPbufferAndAttachIOSurface(GCGLDisplay display, GCGLConfig config, GCGLenum target, GCGLint usageHint, GCGLenum internalFormat, GCGLsizei width, GCGLsizei height, GCGLenum type, IOSurfaceRef surface, GCGLuint plane)

Modified: branches/safari-614.1.8-branch/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.mm (292173 => 292174)


--- branches/safari-614.1.8-branch/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.mm	2022-03-31 21:03:01 UTC (rev 292173)
+++ branches/safari-614.1.8-branch/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.mm	2022-03-31 21:03:43 UTC (rev 292174)
@@ -58,8 +58,8 @@
 #import "ImageRotationSessionVT.h"
 #endif
 
-// Metal may not be available, for example in recovery OS.
-WTF_WEAK_LINK_FORCE_IMPORT(MTLCreateSystemDefaultDevice);
+// FIXME: Checking for EGL_Initialize does not seem to be robust in recovery OS.
+WTF_WEAK_LINK_FORCE_IMPORT(EGL_GetPlatformDisplayEXT);
 
 namespace WebCore {
 
@@ -100,22 +100,6 @@
 
 static bool platformSupportsMetal(bool isWebGL2)
 {
-    // FIXME: Figure out why WebKit runs in recovery system using -framework Metal, but seemingly cannot call into Metal.
-    // The hunk about runnningInRecoverySystem should be removed once it is clear how WebKit can link strongly to Metal
-    // but run without Metal.
-    static bool runningInRecoverySystem = [] {
-        if (getenv("__OSINSTALL_ENVIRONMENT")) {
-            WTFLogAlways("WebGL: Running in recovery. Has access to Metal: %s", !MTLCreateSystemDefaultDevice ? "no" : "yes");
-            return true;
-        }
-        return false;
-    }();
-    if (runningInRecoverySystem)
-        return false;
-
-    if (!MTLCreateSystemDefaultDevice)
-        return false;
-
     auto device = adoptNS(MTLCreateSystemDefaultDevice());
 
     if (device) {
@@ -139,6 +123,12 @@
         WTFLogAlways("Failed to load ANGLE shared library.");
         return EGL_NO_DISPLAY;
     }
+    // FIXME(http://webkit.org/b/238448): Why is checking EGL_Initialize not robust in recovery OS?
+    if (EGL_GetPlatformDisplayEXT == NULL) { // NOLINT
+        WTFLogAlways("Inconsistent weak linking for ANGLE shared library.");
+        return EGL_NO_DISPLAY;
+    }
+
 #if ASSERT_ENABLED
     const char* clientExtensions = EGL_QueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
     ASSERT(clientExtensions);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to