Accelerated Canvas2D and WebGL both live within the GPU process and run within
the same thread. We want to avoid any kind of readbacks from the GPU process
to the content process when doing a drawImage of a WebGL context to an AC2D
canvas.
To achieve this, we pause the AC2D recording translation with an AwaitTranslationSync
event identified by a sync-id. Then we send a request over IPDL to snapshot the
WebGL context while this pause is ongoing via a SnapshotExternalCanvas IPDL message,
which uses the sync-id to identify the snapshot safely in a table of such external
snapshots and force translation to resume. Finally, we send a ResolveExternalSnapshot
event within the recording stream to lookup the snapshot based on the sync-id and
assign it an alias that can be used within the recording stream playback for drawImage.
The sync-id mechanism acts as a sequenced fence so that multiple SnapshotExternalCanvas
requests can be encountered simultaneously from IPDL without confusing the recording
playback.
Differential Revision: https://phabricator.services.mozilla.com/D243399
This utilizes SurfaceDescriptorCanvasSurface to send canvas recording SourceSurfaces over the process
gap, so that we don't need to query data from the canvas recording, which would incur multiple syncs
and and inter-process copies.
This does have to bypass some restrictions in BlitPreventReason, since many use-cases expect WebGL
to automatically do (un)premultiply conversions when sending Canvas2D content to WebGL.
TexUnpackBlobDesc needs to be modified so that instead of just allowing dataSurf to be stored, it
can take normal sourceSurfs, which is a superset, so that recording surfaces (which are not data
surfaces) can be traded around with the SurfaceDescriptorCanvasSurface and keep them alive with
ref-counting as appropriate.
Overall, this relies on the fact that Accelerated Canvas2D and WebGL are running from the same
CanvasRender thread when AC2D is in use. In this case, by the time WebGL executes the command
to use the SurfaceDescriptorCanvasSurface, the AC2D command queue has already been processed to
produce the surface in question, so that no blocking is required.
Differential Revision: https://phabricator.services.mozilla.com/D235263
For traversing an object that wraps a RefPtr and allows setting a new (copied)
value, but only has a const getter, like Canonical<RefPtr<T>> from
StateMirroring.h and Watchable<RefPtr<T>> from StateWatching.h.
Differential Revision: https://phabricator.services.mozilla.com/D224714
This uses existing gl math to do colorSpace conversion between
predefined DOM colorSpaces (sRGB and Display P3). It does not yet
accurately read the inbound colorSpace of the image -- it just assumes
it is sRGB.
Differential Revision: https://phabricator.services.mozilla.com/D218362
This is a stub so webidl reviewers can review this without having to review
the implementation. This is not attempting to do anything with
unpackColorSpace other than ensure that it is get and set in the same
ways that are used for drawingBufferColorSpace.
Differential Revision: https://phabricator.services.mozilla.com/D214053
willReadFrequently does basically what we want for Canvas2D;
however it won't work on Windows _and_ it doesn't exist for WebGL
So we will just add our own (privileged) attribute we can set
Differential Revision: https://phabricator.services.mozilla.com/D212177
The WebGL spec never added this, and WebGL expects this to change via
drawingBufferColorSpace, so I don't think we should push for a spec
addition for .colorSpace.
Differential Revision: https://phabricator.services.mozilla.com/D217350
Adds a pref wegb.enable-egl-image which is true by default. When
enabled, we use EGL images as the preferred texture type for
out-of-process webgl and accelerated canvas on Android. In-process
webgl will never attempt to use EGL images, regardless of the value of
the pref, as we are unable to send EGL images cross-process.
Differential Revision: https://phabricator.services.mozilla.com/D211293
This is only used if the OffscreenCanvas has a webgl context, in which
case it forwards the tex type to WebGLContext::PresentFrontBuffer(). A
later patch in this series will make TexTypeForWebgl() return a
different value depending on whether the webgl context is in-process
or remote, which is something that cannot be known when the
OffscreenCanvas is initialized. This patch therefore removes the field
from OffscreenCanvas and makes WebGLContext::PresentFrontBuffer() call
TexTypeForWebgl() itself.
Differential Revision: https://phabricator.services.mozilla.com/D211289
Adds a pref wegb.enable-egl-image which is true by default. When
enabled, we use EGL images as the preferred texture type for
out-of-process webgl and accelerated canvas on Android. In-process
webgl will never attempt to use EGL images, regardless of the value of
the pref, as we are unable to send EGL images cross-process.
Differential Revision: https://phabricator.services.mozilla.com/D211293
This is only used if the OffscreenCanvas has a webgl context, in which
case it forwards the tex type to WebGLContext::PresentFrontBuffer(). A
later patch in this series will make TexTypeForWebgl() return a
different value depending on whether the webgl context is in-process
or remote, which is something that cannot be known when the
OffscreenCanvas is initialized. This patch therefore removes the field
from OffscreenCanvas and makes WebGLContext::PresentFrontBuffer() call
TexTypeForWebgl() itself.
Differential Revision: https://phabricator.services.mozilla.com/D211289
willReadFrequently does basically what we want for Canvas2D;
however it won't work on Windows _and_ it doesn't exist for WebGL
So we will just add our own (privileged) attribute we can set
Differential Revision: https://phabricator.services.mozilla.com/D212177
willReadFrequently does basically what we want for Canvas2D;
however it won't work on Windows _and_ it doesn't exist for WebGL
So we will just add our own (privileged) attribute we can set
Differential Revision: https://phabricator.services.mozilla.com/D212177