Title: [284952] branches/safari-612-branch/Source/WebCore
Revision
284952
Author
[email protected]
Date
2021-10-27 14:06:06 -0700 (Wed, 27 Oct 2021)

Log Message

Cherry-pick r283301. rdar://problem/84629308

    GPUP Cocoa GraphicsContextGLOpenGL should check for ANGLE presence
    https://bugs.webkit.org/show_bug.cgi?id=230946

    Patch by Kimmo Kinnunen <[email protected]> on 2021-09-29
    Reviewed by Antti Koivisto.

    For consistency, avoid crashing the GPUP mode when trying
    to create GraphicsContextGLOpenGL when the ANGLE-shared dylib
    is not present.

    No new tests, refactor.

    * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
    (WebCore::isANGLEAvailable):
    (WebCore::initializeEGLDisplay):
    (WebCore::GraphicsContextGLOpenGL::create):
    (WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL):
    (WebCore::GraphicsContextGLOpenGL::makeContextCurrent):
    (WebCore::InitializeEGLDisplay): Deleted.

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

Modified Paths

Diff

Modified: branches/safari-612-branch/Source/WebCore/ChangeLog (284951 => 284952)


--- branches/safari-612-branch/Source/WebCore/ChangeLog	2021-10-27 21:06:03 UTC (rev 284951)
+++ branches/safari-612-branch/Source/WebCore/ChangeLog	2021-10-27 21:06:06 UTC (rev 284952)
@@ -1,3 +1,50 @@
+2021-10-26  Russell Epstein  <[email protected]>
+
+        Cherry-pick r283301. rdar://problem/84629308
+
+    GPUP Cocoa GraphicsContextGLOpenGL should check for ANGLE presence
+    https://bugs.webkit.org/show_bug.cgi?id=230946
+    
+    Patch by Kimmo Kinnunen <[email protected]> on 2021-09-29
+    Reviewed by Antti Koivisto.
+    
+    For consistency, avoid crashing the GPUP mode when trying
+    to create GraphicsContextGLOpenGL when the ANGLE-shared dylib
+    is not present.
+    
+    No new tests, refactor.
+    
+    * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
+    (WebCore::isANGLEAvailable):
+    (WebCore::initializeEGLDisplay):
+    (WebCore::GraphicsContextGLOpenGL::create):
+    (WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL):
+    (WebCore::GraphicsContextGLOpenGL::makeContextCurrent):
+    (WebCore::InitializeEGLDisplay): Deleted.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@283301 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-09-29  Kimmo Kinnunen  <[email protected]>
+
+            GPUP Cocoa GraphicsContextGLOpenGL should check for ANGLE presence
+            https://bugs.webkit.org/show_bug.cgi?id=230946
+
+            Reviewed by Antti Koivisto.
+
+            For consistency, avoid crashing the GPUP mode when trying
+            to create GraphicsContextGLOpenGL when the ANGLE-shared dylib
+            is not present.
+
+            No new tests, refactor.
+
+            * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
+            (WebCore::isANGLEAvailable):
+            (WebCore::initializeEGLDisplay):
+            (WebCore::GraphicsContextGLOpenGL::create):
+            (WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL):
+            (WebCore::GraphicsContextGLOpenGL::makeContextCurrent):
+            (WebCore::InitializeEGLDisplay): Deleted.
+
 2021-10-26  Alan Coon  <[email protected]>
 
         Cherry-pick r284523. rdar://problem/83763291

Modified: branches/safari-612-branch/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm (284951 => 284952)


--- branches/safari-612-branch/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm	2021-10-27 21:06:03 UTC (rev 284951)
+++ branches/safari-612-branch/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm	2021-10-27 21:06:06 UTC (rev 284952)
@@ -60,6 +60,11 @@
 
 namespace WebCore {
 
+static bool isANGLEAvailable()
+{
+    return !!EGL_Initialize;
+}
+
 // In isCurrentContextPredictable() == true case this variable is accessed in single-threaded manner.
 // In isCurrentContextPredictable() == false case this variable is accessed from multiple threads but always sequentially
 // and it always contains nullptr and nullptr is always written to it.
@@ -114,8 +119,13 @@
     return false;
 }
 
-static ScopedEGLDefaultDisplay InitializeEGLDisplay(const GraphicsContextGLAttributes& attrs)
+static ScopedEGLDefaultDisplay initializeEGLDisplay(const GraphicsContextGLAttributes& attrs)
 {
+    if (!isANGLEAvailable()) {
+        WTFLogAlways("Failed to load ANGLE shared library.");
+        return { };
+    }
+
     EGLint majorVersion = 0;
     EGLint minorVersion = 0;
     EGLDisplay display;
@@ -181,19 +191,8 @@
 }
 #endif
 
-static bool isANGLEAvailable()
-{
-    return !!EGL_Initialize;
-}
-
 RefPtr<GraphicsContextGLOpenGL> GraphicsContextGLOpenGL::create(GraphicsContextGLAttributes attrs, HostWindow* hostWindow)
 {
-    // If ANGLE is not loaded, we can fail immediately.
-    if (!isANGLEAvailable()) {
-        WTFLogAlways("ANGLE shared library was not loaded. Can't make GraphicsContextGL.");
-        return nullptr;
-    }
-
     // Make space for the incoming context if we're full.
     GraphicsContextGLOpenGLManager::sharedManager().recycleContextIfNecessary();
     if (GraphicsContextGLOpenGLManager::sharedManager().hasTooManyContexts())
@@ -236,7 +235,7 @@
     }
 #endif
 
-    m_displayObj = InitializeEGLDisplay(attrs);
+    m_displayObj = initializeEGLDisplay(attrs);
     if (!m_displayObj)
         return;
 
@@ -502,7 +501,7 @@
         return false;
     if (currentContext == this)
         return true;
-    // Calling MakeCurrent is important to set volatile platform context. See InitializeEGLDisplay().
+    // Calling MakeCurrent is important to set volatile platform context. See initializeEGLDisplay().
     if (!EGL_MakeCurrent(m_displayObj, EGL_NO_SURFACE, EGL_NO_SURFACE, m_contextObj))
         return false;
     if (isCurrentContextPredictable())
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to