Title: [283346] branches/safari-611.4.2.0-branch
Revision
283346
Author
repst...@apple.com
Date
2021-09-30 16:12:17 -0700 (Thu, 30 Sep 2021)

Log Message

Cherry-pick r281613. rdar://problem/83369963

    Crash in GraphicsContextGLOpenGL::reshapeDisplayBufferBacking
    https://bugs.webkit.org/show_bug.cgi?id=229309

    Patch by Alex Christensen <achristen...@webkit.org> on 2021-08-25
    Reviewed by Myles C. Maxfield.

    Source/WebCore:

    Test: fast/canvas/xr-compatible-crash.html

    Null check m_swapChain because reshapeDisplayBufferBacking can be called before it is set.

    * html/canvas/WebGLRenderingContextBase.cpp:
    (WebCore::WebGLRenderingContextBase::addContextObject):
    * platform/graphics/angle/GraphicsContextGLANGLE.cpp:
    (WebCore::GraphicsContextGLOpenGL::reshapeFBOs):
    * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
    (WebCore::GraphicsContextGLOpenGL::reshapeDisplayBufferBacking):

    LayoutTests:

    * fast/canvas/xr-compatible-crash.html: Added.
    * fast/canvas/xr-compatible-crash-expected.txt: Added.

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

Modified Paths

Added Paths

Diff

Modified: branches/safari-611.4.2.0-branch/LayoutTests/ChangeLog (283345 => 283346)


--- branches/safari-611.4.2.0-branch/LayoutTests/ChangeLog	2021-09-30 23:12:10 UTC (rev 283345)
+++ branches/safari-611.4.2.0-branch/LayoutTests/ChangeLog	2021-09-30 23:12:17 UTC (rev 283346)
@@ -1,3 +1,43 @@
+2021-09-30  Russell Epstein  <repst...@apple.com>
+
+        Cherry-pick r281613. rdar://problem/83369963
+
+    Crash in GraphicsContextGLOpenGL::reshapeDisplayBufferBacking
+    https://bugs.webkit.org/show_bug.cgi?id=229309
+    
+    Patch by Alex Christensen <achristen...@webkit.org> on 2021-08-25
+    Reviewed by Myles C. Maxfield.
+    
+    Source/WebCore:
+    
+    Test: fast/canvas/xr-compatible-crash.html
+    
+    Null check m_swapChain because reshapeDisplayBufferBacking can be called before it is set.
+    
+    * html/canvas/WebGLRenderingContextBase.cpp:
+    (WebCore::WebGLRenderingContextBase::addContextObject):
+    * platform/graphics/angle/GraphicsContextGLANGLE.cpp:
+    (WebCore::GraphicsContextGLOpenGL::reshapeFBOs):
+    * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
+    (WebCore::GraphicsContextGLOpenGL::reshapeDisplayBufferBacking):
+    
+    LayoutTests:
+    
+    * fast/canvas/xr-compatible-crash.html: Added.
+    * fast/canvas/xr-compatible-crash-expected.txt: Added.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281613 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-08-25  Alex Christensen  <achristen...@webkit.org>
+
+            Crash in GraphicsContextGLOpenGL::reshapeDisplayBufferBacking
+            https://bugs.webkit.org/show_bug.cgi?id=229309
+
+            Reviewed by Myles C. Maxfield.
+
+            * fast/canvas/xr-compatible-crash.html: Added.
+            * fast/canvas/xr-compatible-crash-expected.txt: Added.
+
 2021-06-21  Alan Coon  <alanc...@apple.com>
 
         Cherry-pick r279010. rdar://problem/79574790

Added: branches/safari-611.4.2.0-branch/LayoutTests/fast/canvas/xr-compatible-crash-expected.txt (0 => 283346)


--- branches/safari-611.4.2.0-branch/LayoutTests/fast/canvas/xr-compatible-crash-expected.txt	                        (rev 0)
+++ branches/safari-611.4.2.0-branch/LayoutTests/fast/canvas/xr-compatible-crash-expected.txt	2021-09-30 23:12:17 UTC (rev 283346)
@@ -0,0 +1 @@
+This test passes if it does not crash.

Added: branches/safari-611.4.2.0-branch/LayoutTests/fast/canvas/xr-compatible-crash.html (0 => 283346)


--- branches/safari-611.4.2.0-branch/LayoutTests/fast/canvas/xr-compatible-crash.html	                        (rev 0)
+++ branches/safari-611.4.2.0-branch/LayoutTests/fast/canvas/xr-compatible-crash.html	2021-09-30 23:12:17 UTC (rev 283346)
@@ -0,0 +1,8 @@
+This test passes if it does not crash.
+<script>
+  if (window.testRunner) {
+    testRunner.dumpAsText();
+  }
+  in_canvas = document.body.appendChild(document.createElement('canvas'));
+  webgl = in_canvas.getContext('webgl', { xrCompatible: true });
+</script>

