[webkit-changes] [WebKit/WebKit] cabe40: [WebGL] Allocate PixelBuffer for read back in web ...

Kimmo Kinnunen noreply at github.com
Fri Jun 28 13:58:26 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: cabe40b191940d6f8fe3dc674aeef91a7dba992f
      https://github.com/WebKit/WebKit/commit/cabe40b191940d6f8fe3dc674aeef91a7dba992f
  Author: Kimmo Kinnunen <kkinnunen at apple.com>
  Date:   2024-06-28 (Fri, 28 Jun 2024)

  Changed paths:
    M Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/DisplayMtl.mm
    M Source/WebCore/html/HTMLCanvasElement.cpp
    M Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
    M Source/WebCore/html/canvas/WebGLRenderingContextBase.h
    M Source/WebCore/platform/graphics/GraphicsContextGL.h
    M Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp
    M Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.h
    M Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.cpp
    M Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.h
    M Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.messages.in
    M Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGLFunctionsGenerated.h
    M Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp
    M Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h
    M Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxyFunctionsGenerated.cpp
    M Tools/Scripts/generate-gpup-webgl
    M Tools/TestWebKitAPI/Tests/WebCore/cocoa/TestGraphicsContextGLCocoa.mm

  Log Message:
  -----------
  [WebGL] Allocate PixelBuffer for read back in web process
https://bugs.webkit.org/show_bug.cgi?id=275761
rdar://129677619

Reviewed by Mike Wyrzykowski.

RemoteGraphicsContextGL::drawingBufferToPixelBuffer() would run out of
memory and crash when sending the pixel buffer back to WP. The encoder
is expected to crash on OOM.

Fix by allocating the memory in WP side. The pixel buffer transfer
does just a readPixels(), so call readpixels explicitly.

Implements the PixelBuffer flip via an ANGLE extension
GL_ANGLE_reverse_row_order, in case the backend supports it.
Add manual flip in case the extension is not supported, like with
OpenGL ES.

Enable GL_ANGLE_reverse_row_order for Metal. It is already implemented
due to the feature needed in other places. It's just not enabled.

The WP side PixelBuffer has to always be flipped, so change the signature.

The PixelBuffer has to be of type ByteArrayPixelBuffer, change the
signature of WebGLRenderingContextBase::drawingBufferToPixelBuffer().

* Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/DisplayMtl.mm:
(rx::DisplayMtl::initializeExtensions const):
* Source/WebCore/html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::getImageData):
* Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::initializeContextState):
(WebCore::WebGLRenderingContextBase::drawingBufferToPixelBuffer):
(WebCore::WebGLRenderingContextBase::readPixels):
* Source/WebCore/html/canvas/WebGLRenderingContextBase.h:
* Source/WebCore/platform/graphics/GraphicsContextGL.h:
* Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp:
(WebCore::GraphicsContextGLANGLE::initialize):
(WebCore::GraphicsContextGLANGLE::readPixelsForPaintResults):
(WebCore::GraphicsContextGLANGLE::readPixels):
(WebCore::GraphicsContextGLANGLE::readPixelsWithStatus):
(WebCore::GraphicsContextGLANGLE::readPixelsBufferObject):
(WebCore::GraphicsContextGLANGLE::setPackParameters):
* Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.h:
* Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.cpp:
(WebKit::RemoteGraphicsContextGL::readPixelsInline):
(WebKit::RemoteGraphicsContextGL::readPixelsSharedMemory):
* Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.h:
* Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.messages.in:
* Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGLFunctionsGenerated.h:
(setDrawingBufferColorSpace):
(drawingBufferToPixelBuffer): Deleted.
* Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp:
(WebKit::RemoteGraphicsContextGLProxy::readPixels):
* Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h:
* Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxyFunctionsGenerated.cpp:
(WebKit::RemoteGraphicsContextGLProxy::drawingBufferToPixelBuffer): Deleted.
* Tools/Scripts/generate-gpup-webgl:
* Tools/TestWebKitAPI/Tests/WebCore/cocoa/TestGraphicsContextGLCocoa.mm:
(TestWebKitAPI::changeContextContents):
(TestWebKitAPI::TEST_P):

Canonical link: https://commits.webkit.org/280472@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list