Title: [291314] trunk/Source/WebKit
Revision
291314
Author
commit-qu...@webkit.org
Date
2022-03-15 14:30:05 -0700 (Tue, 15 Mar 2022)

Log Message

RemoteGraphicsContextGLProxy omits context lost checks for back and front buffer access functions
https://bugs.webkit.org/show_bug.cgi?id=237891

Patch by Kimmo Kinnunen <kkinnu...@apple.com> on 2022-03-15
Reviewed by Myles Maxfield.

Add missing isContextLost() checks to RemoteGraphicsContextGLProxy functions.
WebGLRenderingContextBase would call as follows:
void WebGLRenderingContextBase::paintRenderingResultsToCanvas()
{
    if (isContextLostOrPending())
        return;
    ...
    m_context->prepareForDisplay();
    ...
    m_context->paintCompositedResultsToCanvas();
}

The context may be ok during the first check but then fail later,
and so all the context functions need to check for validity.

No new tests, testing hooks need non-trivial implementation.
This is tracked in bug 237891.

* WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp:
(WebKit::RemoteGraphicsContextGLProxy::paintRenderingResultsToCanvas):
(WebKit::RemoteGraphicsContextGLProxy::paintCompositedResultsToCanvas):
(WebKit::RemoteGraphicsContextGLProxy::copyTextureFromMedia):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (291313 => 291314)


--- trunk/Source/WebKit/ChangeLog	2022-03-15 21:22:35 UTC (rev 291313)
+++ trunk/Source/WebKit/ChangeLog	2022-03-15 21:30:05 UTC (rev 291314)
@@ -1,3 +1,33 @@
+2022-03-15  Kimmo Kinnunen  <kkinnu...@apple.com>
+
+        RemoteGraphicsContextGLProxy omits context lost checks for back and front buffer access functions
+        https://bugs.webkit.org/show_bug.cgi?id=237891
+
+        Reviewed by Myles Maxfield.
+
+        Add missing isContextLost() checks to RemoteGraphicsContextGLProxy functions.
+        WebGLRenderingContextBase would call as follows:
+        void WebGLRenderingContextBase::paintRenderingResultsToCanvas()
+        {
+            if (isContextLostOrPending())
+                return;
+            ...
+            m_context->prepareForDisplay();
+            ...
+            m_context->paintCompositedResultsToCanvas();
+        }
+
+        The context may be ok during the first check but then fail later,
+        and so all the context functions need to check for validity.
+
+        No new tests, testing hooks need non-trivial implementation.
+        This is tracked in bug 237891.
+
+        * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp:
+        (WebKit::RemoteGraphicsContextGLProxy::paintRenderingResultsToCanvas):
+        (WebKit::RemoteGraphicsContextGLProxy::paintCompositedResultsToCanvas):
+        (WebKit::RemoteGraphicsContextGLProxy::copyTextureFromMedia):
+
 2022-03-15  Myles C. Maxfield  <mmaxfi...@apple.com>
 
         [WebGPU] Allow for scheduling asynchronous work

Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp (291313 => 291314)


--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp	2022-03-15 21:22:35 UTC (rev 291313)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp	2022-03-15 21:30:05 UTC (rev 291314)
@@ -138,6 +138,8 @@
 
 void RemoteGraphicsContextGLProxy::paintRenderingResultsToCanvas(ImageBuffer& buffer)
 {
+    if (isContextLost())
+        return;
     // FIXME: the buffer is "relatively empty" always, but for consistency, we need to ensure
     // no pending operations are targeted for the `buffer`.
     buffer.flushDrawingContext();
@@ -158,6 +160,8 @@
 
 void RemoteGraphicsContextGLProxy::paintCompositedResultsToCanvas(ImageBuffer& buffer)
 {
+    if (isContextLost())
+        return;
     buffer.flushDrawingContext();
     auto sendResult = sendSync(Messages::RemoteGraphicsContextGL::PaintCompositedResultsToCanvas(buffer.renderingResourceIdentifier()), Messages::RemoteGraphicsContextGL::PaintCompositedResultsToCanvas::Reply());
     if (!sendResult) {
@@ -186,6 +190,8 @@
 #if ENABLE(VIDEO)
 bool RemoteGraphicsContextGLProxy::copyTextureFromMedia(MediaPlayer& mediaPlayer, PlatformGLObject texture, GCGLenum target, GCGLint level, GCGLenum internalFormat, GCGLenum format, GCGLenum type, bool premultiplyAlpha, bool flipY)
 {
+    if (isContextLost())
+        return false;
     auto videoFrame = mediaPlayer.videoFrameForCurrentTime();
     // Video in WP while WebGL in GPUP is not supported.
     if (!videoFrame || !is<RemoteVideoFrameProxy>(*videoFrame))
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to