Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 07ffd0b1b59db639d8f861e312019aa14d74e514
https://github.com/WebKit/WebKit/commit/07ffd0b1b59db639d8f861e312019aa14d74e514
Author: Kimmo Kinnunen <[email protected]>
Date: 2025-10-30 (Thu, 30 Oct 2025)
Changed paths:
M Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
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/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.h
M Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.mm
M Source/WebKit/GPUProcess/RemoteSharedResourceCache.cpp
M Source/WebKit/GPUProcess/RemoteSharedResourceCache.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.cpp
M
Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGLFunctionsGenerated.h
M Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp
M Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.h
M Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.messages.in
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 Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp
M Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h
M
Source/WebKit/WebProcess/GPU/graphics/cocoa/RemoteGraphicsContextGLProxyCocoa.mm
M
Source/WebKit/WebProcess/GPU/graphics/gbm/RemoteGraphicsContextGLProxyGBM.cpp
M
Source/WebKit/WebProcess/GPU/graphics/wc/RemoteGraphicsContextGLProxyWC.cpp
M Tools/Scripts/generate-gpup-webgl
M Tools/TestWebKitAPI/Tests/WebCore/cocoa/TestGraphicsContextGLCocoa.mm
M Tools/TestWebKitAPI/Tests/WebCore/glib/GraphicsContextGLTextureMapper.cpp
Log Message:
-----------
RemoteGraphicsContextGLProxy transfers images by drawing to ImageBuffer
https://bugs.webkit.org/show_bug.cgi?id=300088
rdar://161883400
Reviewed by Dan Glastonbury.
When obtaining a WebGL rendering for JS uses such has other WebGL
texImage2D or 2D context drawImage, the rendering would be copied
to ImageBuffer. This is slow and needs synchronous thread-to-thread
call in GPUP. Fix by using RemoteNativeImageProxy.
Before,
RemoteGraphicsContextGLProxy::drawSurfaceBufferToImageBuffer would
synchronously send a message with the ImageBuffer id to GPUP WebGL work
queue. The queue would obtain the WebGL rendering to a NativeImage,
synchronously run ImageBuffer::drawNativeImage in RemoteRenderingBackend
thread and wait until that would be finished.
After,
RemoteGraphicsContextGL::copyNativeImageYFlipped produces a
RemoteNativeImageProxy that represents the rendering and return.
In GPUP, RemoteGraphicsContextGL work queue produce the rendering to
a NativeImage and store it to the RemoteSharedResourceCache.
RemoteRenderingBackendProxy will obtain the NativeImage from the shared
cache when the drawing command that uses the image is processed.
The copyNativeImage operation is called copyNativeImageYFlipped
as the WebGL rendering is currently in WebGL coordinates, origin
bottom-left. Later on, this should change.
This is preliminary work on the larger task of reducing copies when
rendering context renderings are used between contexts. The goal
is to form and no-copy NativeImage references in various subsystems
(ImageBitmap, 2D context, WebGL, WebGPU).
Test: Tools/TestWebKitAPI/Tests/WebCore/cocoa/TestGraphicsContextGLCocoa.mm
* Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::surfaceBufferToImageBuffer):
(WebCore::WebGLRenderingContextBase::transferToImageBuffer):
* Source/WebCore/platform/graphics/GraphicsContextGL.h:
* Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp:
(WebCore::GraphicsContextGLANGLE::copyNativeImageYFlipped):
(WebCore::GraphicsContextGLANGLE::drawSurfaceBufferToImageBuffer): Deleted.
(WebCore::GraphicsContextGLANGLE::bufferAsNativeImage): Deleted.
* Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.h:
* Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.h:
* Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.mm:
(WebCore::GraphicsContextGLCocoa::copyNativeImageYFlipped):
(WebCore::GraphicsContextGLCocoa::bufferAsNativeImage): Deleted.
* Source/WebKit/GPUProcess/RemoteSharedResourceCache.cpp:
(WebKit::RemoteSharedResourceCache::addNativeImage):
(WebKit::RemoteSharedResourceCache::takeNativeImage):
* Source/WebKit/GPUProcess/RemoteSharedResourceCache.h:
* Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.cpp:
(WebKit::RemoteGraphicsContextGL::copyNativeImageYFlipped):
(WebKit::RemoteGraphicsContextGL::setDrawingBufferColorSpace):
(WebKit::RemoteGraphicsContextGL::drawSurfaceBufferToImageBuffer): Deleted.
(WebKit::RemoteGraphicsContextGL::paintNativeImageToImageBuffer): Deleted.
* Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.h:
* Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.messages.in:
*
Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGLFunctionsGenerated.cpp:
(WebKit::RemoteGraphicsContextGL::setDrawingBufferColorSpace): Deleted.
* Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGLFunctionsGenerated.h:
* Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::cacheNativeImageFromSharedNativeImage):
* Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.h:
* Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.messages.in:
* Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp:
(WebKit::RemoteGraphicsContextGLProxy::create):
(WebKit::RemoteGraphicsContextGLProxy::RemoteGraphicsContextGLProxy):
(WebKit::RemoteGraphicsContextGLProxy::copyNativeImageYFlipped):
(WebKit::RemoteGraphicsContextGLProxy::setDrawingBufferColorSpace):
(WebKit::RemoteGraphicsContextGLProxy::drawSurfaceBufferToImageBuffer): Deleted.
* Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h:
*
Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxyFunctionsGenerated.cpp:
(WebKit::RemoteGraphicsContextGLProxy::setDrawingBufferColorSpace): Deleted.
* Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
(WebKit::RemoteRenderingBackendProxy::cacheNativeImageFromSharedNativeImage):
* Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h:
*
Source/WebKit/WebProcess/GPU/graphics/cocoa/RemoteGraphicsContextGLProxyCocoa.mm:
(WebKit::RemoteGraphicsContextGLProxy::platformCreate):
* Source/WebKit/WebProcess/GPU/graphics/gbm/RemoteGraphicsContextGLProxyGBM.cpp:
(WebKit::RemoteGraphicsContextGLProxy::platformCreate):
* Source/WebKit/WebProcess/GPU/graphics/wc/RemoteGraphicsContextGLProxyWC.cpp:
(WebKit::RemoteGraphicsContextGLProxy::<platformCreate):
(WebKit::RemoteGraphicsContextGLProxy::platformCreate): Deleted.
* Tools/Scripts/generate-gpup-webgl:
* Tools/TestWebKitAPI/Tests/WebCore/cocoa/TestGraphicsContextGLCocoa.mm:
(TestWebKitAPI::TEST_F(GraphicsContextGLCocoaTest,
CopyNativeImageNoDrawingBufferReturnsNullptr)):
(TestWebKitAPI::TEST_F(GraphicsContextGLCocoaTest,
CopyNativeImageAfterReshape)):
(TestWebKitAPI::TEST_F(GraphicsContextGLCocoaTest,
CopyImageAndMutateDrawingBuffer)):
(TestWebKitAPI::TEST_F(GraphicsContextGLCocoaTest,
BufferAsImageNoDrawingBufferReturnsNullptr)): Deleted.
(TestWebKitAPI::TEST_F(GraphicsContextGLCocoaTest, BufferAsImageAfterReshape)):
Deleted.
Canonical link: https://commits.webkit.org/302334@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications