<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[286242] branches/safari-612-branch/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/286242">286242</a></dd>
<dt>Author</dt> <dd>repstein@apple.com</dd>
<dt>Date</dt> <dd>2021-11-29 11:38:20 -0800 (Mon, 29 Nov 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>Apply patch. rdar://problem/83971417</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari612branchSourceWebCoreChangeLog">branches/safari-612-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari612branchSourceWebCoreplatformgraphicsangleGraphicsContextGLANGLEcpp">branches/safari-612-branch/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp</a></li>
<li><a href="#branchessafari612branchSourceWebCoreplatformgraphicscocoaGraphicsContextGLOpenGLCocoamm">branches/safari-612-branch/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm</a></li>
<li><a href="#branchessafari612branchSourceWebCoreplatformgraphicsopenglGraphicsContextGLOpenGLh">branches/safari-612-branch/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari612branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-612-branch/Source/WebCore/ChangeLog (286241 => 286242)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612-branch/Source/WebCore/ChangeLog      2021-11-29 19:38:17 UTC (rev 286241)
+++ branches/safari-612-branch/Source/WebCore/ChangeLog 2021-11-29 19:38:20 UTC (rev 286242)
</span><span class="lines">@@ -1,5 +1,96 @@
</span><span class="cx"> 2021-11-15  Alan Coon  <alancoon@apple.com>
</span><span class="cx"> 
</span><ins>+        Apply patch. rdar://problem/83971417
+
+    2021-11-09  Alan Coon  <alancoon@apple.com>
+
+            Apply patch. rdar://problem/83971417
+
+        2021-10-26  Russell Epstein  <repstein@apple.com>
+
+                Cherry-pick r284669. rdar://problem/83971417
+
+            WebGL low-power and high-performance contexts should use different ANGLE Metal EGLDisplays
+            https://bugs.webkit.org/show_bug.cgi?id=231012
+            <rdar://problem/83971417>
+
+            Patch by Kimmo Kinnunen <kkinnunen@apple.com> on 2021-10-22
+            Reviewed by Dean Jackson.
+
+            Source/WebCore:
+
+            Use per-power preference EGLDisplay when creating Metal
+            contexts.
+
+            Adds a new API test.
+
+            * platform/RuntimeApplicationChecks.cpp:
+            (WebCore::setAuxiliaryProcessTypeForTesting):
+            * platform/RuntimeApplicationChecks.h:
+            Add a test function to reset the process type after test has set a specific type and then
+            run to completion. process for the duration of the test. The volatile context flag in
+            GraphicsContextGLOpenGL depends on condition isWebProcess || isGPUProcess.
+            * platform/graphics/angle/GraphicsContextGLANGLE.cpp:
+            (WebCore::GraphicsContextGLOpenGL::releaseThreadResources):
+            * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
+            (WebCore::initializeEGLDisplay):
+            (WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL):
+            (WebCore::GraphicsContextGLOpenGL::setContextVisibility):
+            (WebCore::GraphicsContextGLOpenGL::displayWasReconfigured):
+            * platform/graphics/opengl/GraphicsContextGLOpenGL.h:
+
+            Tools:
+
+            Add a API test to test GraphicsContextGLOpenGL
+            Cocoa implementation regarding the bug where
+            the GraphicsContextGLOpenGL instances would use
+            the GPU that was selected by the first instance.
+
+            * TestWebKitAPI/Configurations/TestWebKitAPI.xcconfig:
+            * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+            * TestWebKitAPI/Tests/WebCore/cocoa/TestGraphicsContextGLOpenGLCocoa.mm: Added.
+            (TestWebKitAPI::WebCore::TestedGraphicsContextGLOpenGL::create):
+            (TestWebKitAPI::WebCore::TestedGraphicsContextGLOpenGL::TestedGraphicsContextGLOpenGL):
+            (TestWebKitAPI::hasMultipleGPUs):
+            (TestWebKitAPI::TEST):
+            * TestWebKitAPI/WebCoreUtilities.h: Added.
+            (TestWebKitAPI::ScopedSetAuxiliaryProcessTypeForTesting::ScopedSetAuxiliaryProcessTypeForTesting):
+            (TestWebKitAPI::ScopedSetAuxiliaryProcessTypeForTesting::~ScopedSetAuxiliaryProcessTypeForTesting):
+            Add a utility state setter to set the process type for the
+            duration of a test.
+
+            git-svn-id: https://svn.webkit.org/repository/webkit/trunk@284669 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+            2021-10-22  Kimmo Kinnunen  <kkinnunen@apple.com>
+
+                    WebGL low-power and high-performance contexts should use different ANGLE Metal EGLDisplays
+                    https://bugs.webkit.org/show_bug.cgi?id=231012
+                    <rdar://problem/83971417>
+
+                    Reviewed by Dean Jackson.
+
+                    Use per-power preference EGLDisplay when creating Metal
+                    contexts.
+
+                    Adds a new API test.
+
+                    * platform/RuntimeApplicationChecks.cpp:
+                    (WebCore::setAuxiliaryProcessTypeForTesting):
+                    * platform/RuntimeApplicationChecks.h:
+                    Add a test function to reset the process type after test has set a specific type and then
+                    run to completion. process for the duration of the test. The volatile context flag in
+                    GraphicsContextGLOpenGL depends on condition isWebProcess || isGPUProcess.
+                    * platform/graphics/angle/GraphicsContextGLANGLE.cpp:
+                    (WebCore::GraphicsContextGLOpenGL::releaseThreadResources):
+                    * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
+                    (WebCore::initializeEGLDisplay):
+                    (WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL):
+                    (WebCore::GraphicsContextGLOpenGL::setContextVisibility):
+                    (WebCore::GraphicsContextGLOpenGL::displayWasReconfigured):
+                    * platform/graphics/opengl/GraphicsContextGLOpenGL.h:
+
+2021-11-15  Alan Coon  <alancoon@apple.com>
+
</ins><span class="cx">         Cherry-pick r285728. rdar://problem/85236241
</span><span class="cx"> 
</span><span class="cx">     [Web Animations] Accelerated animations with a single keyframe don't account for prior forward-filling animations
</span></span></pre></div>
<a id="branchessafari612branchSourceWebCoreplatformgraphicsangleGraphicsContextGLANGLEcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-612-branch/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp (286241 => 286242)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612-branch/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp     2021-11-29 19:38:17 UTC (rev 286241)
+++ branches/safari-612-branch/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp        2021-11-29 19:38:20 UTC (rev 286242)
</span><span class="lines">@@ -85,7 +85,8 @@
</span><span class="cx">     // Unset the EGL current context, since the next access might be from another thread, and the
</span><span class="cx">     // context cannot be current on multiple threads.
</span><span class="cx">     if (releaseBehavior == ReleaseThreadResourceBehavior::ReleaseCurrentContext) {
</span><del>-        if (EGL_GetCurrentContext() == EGL_NO_CONTEXT)
</del><ins>+        EGLDisplay display = EGL_GetCurrentDisplay();
+        if (display == EGL_NO_DISPLAY)
</ins><span class="cx">             return true;
</span><span class="cx">         // At the time of writing, ANGLE does not flush on MakeCurrent. Since we are
</span><span class="cx">         // potentially switching threads, we should flush.
</span><span class="lines">@@ -92,20 +93,26 @@
</span><span class="cx">         // Note: Here we assume also that ANGLE has only one platform context -- otherwise
</span><span class="cx">         // we would need to flush each EGL context that has been used.
</span><span class="cx">         gl::Flush();
</span><del>-        EGLDisplay display = EGL_GetDisplay(EGL_DEFAULT_DISPLAY);
-        if (display == EGL_NO_DISPLAY)
-            return true;
</del><span class="cx">         return EGL_MakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
</span><span class="cx">     }
</span><span class="cx">     if (releaseBehavior == ReleaseThreadResourceBehavior::TerminateAndReleaseThreadResources) {
</span><del>-        EGLDisplay display = EGL_GetDisplay(EGL_DEFAULT_DISPLAY);
-        if (display != EGL_NO_DISPLAY) {
-            if (EGL_GetCurrentContext() != EGL_NO_CONTEXT) {
-                ASSERT_NOT_REACHED(); // All resources must have been destroyed.
-                EGL_MakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
-            }
-            EGL_Terminate(display);
</del><ins>+        EGLDisplay currentDisplay = EGL_GetCurrentDisplay();
+        if (currentDisplay != EGL_NO_DISPLAY) {
+            ASSERT_NOT_REACHED(); // All resources must have been destroyed.
+            EGL_MakeCurrent(currentDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
</ins><span class="cx">         }
</span><ins>+        constexpr EGLNativeDisplayType nativeDisplays[] = {
+            defaultDisplay,
+#if PLATFORM(COCOA)
+            lowPowerDisplay,
+            highPerformanceDisplay
+#endif
+        };
+        for (auto nativeDisplay : nativeDisplays) {
+            EGLDisplay display = EGL_GetDisplay(nativeDisplay);
+            if (display != EGL_NO_DISPLAY)
+                EGL_Terminate(display);
+        }
</ins><span class="cx">     }
</span><span class="cx">     // Called when we do not know if we will ever see another call from this thread again.
</span><span class="cx">     // Unset the EGL current context by releasing whole EGL thread state.
</span></span></pre></div>
<a id="branchessafari612branchSourceWebCoreplatformgraphicscocoaGraphicsContextGLOpenGLCocoamm"></a>
<div class="modfile"><h4>Modified: branches/safari-612-branch/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm (286241 => 286242)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612-branch/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm        2021-11-29 19:38:17 UTC (rev 286241)
+++ branches/safari-612-branch/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm   2021-11-29 19:38:20 UTC (rev 286242)
</span><span class="lines">@@ -147,24 +147,25 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     LOG(WebGL, "Attempting to use ANGLE's %s backend.", attrs.useMetal ? "Metal" : "OpenGL");
</span><ins>+    EGLNativeDisplayType nativeDisplay = GraphicsContextGLOpenGL::defaultDisplay;
</ins><span class="cx">     if (attrs.useMetal) {
</span><span class="cx">         displayAttributes.append(EGL_PLATFORM_ANGLE_TYPE_ANGLE);
</span><span class="cx">         displayAttributes.append(EGL_PLATFORM_ANGLE_TYPE_METAL_ANGLE);
</span><del>-    }
-
-    if (attrs.powerPreference != GraphicsContextGLAttributes::PowerPreference::Default || attrs.forceRequestForHighPerformanceGPU) {
-        displayAttributes.append(EGL_POWER_PREFERENCE_ANGLE);
-        if (attrs.powerPreference == GraphicsContextGLAttributes::PowerPreference::LowPower && !attrs.forceRequestForHighPerformanceGPU) {
-            LOG(WebGL, "Requesting low power GPU.");
</del><ins>+        // These properties are defined for EGL_ANGLE_power_preference as EGLContext attributes,
+        // but Metal backend uses EGLDisplay attributes.
+        auto powerPreference = attrs.forceRequestForHighPerformanceGPU ? GraphicsContextGLAttributes::PowerPreference::HighPerformance : attrs.powerPreference;
+        if (powerPreference == GraphicsContextGLAttributes::PowerPreference::LowPower) {
+            displayAttributes.append(EGL_POWER_PREFERENCE_ANGLE);
</ins><span class="cx">             displayAttributes.append(EGL_LOW_POWER_ANGLE);
</span><del>-        } else {
-            ASSERT(attrs.powerPreference == GraphicsContextGLAttributes::PowerPreference::HighPerformance || attrs.forceRequestForHighPerformanceGPU);
-            LOG(WebGL, "Requesting high power GPU if available.");
</del><ins>+            nativeDisplay = GraphicsContextGLOpenGL::lowPowerDisplay;
+        } else if (powerPreference == GraphicsContextGLAttributes::PowerPreference::HighPerformance) {
+            displayAttributes.append(EGL_POWER_PREFERENCE_ANGLE);
</ins><span class="cx">             displayAttributes.append(EGL_HIGH_POWER_ANGLE);
</span><ins>+            nativeDisplay = GraphicsContextGLOpenGL::highPerformanceDisplay;
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx">     displayAttributes.append(EGL_NONE);
</span><del>-    display = EGL_GetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, reinterpret_cast<void*>(EGL_DEFAULT_DISPLAY), displayAttributes.data());
</del><ins>+    display = EGL_GetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, reinterpret_cast<void*>(nativeDisplay), displayAttributes.data());
</ins><span class="cx"> 
</span><span class="cx">     if (EGL_Initialize(display, &majorVersion, &minorVersion) == EGL_FALSE) {
</span><span class="cx">         LOG(WebGL, "EGLDisplay Initialization failed.");
</span><span class="lines">@@ -173,7 +174,7 @@
</span><span class="cx">     LOG(WebGL, "ANGLE initialised Major: %d Minor: %d", majorVersion, minorVersion);
</span><span class="cx">     if (shouldInitializeWithVolatileContextSupport) {
</span><span class="cx">         // After initialization, EGL_DEFAULT_DISPLAY will return the platform-customized display.
</span><del>-        ASSERT(display == EGL_GetDisplay(EGL_DEFAULT_DISPLAY));
</del><ins>+        ASSERT(display == EGL_GetDisplay(nativeDisplay));
</ins><span class="cx">         ASSERT(checkVolatileContextSupportIfDeviceExists(display, "EGL_ANGLE_platform_device_context_volatile_eagl", "EGL_ANGLE_device_eagl", EGL_EAGL_CONTEXT_ANGLE));
</span><span class="cx">         ASSERT(checkVolatileContextSupportIfDeviceExists(display, "EGL_ANGLE_platform_device_context_volatile_cgl", "EGL_ANGLE_device_cgl", EGL_CGL_CONTEXT_ANGLE));
</span><span class="cx">     }
</span><span class="lines">@@ -241,16 +242,25 @@
</span><span class="cx">     if (!m_displayObj)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    bool supportsPowerPreference = false;
</del><span class="cx"> #if PLATFORM(MAC)
</span><del>-    const char *displayExtensions = EGL_QueryString(m_displayObj, EGL_EXTENSIONS);
-    m_supportsPowerPreference = strstr(displayExtensions, "EGL_ANGLE_power_preference");
-    supportsPowerPreference = m_supportsPowerPreference;
</del><ins>+    if (!attrs.useMetal) {
+        // For OpenGL, EGL_ANGLE_power_preference is used. The context is initialized with the
+        // default, low-power device. For high-performance contexts, we request the high-performance
+        // GPU in setContextVisibility. When the request is fullfilled by the system, we get the
+        // display reconfiguration callback. Upon this, we update the CGL contexts inside ANGLE.
+        const char *displayExtensions = EGL_QueryString(m_displayObj, EGL_EXTENSIONS);
+        bool supportsPowerPreference = strstr(displayExtensions, "EGL_ANGLE_power_preference");
+        if (supportsPowerPreference) {
+            m_switchesGPUOnDisplayReconfiguration = attrs.powerPreference == GraphicsContextGLPowerPreference::HighPerformance
+                || attrs.forceRequestForHighPerformanceGPU;
+        } else {
+            if (attrs.powerPreference == GraphicsContextGLPowerPreference::HighPerformance) {
+                attrs.powerPreference = GraphicsContextGLPowerPreference::Default;
+                setContextAttributes(attrs);
+            }
+        }
+    }
</ins><span class="cx"> #endif
</span><del>-    if (!supportsPowerPreference && attrs.powerPreference == GraphicsContextGLPowerPreference::HighPerformance) {
-        attrs.powerPreference = GraphicsContextGLPowerPreference::Default;
-        setContextAttributes(attrs);
-    }
</del><span class="cx"> 
</span><span class="cx">     EGLint configAttributes[] = {
</span><span class="cx">         EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
</span><span class="lines">@@ -535,7 +545,7 @@
</span><span class="cx"> void GraphicsContextGLOpenGL::setContextVisibility(bool isVisible)
</span><span class="cx"> {
</span><span class="cx"> #if PLATFORM(MAC)
</span><del>-    if (contextAttributes().powerPreference != GraphicsContextGLPowerPreference::HighPerformance)
</del><ins>+    if (!m_switchesGPUOnDisplayReconfiguration)
</ins><span class="cx">         return;
</span><span class="cx">     if (isVisible)
</span><span class="cx">         m_highPerformanceGPURequest = ScopedHighPerformanceGPURequest::acquire();
</span><span class="lines">@@ -549,7 +559,7 @@
</span><span class="cx"> void GraphicsContextGLOpenGL::displayWasReconfigured()
</span><span class="cx"> {
</span><span class="cx"> #if PLATFORM(MAC)
</span><del>-    if (m_supportsPowerPreference)
</del><ins>+    if (m_switchesGPUOnDisplayReconfiguration)
</ins><span class="cx">         EGL_HandleGPUSwitchANGLE(m_displayObj);
</span><span class="cx"> #endif
</span><span class="cx">     dispatchContextChangedNotification();
</span></span></pre></div>
<a id="branchessafari612branchSourceWebCoreplatformgraphicsopenglGraphicsContextGLOpenGLh"></a>
<div class="modfile"><h4>Modified: branches/safari-612-branch/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h (286241 => 286242)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612-branch/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h     2021-11-29 19:38:17 UTC (rev 286241)
+++ branches/safari-612-branch/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h        2021-11-29 19:38:20 UTC (rev 286242)
</span><span class="lines">@@ -97,7 +97,7 @@
</span><span class="cx"> 
</span><span class="cx"> typedef WTF::HashMap<CString, uint64_t> ShaderNameHash;
</span><span class="cx"> 
</span><del>-class WEBCORE_EXPORT GraphicsContextGLOpenGL final : public GraphicsContextGL
</del><ins>+class WEBCORE_EXPORT GraphicsContextGLOpenGL : public GraphicsContextGL
</ins><span class="cx"> {
</span><span class="cx"> public:
</span><span class="cx">     static RefPtr<GraphicsContextGLOpenGL> create(GraphicsContextGLAttributes, HostWindow*);
</span><span class="lines">@@ -542,10 +542,20 @@
</span><span class="cx"> #endif
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-private:
</del><ins>+#if USE(ANGLE)
+    constexpr static EGLNativeDisplayType defaultDisplay = EGL_DEFAULT_DISPLAY;
</ins><span class="cx"> #if PLATFORM(COCOA)
</span><ins>+    constexpr static EGLNativeDisplayType lowPowerDisplay = EGL_CAST(EGLNativeDisplayType, -1);
+    constexpr static EGLNativeDisplayType highPerformanceDisplay = EGL_CAST(EGLNativeDisplayType, -2);
+#endif
+#endif
+
+protected:
+#if PLATFORM(COCOA)
</ins><span class="cx">     GraphicsContextGLOpenGL(GraphicsContextGLAttributes, HostWindow*, GraphicsContextGLIOSurfaceSwapChain* = nullptr);
</span><del>-#else
</del><ins>+#endif
+private:
+#if !PLATFORM(COCOA)
</ins><span class="cx">     GraphicsContextGLOpenGL(GraphicsContextGLAttributes, HostWindow*);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="lines">@@ -795,7 +805,7 @@
</span><span class="cx">     void* m_displayBufferPbuffer { nullptr };
</span><span class="cx"> #endif
</span><span class="cx"> #if PLATFORM(MAC)
</span><del>-    bool m_supportsPowerPreference { false };
</del><ins>+    bool m_switchesGPUOnDisplayReconfiguration { false };
</ins><span class="cx">     ScopedHighPerformanceGPURequest m_highPerformanceGPURequest;
</span><span class="cx"> #endif
</span><span class="cx"> #if ENABLE(VIDEO) && USE(AVFOUNDATION)
</span></span></pre>
</div>
</div>

</body>
</html>