Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: a9bd62bea8c1974a69072f33a0cde9ef6d9f9f96
https://github.com/WebKit/WebKit/commit/a9bd62bea8c1974a69072f33a0cde9ef6d9f9f96
Author: Carlos Garcia Campos <[email protected]>
Date: 2026-10-06 (Tue, 06 Oct 2026)
Changed paths:
M Source/WebCore/platform/CoordinatedGraphics.cmake
M Source/WebCore/platform/graphics/android/GraphicsContextGLAndroid.h
M
Source/WebCore/platform/graphics/coordinated/CoordinatedPlatformLayerBufferSkiaImage.cpp
M
Source/WebCore/platform/graphics/coordinated/CoordinatedPlatformLayerBufferSkiaImage.h
A
Source/WebCore/platform/graphics/coordinated/GraphicsContextGLCoordinated.cpp
A
Source/WebCore/platform/graphics/coordinated/GraphicsContextGLCoordinated.h
A
Source/WebCore/platform/graphics/coordinated/GraphicsContextGLCoordinatedEpoxy.cpp
R
Source/WebCore/platform/graphics/coordinated/GraphicsContextGLEGLCoordinated.cpp
M Source/WebCore/platform/graphics/egl/GraphicsContextGLEGL.cpp
M Source/WebCore/platform/graphics/egl/GraphicsContextGLEGL.h
M Source/WebCore/platform/graphics/gbm/GraphicsContextGLGBM.cpp
M Source/WebCore/platform/graphics/gbm/GraphicsContextGLGBM.h
M Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.h
M Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.messages.in
M Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGLGBM.cpp
M
Source/WebKit/WebProcess/GPU/graphics/gbm/RemoteGraphicsContextGLProxyGBM.cpp
M Tools/TestWebKitAPI/PlatformGTK.cmake
M Tools/TestWebKitAPI/PlatformWPE.cmake
A Tools/TestWebKitAPI/Tests/WebCore/glib/GraphicsContextGLCoordinated.cpp
R Tools/TestWebKitAPI/Tests/WebCore/glib/GraphicsContextGLEGL.cpp
Log Message:
-----------
[CoordinatedGraphics] Use a swapchain of three buffers for WebGL
https://bugs.webkit.org/show_bug.cgi?id=325950
Reviewed by Nikolas Zimmermann.
We currently use two fixed buffers, but the compositor hasn't released
the previous one when we do the swap, so a third one is needed. Use a
swapchain based on a fixed size array of 3 buffers similar to the one
used by Cocoa implementation. If we need to bind a new buffer and next
one is still in used by the compositor, it's released and a new one is
allocated. In the GBM implementation the drawing buffer keeps a
reference of the DMABufBuffer so that we know it's no longer in use by
the compositor when it only has one reference. For non-GBM implementation
a thread safe ref counted class is used to wrap the inner texture ID that
is passed to the compositor to keep a reference while the texture is in use.
This patch also moves the coordinated graphics implementation of
GraphicsContextGL to its own file and renames the API test.
Test: Tools/TestWebKitAPI/Tests/WebCore/glib/GraphicsContextGLCoordinated.cpp
* Source/WebCore/platform/CoordinatedGraphics.cmake:
*
Source/WebCore/platform/graphics/coordinated/CoordinatedPlatformLayerBufferSkiaImage.cpp:
(WebCore::PromiseWebGLImageContext::PromiseWebGLImageContext):
(WebCore::PromiseWebGLImageContext::promiseImageTexture):
(WebCore::CoordinatedPlatformLayerBufferSkiaImage::create):
(): Deleted.
*
Source/WebCore/platform/graphics/coordinated/CoordinatedPlatformLayerBufferSkiaImage.h:
*
Source/WebCore/platform/graphics/coordinated/GraphicsContextGLCoordinated.cpp:
Added.
(WebCore::GraphicsContextGLCoordinated::create):
(WebCore::GraphicsContextGLCoordinated::GraphicsContextGLCoordinated):
(WebCore::GraphicsContextGLCoordinated::~GraphicsContextGLCoordinated):
(WebCore::GraphicsContextGLCoordinated::platformInitialize):
(WebCore::GraphicsContextGLCoordinated::DrawingBuffer::DrawingBuffer):
(WebCore::GraphicsContextGLCoordinated::DrawingBuffer::operator=):
(WebCore::GraphicsContextGLCoordinated::DrawingBuffer::isInUse const):
(WebCore::GraphicsContextGLCoordinated::DrawingBuffer::release):
(WebCore::GraphicsContextGLCoordinated::createDrawingBuffer const):
(WebCore::GraphicsContextGLCoordinated::destroyDrawingBuffer const):
(WebCore::GraphicsContextGLCoordinated::freeDrawingBuffers):
(WebCore::GraphicsContextGLCoordinated::freeObsoleteDrawingBuffers):
(WebCore::GraphicsContextGLCoordinated::bindNextDrawingBuffer):
(WebCore::GraphicsContextGLCoordinated::reshapeDrawingBuffer):
(WebCore::GraphicsContextGLCoordinated::prepareForDisplay):
(WebCore::GraphicsContextGLCoordinated::readCompositedResults):
* Source/WebCore/platform/graphics/coordinated/GraphicsContextGLCoordinated.h:
Added.
(WebCore::GraphicsContextGLCoordinated::DrawingBuffer::operator bool const):
(WebCore::GraphicsContextGLCoordinated::DrawingBuffer::texture const):
(WebCore::GraphicsContextGLCoordinated::drawingBuffer):
(WebCore::GraphicsContextGLCoordinated::displayBuffer):
*
Source/WebCore/platform/graphics/coordinated/GraphicsContextGLCoordinatedEpoxy.cpp:
Renamed from
Source/WebCore/platform/graphics/coordinated/GraphicsContextGLEGLCoordinated.cpp.
(WebCore::GraphicsContextGLCoordinated::setupCurrentTexture const):
* Source/WebCore/platform/graphics/egl/GraphicsContextGLEGL.cpp:
(WebCore::createWebProcessGraphicsContextGL):
(WebCore::GraphicsContextGLEGL::~GraphicsContextGLEGL):
(WebCore::GraphicsContextGLEGL::platformInitialize):
(WebCore::GraphicsContextGLEGL::attachDrawingBufferTexture):
(WebCore::GraphicsContextGLEGL::reshapeDrawingBuffer):
(WebCore::GraphicsContextGLEGL::prepareForDisplay):
(WebCore::GraphicsContextGLEGL::swapCompositorTexture): Deleted.
* Source/WebCore/platform/graphics/egl/GraphicsContextGLEGL.h:
* Source/WebCore/platform/graphics/gbm/GraphicsContextGLGBM.cpp:
(WebCore::GraphicsContextGLGBM::~GraphicsContextGLGBM):
(WebCore::GraphicsContextGLGBM::DrawingBuffer::DrawingBuffer):
(WebCore::GraphicsContextGLGBM::DrawingBuffer::operator=):
(WebCore::GraphicsContextGLGBM::DrawingBuffer::isInUse const):
(WebCore::GraphicsContextGLGBM::DrawingBuffer::release):
(WebCore::GraphicsContextGLGBM::destroyDrawingBuffer const):
(WebCore::GraphicsContextGLGBM::freeDrawingBuffers):
(WebCore::GraphicsContextGLGBM::freeObsoleteDrawingBuffers):
(WebCore::GraphicsContextGLGBM::bindNextDrawingBuffer):
(WebCore::GraphicsContextGLGBM::prepareForDisplay):
(WebCore::GraphicsContextGLGBM::prepareForDisplayWithFinishedSignal):
(WebCore::GraphicsContextGLGBM::readCompositedResults):
(WebCore::GraphicsContextGLGBM::drawingBuffers const):
(WebCore::GraphicsContextGLGBM::drawingBufferIDs const):
* Source/WebCore/platform/graphics/gbm/GraphicsContextGLGBM.h:
* Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGLGBM.cpp:
(WebKit::RemoteGraphicsContextGLGBM::prepareForDisplay):
* Tools/TestWebKitAPI/PlatformGTK.cmake:
* Tools/TestWebKitAPI/PlatformWPE.cmake:
* Tools/TestWebKitAPI/Tests/WebCore/glib/GraphicsContextGLCoordinated.cpp:
Renamed from Tools/TestWebKitAPI/Tests/WebCore/glib/GraphicsContextGLEGL.cpp.
(TestWebKitAPI::WebCore::createTestedGraphicsContextGL):
(TestWebKitAPI::WebCore::AnyContextAttributeTest::antialias const):
(TestWebKitAPI::WebCore::AnyContextAttributeTest::preserveDrawingBuffer const):
(TestWebKitAPI::WebCore::AnyContextAttributeTest::isWebGL2 const):
(TestWebKitAPI::WebCore::AnyContextAttributeTest::attributes):
(TestWebKitAPI::WebCore::AnyContextAttributeTest::createTestContext):
(TestWebKitAPI::checkReadPixel):
(TestWebKitAPI::TEST_F(GraphicsContextGLCoordinatedTest,
ClearBufferIncorrectSizes)):
(TestWebKitAPI::TEST_F(GraphicsContextGLCoordinatedTest,
DestroyWithoutMakingCurrent)):
(TestWebKitAPI::TEST_F(GraphicsContextGLCoordinatedTest, TwoLinks)):
(TestWebKitAPI::TEST_F(GraphicsContextGLCoordinatedTest,
CopyNativeImageNoDrawingBufferReturnsNullptr)):
(TestWebKitAPI::TEST_F(GraphicsContextGLCoordinatedTest,
CopyNativeImageIsNotYFlipped)):
(TestWebKitAPI::TEST_F(GraphicsContextGLCoordinatedTest,
CopyImageAndMutateDrawingBuffer)):
(TestWebKitAPI::TEST_P):
(TestWebKitAPI::TEST_F(GraphicsContextGLCoordinatedReadPixelsTest,
readPixelsSuccess)):
(TestWebKitAPI::TEST_F(GraphicsContextGLCoordinatedReadPixelsTest,
readPixelsTooLargeRect)):
(TestWebKitAPI::TEST_F(GraphicsContextGLCoordinatedReadPixelsTest,
readPixelsWithStatusSuccess)):
(TestWebKitAPI::TEST_F(GraphicsContextGLCoordinatedReadPixelsTest,
readPixelsWithStatusTooLargeRect)):
(TestWebKitAPI::TEST_F(GraphicsContextGLCoordinatedReshapeTest,
reshapeSuccess)):
(TestWebKitAPI::TEST_F(GraphicsContextGLCoordinatedReshapeTest,
reshapeWidthTooLarge)):
(TestWebKitAPI::TEST_F(GraphicsContextGLCoordinatedReshapeTest,
reshapeHeightTooLarge)):
* Source/WebCore/platform/graphics/android/GraphicsContextGLAndroid.h:
* Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.h:
* Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.messages.in:
* Source/WebKit/WebProcess/GPU/graphics/gbm/RemoteGraphicsContextGLProxyGBM.cpp:
(WebKit::RemoteGraphicsContextGLProxyGBM::prepareForDisplay):
Canonical link: https://commits.webkit.org/322822@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications