Commit Graph

91 Commits

Author SHA1 Message Date
Said Abou-Hallawa d4fb33122a [GPUP] Enable 2D Canvas in layout tests by default
https://bugs.webkit.org/show_bug.cgi?id=222835

Reviewed by Simon Fraser.

Source/WTF:

Move UseGPUProcessForCanvasRenderingEnabled from WebPreferencesInternal
to WebPreferencesExperimental so that the WebKitTestRunner will turn it
on by default.

* Scripts/Preferences/WebPreferencesExperimental.yaml:
* Scripts/Preferences/WebPreferencesInternal.yaml:

LayoutTests:

Some of the canvas layout tests are still failing when GPUP is enabled
for 2D Canvas. Skip these tests for now.

* TestExpectations:
* gpu-process/TestExpectations:

* http/tests/canvas/color-fonts/fill-gradient-sbix-2.html:
* http/tests/canvas/color-fonts/fill-gradient-sbix-3.html:
* http/tests/canvas/color-fonts/fill-gradient-sbix-4.html:
* http/tests/canvas/color-fonts/stroke-gradient-sbix-2.html:
* http/tests/canvas/color-fonts/stroke-gradient-sbix-3.html:
* http/tests/canvas/color-fonts/stroke-gradient-sbix-4.html:
webkit.org/b/222881

* inspector/canvas/memory.html:
webkit.org/b/222880


Canonical link: https://commits.webkit.org/235215@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274327 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-12 06:57:44 +00:00
Commit Queue c40b9fa0d8 Unreviewed, reverting r274171.
https://bugs.webkit.org/show_bug.cgi?id=223004

Broke canvas layout tests on Apple Silicon

Reverted changeset:

"[GPUP] Enable 2D Canvas in layout tests by default"
https://bugs.webkit.org/show_bug.cgi?id=222835
https://trac.webkit.org/changeset/274171

Canonical link: https://commits.webkit.org/235103@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274184 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-09 23:51:50 +00:00
Said Abou-Hallawa 4ddcb09a50 [GPUP] Enable 2D Canvas in layout tests by default
https://bugs.webkit.org/show_bug.cgi?id=222835

Reviewed by Simon Fraser.

Source/WTF:

Move UseGPUProcessForCanvasRenderingEnabled from WebPreferencesInternal
to WebPreferencesExperimental so that the WebKitTestRunner will turn it
on by default.

* Scripts/Preferences/WebPreferencesExperimental.yaml:
* Scripts/Preferences/WebPreferencesInternal.yaml:

LayoutTests:

Some of the canvas layout tests are still failing when GPUP is enabled
for 2D Canvas. Skip these tests for now.

* TestExpectations:
* gpu-process/TestExpectations:

* http/tests/canvas/color-fonts/fill-gradient-sbix-2.html:
* http/tests/canvas/color-fonts/fill-gradient-sbix-3.html:
* http/tests/canvas/color-fonts/fill-gradient-sbix-4.html:
* http/tests/canvas/color-fonts/stroke-gradient-sbix-2.html:
* http/tests/canvas/color-fonts/stroke-gradient-sbix-3.html:
* http/tests/canvas/color-fonts/stroke-gradient-sbix-4.html:
webkit.org/b/222881

* inspector/canvas/memory.html:
webkit.org/b/222880


Canonical link: https://commits.webkit.org/235092@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274171 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-09 21:19:30 +00:00
Kimmo Kinnunen bfc465666d WebGL asserts after GPU process times out
https://bugs.webkit.org/show_bug.cgi?id=222546

Patch by Kimmo Kinnunen <kkinnunen@apple.com> on 2021-03-08
Reviewed by Wenson Hsieh.

Source/WebCore:

Add a trigger internals.simulateEventForWebGLContext("timeout", context)
to trigger timeout for calls to a WebGL context.

Tests: fast/canvas/webgl/lose-context-on-timeout-async.html
       fast/canvas/webgl/lose-context-on-timeout.html

* testing/Internals.cpp:
(WebCore::Internals::simulateEventForWebGLContext):

Source/WebKit:

IPC::StreamClientConnection::tryAcquire would assert on
    ASSERT(untrustedLimit < (dataSize() - 1));
The untrustedLimit value would be then:
    StreamConnectionBuffer::serverOffsetClientIsWaitingTag.
This would be equivalent of assertion added in this commit:
    ASSERT(clientLimit != ClientLimit::clientIsWaitingTag);

This would happen in case of timeout, because upon entering
the wait sequence:
 1) The client itself would first write the tag value to the
    offset variable.
 2) Wait and timeout the wait.
 3) run the next iteration of the acquire loop.

The next iteration would load the tag value written before,
e.g. serverOffsetClientIsWaitingTag.
This would be then used in clampedLimit() call.

Fix this by taking it into account that the variable might be
ClientLimit::clientIsWaitingTag within the acquire loop.

Possibly fix future similar problems by not treating the value as
size_t, rather treat it as enum class ClientOffset : size_t. This
enables the compiler to enforce that when checking for the various tag
values, the holder must hold the enum class. When intending to interpret
the value as size_t, holder must explicitly convert.

Do the above change for the ServerOffset.

Tests: fast/canvas/webgl/lose-context-on-timeout-async.html
       fast/canvas/webgl/lose-context-on-timeout.html

* GPUProcess/GPUConnectionToWebProcess.cpp:
(WebKit::GPUConnectionToWebProcess::releaseGraphicsContextGL):
Do not assert that the release message actually releases the context.
For testing, the induce the timeout by releasing the context prematurely
and treating the subsequent messages as if they were non-legit messages.
That should be just skipped.

(WebKit::GPUConnectionToWebProcess::releaseGraphicsContextGLForTesting):
Add a public function to invoke from "ForTesting" codepaths.

(WebKit::GPUConnectionToWebProcess::dispatchMessage):
(WebKit::GPUConnectionToWebProcess::dispatchSyncMessage):
Skip RemoteGraphicsContextGL messages that do not get routed to any
instance. These messages can be "non-legit", ones that are sent before
the "context was lost" message reached the sender, or ones that are
sent during simulated timeout.
These do not contain asserts as it is expected that these will occur in
above situations.

* GPUProcess/GPUConnectionToWebProcess.h:
* GPUProcess/graphics/RemoteGraphicsContextGL.cpp:
(WebKit::RemoteGraphicsContextGL::simulateEventForTesting):
* GPUProcess/graphics/RemoteGraphicsContextGL.h:
* GPUProcess/graphics/RemoteGraphicsContextGL.messages.in:
* GPUProcess/graphics/RemoteGraphicsContextGLFunctionsGenerated.h:
Add the simulateEventForTesting function to simulate the
timeout. Simulate via just removing the context, which causes
left-over messages to skipped.
Currently we do not simulate the timeout with an infinite loop
in GPU process threads as that is not supported.
Currently we do not simulate the timeout with a gpu process
crash since it is not supported to be tested (will cause a
reload).

* Platform/IPC/StreamClientConnection.cpp:
(IPC::StreamClientConnection::StreamClientConnection):
* Platform/IPC/StreamClientConnection.h:
(IPC::StreamClientConnection::sendSync):
(IPC::StreamClientConnection::release):
Change size_t usage to -> ClientOffset, ServerOffset

(IPC::StreamClientConnection::tryAcquire):
Fix the assertion of equivalent of ASSERT(clientLimit != ClientLimit::clientIsWaitingTag);
by reorganizing the acquire loop.

(IPC::StreamClientConnection::toLimit const):
Fix the off-by-one in assertion error
( < dataSize() - 1  vs <= dataSize() - 1)

Rename from clampedLimit() to toLimit(), as the
clamping is confusing as the client trusts the
server.

* Platform/IPC/StreamConnectionBuffer.cpp:
(IPC::StreamConnectionBuffer::StreamConnectionBuffer):
(IPC::StreamConnectionBuffer::operator=):
(IPC::StreamConnectionBuffer::encode const):
* Platform/IPC/StreamConnectionBuffer.h:
(IPC::StreamConnectionBuffer::clientOffset):
(IPC::StreamConnectionBuffer::serverOffset):
(IPC::StreamConnectionBuffer::clientWaitSemaphore):
(IPC::StreamConnectionBuffer::maximumSize):
* Platform/IPC/StreamServerConnection.cpp:
(IPC::StreamServerConnectionBase::tryAquire):
(IPC::StreamServerConnectionBase::release):
Change size_t usage to -> ClientOffset, ServerOffset

(IPC::StreamServerConnectionBase::clampedLimit const):
Fix the off-by-one in assertion error
( < dataSize() - 1  vs <= dataSize() - 1)

* Platform/IPC/StreamServerConnection.h:
(IPC::StreamServerConnectionBase::sharedServerLimit):
(IPC::StreamServerConnectionBase::sharedServerOffset):
* WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp:
(WebKit::RemoteGraphicsContextGLProxy::synthesizeGLError):
(WebKit::RemoteGraphicsContextGLProxy::getError):
For the cases where the timeout would happen in these two functions,
call the markContextLost() instead of wasLost(). This is to clarify
all the context lost handling to use the same pattern.

(WebKit::RemoteGraphicsContextGLProxy::simulateEventForTesting):
* WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h:
* WebProcess/GPU/graphics/RemoteGraphicsContextGLProxyFunctionsGenerated.cpp:

LayoutTests:

Add tests to test the case where a WebGL call times out.
Add two variants: one which most probably times out on
synchronous call, and one which most probably times out on
asynchronous call.

* fast/canvas/webgl/lose-context-on-status-failure.html:
The testing APIs were changed, so replace use of
Internals.setFailNextGPUStatusCheck()
with Internals.simulateEventForWebGLContext()
* fast/canvas/webgl/lose-context-on-timeout-async-expected.txt: Added.
* fast/canvas/webgl/lose-context-on-timeout-async.html: Added.
* fast/canvas/webgl/lose-context-on-timeout-expected.txt: Added.
* fast/canvas/webgl/lose-context-on-timeout.html: Added.
* fast/canvas/webgl/webglcontextchangedevent.html:

Canonical link: https://commits.webkit.org/235002@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274066 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-08 10:43:09 +00:00
Kimmo Kinnunen b0ed29b3de WebGL context screen change events should work with GPU process
https://bugs.webkit.org/show_bug.cgi?id=219669
<rdar://problem/72373371>

Patch by Kimmo Kinnunen <kkinnunen@apple.com> on 2021-03-08
Reviewed by Per Arne Vollan.

Source/WebKit:

Pass display configuration change notification from UI
process to GPU process.

Fixes
 fast/canvas/webgl/webglcontextchangedevent.html
 fast/canvas/webgl/context-update-on-display-configuration.html

* GPUProcess/GPUConnectionToWebProcess.cpp:
(WebKit::GPUConnectionToWebProcess::displayConfigurationChanged):
* GPUProcess/GPUConnectionToWebProcess.h:
* GPUProcess/GPUProcess.cpp:
(WebKit::GPUProcess::displayConfigurationChanged):
* GPUProcess/GPUProcess.h:
* GPUProcess/GPUProcess.messages.in:
* GPUProcess/graphics/RemoteGraphicsContextGL.cpp:
(WebKit::RemoteGraphicsContextGL::displayWasReconfigured):
* GPUProcess/graphics/RemoteGraphicsContextGL.h:
* Platform/IPC/ScopedActiveMessageReceiveQueue.h:
(IPC::ScopedActiveMessageReceiveQueue::operator-> const):
* UIProcess/GPU/GPUProcessProxy.cpp:
(WebKit::GPUProcessProxy::displayConfigurationChanged):
* UIProcess/GPU/GPUProcessProxy.h:
* UIProcess/WebProcessPool.cpp:
(WebKit::displayReconfigurationCallBack):
(WebKit::WebProcessPool::sendDisplayConfigurationChangedMessageForTesting):

LayoutTests:

* fast/canvas/webgl/webglcontextchangedevent.html:
Make manually testable.
* gpu-process/TestExpectations:
Remove two tests that now pass.

Canonical link: https://commits.webkit.org/235001@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274065 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-08 09:37:26 +00:00
Said Abou-Hallawa ae875efd77 [GPU Process] Recording transparency layer should reset the alpha of lastDrawingState
https://bugs.webkit.org/show_bug.cgi?id=222855

Reviewed by Simon Fraser.

Source/WebCore:

After appending BeginTransparencyLayer item, the alpha of lastDrawingState
should be reset. So any subsequent setAlpha() should be accumulated even
if the new alpha equals to the last alpha which was set in lastDrawingState.

* platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::beginTransparencyLayer):
(WebCore::GraphicsContext::endTransparencyLayer):
* platform/graphics/displaylists/DisplayListRecorder.cpp:
(WebCore::DisplayList::Recorder::beginTransparencyLayer):
(WebCore::DisplayList::Recorder::endTransparencyLayer):
* platform/graphics/displaylists/DisplayListRecorder.h:
(WebCore::DisplayList::Recorder::ContextState::cloneForTransparencyLayer const):

LayoutTests:

* gpu-process/TestExpectations:


Canonical link: https://commits.webkit.org/234993@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274057 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-07 20:32:25 +00:00
Said Abou-Hallawa 7e708cb0df [GPU Process] Tests under imported/blink/fast/canvas are now fixed by r273956
https://bugs.webkit.org/show_bug.cgi?id=222341

Reviewed by Said Abou-Hallawa.

* gpu-process/TestExpectations:


Canonical link: https://commits.webkit.org/234968@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274032 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-06 07:52:41 +00:00
Said Abou-Hallawa 4b8671a91e [GPU Process] RemoteImageBuffer recording GraphicsContext should report its backend RenderingMode
https://bugs.webkit.org/show_bug.cgi?id=222772

Reviewed by Simon Fraser.

Source/WebCore:

This will allow compositing the 2D canvas elements when GPU rendering is
enabled for 2D canvas.

* platform/graphics/GraphicsContextImpl.h:
(WebCore::GraphicsContextImpl::renderingMode const):
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContext::setIsCALayerContext):
(WebCore::GraphicsContext::isCALayerContext const):
(WebCore::GraphicsContext::setIsAcceleratedContext):
(WebCore::GraphicsContext::isAcceleratedContext const):
* platform/graphics/displaylists/DisplayListRecorder.cpp:
(WebCore::DisplayList::Recorder::renderingMode const):
* platform/graphics/displaylists/DisplayListRecorder.h:
(WebCore::DisplayList::Recorder::Delegate::renderingMode const):

Source/WebKit:

* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:

LayoutTests:

* gpu-process/TestExpectations:


Canonical link: https://commits.webkit.org/234904@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273956 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-05 10:18:29 +00:00
Jon Lee d9015c608f Garden GPU Process TestExpectations
https://bugs.webkit.org/show_bug.cgi?id=222729

Reviewed by Said Abou-Hallawa.

* gpu-process/TestExpectations: Complete filing bugs for failing tests.
Remove expectations for some tests which are now passing on the bot.


Canonical link: https://commits.webkit.org/234860@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273899 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-04 18:10:22 +00:00
Youenn Fablet 1c8a626e6f [GPUP] imported/w3c/web-platform-tests/webrtc/RTCRtpSender-replaceTrack.https.html times out with GPU Process enabled
https://bugs.webkit.org/show_bug.cgi?id=222505
<rdar://problem/74814573>

Unreviewed.


* gpu-process/TestExpectations:
Test is no longer timing out on GPUProcess bot.


Canonical link: https://commits.webkit.org/234791@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273818 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-03 17:11:34 +00:00
Peng Liu f5a2560237 [GPUP] Clean up LayoutTests/gpu-process/TestExpectations related to media tests
https://bugs.webkit.org/show_bug.cgi?id=222570

Reviewed by Eric Carlson.

Clean up test expectations.
- Remove duplicate test expectations.
- Move some media tests from gpu-process/TestExpectations to platform/wk2/TestExpectations.
- Remove tests which are passing consistently from gpu-process/TestExpectations.

* gpu-process/TestExpectations:
* platform/wk2/TestExpectations:


Canonical link: https://commits.webkit.org/234717@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273696 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-01 23:11:05 +00:00
Said Abou-Hallawa f03b8f2595 [GPU Process] Some DisplayList items may not be replayed back before calling getImageData()
https://bugs.webkit.org/show_bug.cgi?id=222343

Reviewed by Tim Horton.

Source/WebKit:

Make sure all the pending DisplayList items are pushed to the GPUP and
submitted to RemoteImageBuffer before calling the asynchronous method
getImageData().

* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:

LayoutTests:

* gpu-process/TestExpectations:


Canonical link: https://commits.webkit.org/234702@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273672 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-01 19:57:01 +00:00
Youenn Fablet 465f634c7a [GPUP] Fix WebRTC layout test failures with GPU Process enabled
https://bugs.webkit.org/show_bug.cgi?id=222505
<rdar://problem/74814573>

Unreviewed.


* gpu-process/TestExpectations:
Removed no longer valid expectations.


Canonical link: https://commits.webkit.org/234685@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273645 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-01 10:44:46 +00:00
Peng Liu acb9f5a302 [GPUP] Refresh test expectations after adding the support to paint GPUP hosted video to 2D canvas and WebGL surfaces
https://bugs.webkit.org/show_bug.cgi?id=222500

Reviewed by Jer Noble.

r273568 adds the support to paint GPU process hosted video in the WebContent process to
2D canvas and WebGL surfaces. This function is used by layout tests no matter
"GPU Process: Canvas Rendering" and "GPU Process: WebGL" are enabled or not.
A lot of tests depending on it are passing now.

* gpu-process/TestExpectations:
* platform/mac-wk2/TestExpectations:
* platform/wk2/TestExpectations:


Canonical link: https://commits.webkit.org/234662@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273616 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-02-27 05:27:48 +00:00
Peng Liu 6756a64559 [GPUP] Clean up TestExpectations related to media tests
https://bugs.webkit.org/show_bug.cgi?id=222456

Reviewed by Simon Fraser.

* gpu-process/TestExpectations:
Remove a duplicated expectation (imported/w3c/web-platform-tests/fetch/range/general.window.html).
Move webaudio related test expectations to platform/wk2/TestExpectations.

* platform/ios-wk2/TestExpectations:
webkit.org/b/221821 has been fixed in r273504.

* platform/mac-wk2/TestExpectations:
Two media capabilities test failures have been fixed in r273504.
Move a test expectation (platform/mac/media/media-source/videoplaybackquality-decompressionsession.html)
to platform/mac/TestExpectations.
Reorganize expectations for tests in webgl/2.0.0/conformance2/textures/video.

* platform/mac/TestExpectations:
Remove a duplicated test expectation (mediaElementAudioSourceToScriptProcessorTest.html).

* platform/wk2/TestExpectations:
Track all modern-media-controls test failures in one bug.
Track all canvas related media test failures in one bug.


Canonical link: https://commits.webkit.org/234619@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273559 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-02-26 17:14:45 +00:00
Peng Liu 09b7ba460e [GPUP] Remove duplicated items in LayoutTests/gpu-process/TestExpectations related to media
https://bugs.webkit.org/show_bug.cgi?id=222390

Unreviewed test gardening.

We have enabled "Media in GPU Process" by default in WKTR, so platform-specific TestExpectations
such as platform/wk2/TestExpectations will be used as the baseline for media related tests.


* gpu-process/TestExpectations:


Canonical link: https://commits.webkit.org/234552@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273472 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-02-25 06:24:46 +00:00
Said Abou-Hallawa 023236cb7c [GPU Process] In process DisplayList display should have a higher precedence than GPUP display
https://bugs.webkit.org/show_bug.cgi?id=222345

Reviewed by Wenson Hsieh.

Source/WebCore:

Give ShouldUseDisplayList a higher precedence since it is a debug option.

* platform/graphics/ImageBuffer.cpp:
(WebCore::ImageBuffer::create):

LayoutTests:

* gpu-process/TestExpectations:


Canonical link: https://commits.webkit.org/234518@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273407 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-02-24 17:58:32 +00:00
Said Abou-Hallawa 637c223dc7 [GPU Process] Implement ImageBufferShareableBitmapBackend::bytesPerRow()
https://bugs.webkit.org/show_bug.cgi?id=222348

Reviewed by Simon Fraser.

Source/WebKit:

The default implementation ImageBufferBackend::bytesPerRow() is not correct
for ImageBufferShareableBitmapBackend because ShareableBitmap aligns the
rows using IOSurfaceAlignProperty(kIOSurfaceBytesPerRow, ...).

* Shared/ShareableBitmap.h:
(WebKit::ShareableBitmap::bytesPerRow const):
* WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp:
(WebKit::ImageBufferShareableBitmapBackend::bytesPerRow const):
* WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.h:

LayoutTests:

* gpu-process/TestExpectations:


Canonical link: https://commits.webkit.org/234517@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273406 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-02-24 17:51:55 +00:00
Kimmo Kinnunen ed5569497c HTMLCanvasElement::copiedImage() contains old image with GPU Process on
https://bugs.webkit.org/show_bug.cgi?id=222101

Patch by Kimmo Kinnunen <kkinnunen@apple.com> on 2021-02-23
Reviewed by Simon Fraser.

Source/WebKit:

Implement RemoteImageBufferProxy::copyImage and
RemoteImageBufferProxy::copyNativeImage.
Implement by asking the data from the GPU process.

Previously, with AcceleratedImageBufferShareableMappedBackend
the HTMLCanvasElement::copiedImage() would construct the copy
by copying the CGContext backed by the IOSurface that is accessible
by both processes. This would succeed. After a draw to the image,
the second copy would not reflect the draw but contain the same
image as the first copy.

Fix by not using the fact that the IOSurface is accessible by both
processes. In the end, IOSurfaces will not be available in
Web process.

Converts NativeImage to ShareableBitmap with WebCore::CompositeOperator::Copy
since the ImageBuffers might have unpremultiplied contents. Also, ShareableBitmap
does not have contents, so blending is overhead.

No new tests, enables ~150 tests.

* GPUProcess/graphics/RemoteGraphicsContextGL.cpp:
(WebKit::RemoteGraphicsContextGL::copyTextureFromMedia):
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::getShareableBitmapForImageBuffer):
* GPUProcess/graphics/RemoteRenderingBackend.h:
* GPUProcess/graphics/RemoteRenderingBackend.messages.in:
* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
(WebKit::RemoteRenderingBackendProxy::getShareableBitmap):
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h:

LayoutTests:

* gpu-process/TestExpectations:

Canonical link: https://commits.webkit.org/234461@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273301 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-02-23 08:58:30 +00:00
Said Abou-Hallawa f8cc8f3baf [GPU Process] Implement the ClipToDrawingCommands item by using begin and end markers
https://bugs.webkit.org/show_bug.cgi?id=222230

Reviewed by Simon Fraser.

Source/WebCore:

Instead of encoding and decoding the clipping commands as a separate
DisplayList, the recorder will insert a "begin" and "end" markers before
and after the clipping commands.

When replaying the "begin" mark, the replayer will create a mask ImageBuffer
and force using its context for the following items.

When replaying the "end" mark, it will clip the original context to the
mask ImageBuffer.

* platform/graphics/displaylists/DisplayList.cpp:
(WebCore::DisplayList::DisplayList::append):
* platform/graphics/displaylists/DisplayListItemBuffer.cpp:
(WebCore::DisplayList::ItemHandle::apply):
(WebCore::DisplayList::ItemHandle::destroy):
(WebCore::DisplayList::ItemHandle::safeCopy const):
* platform/graphics/displaylists/DisplayListItemType.cpp:
(WebCore::DisplayList::sizeOfItemInBytes):
(WebCore::DisplayList::isDrawingItem):
(WebCore::DisplayList::isInlineItem):
* platform/graphics/displaylists/DisplayListItemType.h:
* platform/graphics/displaylists/DisplayListItems.cpp:
(WebCore::DisplayList::operator<<):
(WebCore::DisplayList::ClipToDrawingCommands::apply const): Deleted.
* platform/graphics/displaylists/DisplayListItems.h:
(WebCore::DisplayList::BeginClipToDrawingCommands::BeginClipToDrawingCommands):
(WebCore::DisplayList::BeginClipToDrawingCommands::colorSpace const):
(WebCore::DisplayList::EndClipToDrawingCommands::EndClipToDrawingCommands):
(WebCore::DisplayList::EndClipToDrawingCommands::destination const):
(WebCore::DisplayList::ClipToDrawingCommands::ClipToDrawingCommands): Deleted.
(WebCore::DisplayList::ClipToDrawingCommands::operator=): Deleted.
(WebCore::DisplayList::ClipToDrawingCommands::destination const): Deleted.
(WebCore::DisplayList::ClipToDrawingCommands::colorSpace const): Deleted.
(WebCore::DisplayList::ClipToDrawingCommands::drawingCommands const): Deleted.
(WebCore::DisplayList::ClipToDrawingCommands::encode const): Deleted.
(WebCore::DisplayList::ClipToDrawingCommands::decode): Deleted.
* platform/graphics/displaylists/DisplayListRecorder.cpp:
(WebCore::DisplayList::Recorder::clipToDrawingCommands):
* platform/graphics/displaylists/DisplayListReplayer.cpp:
(WebCore::DisplayList::Replayer::context const):
(WebCore::DisplayList::Replayer::applyItem):
* platform/graphics/displaylists/DisplayListReplayer.h:

Source/WebKit:

Replace the DisplayList item ClipToDrawingCommands by the pair items
BeginClipToDrawingCommands and EndClipToDrawingCommands.

* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::decodeItem):
* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:

LayoutTests:

The text with gradient tests will be fixed by this change.

* gpu-process/TestExpectations:


Canonical link: https://commits.webkit.org/234453@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273291 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-02-23 02:00:56 +00:00
Kimmo Kinnunen 3696f97d5a WebGL GPU process IPC should use shared memory for asynchronous messages
https://bugs.webkit.org/show_bug.cgi?id=219641
<rdar://problem/72340651>

Patch by Kimmo Kinnunen <kkinnunen@apple.com> on 2021-02-20
Reviewed by Geoff Garen.

Source/WebKit:

Implement a concept of a message buffer. This is a similar concept as
"command buffer" or "display list" in some graphics APIs. Messages
can be added to the buffer by a client and then played back by a
server.

Current implementation adds a specific pseudo-infinite,
semi-duplex message buffer type IPC::StreamConnectionBuffer. This
is a buffer that can be attached to stream connection, an object
that can deliver IPC messages either through the message buffer
or through normal IPC::Connection. The stream connection is
implemented as IPC::StreamClientConnection and IPC::StreamServerConnection.
The connection has server and client distinction, similar to
IPC::Connection. Unlike IPC::Connection, a stream connection is asymmetric
in features: the client can send messages and receive replies, where
as the server can receive messages and send replies.

Messages received through IPC::StreamServerConnection can be
processed by StreamConnectionWorkQueue.

Currently asynchronous messages are added to the stream. Synchronous messages
and their replies are dispatched through normal IPC.

WebGL is implemented by having one StreamConnectionWorkQueue for all WebGL
in the browser. Currently each web process WebGL context in has one
StreamClientConnection attached to one 2mb StreamConnectionBuffer.

Later on, there will be only one WebGL stream connection and connection
buffer shared between all contexts in particular thread in Web process.
The implementation is "optimized" for the later on case. Due to single-
process nature of each page, it does not make much sense to have buffer
per context. However, it is anticipated that many of the successive calls
are to same context. The SHM message format implements an optimization
where the destination id is maintained as part of the stream connection
state.

In GPU process side, all WebGL is processed in one task queue,
"RemoteGraphicsContextGL task queue". It will process up to 1000 commands
per connection per iteration.

Implemented as follows:
Sender shares the shared memory area with the destination when creating
the destination.

If the message fits to the stream shared memory area, write it there.
Otherwise send it via normal IPC as out of line message.

Messages to the destination arrive as before, in order. For each out of line
message, an entry is pushed to the stream. Receiver will stop processing the
stream and processing will continue once the out-of-line
message has been processed.

Sender can write messages to the stream simultaneous to the receiver reading
the messages. This is implemented as a ring buffer with atomic sender and receiver
pointers.

Stream connection processing is implemented as a shared semaphore. This semaphore
is notified if the receiver is waiting on it.

Performance impact (iMac Pro):
    - MotionMark triangles: 300 points -> 4000 points
      (~7000 points no-GPUP)
    - WebGL samples Aquarium: 1000 fish ~60fps -> 5000 fish ~60fps
      (~5000 fish with no-GPUP)

No new tests, tested by existing tests.

* GPUProcess/GPUConnectionToWebProcess.cpp:
(WebKit::GPUConnectionToWebProcess::createGraphicsContextGL):
* GPUProcess/GPUConnectionToWebProcess.h:
* GPUProcess/GPUConnectionToWebProcess.messages.in:
* GPUProcess/graphics/RemoteGraphicsContextGL.cpp:
(WebKit::remoteGraphicsContextGLStreamWorkQueue):
(WebKit::RemoteGraphicsContextGL::create):
(WebKit::RemoteGraphicsContextGL::RemoteGraphicsContextGL):
(WebKit::RemoteGraphicsContextGL::~RemoteGraphicsContextGL):
(WebKit::RemoteGraphicsContextGL::initialize):
(WebKit::RemoteGraphicsContextGL::connectWebProcessConnection):
(WebKit::RemoteGraphicsContextGL::disconnectWebProcessConnection):
(WebKit::RemoteGraphicsContextGL::workQueueInitialize):
(WebKit::RemoteGraphicsContextGL::workQueueUninitialize):
Initialize the OpenGL context in the work queue, since OpenGL
has various limitations wrt thread mobility.

(WebKit::RemoteGraphicsContextGL::forceContextLost):
(WebKit::RemoteGraphicsContextGL::dispatchContextChangedNotification):
* GPUProcess/graphics/RemoteGraphicsContextGL.h:
(WebKit::RemoteGraphicsContextGL::platformWorkQueueInitialize):
(WebKit::RemoteGraphicsContextGL::send const):
* GPUProcess/graphics/RemoteGraphicsContextGL.messages.in:
* GPUProcess/graphics/RemoteGraphicsContextGLCocoa.cpp:
(WebKit::RemoteGraphicsContextGL::create):
(WebKit::RemoteGraphicsContextGLCocoa::RemoteGraphicsContextGLCocoa):
(WebKit::RemoteGraphicsContextGLCocoa::platformWorkQueueInitialize):
* NetworkProcess/webrtc/NetworkRTCProvider.h:
* Platform/IPC/ArgumentCoder.h:
* Platform/IPC/ArgumentCoders.cpp:
* Platform/IPC/ArgumentCoders.h:
Make it possible to use multiple different Encoder classes to encode
the IPC data.

* Platform/IPC/Connection.cpp:
(IPC::Connection::processIncomingMessage):
(IPC::Connection::dispatchDidReceiveInvalidMessage):
* Platform/IPC/Connection.h:
Add possibility for the stream decoding logic to send the didReceiveInvalidMessage
notification to the connection client.

* Platform/IPC/Decoder.cpp:
(IPC::Decoder::Decoder):
(IPC::m_bufferDeallocator):
(IPC::m_destinationID):
* Platform/IPC/Decoder.h:
Add a constructor for Decoder for constructing a decoder in place in
the stream buffer.

* Platform/IPC/HandleMessage.h:
(IPC::handleMessageSynchronous):
Adds a stream-specific handleMessageSynchronous.
The old ones are unneccessarily complex, as they need redundant calls through redundant
generated send functions.
The old ones need the reply encoder passed in, which is redundant and problematic
for the upcoming case where the stream messaging will mainly reply through the stream itself,
constructing the IPC::StreamConnectionEncoder instead of normal IPC::Encoder.

* Platform/IPC/StreamClientConnection.cpp: Copied from Source/WebKit/Platform/IPC/cocoa/MachPort.h.
(IPC::StreamClientConnection::StreamClientConnection):
(IPC::StreamClientConnection::setWakeUpSemaphore):
Add function to set the connection receive side wakeup semaphore.
Currently the semaphore is the semaphore that StreamConnectionWorkQueue
waits on. All streams processed by the same work queue will receive the same
semaphore and will notify it when they have written new data.

(IPC::StreamClientConnection::wakeUpReceiver):
* Platform/IPC/StreamClientConnection.h: Added.
(IPC::StreamClientConnection::send):
(IPC::StreamClientConnection::sendSync):
(IPC::StreamClientConnection::trySendDestinationIDIfNeeded):
(IPC::StreamClientConnection::sendProcessOutOfStreamMessage):
(IPC::StreamClientConnection::tryAcquire):
(IPC::StreamClientConnection::release):
(IPC::StreamClientConnection::alignedSpan):
(IPC::StreamClientConnection::size):
(IPC::StreamClientConnection::clampedLimit const):
Add the implementation for sending data through the shared memory.

* Platform/IPC/StreamConnectionBuffer.cpp: Added.
(IPC::createMemory):
(IPC::StreamConnectionBuffer::StreamConnectionBuffer):
(IPC::StreamConnectionBuffer::operator=):
(IPC::StreamConnectionBuffer::encode const):
(IPC::StreamConnectionBuffer::decode):
* Platform/IPC/StreamConnectionBuffer.h: Added.
(IPC::StreamConnectionBuffer::wrapOffset const):
(IPC::StreamConnectionBuffer::alignOffset const):
(IPC::StreamConnectionBuffer::senderOffset):
(IPC::StreamConnectionBuffer::receiverOffset):
(IPC::StreamConnectionBuffer::data const):
(IPC::StreamConnectionBuffer::dataSize const):
(IPC::StreamConnectionBuffer::senderWaitSemaphore):
(IPC::StreamConnectionBuffer::header const):
(IPC::StreamConnectionBuffer::headerSize):
Add the common implementation for the shared memory ring buffer.
This is the common implementation used by both the sender side
as well as the receiver side.
Due to the selection of how the size is marked up, the
common implementation does not contain all the non-trivial code.
The "algorithm" uses a "hole indicator" to differentiate between
cases of "buffer is empty" and "buffer is full". The other
alternative could be better and maybe explored later.

* Platform/IPC/StreamConnectionEncoder.h: Added.
* Platform/IPC/StreamConnectionWorkQueue.cpp: Added.
(IPC::StreamConnectionWorkQueue::StreamConnectionWorkQueue):
(IPC::StreamConnectionWorkQueue::dispatch):
(IPC::StreamConnectionWorkQueue::addStreamConnection):
(IPC::StreamConnectionWorkQueue::removeStreamConnection):
(IPC::StreamConnectionWorkQueue::stop):
(IPC::StreamConnectionWorkQueue::wakeUp):
(IPC::StreamConnectionWorkQueue::wakeUpSemaphore):
(IPC::StreamConnectionWorkQueue::wakeUpProcessingThread):
(IPC::StreamConnectionWorkQueue::processStreams):
Work queue contains multiple StreamServerConnection instances.
For each iteration of the work queue thread, it will process
1000 items from each connection. If none of the connections contain
work, the queue will sleep on the work queue semaphore.
The senders will send through StreamClientConnection which
will wake up the work queue by signaling the semaphore.

* Platform/IPC/StreamConnectionWorkQueue.h: Copied from Source/WebKit/Platform/IPC/cocoa/MachPort.h.
* Platform/IPC/StreamServerConnection.cpp: Added.
(IPC::StreamServerConnectionBase::StreamServerConnectionBase):
(IPC::StreamServerConnectionBase::startReceivingMessagesImpl):
(IPC::StreamServerConnectionBase::stopReceivingMessagesImpl):
(IPC::StreamServerConnectionBase::enqueueMessage):
(IPC::StreamServerConnectionBase::tryAquire):
(IPC::StreamServerConnectionBase::release):
(IPC::StreamServerConnectionBase::alignedSpan):
(IPC::StreamServerConnectionBase::size):
(IPC::StreamServerConnectionBase::clampedLimit const):
* Platform/IPC/StreamServerConnection.h: Added.
(IPC::StreamServerConnectionBase::connection):
(IPC::StreamServerConnectionBase::wrapOffset const):
(IPC::StreamServerConnectionBase::alignOffset const):
(IPC::StreamServerConnectionBase::sharedSenderOffset):
(IPC::StreamServerConnectionBase::sharedReceiverOffset):
(IPC::StreamServerConnectionBase::data const):
(IPC::StreamServerConnectionBase::dataSize const):
(IPC::StreamServerConnectionBase::sendSyncReply):
(IPC::StreamServerConnection<Receiver>::startReceivingMessages):
(IPC::StreamServerConnection<Receiver>::stopReceivingMessages):
(IPC::StreamServerConnection<Receiver>::dispatchStreamMessages):
(IPC::StreamServerConnection<Receiver>::processSetStreamDestinationID):
(IPC::StreamServerConnection<Receiver>::dispatchStreamMessage):
(IPC::StreamServerConnection<Receiver>::dispatchOutOfStreamMessage):
StreamServerConnection will process the message buffer and dispatch
messages based on the buffer contents. The class is a template so
that the message data decode switch (generated by the normal IPC
generator) is perhaps inlined to the message unpack loop.
* Platform/IPC/cocoa/MachPort.h:

* Scripts/webkit/messages.py:
* Scripts/webkit/messages_unittest.py:
Implements a 'Stream' attribute for the message receiver. When marked as
'Stream', the receiver message handler is didReceiveStreamMessage and it
will be called for all messages, stream or normal IPC, sync or async.

* Scripts/webkit/model.py:
Adds IPC control message ProcessOutOfStreamMessage that is acted on if
it is part of the stream messages. It means that the stream processing
should stop until one normal IPC message, sync or non-synch, should be
processed.

Adds IPC control message SetStreamDestinationID that is acted on if it
is part of the stream messages. It will set the destination ID for all
the subsequent stream messages, until another SetStreamDestinationID
message is seen.

* Scripts/webkit/tests/Makefile:
* Scripts/webkit/tests/MessageNames.cpp:
(IPC::description):
(IPC::receiverName):
(IPC::isValidMessageName):
* Scripts/webkit/tests/MessageNames.h:
* Scripts/webkit/tests/TestWithStream.messages.in: Copied from Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.messages.in.
* Scripts/webkit/tests/TestWithStreamBuffer.messages.in: Copied from Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.messages.in.
* Scripts/webkit/tests/TestWithStreamBufferMessageReceiver.cpp: Added.
(WebKit::TestWithStreamBuffer::didReceiveMessage):
* Scripts/webkit/tests/TestWithStreamBufferMessages.h: Added.
(Messages::TestWithStreamBuffer::messageReceiverName):
(Messages::TestWithStreamBuffer::SendStreamBuffer::name):
(Messages::TestWithStreamBuffer::SendStreamBuffer::SendStreamBuffer):
(Messages::TestWithStreamBuffer::SendStreamBuffer::arguments const):
* Scripts/webkit/tests/TestWithStreamBufferMessagesReplies.h: Added.
* Scripts/webkit/tests/TestWithStreamMessageReceiver.cpp: Added.
(WebKit::TestWithStream::didReceiveStreamMessage):
* Scripts/webkit/tests/TestWithStreamMessages.h: Added.
(Messages::TestWithStream::messageReceiverName):
(Messages::TestWithStream::SendString::name):
(Messages::TestWithStream::SendString::SendString):
(Messages::TestWithStream::SendString::arguments const):
(Messages::TestWithStream::SendStringSynchronized::name):
(Messages::TestWithStream::SendStringSynchronized::SendStringSynchronized):
(Messages::TestWithStream::SendStringSynchronized::arguments const):
* Scripts/webkit/tests/TestWithStreamMessagesReplies.h: Added.
* Sources.txt:
* UIProcess/Downloads/DownloadProxy.h:
* UIProcess/ProvisionalPageProxy.cpp:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp:
(WebKit::RemoteGraphicsContextGLProxy::RemoteGraphicsContextGLProxy):
(WebKit::RemoteGraphicsContextGLProxy::wasCreated):
Send the work queue wakeup semaphore as a result of the context creation.

* Platform/IPC/ScopedActiveMessageReceiveQueue.h: Added.
(IPC::ScopedActiveMessageReceiveQueue::ScopedActiveMessageReceiveQueue):
(IPC::ScopedActiveMessageReceiveQueue::operator=):
(IPC::ScopedActiveMessageReceiveQueue::~ScopedActiveMessageReceiveQueue):
(IPC::ScopedActiveMessageReceiveQueue::reset):
(IPC::ScopedActiveMessageReceiveQueue::get const):
(IPC::ScopedActiveMessageReceiveQueue::stopListeningForIPCAndRelease):
Add a holder to replace previous RemoteRenderingBackendWrapper.
Now other classes can be held similarly.

* WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h:
* WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.messages.in:
* WebProcess/Network/webrtc/LibWebRTCNetwork.h:

Tools:

Mark RemoteGraphicsContextGL message receiver as "Stream",
a new variant of receiver.

* Scripts/generate-gpup-webgl:

LayoutTests:

Mark few tests as not timing out now that the implementation is not so slow.

* gpu-process/TestExpectations:

Canonical link: https://commits.webkit.org/234390@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273204 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-02-20 20:33:25 +00:00
Rini Patel 46ba5548c4 [GPU Process] Repopulate the TestExpectations file #4
https://bugs.webkit.org/show_bug.cgi?id=222147

Unreviewed test gardening.

Patch by Rini Patel <rini_patel@apple.com> on 2021-02-19

* gpu-process/TestExpectations:

Canonical link: https://commits.webkit.org/234344@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273149 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-02-19 19:06:29 +00:00
Kimmo Kinnunen 83c2e98b6c WebGL contexts do not work as source for Context2D drawImage calls in GPU process
https://bugs.webkit.org/show_bug.cgi?id=221811

Patch by Kimmo Kinnunen <kkinnunen@apple.com> on 2021-02-18
Reviewed by Darin Adler.

Source/WebCore:

Implements rudimentary support for reading the WebGL context and transfering
it to a ImageBuffer.

Fixes many tests that are removed from gpu-process/TestExpectations.

* html/OffscreenCanvas.cpp:
(WebCore::OffscreenCanvas::transferToImageBitmap):
* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::paintRenderingResultsToCanvas):
* platform/graphics/GraphicsContextGL.h:
Make paintRenderingResultsToCanvas and paintCompositedResultsToCanvas
take ImageBuffer& instead of ImageBuffer*, since the buffer always
exists.

 * platform/graphics/cairo/GraphicsContextGLCairo.cpp:
(WebCore::GraphicsContextGLOpenGL::paintToCanvas):
* platform/graphics/cg/GraphicsContextGLCG.cpp:
(WebCore::GraphicsContextGLOpenGL::paintToCanvas):
Change the function signature so that it can be called from
other thread and without GraphicsContextGL instance.
It is not really a GraphicsContextGLOpenGL related function..

* platform/graphics/cocoa/GraphicsContextGLIOSurfaceSwapChain.cpp:
(WebCore::GraphicsContextGLIOSurfaceSwapChain::displayBuffer const):
(WebCore::GraphicsContextGLIOSurfaceSwapChain::recycleBuffer):
(WebCore::GraphicsContextGLIOSurfaceSwapChain::detachClient):
(WebCore::GraphicsContextGLIOSurfaceSwapChain::present):
* platform/graphics/cocoa/GraphicsContextGLIOSurfaceSwapChain.h:
* platform/graphics/cocoa/WebGLLayer.mm:
(WebGLLayerSwapChain::present):
Move the triple buffering implementation to the base class.
The implementation is now also used in GPU process side,
since the GPU process needs to be able to read the composited
results.

Previously the same logic was split between Web process and GPU process.

* platform/graphics/opengl/GraphicsContextGLOpenGL.cpp:
(WebCore::GraphicsContextGLOpenGL::paintRenderingResultsToCanvas):
(WebCore::GraphicsContextGLOpenGL::paintCompositedResultsToCanvas):
(WebCore::GraphicsContextGLOpenGL::paintRenderingResultsToImageData):
(WebCore::GraphicsContextGLOpenGL::readRenderingResultsForPainting):
(WebCore::GraphicsContextGLOpenGL::readCompositedResultsForPainting):
* platform/graphics/opengl/GraphicsContextGLOpenGL.h:

Expose public functions to get ImageData out of drawing buffer and
display buffer.

Source/WebKit:

Implements rudimentary support for reading the WebGL context and transfering
it to a ImageBuffer.

Fixes many tests that are removed from gpu-process/TestExpectations.

* GPUProcess/GPUConnectionToWebProcess.cpp:
(WebKit::GPUConnectionToWebProcess::createGraphicsContextGL):
* GPUProcess/GPUConnectionToWebProcess.h:
(WebKit::GPUConnectionToWebProcess::RemoteRenderingBackendWrapper::get const):
* GPUProcess/GPUConnectionToWebProcess.messages.in:
* GPUProcess/graphics/RemoteGraphicsContextGL.cpp:
(WebKit::RemoteGraphicsContextGL::create):
(WebKit::RemoteGraphicsContextGL::RemoteGraphicsContextGL):
       * WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::createGraphicsContextGL const):
* GPUProcess/graphics/RemoteGraphicsContextGLCocoa.cpp:
(WebKit::RemoteGraphicsContextGL::create):
(WebKit::RemoteGraphicsContextGLCocoa::RemoteGraphicsContextGLCocoa):
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h:
(WebKit::RemoteRenderingBackendProxy::renderingBackendIdentifier const):

RemoteGraphicsContextGL takes a ref of the respective RemoteRenderingBackend.
RemoteRenderingBackend is the one that can handle ImageBuffers.

(WebKit::RemoteGraphicsContextGL::paintRenderingResultsToCanvas):
(WebKit::RemoteGraphicsContextGL::paintCompositedResultsToCanvas):
(WebKit::RemoteGraphicsContextGL::paintImageDataToImageBuffer):
* GPUProcess/graphics/RemoteGraphicsContextGL.h:
* GPUProcess/graphics/RemoteGraphicsContextGL.messages.in:

Implement the functions by:
 1) Wait for the pending changes to the ImageBuffer
 2) Send a synchronous message from Web process to GPU process WebGL sequence
 3) Reading the buffer, post the task to RenderingBackend sequence
 4) Paint the results to the ImageBuffer
 5) Return the synchronous message result

(WebKit::RemoteGraphicsContextGLCocoa::prepareForDisplay):

RemoteGraphicsContextGL now retains the reference to display buffer.
Before, just sent the display buffer to Web process and forgot
about it.

* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::dispatch):
* GPUProcess/graphics/RemoteRenderingBackend.h:

Add function to dispatch work to rendering backend sequence.

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

Send the messages.

* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
(WebKit::RemoteRenderingBackendProxy::connectToGPUProcess):

Use IPC::SendOption::DispatchMessageEvenWhenWaitingForSyncReply to
send CreateRenderingBackend. It must be dispatched in order compared to other
messages such as CreateRemoteGraphicsContextGL.

Tools:

Update two signatures for manually implemented messages.

* Scripts/generate-gpup-webgl:

LayoutTests:

Remove now passing tests from the expectations.

* gpu-process/TestExpectations:

Canonical link: https://commits.webkit.org/234278@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273080 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-02-18 17:46:35 +00:00
Rini Patel d8c9930d8a [GPU Process] Repopulate the TestExpectations file #3
https://bugs.webkit.org/show_bug.cgi?id=221708

Unreviewed test gardening.

Patch by Rini Patel <rini_patel@apple.com> on 2021-02-15

* gpu-process/TestExpectations:

Canonical link: https://commits.webkit.org/234102@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272868 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-02-15 19:18:12 +00:00
Said Abou-Hallawa 8fff671bb0 Source/WebCore:
Make Pattern hold a NativeImage instead of an Image
https://bugs.webkit.org/show_bug.cgi?id=221637

Reviewed by Simon Fraser.

This will make caching the Pattern data in the GPUP straightforward since
all we need is to cache the NativeImage and encode the pattern data.

* html/canvas/CanvasPattern.cpp:
(WebCore::CanvasPattern::create):
(WebCore::CanvasPattern::CanvasPattern):
* html/canvas/CanvasPattern.h:
* html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::CanvasRenderingContext2DBase::createPattern):
* inspector/InspectorCanvas.cpp:
(WebCore::InspectorCanvas::buildArrayForCanvasPattern):
Extract a NativeImage of an Image. The platform Patterns deal with
NativeImages only.

* platform/graphics/Image.h:
Remove ImageHandle.

* platform/graphics/Pattern.cpp:
(WebCore::Pattern::create):
(WebCore::Pattern::Pattern):
(WebCore::Pattern::setPatternSpaceTransform):
* platform/graphics/Pattern.h:
(WebCore::Pattern::Parameters::encode const):
(WebCore::Pattern::Parameters::decode):
(WebCore::Pattern::encode const): Deleted.
(WebCore::Pattern::decode): Deleted.
Make the new struct 'Parameters' holds all the members other than the
NativeImage. This struct + RenderingResourceIdentifer of the NativeImage
will be recorded for the strokePattern and the fillPattern.

* platform/graphics/cairo/CairoOperations.cpp:
(WebCore::Cairo::FillSource::FillSource):
* platform/graphics/cairo/PatternCairo.cpp:
(WebCore::Pattern::createPlatformPattern const):
* platform/graphics/cg/PatternCG.cpp:
(WebCore::Pattern::createPlatformPattern const):
The platform Pattern deals only with NativeImages.

* platform/graphics/displaylists/DisplayList.cpp:
(WebCore::DisplayList::DisplayList::shouldDumpForFlags):
SetState::state() is renamed to SetStateItem::stateChange() since it
returns GraphicsContextStateChange.

* platform/graphics/displaylists/DisplayListItemBuffer.cpp:
(WebCore::DisplayList::ItemHandle::apply):
SetState::apply() has to be a special case.

* platform/graphics/displaylists/DisplayListItems.cpp:
(WebCore::DisplayList::SetState::SetState):
(WebCore::DisplayList::SetState::apply):
(WebCore::DisplayList::operator<<):
(WebCore::DisplayList::SetState::apply const): Deleted.
Add a new constructor for SetState to be used by the decoder. All the
members of GraphicsContextStateChange will be copied but strokePattern
and fillPattern will be created only when their NativeImages are resolved
in the SetState::apply().

* platform/graphics/displaylists/DisplayListItems.h:
(WebCore::DisplayList::SetState::stateChange const):
(WebCore::DisplayList::SetState::strokePatternParameters const):
(WebCore::DisplayList::SetState::fillPatternParameters const):
(WebCore::DisplayList::SetState::strokePatternImageIdentifier const):
(WebCore::DisplayList::SetState::fillPatternImageIdentifier const):
(WebCore::DisplayList::SetState::encode const):
(WebCore::DisplayList::SetState::decode):
(WebCore::DisplayList::SetState::state const): Deleted.
Specialize the encode and the decoding of strokePattern and fillPattern
by using the Pattern::Parameters and the RenderingResourceIdentifer of
the NativeImage.

* platform/graphics/displaylists/DisplayListRecorder.cpp:
(WebCore::DisplayList::Recorder::cacheNativeImage):
(WebCore::DisplayList::Recorder::appendStateChangeItem):
(WebCore::DisplayList::Recorder::drawNativeImage):
(WebCore::DisplayList::Recorder::drawPattern):
* platform/graphics/displaylists/DisplayListRecorder.h:
Cache the NativeImages of strokePattern and fillPattern.

* platform/graphics/displaylists/DisplayListReplayer.cpp:
(WebCore::DisplayList::applySetStateItem):
(WebCore::DisplayList::Replayer::applyItem):
Resolve the NativeImages of strokePattern and fillPattern from the cached
NativeImages.

* platform/graphics/filters/FETile.cpp:
(WebCore::FETile::platformApplySoftware):
* rendering/RenderLayerBacking.cpp:
(WebCore::patternForDescription):
* rendering/svg/RenderSVGResourcePattern.cpp:
(WebCore::RenderSVGResourcePattern::buildPattern):
Patterns should be created with NativeImages.

Source/WebKit:
Make Pattern hold a NativeImage instead of an Image
https://bugs.webkit.org/show_bug.cgi?id=221637

Reviewed by Simon Fraser.

* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<ImageHandle>::encode): Deleted.
(IPC::ArgumentCoder<ImageHandle>::decode): Deleted.
* Shared/WebCoreArgumentCoders.h:
Delete the encoding and decoding of Image since it is not used anymore

LayoutTests:
[GPU Process] Implement SetState DisplayList item
https://bugs.webkit.org/show_bug.cgi?id=219468

Reviewed by Simon Fraser.

* gpu-process/TestExpectations:
Unmark tests that are no longer crash.


Canonical link: https://commits.webkit.org/234012@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272776 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-02-12 09:10:38 +00:00
Chris Dumez 575a12e069 [GPUP] <audio> won't load when URL ends with .php causing some tests to time out
https://bugs.webkit.org/show_bug.cgi?id=221695

Reviewed by Eric Carlson.

Source/WebCore:

No new tests, covered by unskipped layout tests.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::mediaPlayerEngineUpdated):
(WebCore::HTMLMediaElement::mediaPlayerDidInitializeMediaEngine):
We were calling HTMLMediaElement::audioSourceProvider() in mediaPlayerEngineUpdated() which
happens right after we've constructed the MediaPlayerPrivate but before we've called
load() on the MediaPlayerPrivate. The issue was that calling audioSourceProvider() would
initialize the AudioSourceProvider and end up sending the RemoteMediaPlayerProxy::CreateAudioSourceProvider
IPC to the GPUProcess. RemoteMediaPlayerProxy::createAudioSourceProvider() would return early
because m_player->audioSourceProvider() returns null. The reason m_player->audioSourceProvider()
returns null is because it's MediaPlayerPrivate is still a NullMediaPlayerPrivate, because
MediaPlayer::load() has not been called in the GPUProcess yet. For this reason, I moved the
audioSourceProvider() initialization from mediaPlayerEngineUpdated() to
mediaPlayerDidInitializeMediaEngine(). mediaPlayerDidInitializeMediaEngine() happens right
after we've called MediaPlayerPrivate::load() which will end up calling MediaPlayer::load()
in the GPUProcess.

* platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::loadWithNextMediaEngine):
Pass an empty ContentType to MediaPlayerPrivate::load() when we did not have a content type
but guessed one based on the extension. This ends up getting passed to the MediaPlayer
in the GPUProcess and it is important it knows it does not have a content type so that
it can guess one from the extension and try the next media engine if it cannot find one.

LayoutTests:

Unskip tests that are no longer timing out.

* gpu-process/TestExpectations:


Canonical link: https://commits.webkit.org/233990@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272750 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-02-11 22:05:29 +00:00
Peng Liu 322ff5353c [GPUP] Reset expectations of media related tests
https://bugs.webkit.org/show_bug.cgi?id=221700

Unreviewed test gardening.


* gpu-process/TestExpectations:


Canonical link: https://commits.webkit.org/233933@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272682 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-02-10 21:16:13 +00:00
Kimmo Kinnunen 8204bad4a6 RemoteGraphicsContextGLProxy should support losing the context and should lose the context on timeouts
https://bugs.webkit.org/show_bug.cgi?id=221396

Patch by Kimmo Kinnunen <kkinnunen@apple.com> on 2021-02-10
Reviewed by Simon Fraser.

Source/WebKit:

Implement support for RemoteGraphicsContextGLProxy acting on
losing the context in RemoteGraphicsContextGL.

Implement support for RemoteGraphicsContextGLProxy timing out on message
sends. Force the context to be lost.

Implement support for GPUProcessConnection disconnect. Force the context
be lost.

* GPUProcess/graphics/RemoteGraphicsContextGL.cpp:

Send a bool via WasCreated method, so that the
receiver knows if creation was successful or not.
Currently the creation always succeeds.

Previously it was designed to use wasLost instead,
but this has the problem that the client will wait
for WasCreated in particular cases to ensure initialization,
and thus we cannot wait for  "WasCreated OR WasLost".

(WebKit::RemoteGraphicsContextGL::RemoteGraphicsContextGL):
(WebKit::RemoteGraphicsContextGL::synthesizeGLError):
(WebKit::RemoteGraphicsContextGL::getError):

Manually implement few methods that contain custom client-side
logic wrt. lost context.

* GPUProcess/graphics/RemoteGraphicsContextGL.h:
* GPUProcess/graphics/RemoteGraphicsContextGL.messages.in:
* GPUProcess/graphics/RemoteGraphicsContextGLFunctionsGenerated.h:
(setFailNextGPUStatusCheck):
(getBooleanv):
* WebProcess/GPU/GPUProcessConnection.cpp:
(WebKit::GPUProcessConnection::dispatchMessage):

Skip the RemoteGraphicsContextGLProxy messages that do not have
a receiver. This is expected, as we cannot assume that only expected
messages arrive to the message hander.

The client, i.e. the web process, might
 - just delete the proxy
 - force the context to be lost
 - notice a timeout and force the context to be lost

while the GPU process cannot know this. RemoteGraphicsContextGL might
already have sent messages to the Proxy.

* WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp:
(WebKit::RemoteGraphicsContextGLProxy::create):
(WebKit::RemoteGraphicsContextGLProxy::RemoteGraphicsContextGLProxy):
(WebKit::RemoteGraphicsContextGLProxy::~RemoteGraphicsContextGLProxy):

Listen to GPUProcessConnection::Client notifications about
connection closure. When the connection closes, mark the context object
lost.

Store the reference to GPUProcessConnection so that when the connection
is shut down and new one is instantiated, RemoteGraphicsContextGLProxy
destruction logic will correctly refer to the one it was using.

(WebKit::RemoteGraphicsContextGLProxy::reshape):
(WebKit::RemoteGraphicsContextGLProxy::prepareForDisplay):
(WebKit::RemoteGraphicsContextGLProxy::ensureExtensionEnabled):
(WebKit::RemoteGraphicsContextGLProxy::notifyMarkContextChanged):
(WebKit::RemoteGraphicsContextGLProxy::synthesizeGLError):
(WebKit::RemoteGraphicsContextGLProxy::getError):
(WebKit::RemoteGraphicsContextGLProxy::wasCreated):
(WebKit::RemoteGraphicsContextGLProxy::wasLost):

When the context lost event happens, disconnect with
the GPUProcessConnection.

(WebKit::RemoteGraphicsContextGLProxy::wasChanged):
(WebKit::RemoteGraphicsContextGLProxy::markContextLost):
(WebKit::RemoteGraphicsContextGLProxy::waitUntilInitialized):
(WebKit::RemoteGraphicsContextGLProxy::gpuProcessConnectionDidClose):

When the connection closes, mark the context object
lost.

(WebKit::RemoteGraphicsContextGLProxy::disconnect):
* WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h:
* WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.messages.in:
* WebProcess/GPU/graphics/RemoteGraphicsContextGLProxyFunctionsGenerated.cpp:

Changes generated by the code-generator wrt handling timeouts from the sends.

Tools:

Generate calls to lose the context on timeouts.

Generate the send calls as calls to the helper functions to send the
messages. The helper functions will provide the non-changing arguments.

Move few messages to be implemented by hand.

* Scripts/generate-gpup-webgl:

LayoutTests:

Fix the lose-context-on-status-failure.html. The test was using
an internal function to lose the context and then synchronously
checking that the context was lost. With GPU process this is not
possible, so check after normal Canvas webglcontextlost event.

Enable the test for --use-gpu-process.

* fast/canvas/webgl/lose-context-on-status-failure.html:
* gpu-process/TestExpectations:

Canonical link: https://commits.webkit.org/233904@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272645 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-02-10 12:04:48 +00:00
Peng Liu 13281cee11 [GPUP] Test media/track/audio-track-add-remove.html crashes on debug bots
https://bugs.webkit.org/show_bug.cgi?id=221595

Reviewed by Eric Carlson.

Source/WebKit:

Under stress tests, instances of RemoteAudioTrackProxy, RemoteTextTrackProxy, and
RemoteVideoTrackProxy might be destroyed in the GPU process when an IPC message
comes and leads to an assertion failure.

To fix the assertion failure, this patches removes three IPC message receivers in
the GPU process:
- RemoteAudioTrackProxy
- RemoteTextTrackProxy
- RemoteVideoTrackProxy
Instead of using these three message receivers, this patch adds three new IPC messages
to RemoteMediaPlayerProxy:
- AudioTrackSetEnabled
- TextTrackSetMode
- VideoTrackSetSelected

No new tests, fixing following tests:
- media/track/audio-track-add-remove.html
- media/track/audio-track.html

* CMakeLists.txt:
* DerivedSources.make:
* GPUProcess/media/RemoteAudioTrackProxy.cpp:
(WebKit::RemoteAudioTrackProxy::RemoteAudioTrackProxy):
(WebKit::RemoteAudioTrackProxy::~RemoteAudioTrackProxy):
* GPUProcess/media/RemoteAudioTrackProxy.h:
* GPUProcess/media/RemoteAudioTrackProxy.messages.in: Removed.
* GPUProcess/media/RemoteMediaPlayerProxy.cpp:
(WebKit::RemoteMediaPlayerProxy::audioTrackSetEnabled):
(WebKit::RemoteMediaPlayerProxy::videoTrackSetSelected):
(WebKit::RemoteMediaPlayerProxy::textTrackSetMode):
* GPUProcess/media/RemoteMediaPlayerProxy.h:
* GPUProcess/media/RemoteMediaPlayerProxy.messages.in:
* GPUProcess/media/RemoteTextTrackProxy.cpp:
(WebKit::RemoteTextTrackProxy::RemoteTextTrackProxy):
(WebKit::RemoteTextTrackProxy::~RemoteTextTrackProxy):
* GPUProcess/media/RemoteTextTrackProxy.h:
* GPUProcess/media/RemoteTextTrackProxy.messages.in: Removed.
* GPUProcess/media/RemoteVideoTrackProxy.cpp:
(WebKit::RemoteVideoTrackProxy::RemoteVideoTrackProxy):
(WebKit::RemoteVideoTrackProxy::~RemoteVideoTrackProxy):
* GPUProcess/media/RemoteVideoTrackProxy.h:
* GPUProcess/media/RemoteVideoTrackProxy.messages.in: Removed.
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/GPU/media/AudioTrackPrivateRemote.cpp:
(WebKit::AudioTrackPrivateRemote::AudioTrackPrivateRemote):
(WebKit::AudioTrackPrivateRemote::setEnabled):
* WebProcess/GPU/media/AudioTrackPrivateRemote.h:
* WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
(WebKit::MediaPlayerPrivateRemote::addRemoteAudioTrack):
(WebKit::MediaPlayerPrivateRemote::addRemoteTextTrack):
(WebKit::MediaPlayerPrivateRemote::addRemoteVideoTrack):
* WebProcess/GPU/media/TextTrackPrivateRemote.cpp:
(WebKit::TextTrackPrivateRemote::TextTrackPrivateRemote):
(WebKit::TextTrackPrivateRemote::setMode):
* WebProcess/GPU/media/TextTrackPrivateRemote.h:
* WebProcess/GPU/media/VideoTrackPrivateRemote.cpp:
(WebKit::VideoTrackPrivateRemote::VideoTrackPrivateRemote):
(WebKit::VideoTrackPrivateRemote::setSelected):
* WebProcess/GPU/media/VideoTrackPrivateRemote.h:
(WebKit::VideoTrackPrivateRemote::create):

LayoutTests:

* gpu-process/TestExpectations:


Canonical link: https://commits.webkit.org/233863@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272600 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-02-09 20:21:09 +00:00
Rini Patel 6a76c2b74c [GPU Process] Repopulate the TestExpectations file #2
https://bugs.webkit.org/show_bug.cgi?id=221446

Unreviewed test gardening.

Patch by Rini Patel <rini_patel@apple.com> on 2021-02-05

* gpu-process/TestExpectations:

Canonical link: https://commits.webkit.org/233750@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272427 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-02-05 18:53:42 +00:00
Rini Patel 8b96bba686 [GPU Process] Repopulate the TestExpectations file
https://bugs.webkit.org/show_bug.cgi?id=221284

Patch by Rini Patel <rini_patel@apple.com> on 2021-02-02
Reviewed by Simon Fraser.

* gpu-process/TestExpectations:

Canonical link: https://commits.webkit.org/233618@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272242 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-02-02 23:23:33 +00:00
Rini Patel 0bae67b27d [GPU Process] Layout tests TestExpectation file rewriting
https://bugs.webkit.org/show_bug.cgi?id=221101

Populate TestExpectations from clean state, remove all skipped dirs, add back failing tests.
Patch by Rini Patel <rini_patel@apple.com> on 2021-02-01
Reviewed by Simon Fraser.

* gpu-process/TestExpectations:

Canonical link: https://commits.webkit.org/233540@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272153 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-02-01 19:43:40 +00:00
Peng Liu d00fa96cd6 [GPUP][MSE] A video element does not fire “canplaythrough” event if SourceBuffer.abort() is called
https://bugs.webkit.org/show_bug.cgi?id=220964

Reviewed by Jer Noble.

Source/WebCore:

This patch removes `initializationSegmentIsHandledSemaphore` from both `SourceBufferParserAVFObjC`
and `SourceBufferParserWebM`, and implements a media sample cache mechanism in `SourceBufferPrivateAVFObjC`
to ensure that "Coded Frame Processing" steps execute after `SourceBufferPrivate` has handled the
initialization segment and enabled video/audio tracks. Without the cache mechanism, some media
samples following the initialization segment may be dropped when we run `SourceBufferPrivateAVFObjC`
in the GPU process, and the media element won't fire "canplaythrough" event because it cannot change
its ready state to a value greater than HAVE_METADATA.

This patch also implements the mechanism to make sure `SourceBufferPrivateAVFObjC::appendCompleted()`
runs after all media samples have gone through the "Coded Frame Processing" steps, so that the source
buffer object will fire "update" and "updateend" event after the parser has completedly parsed the
appended buffer.

* platform/graphics/avfoundation/objc/SourceBufferParserAVFObjC.h:
* platform/graphics/avfoundation/objc/SourceBufferParserAVFObjC.mm:
(WebCore::SourceBufferParserAVFObjC::SourceBufferParserAVFObjC):
(WebCore::SourceBufferParserAVFObjC::~SourceBufferParserAVFObjC):
(WebCore::SourceBufferParserAVFObjC::appendData):
Add a parameter "CompletionHandler" to notify the caller that the parser has parsed the whole buffer.
(WebCore::SourceBufferParserAVFObjC::flushPendingMediaData):
(WebCore::SourceBufferParserAVFObjC::resetParserState):
(WebCore::SourceBufferParserAVFObjC::invalidate):
(WebCore::SourceBufferParserAVFObjC::didParseStreamDataAsAsset):

* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
(WebCore::SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC):
(WebCore::SourceBufferPrivateAVFObjC::~SourceBufferPrivateAVFObjC):
(WebCore::SourceBufferPrivateAVFObjC::didParseInitializationData):
After `SourceBufferPrivateClient` has done the configuration with the initialization segment, we need to
push the cached media samples (if any) to `SourceBufferPrivate` to run the "Coded Frame Processing" steps.
And we need to call "appendCompleted()" if there is a pending callback.
(WebCore::SourceBufferPrivateAVFObjC::didProvideMediaDataForTrackId):
`SourceBufferPrivateAVFObjC` needs to cache the media sample if the initialization segment has not been
processed by `SourceBufferPrivateClient` yet.
(WebCore::SourceBufferPrivateAVFObjC::append):
We need to postpone the "appendCompleted()" callback if there are cached media samples.
(WebCore::SourceBufferPrivateAVFObjC::appendCompleted):
(WebCore::SourceBufferPrivateAVFObjC::abort):
(WebCore::SourceBufferPrivateAVFObjC::setVideoLayer):
(WebCore::SourceBufferPrivateAVFObjC::didProvideMediaDataForTrackID): Deleted.

* platform/graphics/cocoa/SourceBufferParser.h:

* platform/graphics/cocoa/SourceBufferParserWebM.cpp:
(WebCore::SourceBufferParserWebM::SourceBufferParserWebM):
(WebCore::SourceBufferParserWebM::~SourceBufferParserWebM):
(WebCore::SourceBufferParserWebM::appendData):
(WebCore::SourceBufferParserWebM::flushPendingMediaData):
(WebCore::SourceBufferParserWebM::resetParserState):
(WebCore::SourceBufferParserWebM::invalidate):
(WebCore::SourceBufferParserWebM::OnClusterBegin):

* platform/graphics/cocoa/SourceBufferParserWebM.h:

Source/WebKit:

* Shared/mac/MediaFormatReader/MediaFormatReader.cpp:
(WebKit::MediaFormatReader::parseByteSource):

LayoutTests:

* gpu-process/TestExpectations:
* media/media-source/media-source-webm-append-buffer-after-abort-expected.txt: Added.
* media/media-source/media-source-webm-append-buffer-after-abort.html: Added.
* platform/mac/TestExpectations:


Canonical link: https://commits.webkit.org/233458@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272039 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-01-29 00:19:30 +00:00
Rini Patel b1bc1d0af3 [GPU Process] Remove blind skips from TestExpectations file
https://bugs.webkit.org/show_bug.cgi?id=220935

Patch by Rini Patel <rini_patel@apple.com> on 2021-01-27
Reviewed by Simon Fraser.

* gpu-process/TestExpectations:

Canonical link: https://commits.webkit.org/233418@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271983 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-01-27 21:15:17 +00:00
Rini Patel a1d78517db [GPU Process] Add Layout tests timeouts and failures to TestExpectations
https://bugs.webkit.org/show_bug.cgi?id=220803

Patch by Rini Patel <rini_patel@apple.com> on 2021-01-21
Reviewed by Simon Fraser.

* gpu-process/TestExpectations:

Canonical link: https://commits.webkit.org/233211@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271702 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-01-21 19:15:38 +00:00
Rini Patel d6d16b11b8 [GPU process] Some more Layout tests failures in TestExpectations
https://bugs.webkit.org/show_bug.cgi?id=220570

Patch by Rini Patel <rini_patel@apple.com> on 2021-01-13
Reviewed by Simon Fraser.

* gpu-process/TestExpectations:

Canonical link: https://commits.webkit.org/233002@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271442 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-01-13 18:43:31 +00:00
Youenn Fablet 69cbccc759 PaintFrameForMedia has a null identifier when media player is a media stream track video player
https://bugs.webkit.org/show_bug.cgi?id=220411

Reviewed by Wenson Hsieh.

Source/WebCore:

MediaStreamTrack video player is running in WebProcess as WebProcess gets each video sample.
There is no corresponding remote media player.
Disable the GPU code path for painting the video element and use the in-process one instead.

Covered by test in GPU process mode.

* platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::paintFrameForMedia):
* platform/graphics/GraphicsContextImpl.h:
* platform/graphics/cairo/GraphicsContextImplCairo.h:
* platform/graphics/displaylists/DisplayListRecorder.cpp:
(WebCore::DisplayList::Recorder::canPaintFrameForMedia const):
(WebCore::DisplayList::Recorder::paintFrameForMedia):
* platform/graphics/displaylists/DisplayListRecorder.h:
* platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.h:
* platform/graphics/win/GraphicsContextImplDirect2D.h:

LayoutTests:

* gpu-process/TestExpectations:


Canonical link: https://commits.webkit.org/232874@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271295 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-01-08 15:26:34 +00:00
Rini Patel 1ce7f2ce13 [GPU process] Add Layout tests failures to LayoutTests/gpu-process/TestExpectations
https://bugs.webkit.org/show_bug.cgi?id=220070

Patch by Rini Patel <rini_patel@apple.com> on 2021-01-06
Reviewed by Darin Adler.

* gpu-process/TestExpectations:

Canonical link: https://commits.webkit.org/232798@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271202 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-01-06 17:49:19 +00:00
Peng Liu 5c679919af [Media in GPU Process][MSE] SourceBuffer fires update and updateend events before the coded frames are removed
https://bugs.webkit.org/show_bug.cgi?id=220334

Reviewed by Eric Carlson.

Source/WebCore:

Add a completion handler parameter to SourceBufferPrivate::removeCodedFrames(),
and the caller (SourceBuffer) will fire `update` and `updateend` events when
the completion handler is called.

No new tests. Fix failures of the following tests:
- imported/w3c/web-platform-tests/media-source/mediasource-config-change-webm-v-framesize.html
- imported/w3c/web-platform-tests/media-source/mediasource-config-change-mp4-av-audio-bitrate.html
- imported/w3c/web-platform-tests/media-source/mediasource-config-change-mp4-av-video-bitrate.html

* Modules/mediasource/SourceBuffer.cpp:
(WebCore::SourceBuffer::removeTimerFired):
* platform/graphics/SourceBufferPrivate.cpp:
(WebCore::SourceBufferPrivate::removeCodedFrames):
* platform/graphics/SourceBufferPrivate.h:
(WebCore::SourceBufferPrivate::removeCodedFrames):

Source/WebKit:

Update the IPC message RemoteSourceBufferProxy::RemoveCodedFrames to implement
SourceBufferPrivateRemote::removeCodedFrames().

* GPUProcess/media/RemoteSourceBufferProxy.cpp:
(WebKit::RemoteSourceBufferProxy::removeCodedFrames):
* GPUProcess/media/RemoteSourceBufferProxy.h:
* GPUProcess/media/RemoteSourceBufferProxy.messages.in:
* WebProcess/GPU/media/SourceBufferPrivateRemote.cpp:
(WebKit::SourceBufferPrivateRemote::removeCodedFrames):
* WebProcess/GPU/media/SourceBufferPrivateRemote.h:

LayoutTests:

* gpu-process/TestExpectations:


Canonical link: https://commits.webkit.org/232775@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271178 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-01-05 23:02:40 +00:00
Peng Liu a790ff004c [Media in GPU Process][MSE] Media element does not fire "resize" event
https://bugs.webkit.org/show_bug.cgi?id=220119

Reviewed by Eric Carlson.

Source/WebKit:

Implement `RemoteMediaPlayerProxy::mediaPlayerSizeChanged()` to forward the video
resize callback from MSE media player to web process.

No new tests, covered by existing failing layout test.

* GPUProcess/media/RemoteMediaPlayerProxy.cpp:
(WebKit::RemoteMediaPlayerProxy::mediaPlayerSizeChanged):
* GPUProcess/media/RemoteMediaPlayerProxy.h:

LayoutTests:

* gpu-process/TestExpectations:


Canonical link: https://commits.webkit.org/232673@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271076 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-12-23 20:55:32 +00:00
Rini Patel b782554f19 [GPU process] Adding more tests to TestExpectations for Layout tests crashes
https://bugs.webkit.org/show_bug.cgi?id=220035

Patch by Rini Patel <rini_patel@apple.com> on 2020-12-18
Reviewed by Tim Horton.

* gpu-process/TestExpectations:

Canonical link: https://commits.webkit.org/232611@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271001 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-12-19 05:41:04 +00:00
Peng Liu 94b3cbc82a [Media in GPU Process][MSE] SourceBufferPrivateRemote needs to override some track buffer related functions of SourceBufferPrivate
https://bugs.webkit.org/show_bug.cgi?id=219998

Reviewed by Jer Noble.

Source/WebCore:

No new tests, fix layout test failures.

* platform/graphics/SourceBufferPrivate.h:
(WebCore::SourceBufferPrivate::setTimestampOffset):
(WebCore::SourceBufferPrivate::setAppendWindowStart):
(WebCore::SourceBufferPrivate::setAppendWindowEnd):
(WebCore::SourceBufferPrivate::hasVideo const):
(WebCore::SourceBufferPrivate::timestampOffset const):
Change these functions to virtual because `SourceBufferPrivateRemote` needs to override them.

Source/WebKit:

Implement some track buffer related functions of `SourceBufferPrivateRemote` with new IPC messages.

* GPUProcess/media/RemoteSourceBufferProxy.cpp:
(WebKit::RemoteSourceBufferProxy::resetTrackBuffers):
(WebKit::RemoteSourceBufferProxy::clearTrackBuffers):
(WebKit::RemoteSourceBufferProxy::resetTimestampOffsetInTrackBuffers):
(WebKit::RemoteSourceBufferProxy::setTimestampOffset):
(WebKit::RemoteSourceBufferProxy::setAppendWindowStart):
(WebKit::RemoteSourceBufferProxy::setAppendWindowEnd):
(WebKit::RemoteSourceBufferProxy::updateTrackIds):
* GPUProcess/media/RemoteSourceBufferProxy.h:
* GPUProcess/media/RemoteSourceBufferProxy.messages.in:

* WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
(WebKit::MediaPlayerPrivateRemote::addRemoteAudioTrack):
(WebKit::MediaPlayerPrivateRemote::addRemoteTextTrack):
(WebKit::MediaPlayerPrivateRemote::addRemoteVideoTrack):
`MediaSource` manages the track information for the MSE media player, so we should not call
`MediaPlayer::addAudioTrack()`, `MediaPlayer::addTextTrack()` and `MediaPlayer::addVideoTrack()`.

* WebProcess/GPU/media/SourceBufferPrivateRemote.cpp:
(WebKit::SourceBufferPrivateRemote::resetTrackBuffers):
(WebKit::SourceBufferPrivateRemote::clearTrackBuffers):
(WebKit::SourceBufferPrivateRemote::resetTimestampOffsetInTrackBuffers):
(WebKit::SourceBufferPrivateRemote::setTimestampOffset):
(WebKit::SourceBufferPrivateRemote::setAppendWindowStart):
(WebKit::SourceBufferPrivateRemote::setAppendWindowEnd):
(WebKit::SourceBufferPrivateRemote::updateTrackIds):
* WebProcess/GPU/media/SourceBufferPrivateRemote.h:

LayoutTests:

* gpu-process/TestExpectations:


Canonical link: https://commits.webkit.org/232598@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@270987 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-12-18 21:10:53 +00:00
Peng Liu fe0dd871e7 [Media in GPU Process][MSE] Add an IPC message BufferedSamplesForTrackId for testing purposes
https://bugs.webkit.org/show_bug.cgi?id=219956

Reviewed by Eric Carlson.

Source/WebCore:

No new tests, fix a layout test failure.

* Modules/mediasource/SourceBuffer.cpp:
(WebCore::SourceBuffer::bufferedSamplesForTrackId):
(WebCore::SourceBuffer::bufferedSamplesForTrackID): Deleted.
* Modules/mediasource/SourceBuffer.h:
* platform/graphics/SourceBufferPrivate.cpp:
(WebCore::SourceBufferPrivate::bufferedSamplesForTrackId):
(WebCore::SourceBufferPrivate::bufferedSamplesForTrackID): Deleted.
* platform/graphics/SourceBufferPrivate.h:
(WebCore::SourceBufferPrivate::enqueuedSamplesForTrackID):
* testing/Internals.cpp:
(WebCore::Internals::bufferedSamplesForTrackId):
(WebCore::Internals::bufferedSamplesForTrackID): Deleted.
* testing/Internals.h:
* testing/Internals.idl:

Source/WebKit:

Implement `SourceBufferPrivateRemote::bufferedSamplesForTrackId()` with a new IPC message.

* GPUProcess/media/RemoteSourceBufferProxy.cpp:
(WebKit::RemoteSourceBufferProxy::bufferedSamplesForTrackId):
* GPUProcess/media/RemoteSourceBufferProxy.h:
* GPUProcess/media/RemoteSourceBufferProxy.messages.in:
* WebProcess/GPU/media/SourceBufferPrivateRemote.cpp:
(WebKit::SourceBufferPrivateRemote::bufferedSamplesForTrackId):
* WebProcess/GPU/media/SourceBufferPrivateRemote.h:

LayoutTests:

The tests using internals.bufferedSamplesForTrackID() need to be updated since the function
is asynchronous now.

* gpu-process/TestExpectations:
* media/media-source/media-source-append-acb-no-frame-lost.html:
* media/media-source/media-source-append-acb-tolerance.html:
* media/media-source/media-source-append-overlapping-dts.html:
* media/media-source/media-source-append-presentation-durations.html:
* media/media-source/media-source-append-twice-overlapping-sync-frame.html:
* media/media-source/media-source-append-variable-frame-lengths-with-matching-durations.html:
* media/media-source/media-source-dropped-iframe.html:
* media/media-source/media-source-overlapping-append.html:
* media/media-source/media-source-overlapping-decodetime.html:
* media/media-source/media-source-range-end-frame-not-removed.html:
* media/media-source/media-source-range-start-frame-replaced.html:
* media/media-source/media-source-remove-b-frame.html:
* media/media-source/media-source-samples-out-of-order.html:
* media/media-source/media-source-samples-resolution-change.html:
* media/media-source/media-source-sequence-timestamps.html:
* media/media-source/media-source-timeoffset.html:
* media/media-source/media-source-timestampoffset-rounding-error.html:
* media/media-source/media-source-timestampoffset-then-zero.html:


Canonical link: https://commits.webkit.org/232545@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@270919 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-12-17 02:19:07 +00:00
Rini Patel b9fd62bcd8 [GPU process] Update TestExpectations to skip Layout tests crashes under encodeSingleObject()
https://bugs.webkit.org/show_bug.cgi?id=219955

Patch by Rini Patel <rini_patel@apple.com> on 2020-12-16
Reviewed by Tim Horton.

* gpu-process/TestExpectations:

Canonical link: https://commits.webkit.org/232536@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@270902 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-12-16 20:41:32 +00:00
Peng Liu 2592d0c0f4 [Media in GPU Process][MSE] Enable media-source layout tests
https://bugs.webkit.org/show_bug.cgi?id=219906

Reviewed by Eric Carlson.

* gpu-process/TestExpectations:


Canonical link: https://commits.webkit.org/232500@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@270859 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-12-15 20:31:44 +00:00
Rini Patel a0aba0b78e [GPU process] Update TestExpectations to skip Layout tests crashes
https://bugs.webkit.org/show_bug.cgi?id=219792

Patch by Rini Patel <rini_patel@apple.com> on 2020-12-11
Reviewed by Simon Fraser.

* gpu-process/TestExpectations:

Canonical link: https://commits.webkit.org/232359@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@270696 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-12-11 19:54:38 +00:00
Kimmo Kinnunen 0fed30638e Source/WebCore:
Implement RemoteGraphicsContextGL
https://bugs.webkit.org/show_bug.cgi?id=217216
<rdar://problem/69876258>

Patch by Kimmo Kinnunen <kkinnunen@apple.com> on 2020-12-09
Reviewed by Simon Fraser.

Implements a beginning of a remote version of GraphicsContextGL for GPU
process. Current implementation is using WebKit IPC.

Implemented with a generator script implementing the IPC to pass the
GraphicsContextGL member function calls from web process to the GPU
process. The script is run during development time and the results are
committed to the repo for ease of review.

Extracts an interface GraphicsContextGLIOSurfaceSwapChain which is
used to submit IOSurfaces from GraphicsContextGLOpenGL. For
web process WebGL, these go to WebGLLayer. For GPU process WebGL,
the IOSurfaces go to the prepareForDisplay caller, e.g. the
RemoteGraphicsContextGL, which then return the IOSurfaces back
to Web process side. RemoteGraphicsContextGLProxy will send
them to WebGLLayer.

No new tests, tested by existing webgl tests once the implementation works.

* PlatformMac.cmake:
* Sources.txt:
* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
* html/canvas/WebGL2RenderingContext.cpp:
(WebCore::WebGL2RenderingContext::getBufferSubData):
(WebCore::WebGL2RenderingContext::vertexAttribI4uiv):
(WebCore::WebGL2RenderingContext::getQueryParameter):
(WebCore::WebGL2RenderingContext::bindSampler):
(WebCore::WebGL2RenderingContext::getSamplerParameter):
(WebCore::WebGL2RenderingContext::clientWaitSync):
(WebCore::WebGL2RenderingContext::deleteTransformFeedback):
(WebCore::WebGL2RenderingContext::beginTransformFeedback):
(WebCore::WebGL2RenderingContext::endTransformFeedback):
(WebCore::WebGL2RenderingContext::transformFeedbackVaryings):
(WebCore::WebGL2RenderingContext::getActiveUniforms):
(WebCore::WebGL2RenderingContext::readPixels):
* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::create):
(WebCore::WebGLRenderingContextBase::readPixels):
* html/canvas/WebGLSync.cpp:
(WebCore::WebGLSync::updateCache):
* page/Chrome.cpp:
(WebCore::Chrome::createGraphicsContextGL const):
(WebCore::Chrome::windowScreenDidChange):
* page/Chrome.h:
* page/ChromeClient.h:
(WebCore::ChromeClient::createGraphicsContextGL const):
* platform/HostWindow.h:
* platform/RuntimeApplicationChecks.h:
(WebCore::isInGPUProcess):
* platform/cocoa/RuntimeApplicationChecksCocoa.mm:
(WebCore::isInGPUProcess):
* platform/graphics/ExtensionsGL.h:
* platform/graphics/GraphicsContextGL.cpp:
(WebCore::GraphicsContextGL::create):
* platform/graphics/GraphicsContextGL.h:
* platform/graphics/GraphicsTypesGL.h:
(GCGLSpan::GCGLSpan):
(GCGLSpan<GCGLvoid>::GCGLSpan):
* platform/graphics/RemoteGraphicsContextGLProxyBase.cpp: Added.
(WebCore::RemoteGraphicsContextGLProxyBase::RemoteGraphicsContextGLProxyBase):
(WebCore::RemoteGraphicsContextGLProxyBase::platformGraphicsContextGL const):
(WebCore::RemoteGraphicsContextGLProxyBase::platformTexture const):
(WebCore::RemoteGraphicsContextGLProxyBase::getExtensions):
(WebCore::RemoteGraphicsContextGLProxyBase::setContextVisibility):
(WebCore::RemoteGraphicsContextGLProxyBase::powerPreferenceUsedForCreation const):
(WebCore::RemoteGraphicsContextGLProxyBase::isGLES2Compliant const):
(WebCore::RemoteGraphicsContextGLProxyBase::markContextChanged):
(WebCore::RemoteGraphicsContextGLProxyBase::markLayerComposited):
(WebCore::RemoteGraphicsContextGLProxyBase::layerComposited const):
(WebCore::RemoteGraphicsContextGLProxyBase::setBuffersToAutoClear):
(WebCore::RemoteGraphicsContextGLProxyBase::getBuffersToAutoClear const):
(WebCore::RemoteGraphicsContextGLProxyBase::paintCompositedResultsToCanvas):
(WebCore::RemoteGraphicsContextGLProxyBase::enablePreserveDrawingBuffer):
(WebCore::RemoteGraphicsContextGLProxyBase::supports):
(WebCore::RemoteGraphicsContextGLProxyBase::ensureEnabled):
(WebCore::RemoteGraphicsContextGLProxyBase::isEnabled):
(WebCore::RemoteGraphicsContextGLProxyBase::initialize):
(WebCore::RemoteGraphicsContextGLProxyBase::platformInitialize):
(WebCore::RemoteGraphicsContextGLProxyBase::platformLayer const):
* platform/graphics/RemoteGraphicsContextGLProxyBase.h: Added.
* platform/graphics/angle/ExtensionsGLANGLE.cpp:
(WebCore::ExtensionsGLANGLE::ExtensionsGLANGLE):
(WebCore::ExtensionsGLANGLE::getGraphicsResetStatusARB):
(WebCore::ExtensionsGLANGLE::getTranslatedShaderSourceANGLE):
(WebCore::ExtensionsGLANGLE::blitFramebufferANGLE):
(WebCore::ExtensionsGLANGLE::renderbufferStorageMultisampleANGLE):
(WebCore::ExtensionsGLANGLE::drawArraysInstancedANGLE):
(WebCore::ExtensionsGLANGLE::drawElementsInstancedANGLE):
(WebCore::ExtensionsGLANGLE::vertexAttribDivisorANGLE):
(WebCore::ExtensionsGLANGLE::getUniformuivRobustANGLE):
(WebCore::ExtensionsGLANGLE::getTexLevelParameterivRobustANGLE):
(WebCore::ExtensionsGLANGLE::getTexLevelParameterfvRobustANGLE):
(WebCore::ExtensionsGLANGLE::getnUniformfvRobustANGLE):
(WebCore::ExtensionsGLANGLE::getnUniformivRobustANGLE):
(WebCore::ExtensionsGLANGLE::getnUniformuivRobustANGLE):
* platform/graphics/angle/ExtensionsGLANGLE.h:
* platform/graphics/angle/GraphicsContextGLANGLE.cpp:
(WebCore::GraphicsContextGLOpenGL::readnPixels):
(WebCore::GraphicsContextGLOpenGL::readnPixelsImpl):
(WebCore::GraphicsContextGLOpenGL::getBufferSubData):
(WebCore::GraphicsContextGLOpenGL::getActiveUniforms):
(WebCore::GraphicsContextGLOpenGL::getQueryObjectui):
(WebCore::GraphicsContextGLOpenGL::getSamplerParameterf):
(WebCore::GraphicsContextGLOpenGL::getSamplerParameteri):
(WebCore::GraphicsContextGLOpenGL::getSynci):
* platform/graphics/cocoa/GraphicsContextGLIOSurfaceSwapChain.cpp: Added.
* platform/graphics/cocoa/GraphicsContextGLIOSurfaceSwapChain.h: Copied from Source/WebCore/platform/graphics/cocoa/WebGLLayer.h.
* platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
(WebCore::InitializeEGLDisplay):
(WebCore::GraphicsContextGLOpenGL::create):
(WebCore::GraphicsContextGLOpenGL::createShared):
(WebCore::GraphicsContextGLOpenGL::createForGPUProcess):
(WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL):
(WebCore::GraphicsContextGLOpenGL::~GraphicsContextGLOpenGL):
(WebCore::GraphicsContextGLOpenGL::reshapeDisplayBufferBacking):
(WebCore::GraphicsContextGLOpenGL::allocateAndBindDisplayBufferBacking):
(WebCore::GraphicsContextGLOpenGL::allowOfflineRenderers const):
(WebCore::GraphicsContextGLOpenGL::prepareForDisplay):
* platform/graphics/cocoa/RemoteGraphicsContextGLProxyBaseCocoa.mm: Added.
(WebCore::RemoteGraphicsContextGLProxyBase::platformInitialize):
(WebCore::RemoteGraphicsContextGLProxyBase::platformLayer const):
(WebCore::RemoteGraphicsContextGLProxyBase::asCV):
(WebCore::RemoteGraphicsContextGLProxyBase::platformSwapChain):
* platform/graphics/cocoa/WebGLLayer.h:
* platform/graphics/cocoa/WebGLLayer.mm:
(-[WebGLLayer initWithDevicePixelRatio:contentsOpaque:]):
(-[WebGLLayer swapChain]):
(-[WebGLLayer prepareForDisplay]):
(-[WebGLLayer display]):
(WebGLLayerSwapChain::present):
* platform/graphics/coreimage/FilterEffectRendererCoreImage.mm:
* platform/graphics/opengl/ExtensionsGLOpenGL.cpp:
(WebCore::ExtensionsGLOpenGL::blitFramebufferANGLE):
(WebCore::ExtensionsGLOpenGL::renderbufferStorageMultisampleANGLE):
(WebCore::ExtensionsGLOpenGL::drawArraysInstancedANGLE):
(WebCore::ExtensionsGLOpenGL::drawElementsInstancedANGLE):
(WebCore::ExtensionsGLOpenGL::vertexAttribDivisorANGLE):
* platform/graphics/opengl/ExtensionsGLOpenGL.h:
* platform/graphics/opengl/ExtensionsGLOpenGLCommon.cpp:
(WebCore::ExtensionsGLOpenGLCommon::readnPixelsRobustANGLE):
* platform/graphics/opengl/ExtensionsGLOpenGLCommon.h:
* platform/graphics/opengl/ExtensionsGLOpenGLES.cpp:
(WebCore::ExtensionsGLOpenGLES::blitFramebufferANGLE):
(WebCore::ExtensionsGLOpenGLES::renderbufferStorageMultisampleANGLE):
(WebCore::ExtensionsGLOpenGLES::drawArraysInstancedANGLE):
(WebCore::ExtensionsGLOpenGLES::drawElementsInstancedANGLE):
(WebCore::ExtensionsGLOpenGLES::vertexAttribDivisorANGLE):
* platform/graphics/opengl/ExtensionsGLOpenGLES.h:
* platform/graphics/opengl/GraphicsContextGLOpenGL.h:
* platform/graphics/opengl/GraphicsContextGLOpenGLCommon.cpp:
(WebCore::GraphicsContextGLOpenGL::drawArraysInstanced):
(WebCore::GraphicsContextGLOpenGL::drawElementsInstanced):
(WebCore::GraphicsContextGLOpenGL::vertexAttribDivisor):
(WebCore::GraphicsContextGLOpenGL::getBufferSubData):
(WebCore::GraphicsContextGLOpenGL::getQueryObjectui):
(WebCore::GraphicsContextGLOpenGL::getSamplerParameterf):
(WebCore::GraphicsContextGLOpenGL::getSamplerParameteri):
(WebCore::GraphicsContextGLOpenGL::getSynci):
(WebCore::GraphicsContextGLOpenGL::getActiveUniforms):
* platform/graphics/opengl/GraphicsContextGLOpenGLES.cpp:
(WebCore::GraphicsContextGLOpenGL::reshapeFBOs):

Source/WebKit:
Implement RemoteWebGLBackend
https://bugs.webkit.org/show_bug.cgi?id=217216
<rdar://problem/69876258>

Patch by Kimmo Kinnunen <kkinnunen@apple.com> on 2020-12-09
Reviewed by Simon Fraser.

Implements a beginning of a remote version of GraphicsContextGL for GPU
process. Current implementation is using WebKit IPC.

Implemented with a generator script implementing the IPC to pass the
GraphicsContextGL member function calls from web process to the GPU
process. The script is run during development time and the results are
committed to the repo for ease of review.

Implement the RemoteGraphicsContextGL in WebKit side. This class will
forward calls received via IPC to the GraphicsContextGLOpenGL. At the
moment RemoteGraphicsContextGL instance is a direct child of
GPUConnectionToWebProcess.

Compositing is implemented only for PLATFORM(COCOA).

Missing:
 - Simulated context loss
 - Simulated context change
 - Paint WebGL contents to 2D canvas
 - Upload video to WebGL
 - Upload canvas to WebGL

* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* GPUProcess/GPUConnectionToWebProcess.cpp:
(WebKit::GPUConnectionToWebProcess::createGraphicsContextGL):
(WebKit::GPUConnectionToWebProcess::releaseGraphicsContextGL):
* GPUProcess/GPUConnectionToWebProcess.h:
* GPUProcess/GPUConnectionToWebProcess.messages.in:
* GPUProcess/graphics/RemoteGraphicsContextGL.cpp: Added.
(WebKit::RemoteGraphicsContextGL::create):
(WebKit::RemoteGraphicsContextGL::RemoteGraphicsContextGL):
(WebKit::RemoteGraphicsContextGL::~RemoteGraphicsContextGL):
(WebKit::RemoteGraphicsContextGL::gpuConnectionToWebProcess const):
(WebKit::RemoteGraphicsContextGL::messageSenderConnection const):
(WebKit::RemoteGraphicsContextGL::messageSenderDestinationID const):
(WebKit::RemoteGraphicsContextGL::didComposite):
(WebKit::RemoteGraphicsContextGL::forceContextLost):
(WebKit::RemoteGraphicsContextGL::recycleContext):
(WebKit::RemoteGraphicsContextGL::dispatchContextChangedNotification):
(WebKit::RemoteGraphicsContextGL::recycleBuffer):
(WebKit::RemoteGraphicsContextGL::present):
(WebKit::RemoteGraphicsContextGL::detachClient):
(WebKit::RemoteGraphicsContextGL::reshape):
(WebKit::RemoteGraphicsContextGL::prepareForDisplay):
(WebKit::RemoteGraphicsContextGL::ensureExtensionEnabled):
(WebKit::RemoteGraphicsContextGL::notifyMarkContextChanged):
* GPUProcess/graphics/RemoteGraphicsContextGL.h: Added.
* GPUProcess/graphics/RemoteGraphicsContextGL.messages.in: Added.
* GPUProcess/graphics/RemoteGraphicsContextGLFunctionsGenerated.h: Added.
(setFailNextGPUStatusCheck):
(synthesizeGLError):
(moveErrorsToSyntheticErrorList):
(activeTexture):
(attachShader):
(bindAttribLocation):
(bindBuffer):
(bindFramebuffer):
(bindRenderbuffer):
(bindTexture):
(blendColor):
(blendEquation):
(blendEquationSeparate):
(blendFunc):
(blendFuncSeparate):
(checkFramebufferStatus):
(clear):
(clearColor):
(clearDepth):
(clearStencil):
(colorMask):
(compileShader):
(copyTexImage2D):
(copyTexSubImage2D):
(createBuffer):
(createFramebuffer):
(createProgram):
(createRenderbuffer):
(createShader):
(createTexture):
(cullFace):
(deleteBuffer):
(deleteFramebuffer):
(deleteProgram):
(deleteRenderbuffer):
(deleteShader):
(deleteTexture):
(depthFunc):
(depthMask):
(depthRange):
(detachShader):
(disable):
(disableVertexAttribArray):
(drawArrays):
(drawElements):
(enable):
(enableVertexAttribArray):
(finish):
(flush):
(framebufferRenderbuffer):
(framebufferTexture2D):
(frontFace):
(generateMipmap):
(getActiveAttrib):
(getActiveUniform):
(getAttribLocation):
(getBufferParameteri):
(getString):
(getFloatv):
(getIntegerv):
(getInteger64):
(getInteger64i):
(getProgrami):
(getBooleanv):
(getError):
(getFramebufferAttachmentParameteri):
(getProgramInfoLog):
(getRenderbufferParameteri):
(getShaderi):
(getShaderInfoLog):
(getShaderPrecisionFormat):
(getShaderSource):
(getTexParameterf):
(getTexParameteri):
(getUniformfv):
(getUniformiv):
(getUniformuiv):
(getUniformLocation):
(getVertexAttribOffset):
(hint):
(isBuffer):
(isEnabled):
(isFramebuffer):
(isProgram):
(isRenderbuffer):
(isShader):
(isTexture):
(lineWidth):
(linkProgram):
(pixelStorei):
(polygonOffset):
(renderbufferStorage):
(sampleCoverage):
(scissor):
(shaderSource):
(stencilFunc):
(stencilFuncSeparate):
(stencilMask):
(stencilMaskSeparate):
(stencilOp):
(stencilOpSeparate):
(texParameterf):
(texParameteri):
(uniform1f):
(uniform1fv):
(uniform1i):
(uniform1iv):
(uniform2f):
(uniform2fv):
(uniform2i):
(uniform2iv):
(uniform3f):
(uniform3fv):
(uniform3i):
(uniform3iv):
(uniform4f):
(uniform4fv):
(uniform4i):
(uniform4iv):
(uniformMatrix2fv):
(uniformMatrix3fv):
(uniformMatrix4fv):
(useProgram):
(validateProgram):
(vertexAttrib1f):
(vertexAttrib1fv):
(vertexAttrib2f):
(vertexAttrib2fv):
(vertexAttrib3f):
(vertexAttrib3fv):
(vertexAttrib4f):
(vertexAttrib4fv):
(vertexAttribPointer):
(viewport):
(bufferData0):
(bufferData1):
(bufferSubData):
(readnPixels0):
(readnPixels1):
(texImage2D0):
(texImage2D1):
(texSubImage2D0):
(texSubImage2D1):
(compressedTexImage2D0):
(compressedTexImage2D1):
(compressedTexSubImage2D0):
(compressedTexSubImage2D1):
(drawArraysInstanced):
(drawElementsInstanced):
(vertexAttribDivisor):
(createVertexArray):
(deleteVertexArray):
(isVertexArray):
(bindVertexArray):
(copyBufferSubData):
(getBufferSubData):
(blitFramebuffer):
(framebufferTextureLayer):
(invalidateFramebuffer):
(invalidateSubFramebuffer):
(readBuffer):
(renderbufferStorageMultisample):
(texStorage2D):
(texStorage3D):
(texImage3D0):
(texImage3D1):
(texSubImage3D0):
(texSubImage3D1):
(copyTexSubImage3D):
(compressedTexImage3D0):
(compressedTexImage3D1):
(compressedTexSubImage3D0):
(compressedTexSubImage3D1):
(getFragDataLocation):
(uniform1ui):
(uniform2ui):
(uniform3ui):
(uniform4ui):
(uniform1uiv):
(uniform2uiv):
(uniform3uiv):
(uniform4uiv):
(uniformMatrix2x3fv):
(uniformMatrix3x2fv):
(uniformMatrix2x4fv):
(uniformMatrix4x2fv):
(uniformMatrix3x4fv):
(uniformMatrix4x3fv):
(vertexAttribI4i):
(vertexAttribI4iv):
(vertexAttribI4ui):
(vertexAttribI4uiv):
(vertexAttribIPointer):
(drawRangeElements):
(drawBuffers):
(clearBufferiv):
(clearBufferuiv):
(clearBufferfv):
(clearBufferfi):
(createQuery):
(deleteQuery):
(isQuery):
(beginQuery):
(endQuery):
(getQuery):
(getQueryObjectui):
(createSampler):
(deleteSampler):
(isSampler):
(bindSampler):
(samplerParameteri):
(samplerParameterf):
(getSamplerParameterf):
(getSamplerParameteri):
(fenceSync):
(isSync):
(deleteSync):
(clientWaitSync):
(waitSync):
(getSynci):
(createTransformFeedback):
(deleteTransformFeedback):
(isTransformFeedback):
(bindTransformFeedback):
(beginTransformFeedback):
(endTransformFeedback):
(transformFeedbackVaryings):
(getTransformFeedbackVarying):
(pauseTransformFeedback):
(resumeTransformFeedback):
(bindBufferBase):
(bindBufferRange):
(getUniformIndices):
(getActiveUniforms):
(getUniformBlockIndex):
(getActiveUniformBlockName):
(uniformBlockBinding):
(getActiveUniformBlockiv):
(getGraphicsResetStatusARB):
(blitFramebufferANGLE):
(renderbufferStorageMultisampleANGLE):
(createVertexArrayOES):
(deleteVertexArrayOES):
(isVertexArrayOES):
(bindVertexArrayOES):
(getTranslatedShaderSourceANGLE):
(insertEventMarkerEXT):
(pushGroupMarkerEXT):
(popGroupMarkerEXT):
(drawBuffersEXT):
(drawArraysInstancedANGLE):
(drawElementsInstancedANGLE):
(vertexAttribDivisorANGLE):
* GPUProcess/mac/GPUProcessMac.mm:
(WebKit::GPUProcess::initializeProcess):
* GPUProcess/media/RemoteLegacyCDMProxy.h:
* GPUProcess/media/RemoteLegacyCDMSessionProxy.cpp:
* GPUProcess/media/RemoteMediaResourceManager.cpp:
* GPUProcess/media/RemoteMediaResourceManager.h:
* GPUProcess/media/RemoteMediaSourceProxy.h:
* GPUProcess/media/RemoteSourceBufferProxy.cpp:
* GPUProcess/media/RemoteSourceBufferProxy.h:
* GPUProcess/webrtc/LibWebRTCCodecsProxy.h:
* GPUProcess/webrtc/LibWebRTCCodecsProxy.mm:
* GPUProcess/webrtc/RemoteMediaRecorder.h:
* NetworkProcess/CustomProtocols/Cocoa/LegacyCustomProtocolManagerCocoa.mm:
* NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.h:
* NetworkProcess/Downloads/Download.cpp:
* NetworkProcess/Downloads/Download.h:
* NetworkProcess/Downloads/DownloadManager.cpp:
* NetworkProcess/Downloads/DownloadManager.h:
* NetworkProcess/NetworkSocketChannel.cpp:
* NetworkProcess/NetworkSocketChannel.h:
* NetworkProcess/NetworkSocketStream.cpp:
* NetworkProcess/NetworkSocketStream.h:
* NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h:
* NetworkProcess/WebSocketTask.h:
* NetworkProcess/cocoa/WebSocketTaskCocoa.h:
* NetworkProcess/cocoa/WebSocketTaskCocoa.mm:
* NetworkProcess/soup/WebSocketTaskSoup.cpp:
* NetworkProcess/soup/WebSocketTaskSoup.h:
* Platform/IPC/ArgumentCoders.h:
* Platform/IPC/ArrayReference.h: Copied from Source/WebKit/Platform/IPC/DataReference.h.
(IPC::ArrayReference::ArrayReference):
(IPC::ArrayReference::isEmpty const):
(IPC::ArrayReference::size const):
(IPC::ArrayReference::data const):
(IPC::ArrayReference::vector const):
* Platform/IPC/Connection.h:
(IPC::Connection::sendSync):
* Platform/IPC/DataReference.h:
* Platform/IPC/Decoder.cpp:
(IPC::Decoder::decodeFixedLengthReference):
* Platform/IPC/Decoder.h:
* Platform/IPC/Encoder.cpp:
(IPC::Encoder::wrapForTesting):
* Platform/IPC/Encoder.h:
* Platform/IPC/HandleMessage.h:
* Platform/IPC/MessageSender.h:
(IPC::MessageSender::sendSync):
* Platform/IPC/SharedBufferCopy.cpp:
(IPC::SharedBufferCopy::decode):
* Platform/IPC/SharedBufferDataReference.cpp:
* Platform/IPC/StringReference.cpp:
* PluginProcess/PluginControllerProxy.cpp:
* PluginProcess/PluginControllerProxy.h:
* Scripts/webkit/messages.py:
* Shared/API/APIData.cpp:
* Shared/AuxiliaryProcess.h:
* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<WebCore::GraphicsContextGLAttributes>::encode):
(IPC::ArgumentCoder<WebCore::GraphicsContextGLAttributes>::decode):
(IPC::ArgumentCoder<WebCore::GraphicsContextGL::ActiveInfo>::encode):
(IPC::ArgumentCoder<WebCore::GraphicsContextGL::ActiveInfo>::decode):
* Shared/WebCoreArgumentCoders.h:
* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode const):
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h:
* Shared/cf/ArgumentCodersCF.cpp:
* Shared/soup/WebCoreArgumentCodersSoup.cpp:
(IPC::ArgumentCoder<CertificateInfo>::encode):
(IPC::ArgumentCoder<CertificateInfo>::decode):
* Sources.txt:
* SourcesCocoa.txt:
* UIProcess/API/APIIconLoadingClient.h:
* UIProcess/AuxiliaryProcessProxy.h:
(WebKit::AuxiliaryProcessProxy::sendSync):
* UIProcess/Cocoa/SOAuthorization/SubFrameSOAuthorizationSession.h:
* UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.h:
* UIProcess/PageClient.h:
* UIProcess/UserContent/WebUserContentControllerProxy.cpp:
* UIProcess/UserContent/WebUserContentControllerProxy.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::creationParameters):
* UIProcess/WebPageProxy.h:
* UIProcess/WebURLSchemeHandler.h:
* UIProcess/WebURLSchemeTask.h:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/ApplePay/WebPaymentCoordinator.h:
* WebProcess/GPU/GPUProcessConnection.h:
* WebProcess/GPU/graphics/GraphicsContextGLIdentifier.h: Renamed from Source/WebKit/Platform/IPC/DataReference.cpp.
* WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp: Added.
(WebKit::RemoteGraphicsContextGLProxy::create):
(WebKit::RemoteGraphicsContextGLProxy::RemoteGraphicsContextGLProxy):
(WebKit::RemoteGraphicsContextGLProxy::~RemoteGraphicsContextGLProxy):
(WebKit::RemoteGraphicsContextGLProxy::messageSenderConnection const):
(WebKit::RemoteGraphicsContextGLProxy::messageSenderDestinationID const):
(WebKit::RemoteGraphicsContextGLProxy::reshape):
(WebKit::RemoteGraphicsContextGLProxy::prepareForDisplay):
(WebKit::RemoteGraphicsContextGLProxy::ensureExtensionEnabled):
(WebKit::RemoteGraphicsContextGLProxy::notifyMarkContextChanged):
(WebKit::RemoteGraphicsContextGLProxy::simulateContextChanged):
(WebKit::RemoteGraphicsContextGLProxy::paintRenderingResultsToCanvas):
(WebKit::RemoteGraphicsContextGLProxy::paintRenderingResultsToImageData):
(WebKit::RemoteGraphicsContextGLProxy::wasCreated):
(WebKit::RemoteGraphicsContextGLProxy::wasLost):
(WebKit::RemoteGraphicsContextGLProxy::wasChanged):
(WebKit::RemoteGraphicsContextGLProxy::waitUntilInitialized):
* WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h: Added.
* WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.messages.in: Copied from Source/WebKit/GPUProcess/GPUConnectionToWebProcess.messages.in.
* WebProcess/GPU/graphics/RemoteGraphicsContextGLProxyFunctionsGenerated.cpp: Added.
(WebKit::RemoteGraphicsContextGLProxy::setFailNextGPUStatusCheck):
(WebKit::RemoteGraphicsContextGLProxy::synthesizeGLError):
(WebKit::RemoteGraphicsContextGLProxy::moveErrorsToSyntheticErrorList):
(WebKit::RemoteGraphicsContextGLProxy::activeTexture):
(WebKit::RemoteGraphicsContextGLProxy::attachShader):
(WebKit::RemoteGraphicsContextGLProxy::bindAttribLocation):
(WebKit::RemoteGraphicsContextGLProxy::bindBuffer):
(WebKit::RemoteGraphicsContextGLProxy::bindFramebuffer):
(WebKit::RemoteGraphicsContextGLProxy::bindRenderbuffer):
(WebKit::RemoteGraphicsContextGLProxy::bindTexture):
(WebKit::RemoteGraphicsContextGLProxy::blendColor):
(WebKit::RemoteGraphicsContextGLProxy::blendEquation):
(WebKit::RemoteGraphicsContextGLProxy::blendEquationSeparate):
(WebKit::RemoteGraphicsContextGLProxy::blendFunc):
(WebKit::RemoteGraphicsContextGLProxy::blendFuncSeparate):
(WebKit::RemoteGraphicsContextGLProxy::checkFramebufferStatus):
(WebKit::RemoteGraphicsContextGLProxy::clear):
(WebKit::RemoteGraphicsContextGLProxy::clearColor):
(WebKit::RemoteGraphicsContextGLProxy::clearDepth):
(WebKit::RemoteGraphicsContextGLProxy::clearStencil):
(WebKit::RemoteGraphicsContextGLProxy::colorMask):
(WebKit::RemoteGraphicsContextGLProxy::compileShader):
(WebKit::RemoteGraphicsContextGLProxy::copyTexImage2D):
(WebKit::RemoteGraphicsContextGLProxy::copyTexSubImage2D):
(WebKit::RemoteGraphicsContextGLProxy::createBuffer):
(WebKit::RemoteGraphicsContextGLProxy::createFramebuffer):
(WebKit::RemoteGraphicsContextGLProxy::createProgram):
(WebKit::RemoteGraphicsContextGLProxy::createRenderbuffer):
(WebKit::RemoteGraphicsContextGLProxy::createShader):
(WebKit::RemoteGraphicsContextGLProxy::createTexture):
(WebKit::RemoteGraphicsContextGLProxy::cullFace):
(WebKit::RemoteGraphicsContextGLProxy::deleteBuffer):
(WebKit::RemoteGraphicsContextGLProxy::deleteFramebuffer):
(WebKit::RemoteGraphicsContextGLProxy::deleteProgram):
(WebKit::RemoteGraphicsContextGLProxy::deleteRenderbuffer):
(WebKit::RemoteGraphicsContextGLProxy::deleteShader):
(WebKit::RemoteGraphicsContextGLProxy::deleteTexture):
(WebKit::RemoteGraphicsContextGLProxy::depthFunc):
(WebKit::RemoteGraphicsContextGLProxy::depthMask):
(WebKit::RemoteGraphicsContextGLProxy::depthRange):
(WebKit::RemoteGraphicsContextGLProxy::detachShader):
(WebKit::RemoteGraphicsContextGLProxy::disable):
(WebKit::RemoteGraphicsContextGLProxy::disableVertexAttribArray):
(WebKit::RemoteGraphicsContextGLProxy::drawArrays):
(WebKit::RemoteGraphicsContextGLProxy::drawElements):
(WebKit::RemoteGraphicsContextGLProxy::enable):
(WebKit::RemoteGraphicsContextGLProxy::enableVertexAttribArray):
(WebKit::RemoteGraphicsContextGLProxy::finish):
(WebKit::RemoteGraphicsContextGLProxy::flush):
(WebKit::RemoteGraphicsContextGLProxy::framebufferRenderbuffer):
(WebKit::RemoteGraphicsContextGLProxy::framebufferTexture2D):
(WebKit::RemoteGraphicsContextGLProxy::frontFace):
(WebKit::RemoteGraphicsContextGLProxy::generateMipmap):
(WebKit::RemoteGraphicsContextGLProxy::getActiveAttrib):
(WebKit::RemoteGraphicsContextGLProxy::getActiveUniform):
(WebKit::RemoteGraphicsContextGLProxy::getAttribLocation):
(WebKit::RemoteGraphicsContextGLProxy::getBufferParameteri):
(WebKit::RemoteGraphicsContextGLProxy::getString):
(WebKit::RemoteGraphicsContextGLProxy::getFloatv):
(WebKit::RemoteGraphicsContextGLProxy::getIntegerv):
(WebKit::RemoteGraphicsContextGLProxy::getInteger64):
(WebKit::RemoteGraphicsContextGLProxy::getInteger64i):
(WebKit::RemoteGraphicsContextGLProxy::getProgrami):
(WebKit::RemoteGraphicsContextGLProxy::getBooleanv):
(WebKit::RemoteGraphicsContextGLProxy::getError):
(WebKit::RemoteGraphicsContextGLProxy::getFramebufferAttachmentParameteri):
(WebKit::RemoteGraphicsContextGLProxy::getProgramInfoLog):
(WebKit::RemoteGraphicsContextGLProxy::getRenderbufferParameteri):
(WebKit::RemoteGraphicsContextGLProxy::getShaderi):
(WebKit::RemoteGraphicsContextGLProxy::getShaderInfoLog):
(WebKit::RemoteGraphicsContextGLProxy::getShaderPrecisionFormat):
(WebKit::RemoteGraphicsContextGLProxy::getShaderSource):
(WebKit::RemoteGraphicsContextGLProxy::getTexParameterf):
(WebKit::RemoteGraphicsContextGLProxy::getTexParameteri):
(WebKit::RemoteGraphicsContextGLProxy::getUniformfv):
(WebKit::RemoteGraphicsContextGLProxy::getUniformiv):
(WebKit::RemoteGraphicsContextGLProxy::getUniformuiv):
(WebKit::RemoteGraphicsContextGLProxy::getUniformLocation):
(WebKit::RemoteGraphicsContextGLProxy::getVertexAttribOffset):
(WebKit::RemoteGraphicsContextGLProxy::hint):
(WebKit::RemoteGraphicsContextGLProxy::isBuffer):
(WebKit::RemoteGraphicsContextGLProxy::isEnabled):
(WebKit::RemoteGraphicsContextGLProxy::isFramebuffer):
(WebKit::RemoteGraphicsContextGLProxy::isProgram):
(WebKit::RemoteGraphicsContextGLProxy::isRenderbuffer):
(WebKit::RemoteGraphicsContextGLProxy::isShader):
(WebKit::RemoteGraphicsContextGLProxy::isTexture):
(WebKit::RemoteGraphicsContextGLProxy::lineWidth):
(WebKit::RemoteGraphicsContextGLProxy::linkProgram):
(WebKit::RemoteGraphicsContextGLProxy::pixelStorei):
(WebKit::RemoteGraphicsContextGLProxy::polygonOffset):
(WebKit::RemoteGraphicsContextGLProxy::renderbufferStorage):
(WebKit::RemoteGraphicsContextGLProxy::sampleCoverage):
(WebKit::RemoteGraphicsContextGLProxy::scissor):
(WebKit::RemoteGraphicsContextGLProxy::shaderSource):
(WebKit::RemoteGraphicsContextGLProxy::stencilFunc):
(WebKit::RemoteGraphicsContextGLProxy::stencilFuncSeparate):
(WebKit::RemoteGraphicsContextGLProxy::stencilMask):
(WebKit::RemoteGraphicsContextGLProxy::stencilMaskSeparate):
(WebKit::RemoteGraphicsContextGLProxy::stencilOp):
(WebKit::RemoteGraphicsContextGLProxy::stencilOpSeparate):
(WebKit::RemoteGraphicsContextGLProxy::texParameterf):
(WebKit::RemoteGraphicsContextGLProxy::texParameteri):
(WebKit::RemoteGraphicsContextGLProxy::uniform1f):
(WebKit::RemoteGraphicsContextGLProxy::uniform1fv):
(WebKit::RemoteGraphicsContextGLProxy::uniform1i):
(WebKit::RemoteGraphicsContextGLProxy::uniform1iv):
(WebKit::RemoteGraphicsContextGLProxy::uniform2f):
(WebKit::RemoteGraphicsContextGLProxy::uniform2fv):
(WebKit::RemoteGraphicsContextGLProxy::uniform2i):
(WebKit::RemoteGraphicsContextGLProxy::uniform2iv):
(WebKit::RemoteGraphicsContextGLProxy::uniform3f):
(WebKit::RemoteGraphicsContextGLProxy::uniform3fv):
(WebKit::RemoteGraphicsContextGLProxy::uniform3i):
(WebKit::RemoteGraphicsContextGLProxy::uniform3iv):
(WebKit::RemoteGraphicsContextGLProxy::uniform4f):
(WebKit::RemoteGraphicsContextGLProxy::uniform4fv):
(WebKit::RemoteGraphicsContextGLProxy::uniform4i):
(WebKit::RemoteGraphicsContextGLProxy::uniform4iv):
(WebKit::RemoteGraphicsContextGLProxy::uniformMatrix2fv):
(WebKit::RemoteGraphicsContextGLProxy::uniformMatrix3fv):
(WebKit::RemoteGraphicsContextGLProxy::uniformMatrix4fv):
(WebKit::RemoteGraphicsContextGLProxy::useProgram):
(WebKit::RemoteGraphicsContextGLProxy::validateProgram):
(WebKit::RemoteGraphicsContextGLProxy::vertexAttrib1f):
(WebKit::RemoteGraphicsContextGLProxy::vertexAttrib1fv):
(WebKit::RemoteGraphicsContextGLProxy::vertexAttrib2f):
(WebKit::RemoteGraphicsContextGLProxy::vertexAttrib2fv):
(WebKit::RemoteGraphicsContextGLProxy::vertexAttrib3f):
(WebKit::RemoteGraphicsContextGLProxy::vertexAttrib3fv):
(WebKit::RemoteGraphicsContextGLProxy::vertexAttrib4f):
(WebKit::RemoteGraphicsContextGLProxy::vertexAttrib4fv):
(WebKit::RemoteGraphicsContextGLProxy::vertexAttribPointer):
(WebKit::RemoteGraphicsContextGLProxy::viewport):
(WebKit::RemoteGraphicsContextGLProxy::bufferData):
(WebKit::RemoteGraphicsContextGLProxy::bufferSubData):
(WebKit::RemoteGraphicsContextGLProxy::readnPixels):
(WebKit::RemoteGraphicsContextGLProxy::texImage2D):
(WebKit::RemoteGraphicsContextGLProxy::texSubImage2D):
(WebKit::RemoteGraphicsContextGLProxy::compressedTexImage2D):
(WebKit::RemoteGraphicsContextGLProxy::compressedTexSubImage2D):
(WebKit::RemoteGraphicsContextGLProxy::drawArraysInstanced):
(WebKit::RemoteGraphicsContextGLProxy::drawElementsInstanced):
(WebKit::RemoteGraphicsContextGLProxy::vertexAttribDivisor):
(WebKit::RemoteGraphicsContextGLProxy::createVertexArray):
(WebKit::RemoteGraphicsContextGLProxy::deleteVertexArray):
(WebKit::RemoteGraphicsContextGLProxy::isVertexArray):
(WebKit::RemoteGraphicsContextGLProxy::bindVertexArray):
(WebKit::RemoteGraphicsContextGLProxy::copyBufferSubData):
(WebKit::RemoteGraphicsContextGLProxy::getBufferSubData):
(WebKit::RemoteGraphicsContextGLProxy::blitFramebuffer):
(WebKit::RemoteGraphicsContextGLProxy::framebufferTextureLayer):
(WebKit::RemoteGraphicsContextGLProxy::invalidateFramebuffer):
(WebKit::RemoteGraphicsContextGLProxy::invalidateSubFramebuffer):
(WebKit::RemoteGraphicsContextGLProxy::readBuffer):
(WebKit::RemoteGraphicsContextGLProxy::renderbufferStorageMultisample):
(WebKit::RemoteGraphicsContextGLProxy::texStorage2D):
(WebKit::RemoteGraphicsContextGLProxy::texStorage3D):
(WebKit::RemoteGraphicsContextGLProxy::texImage3D):
(WebKit::RemoteGraphicsContextGLProxy::texSubImage3D):
(WebKit::RemoteGraphicsContextGLProxy::copyTexSubImage3D):
(WebKit::RemoteGraphicsContextGLProxy::compressedTexImage3D):
(WebKit::RemoteGraphicsContextGLProxy::compressedTexSubImage3D):
(WebKit::RemoteGraphicsContextGLProxy::getFragDataLocation):
(WebKit::RemoteGraphicsContextGLProxy::uniform1ui):
(WebKit::RemoteGraphicsContextGLProxy::uniform2ui):
(WebKit::RemoteGraphicsContextGLProxy::uniform3ui):
(WebKit::RemoteGraphicsContextGLProxy::uniform4ui):
(WebKit::RemoteGraphicsContextGLProxy::uniform1uiv):
(WebKit::RemoteGraphicsContextGLProxy::uniform2uiv):
(WebKit::RemoteGraphicsContextGLProxy::uniform3uiv):
(WebKit::RemoteGraphicsContextGLProxy::uniform4uiv):
(WebKit::RemoteGraphicsContextGLProxy::uniformMatrix2x3fv):
(WebKit::RemoteGraphicsContextGLProxy::uniformMatrix3x2fv):
(WebKit::RemoteGraphicsContextGLProxy::uniformMatrix2x4fv):
(WebKit::RemoteGraphicsContextGLProxy::uniformMatrix4x2fv):
(WebKit::RemoteGraphicsContextGLProxy::uniformMatrix3x4fv):
(WebKit::RemoteGraphicsContextGLProxy::uniformMatrix4x3fv):
(WebKit::RemoteGraphicsContextGLProxy::vertexAttribI4i):
(WebKit::RemoteGraphicsContextGLProxy::vertexAttribI4iv):
(WebKit::RemoteGraphicsContextGLProxy::vertexAttribI4ui):
(WebKit::RemoteGraphicsContextGLProxy::vertexAttribI4uiv):
(WebKit::RemoteGraphicsContextGLProxy::vertexAttribIPointer):
(WebKit::RemoteGraphicsContextGLProxy::drawRangeElements):
(WebKit::RemoteGraphicsContextGLProxy::drawBuffers):
(WebKit::RemoteGraphicsContextGLProxy::clearBufferiv):
(WebKit::RemoteGraphicsContextGLProxy::clearBufferuiv):
(WebKit::RemoteGraphicsContextGLProxy::clearBufferfv):
(WebKit::RemoteGraphicsContextGLProxy::clearBufferfi):
(WebKit::RemoteGraphicsContextGLProxy::createQuery):
(WebKit::RemoteGraphicsContextGLProxy::deleteQuery):
(WebKit::RemoteGraphicsContextGLProxy::isQuery):
(WebKit::RemoteGraphicsContextGLProxy::beginQuery):
(WebKit::RemoteGraphicsContextGLProxy::endQuery):
(WebKit::RemoteGraphicsContextGLProxy::getQuery):
(WebKit::RemoteGraphicsContextGLProxy::getQueryObjectui):
(WebKit::RemoteGraphicsContextGLProxy::createSampler):
(WebKit::RemoteGraphicsContextGLProxy::deleteSampler):
(WebKit::RemoteGraphicsContextGLProxy::isSampler):
(WebKit::RemoteGraphicsContextGLProxy::bindSampler):
(WebKit::RemoteGraphicsContextGLProxy::samplerParameteri):
(WebKit::RemoteGraphicsContextGLProxy::samplerParameterf):
(WebKit::RemoteGraphicsContextGLProxy::getSamplerParameterf):
(WebKit::RemoteGraphicsContextGLProxy::getSamplerParameteri):
(WebKit::RemoteGraphicsContextGLProxy::fenceSync):
(WebKit::RemoteGraphicsContextGLProxy::isSync):
(WebKit::RemoteGraphicsContextGLProxy::deleteSync):
(WebKit::RemoteGraphicsContextGLProxy::clientWaitSync):
(WebKit::RemoteGraphicsContextGLProxy::waitSync):
(WebKit::RemoteGraphicsContextGLProxy::getSynci):
(WebKit::RemoteGraphicsContextGLProxy::createTransformFeedback):
(WebKit::RemoteGraphicsContextGLProxy::deleteTransformFeedback):
(WebKit::RemoteGraphicsContextGLProxy::isTransformFeedback):
(WebKit::RemoteGraphicsContextGLProxy::bindTransformFeedback):
(WebKit::RemoteGraphicsContextGLProxy::beginTransformFeedback):
(WebKit::RemoteGraphicsContextGLProxy::endTransformFeedback):
(WebKit::RemoteGraphicsContextGLProxy::transformFeedbackVaryings):
(WebKit::RemoteGraphicsContextGLProxy::getTransformFeedbackVarying):
(WebKit::RemoteGraphicsContextGLProxy::pauseTransformFeedback):
(WebKit::RemoteGraphicsContextGLProxy::resumeTransformFeedback):
(WebKit::RemoteGraphicsContextGLProxy::bindBufferBase):
(WebKit::RemoteGraphicsContextGLProxy::bindBufferRange):
(WebKit::RemoteGraphicsContextGLProxy::getUniformIndices):
(WebKit::RemoteGraphicsContextGLProxy::getActiveUniforms):
(WebKit::RemoteGraphicsContextGLProxy::getUniformBlockIndex):
(WebKit::RemoteGraphicsContextGLProxy::getActiveUniformBlockName):
(WebKit::RemoteGraphicsContextGLProxy::uniformBlockBinding):
(WebKit::RemoteGraphicsContextGLProxy::getActiveUniformBlockiv):
(WebKit::RemoteGraphicsContextGLProxy::getGraphicsResetStatusARB):
(WebKit::RemoteGraphicsContextGLProxy::blitFramebufferANGLE):
(WebKit::RemoteGraphicsContextGLProxy::renderbufferStorageMultisampleANGLE):
(WebKit::RemoteGraphicsContextGLProxy::createVertexArrayOES):
(WebKit::RemoteGraphicsContextGLProxy::deleteVertexArrayOES):
(WebKit::RemoteGraphicsContextGLProxy::isVertexArrayOES):
(WebKit::RemoteGraphicsContextGLProxy::bindVertexArrayOES):
(WebKit::RemoteGraphicsContextGLProxy::getTranslatedShaderSourceANGLE):
(WebKit::RemoteGraphicsContextGLProxy::insertEventMarkerEXT):
(WebKit::RemoteGraphicsContextGLProxy::pushGroupMarkerEXT):
(WebKit::RemoteGraphicsContextGLProxy::popGroupMarkerEXT):
(WebKit::RemoteGraphicsContextGLProxy::drawBuffersEXT):
(WebKit::RemoteGraphicsContextGLProxy::drawArraysInstancedANGLE):
(WebKit::RemoteGraphicsContextGLProxy::drawElementsInstancedANGLE):
(WebKit::RemoteGraphicsContextGLProxy::vertexAttribDivisorANGLE):
(WebKit::RemoteGraphicsContextGLProxy::getInternalformativ):
(WebKit::RemoteGraphicsContextGLProxy::readPixelsRobustANGLE):
(WebKit::RemoteGraphicsContextGLProxy::texParameterfvRobustANGLE):
(WebKit::RemoteGraphicsContextGLProxy::texParameterivRobustANGLE):
(WebKit::RemoteGraphicsContextGLProxy::getQueryivRobustANGLE):
(WebKit::RemoteGraphicsContextGLProxy::getQueryObjectuivRobustANGLE):
(WebKit::RemoteGraphicsContextGLProxy::getBufferPointervRobustANGLE):
(WebKit::RemoteGraphicsContextGLProxy::getInternalformativRobustANGLE):
(WebKit::RemoteGraphicsContextGLProxy::getVertexAttribIivRobustANGLE):
(WebKit::RemoteGraphicsContextGLProxy::getVertexAttribIuivRobustANGLE):
(WebKit::RemoteGraphicsContextGLProxy::getUniformuivRobustANGLE):
(WebKit::RemoteGraphicsContextGLProxy::getBufferParameteri64vRobustANGLE):
(WebKit::RemoteGraphicsContextGLProxy::samplerParameterivRobustANGLE):
(WebKit::RemoteGraphicsContextGLProxy::samplerParameterfvRobustANGLE):
(WebKit::RemoteGraphicsContextGLProxy::getSamplerParameterivRobustANGLE):
(WebKit::RemoteGraphicsContextGLProxy::getSamplerParameterfvRobustANGLE):
(WebKit::RemoteGraphicsContextGLProxy::getFramebufferParameterivRobustANGLE):
(WebKit::RemoteGraphicsContextGLProxy::getProgramInterfaceivRobustANGLE):
(WebKit::RemoteGraphicsContextGLProxy::getBooleani_vRobustANGLE):
(WebKit::RemoteGraphicsContextGLProxy::getMultisamplefvRobustANGLE):
(WebKit::RemoteGraphicsContextGLProxy::getTexLevelParameterivRobustANGLE):
(WebKit::RemoteGraphicsContextGLProxy::getTexLevelParameterfvRobustANGLE):
(WebKit::RemoteGraphicsContextGLProxy::getPointervRobustANGLERobustANGLE):
(WebKit::RemoteGraphicsContextGLProxy::getnUniformfvRobustANGLE):
(WebKit::RemoteGraphicsContextGLProxy::getnUniformivRobustANGLE):
(WebKit::RemoteGraphicsContextGLProxy::getnUniformuivRobustANGLE):
(WebKit::RemoteGraphicsContextGLProxy::texParameterIivRobustANGLE):
(WebKit::RemoteGraphicsContextGLProxy::texParameterIuivRobustANGLE):
(WebKit::RemoteGraphicsContextGLProxy::getTexParameterIivRobustANGLE):
(WebKit::RemoteGraphicsContextGLProxy::getTexParameterIuivRobustANGLE):
(WebKit::RemoteGraphicsContextGLProxy::samplerParameterIivRobustANGLE):
(WebKit::RemoteGraphicsContextGLProxy::samplerParameterIuivRobustANGLE):
(WebKit::RemoteGraphicsContextGLProxy::getSamplerParameterIivRobustANGLE):
(WebKit::RemoteGraphicsContextGLProxy::getSamplerParameterIuivRobustANGLE):
(WebKit::RemoteGraphicsContextGLProxy::getQueryObjectivRobustANGLE):
(WebKit::RemoteGraphicsContextGLProxy::getQueryObjecti64vRobustANGLE):
(WebKit::RemoteGraphicsContextGLProxy::getQueryObjectui64vRobustANGLE):
* WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
(WebKit::MediaPlayerPrivateRemote::copyVideoTextureToPlatformTexture):
* WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp:
(WebKit::RemoteAudioDestinationProxy::connectToGPUProcess):
* WebProcess/GPU/media/RemoteAudioSession.cpp:
* WebProcess/GPU/media/RemoteAudioSourceProviderManager.cpp:
* WebProcess/GPU/media/RemoteAudioSourceProviderManager.h:
* WebProcess/GPU/media/RemoteLegacyCDMSession.cpp:
* WebProcess/GPU/media/SourceBufferPrivateRemote.h:
* WebProcess/GPU/media/TextTrackPrivateRemote.h:
* WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp:
* WebProcess/GPU/webrtc/LibWebRTCCodecs.h:
* WebProcess/InjectedBundle/InjectedBundle.h:
* WebProcess/Network/NetworkProcessConnection.h:
* WebProcess/Network/WebResourceLoader.cpp:
* WebProcess/Network/WebResourceLoader.h:
* WebProcess/Network/WebSocketChannel.cpp:
* WebProcess/Network/WebSocketChannel.h:
* WebProcess/Network/WebSocketStream.cpp:
* WebProcess/Network/WebSocketStream.h:
* WebProcess/Network/webrtc/LibWebRTCSocket.h:
* WebProcess/Plugins/PDF/PDFPlugin.h:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::createGraphicsContextGL const):
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_limitsNavigationsToAppBoundDomains):
(WebKit::WebPage::updatePreferences):
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::sendSyncWithDelayedReply):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::handleEditingKeyboardEvent):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::setUseGPUProcessForWebGL):
(WebKit::WebProcess::shouldUseRemoteRenderingForWebGL const):
* WebProcess/WebProcess.h:

Tools:
Implement RemoteGraphicsContextGL
https://bugs.webkit.org/show_bug.cgi?id=217216
<rdar://problem/69876258>

Patch by Kimmo Kinnunen <kkinnunen@apple.com> on 2020-12-09
Reviewed by Simon Fraser.

Implements a remote version of GraphicsContextGL for GPU process.
Current implementation is using WebKit IPC and is incomplete.

Add the code generator to generate the implementation. Currently
the generator generates a WebKit IPC implementation.

The input definition to the generator is the proxy implementation
header files.
The output of the generator is
   - WebKit IPC message definition file
   - Message sender code
   - Message receiver and payload invocation code

The generator converts GraphicsContextGL GCGL -prefixed types to
sized IPC types.

The generator is invoked during development time and the results are
stored in the repository.

* Scripts/generate-gpup-webgl: Added.

LayoutTests:
Implement RemoteGraphicsContextGL
https://bugs.webkit.org/show_bug.cgi?id=217216
<rdar://problem/69876258>

Patch by Kimmo Kinnunen <kkinnunen@apple.com> on 2020-12-09
Reviewed by Simon Fraser.

Implements a beginning of a remote version of GraphicsContextGL for GPU
process. Current implementation is using WebKit IPC.

Adds test expectations for the missing functionality. Does not yet
enable the tests that actually pass but which were skipped before the
implementation.