Modified: branches/safari-611.4.2.0-branch/Source/WebCore/ChangeLog (283345 => 283346)


--- branches/safari-611.4.2.0-branch/Source/WebCore/ChangeLog	2021-09-30 23:12:10 UTC (rev 283345)
+++ branches/safari-611.4.2.0-branch/Source/WebCore/ChangeLog	2021-09-30 23:12:17 UTC (rev 283346)
@@ -1,5 +1,53 @@
 2021-09-30  Russell Epstein  <repst...@apple.com>
 
+        Cherry-pick r281613. rdar://problem/83369963
+
+    Crash in GraphicsContextGLOpenGL::reshapeDisplayBufferBacking
+    https://bugs.webkit.org/show_bug.cgi?id=229309
+    
+    Patch by Alex Christensen <achristen...@webkit.org> on 2021-08-25
+    Reviewed by Myles C. Maxfield.
+    
+    Source/WebCore:
+    
+    Test: fast/canvas/xr-compatible-crash.html
+    
+    Null check m_swapChain because reshapeDisplayBufferBacking can be called before it is set.
+    
+    * html/canvas/WebGLRenderingContextBase.cpp:
+    (WebCore::WebGLRenderingContextBase::addContextObject):
+    * platform/graphics/angle/GraphicsContextGLANGLE.cpp:
+    (WebCore::GraphicsContextGLOpenGL::reshapeFBOs):
+    * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
+    (WebCore::GraphicsContextGLOpenGL::reshapeDisplayBufferBacking):
+    
+    LayoutTests:
+    
+    * fast/canvas/xr-compatible-crash.html: Added.
+    * fast/canvas/xr-compatible-crash-expected.txt: Added.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281613 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-08-25  Alex Christensen  <achristen...@webkit.org>
+
+            Crash in GraphicsContextGLOpenGL::reshapeDisplayBufferBacking
+            https://bugs.webkit.org/show_bug.cgi?id=229309
+
+            Reviewed by Myles C. Maxfield.
+
+            Test: fast/canvas/xr-compatible-crash.html
+
+            Null check m_swapChain because reshapeDisplayBufferBacking can be called before it is set.
+
+            * html/canvas/WebGLRenderingContextBase.cpp:
+            (WebCore::WebGLRenderingContextBase::addContextObject):
+            * platform/graphics/angle/GraphicsContextGLANGLE.cpp:
+            (WebCore::GraphicsContextGLOpenGL::reshapeFBOs):
+            * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
+            (WebCore::GraphicsContextGLOpenGL::reshapeDisplayBufferBacking):
+
+2021-09-30  Russell Epstein  <repst...@apple.com>
+
         Cherry-pick r280861. rdar://problem/81757530
 
     Deploy some more smart pointers in DOMWindow.cpp

Modified: branches/safari-611.4.2.0-branch/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp (283345 => 283346)


--- branches/safari-611.4.2.0-branch/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp	2021-09-30 23:12:10 UTC (rev 283345)
+++ branches/safari-611.4.2.0-branch/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp	2021-09-30 23:12:17 UTC (rev 283346)
@@ -6247,7 +6247,6 @@
     if (m_isPendingPolicyResolution)
         return;
 
-    ASSERT(!isContextLost());
     m_contextObjects.add(&object);
 }
 

Modified: branches/safari-611.4.2.0-branch/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp (283345 => 283346)


--- branches/safari-611.4.2.0-branch/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp	2021-09-30 23:12:10 UTC (rev 283345)
+++ branches/safari-611.4.2.0-branch/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp	2021-09-30 23:12:17 UTC (rev 283346)
@@ -165,7 +165,6 @@
 
     // resize regular FBO
     gl::BindFramebuffer(GL_FRAMEBUFFER, m_fbo);
-    ASSERT(m_texture);
 
 #if PLATFORM(COCOA)
     if (!reshapeDisplayBufferBacking()) {

Modified: branches/safari-611.4.2.0-branch/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm (283345 => 283346)


--- branches/safari-611.4.2.0-branch/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm	2021-09-30 23:12:10 UTC (rev 283345)
+++ branches/safari-611.4.2.0-branch/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm	2021-09-30 23:12:17 UTC (rev 283346)
@@ -518,10 +518,12 @@
         m_displayBufferPbuffer = EGL_NO_SURFACE;
     }
     // Reset the future recycled buffer now, because it most likely will not be reusable at the time it will be reused.
-    auto recycledBuffer = m_swapChain->recycleBuffer();
-    if (recycledBuffer.handle)
-        EGL_DestroySurface(m_displayObj, recycledBuffer.handle);
-    recycledBuffer.surface.reset();
+    if (m_swapChain) {
+        auto recycledBuffer = m_swapChain->recycleBuffer();
+        if (recycledBuffer.handle)
+            EGL_DestroySurface(m_displayObj, recycledBuffer.handle);
+        recycledBuffer.surface.reset();
+    }
     return allocateAndBindDisplayBufferBacking();
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to