* gpu-process/TestExpectations:

Canonical link: https://commits.webkit.org/232258@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@270587 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-12-09 18:32:29 +00:00
Eric Carlson 9fe30e4040 [Media in GPU Process] in-band metadata cues sometimes crash
https://bugs.webkit.org/show_bug.cgi?id=218106
<rdar://problem/70226170>

Reviewed by Jer Noble.

Source/WebCore:

No new tests, enabled existing test in the GPU process.

* platform/SerializedPlatformDataCueValue.h:
(WebCore::SerializedPlatformDataCueValue::SerializedPlatformDataCueValue):
(WebCore::SerializedPlatformDataCueValue::nativeValue const):
Make m_nativeValue a RetainPtr<> so the ownership and lifetime of the object is
explicit and managed correctly.

* platform/mac/SerializedPlatformDataCueMac.mm:
(WebCore::SerializedPlatformDataCueMac::encodableValue const): Update for change
to native value.
(WebCore::jsValueWithAVMetadataItemInContext):  Ditto.
(WebCore::NSDictionaryWithAVMetadataItem): Return a RetainPtr<NSDictionary> instead
of an auto-released dictionary.

Source/WebKit:

* Shared/mac/WebCoreArgumentCodersMac.mm:
(IPC::ArgumentCoder<WebCore::SerializedPlatformDataCueValue>::encodePlatformData):
SerializedPlatformDataCueValue::nativeValue() is a RetainPtr<>.

LayoutTests:

* gpu-process/TestExpectations: Mark test as passing.


Canonical link: https://commits.webkit.org/230845@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268939 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-23 20:19:53 +00:00
Chris Dumez 575ab456c1 WebAudio tests are crashing in debug when enabling the GPU process
https://bugs.webkit.org/show_bug.cgi?id=217663

Reviewed by Geoff Garen.

Source/WebCore:

No new tests, unskipped existing tests.

* WebCore.xcodeproj/project.pbxproj:
* platform/audio/PushPullFIFO.h:
Export PushPullFIFO so that it can be used at WebKit layer.

Source/WebKit:

WebAudio tests were crashing in debug when enabling the GPU process because it did audio
processing on the WebContent process's main thread. To address the issue, I made
RemoteAudioDestinationProxy a ThreadMessageReceiver so that it receives IPC on an audio
thread instead of the main thread. IPC messages are processed directly on the AudioWorklet
thread when active or on an audio thread constructed by RemoteAudioDestinationProxy
otherwise.

* GPUProcess/media/RemoteAudioDestinationManager.cpp:
(WebKit::RemoteAudioDestination::RemoteAudioDestination):
Use a PushPullFIFO structure in render() to avoid hanging the audio rendering thread
on a semaphore. Hanging the rendering thread was terrible for performance and was also
a source of deadlock since the underlying framework is holding a lock while render() is
called. We could process a RemoteAudioDestination::CreateAudioDestination sync IPC on the
main thread and deadlock on that lock.

* GPUProcess/webrtc/LibWebRTCCodecsProxy.h:
* GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererManager.h:
* GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.h:
* NetworkProcess/IndexedDB/WebIDBServer.h:
* NetworkProcess/webrtc/NetworkRTCProvider.h:
* WebProcess/Network/webrtc/LibWebRTCNetwork.h:
* WebProcess/cocoa/RemoteCaptureSampleManager.h:
Use ThreadMessageReceiverRefCounted instead of ThreadMessageReceiver since those classes
do not provide their own RefCounting.

* Platform/IPC/Connection.cpp:
(IPC::Connection::addWorkQueueMessageReceiver):
(IPC::Connection::removeWorkQueueMessageReceiver):
(IPC::Connection::addThreadMessageReceiver):
(IPC::Connection::removeThreadMessageReceiver):
(IPC::Connection::processIncomingMessage):
(IPC::Connection::dispatchMessageToWorkQueueReceiver):
(IPC::Connection::dispatchMessageToThreadReceiver):
* Platform/IPC/Connection.h:
(IPC::Connection::ThreadMessageReceiver::ref):
(IPC::Connection::ThreadMessageReceiver::deref):
- Add support for passing a destinationID when registering a WorkQueueMessageReceiver or a
  ThreadMessageReceiver, similarly to regular MessageReceivers. This was needed here since
  The GPUProcess sends IPC messages to the RemoteAudioDestinationProxy with a given
  destinationID and since RemoteAudioDestinationProxy is now a ThreadMessageReceiver.
- Stop having ThreadMessageReceiver subclass ThreadSafeRefCounted since
  RemoteAudioDestinationProxy already subclasses ThreadSafeRefCounted indirectly. A new
  ThreadMessageReceiverRefCounted class was added for convenience for existing code that
  relied on its refcounting.

* WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp:
(WebKit::RemoteAudioDestinationProxy::RemoteAudioDestinationProxy):
(WebKit::RemoteAudioDestinationProxy::~RemoteAudioDestinationProxy):
(WebKit::RemoteAudioDestinationProxy::start):
(WebKit::RemoteAudioDestinationProxy::stop):
(WebKit::RemoteAudioDestinationProxy::renderBuffer):
(WebKit::RemoteAudioDestinationProxy::didChangeIsPlaying):
(WebKit::RemoteAudioDestinationProxy::dispatchToThread):
* WebProcess/GPU/media/RemoteAudioDestinationProxy.h:
Use a PushPullFIFO container in render() to avoid handing the audio rendering thread on
a semaphore while the Render IPC is getting processed by the WebProcess.

Source/WTF:

* wtf/CrossThreadQueue.h:
(WTF::CrossThreadQueue<DataType>::waitForMessage):
If CrossThreadQueue::kill() gets called while another thread is waiting on a
CrossThreadQueue::waitForMessage() call, make it so that waitForMessage()
returns a default-constructed DataType instead of crashing trying to
dequeue (since the queue is empty).

LayoutTests:

Unskip webaudio tests when the GPU process is enabled.

* gpu-process/TestExpectations:


Canonical link: https://commits.webkit.org/230420@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268423 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-13 21:53:22 +00:00
Wenson Hsieh 91be6bdf64 [GPU Process] Add additional support for painting video elements to 2D contexts
https://bugs.webkit.org/show_bug.cgi?id=217532

Reviewed by Tim Horton.

Source/WebCore:

Add support for using `video` elements as sources for `createImageBitmap` and `createPattern` by ensuring that
we use display-list-backed image buffers for painting when using the GPU process for media. See below for more
details.

Tests:  fast/canvas/canvas-createPattern-video-loading.html
        fast/canvas/canvas-createPattern-video-modify.html
        imported/w3c/web-platform-tests/html/canvas/element/imagebitmap/canvas-createImageBitmap-video-resize.html
        imported/w3c/web-platform-tests/html/canvas/element/imagebitmap/createImageBitmap-drawImage.html
        imported/w3c/web-platform-tests/html/canvas/element/imagebitmap/createImageBitmap-flipY.html

* html/HTMLVideoElement.cpp:
(WebCore::HTMLVideoElement::createBufferForPainting const):
* html/HTMLVideoElement.h:

Add a helper function to create an `ImageBuffer` compatible with this video element, for the purpose of
painting video frames. In particular, if GPU process for media is enabled, we'll create a display-list-backed
remote image buffer.

* html/ImageBitmap.cpp:
(WebCore::ImageBitmap::createPromise):

Call into `HTMLVideoElement::createBufferForPainting` to construct the `ImageBuffer`.

* html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::CanvasRenderingContext2DBase::createPattern):

Call into `HTMLVideoElement::createBufferForPainting` to construct the `ImageBuffer`.

* platform/graphics/RenderingMode.h:

Add a "purpose" enum value for media painting.

* platform/graphics/displaylists/DisplayListImageBuffer.h:

Adjust this to avoid forcing the platform context to be created in the case where there are no display list
items to flush. Needed to avoid crashing when creating `CanvasPattern` with a video element.

Source/WebKit:

See WebCore/ChangeLog for more details.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::shouldUseRemoteRenderingFor):

LayoutTests:

Unskip several layout tests that pass after this change.

* gpu-process/TestExpectations:


Canonical link: https://commits.webkit.org/230324@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268299 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-09 23:39:34 +00:00