Граф коммитов

954 Коммитов

Автор SHA1 Сообщение Дата
Andrew Osmond 89415472e9 Bug 1855742 - Part 3. Allow recording based canvases with OffscreenCanvas. r=gfx-reviewers,lsalzman
It is disabled in this patch via the gfx.canvas.remote.allow-offscreen
pref. A follow up patch will enable this by default.

Differential Revision: https://phabricator.services.mozilla.com/D189532
2024-02-21 03:08:03 +00:00
Andrew Osmond 4d74abb189 Bug 1877429 - Prevent offscreen canvas2d updates from racing with compositing. r=gfx-reviewers,lsalzman
When OffscreenCanvas::CommitFrameToCompositor uses the non-remote
texture canvas path with Skia, it uses ImageBridgeChild for compositing.
When ImageContainer::SetCurrentImages is called, there was an
intermediate state where the relevant textures were not yet marked as
read only for the compositor's consumption, because the event to do so
was dispatched asynchronously to the ImageBridgeChild thread. If the
owning thread of the canvas (main or DOM worker) ran immediately after
CommitFrameToCompositor, then we could run into texture reuse since
nothing marked the texture yet as being used for compositing. This had
the end result of sometimes displaying back buffer textures currently
being used for drawing on the display pipeline.

This patch makes it so that we mark OffscreenCanvas textures as read
only for the compositor before dispatching, and releasing the lock
either when we swap the images in the ImageContainer (winning the race
with ImageBridgeChild), or after the compositor has finished with it
(losing the race, if any, with ImageBridgeChild).

Additionally, to handle better the case where we run out of buffers, we
need to implement ImageBridgeChild::SyncWithCompositor, to be analogous
to how WebRenderBridgeChild::SyncWithCompositor works. We achieve this
by calling from ImageBridgeChild back into the appropriate
WebRenderBridgeChild based on the window ID associated with the canvas,

It also adds a new pref, gfx.offscreencanvas.shared-provider, which
allows one to switch between PersistentBufferProviderShared and Basic.
The latter of which is used if we fallback from using shared buffers if
it takes too long to get the shared buffers back from the compositor.

Differential Revision: https://phabricator.services.mozilla.com/D200991
2024-02-07 20:25:52 +00:00
Lee Salzman f07311c7ab Bug 1877010 - Track forwarder transaction ids for RemoteTextureMap with WebGL and WebGPU. r=sotaro
Differential Revision: https://phabricator.services.mozilla.com/D199876
2024-01-30 15:44:04 +00:00
Andrew Osmond dab12d3ea7 Bug 1870488 - Part 3. Make OffscreenCanvas use PersistentBufferProvider on the display pipeline. r=lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D195124
2024-01-18 01:12:34 +00:00
Lee Salzman e12f705e69 Bug 1874842 - Avoid redundant transformed copies of Canvas2d path builder. r=aosmond
If a path builder is left in place after a drawing command, and then user then
sets up new transforms before beginning a new path, the old path will get spuriously
transformed every time the transform is changed, even though it will never be used.
We want to delay actually transforming the path until we need to read from it or
write to it.

Differential Revision: https://phabricator.services.mozilla.com/D198672
2024-01-17 00:18:05 +00:00
Lee Salzman 82a1a4adb6 Bug 1874666 - Reduce some unnecessary SetTransform calls. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D198524
2024-01-15 19:30:40 +00:00
Jonathan Kew 7d379bc9bd Bug 1872545 - Hoist color-font palette cache out of TextRunDrawParams to the nsPresContext or CanvasRenderingContext2D, for greater effectiveness. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D197463
2024-01-04 11:07:44 +00:00
Iulian Moraru 260831d17d Backed out changeset 21beaf6ba627 (bug 1872545) for causing windows build bustages on FontPaletteCache.cpp. CLOSED TREE 2024-01-04 01:54:01 +02:00
Jonathan Kew b3387dce2c Bug 1872545 - Hoist color-font palette cache out of TextRunDrawParams to the nsPresContext or CanvasRenderingContext2D, for greater effectiveness. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D197463
2024-01-03 22:54:10 +00:00
Cristian Tuns be4999cd86 Backed out changeset 395cc57551ec (bug 1872545) for causing build bustages in rust.mk CLOSED TREE 2024-01-03 05:14:31 -05:00
Jonathan Kew 5f8f825e05 Bug 1872545 - Hoist color-font palette cache out of TextRunDrawParams to the nsPresContext or CanvasRenderingContext2D, for greater effectiveness. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D197463
2024-01-02 13:12:29 +00:00
Narcis Beleuzu 6a84e2feb4 Backed out changeset e959df5e9484 (bug 1872545) for bustages on COLRFonts.cpp 2024-01-02 13:50:05 +02:00
Jonathan Kew 6a8e2f2bb9 Bug 1872545 - Hoist color-font palette cache out of TextRunDrawParams to the nsPresContext or CanvasRenderingContext2D, for greater effectiveness. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D197463
2024-01-02 09:52:49 +00:00
Lee Salzman c6b17dfd7e Bug 1871523 - Only error once when rendering into a canvas after shutdown. r=gfx-reviewers,ahale
EnsureTarget() is called in many places in the code without checking the result, so
in error cases, like processing path builder commands, it can lead to EnsureTarget()
generating an error to the log on every single invocation, with some users noticing
thousands upon thousands of errors being generated.

One notice of this error should be sufficient, given that this is a shutdown error.

Differential Revision: https://phabricator.services.mozilla.com/D197440
2023-12-30 05:40:54 +00:00
Andrew Osmond 458224e190 Bug 1870957 - Part 4. Refactor canvas shutdown to be synchronized with CanvasManagerChild. r=lsalzman
Because we cannot control the ordering of shutdown notification from
WorkerRef, we need to choose one centralized point to begin shutdown of
the main thread or the owning DOM worker. Since there are other objects
owned by CanvasManagerChild, we also switch to a ThreadSafeWorkerRef.

Differential Revision: https://phabricator.services.mozilla.com/D195120
2023-12-20 13:01:19 +00:00
Noemi Erli 7b97e142d0 Backed out 12 changesets (bug 1795296, bug 1855742) as requested by aosmond a=backout
Backed out changeset 05b607c3bbe6 (bug 1795296)
Backed out changeset 7704291111b4 (bug 1855742)
Backed out changeset db60743295fb (bug 1855742)
Backed out changeset 8ed51e7d1c98 (bug 1855742)
Backed out changeset 40cba2c51b1c (bug 1855742)
Backed out changeset d4bfe15c07ec (bug 1855742)
Backed out changeset 2061271c53e8 (bug 1855742)
Backed out changeset 5b2a89a61f7f (bug 1855742)
Backed out changeset 2028c7018977 (bug 1855742)
Backed out changeset 13e806495fb8 (bug 1855742)
Backed out changeset 4bfa0d4913a2 (bug 1855742)
Backed out changeset 711b3f47e380 (bug 1855742)
2023-12-19 17:25:55 +02:00
Andrew Osmond 13cc2c3b57 Bug 1855742 - Part 11. Allow recording based canvases with OffscreenCanvas. r=gfx-reviewers,lsalzman
It is disabled in this patch via the gfx.canvas.remote.allow-offscreen
pref. A follow up patch will enable this by default.

Differential Revision: https://phabricator.services.mozilla.com/D189532
2023-12-19 05:10:35 +00:00
Andrew Osmond 696dee1a1a Bug 1855742 - Part 5. Refactor canvas shutdown to be synchronized with CanvasManagerChild. r=lsalzman
Because we cannot control the ordering of shutdown notification from
WorkerRef, we need to choose one centralized point to begin shutdown of
the main thread or the owning DOM worker. Since there are other objects
owned by CanvasManagerChild, we also switch to a ThreadSafeWorkerRef.

Differential Revision: https://phabricator.services.mozilla.com/D195120
2023-12-19 05:10:33 +00:00
Lee Salzman 5b34ab7937 Bug 1829026 - Update CanvasTranslator to work with DrawTargetWebgl. r=aosmond
This adds the necessary infrastructure for CanvasTranslator to allocate DrawTargetWebgl
instead of just allocating TextureData, and to use RemoteTextureMap to handle sending
the DrawTargetWebgl frames to the compositor.

This optimizes snapshot transport to use fewer copies to and from shmems when we know
the snapshot contents can be sourced from a shmem.

This adds a blocking mechanism separate from deactivation so that existing DrawTargetWebgls
can continue processing events while denying further ones from being created in the event
that allocating further DrawTargetWebgls might cause problems, but so that we don't disrupt
canvases that are already in flight.

PersistentBufferProviderAccelerated still remains the buffer provider for the new setup,
but just allocates a single RecordedTextureData internally. Since DrawTargetWebgl already
does its own swap chain management internally, we do not want to use the multiple texture
client strategy that PersistentBufferProviderShared does.

This adds a fallback mechanism such that if DrawTargetWebgl allocation fails, a TextureData
is allocated instead that still sends results to RemoteTextureMap. This has the advantage
that we don't need to synchronously block in the content process to verify if acceleration
succeeded, as the costs of such blocking are rather extreme and we must still produce the
rendered frame to ensure the user sees the correct result if the speculative acceleration
failed. It then notifies the content process asynchronously via the refresh mechanism to
try to recreate a non-accelerated buffer provider when it is ready.

There is one additional hitch in RemoteTextureMap that we need to add a mechanism to deal
with the setup of the RemoteTextureOwner. When display list building initially needs to get
the remote texture, the RemoteTextureOwner might not exist yet. In this case, we need to add
a block to ensure we wait for that to occur so that we do not render an erroneous result.
Previously, this block was handled in ClientWebGLContext. Since that is no longer used,
the block must be reinstated somewhere else until a non-blocking mechanism for display list
building to proceed with a stub texture host wrapper can be implemented.

Currently this leaves the gfx.canvas.remote and gfx.canvas.accelerated prefs as separate
toggles rather than trying to lump everything into one mechanism. While this may be desirable
in the future, currently Direct2D remote canvas is a separate acceleration mechanism that
needs to co-exist with the WebGL acceleration, and so being able to toggle both on or off
for testing is desirable.

Differential Revision: https://phabricator.services.mozilla.com/D194352
2023-12-18 18:10:46 +00:00
Butkovits Atila fcac574890 Merge autoland to mozilla-central. a=merge 2023-12-13 23:40:45 +02:00
Sebastian Hengst 4d6a5b9742 Backed out 10 changesets (bug 1829026) for causing bug 1869760 and bug 1869738. a=backout
Backed out changeset 4c619422efe5 (bug 1829026)
Backed out changeset 77da89c7dab7 (bug 1829026)
Backed out changeset 19d28d8f75a4 (bug 1829026)
Backed out changeset 674b60ba54b1 (bug 1829026)
Backed out changeset 31935f164ef0 (bug 1829026)
Backed out changeset 13c9bf69085f (bug 1829026)
Backed out changeset 330a6732fc0b (bug 1829026)
Backed out changeset 974c08a3791b (bug 1829026)
Backed out changeset 3ba040642ddc (bug 1829026)
Backed out changeset 9d9b3a68858c (bug 1829026)
2023-12-13 19:20:00 +01:00
Tom Schuster 375c65e422 Bug 1856732 - WebExtensions should not be subject to random canvas noise for fingerprint resistance. r=timhuang,gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D195239
2023-12-13 11:33:25 +00:00
Lee Salzman 0978159170 Bug 1829026 - Update CanvasTranslator to work with DrawTargetWebgl. r=aosmond
This adds the necessary infrastructure for CanvasTranslator to allocate DrawTargetWebgl
instead of just allocating TextureData, and to use RemoteTextureMap to handle sending
the DrawTargetWebgl frames to the compositor.

This optimizes snapshot transport to use fewer copies to and from shmems when we know
the snapshot contents can be sourced from a shmem.

This adds a blocking mechanism separate from deactivation so that existing DrawTargetWebgls
can continue processing events while denying further ones from being created in the event
that allocating further DrawTargetWebgls might cause problems, but so that we don't disrupt
canvases that are already in flight.

PersistentBufferProviderAccelerated still remains the buffer provider for the new setup,
but just allocates a single RecordedTextureData internally. Since DrawTargetWebgl already
does its own swap chain management internally, we do not want to use the multiple texture
client strategy that PersistentBufferProviderShared does.

This adds a fallback mechanism such that if DrawTargetWebgl allocation fails, a TextureData
is allocated instead that still sends results to RemoteTextureMap. This has the advantage
that we don't need to synchronously block in the content process to verify if acceleration
succeeded, as the costs of such blocking are rather extreme and we must still produce the
rendered frame to ensure the user sees the correct result if the speculative acceleration
failed. It then notifies the content process asynchronously via the refresh mechanism to
try to recreate a non-accelerated buffer provider when it is ready.

There is one additional hitch in RemoteTextureMap that we need to add a mechanism to deal
with the setup of the RemoteTextureOwner. When display list building initially needs to get
the remote texture, the RemoteTextureOwner might not exist yet. In this case, we need to add
a block to ensure we wait for that to occur so that we do not render an erroneous result.
Previously, this block was handled in ClientWebGLContext. Since that is no longer used,
the block must be reinstated somewhere else until a non-blocking mechanism for display list
building to proceed with a stub texture host wrapper can be implemented.

Currently this leaves the gfx.canvas.remote and gfx.canvas.accelerated prefs as separate
toggles rather than trying to lump everything into one mechanism. While this may be desirable
in the future, currently Direct2D remote canvas is a separate acceleration mechanism that
needs to co-exist with the WebGL acceleration, and so being able to toggle both on or off
for testing is desirable.

Differential Revision: https://phabricator.services.mozilla.com/D194352
2023-12-12 07:35:03 +00:00
Stanca Serban 1cc99991d8 Backed out changeset ad72b273da7f (bug 1856732) for causing bc failures in browser_canvas_randomization.js. CLOSED TREE 2023-12-08 16:52:18 +02:00
Tom Schuster 20cc3bf2c1 Bug 1856732 - WebExtensions should not be subject to random canvas noise for fingerprint resistance. r=timhuang,gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D195239
2023-12-08 10:56:37 +00:00
Cosmin Sabou 6f5d4853e5 Backed out 8 changesets (bug 1829026) for causing several mochitest failures. CLOSED TREE
Backed out changeset 790ba6aa65e4 (bug 1829026)
Backed out changeset 2ff1f5f41380 (bug 1829026)
Backed out changeset de6ddf5eb2a7 (bug 1829026)
Backed out changeset 773e7b31ac6e (bug 1829026)
Backed out changeset e09602ab096d (bug 1829026)
Backed out changeset fe16d4ac1049 (bug 1829026)
Backed out changeset c0fe0aea86c2 (bug 1829026)
Backed out changeset 53d6f69055f1 (bug 1829026)
2023-12-05 16:08:36 +02:00
Lee Salzman ada9a43cc2 Bug 1829026 - Update CanvasTranslator to work with DrawTargetWebgl. r=aosmond
This adds the necessary infrastructure for CanvasTranslator to allocate DrawTargetWebgl
instead of just allocating TextureData, and to use RemoteTextureMap to handle sending
the DrawTargetWebgl frames to the compositor.

This optimizes snapshot transport to use fewer copies to and from shmems when we know
the snapshot contents can be sourced from a shmem.

This adds a blocking mechanism separate from deactivation so that existing DrawTargetWebgls
can continue processing events while denying further ones from being created in the event
that allocating further DrawTargetWebgls might cause problems, but so that we don't disrupt
canvases that are already in flight.

PersistentBufferProviderAccelerated still remains the buffer provider for the new setup,
but just allocates a single RecordedTextureData internally. Since DrawTargetWebgl already
does its own swap chain management internally, we do not want to use the multiple texture
client strategy that PersistentBufferProviderShared does.

This adds a fallback mechanism such that if DrawTargetWebgl allocation fails, a TextureData
is allocated instead that still sends results to RemoteTextureMap. This has the advantage
that we don't need to synchronously block in the content process to verify if acceleration
succeeded, as the costs of such blocking are rather extreme and we must still produce the
rendered frame to ensure the user sees the correct result if the speculative acceleration
failed. It then notifies the content process asynchronously via the refresh mechanism to
try to recreate a non-accelerated buffer provider when it is ready.

There is one additional hitch in RemoteTextureMap that we need to add a mechanism to deal
with the setup of the RemoteTextureOwner. When display list building initially needs to get
the remote texture, the RemoteTextureOwner might not exist yet. In this case, we need to add
a block to ensure we wait for that to occur so that we do not render an erroneous result.
Previously, this block was handled in ClientWebGLContext. Since that is no longer used,
the block must be reinstated somewhere else until a non-blocking mechanism for display list
building to proceed with a stub texture host wrapper can be implemented.

Currently this leaves the gfx.canvas.remote and gfx.canvas.accelerated prefs as separate
toggles rather than trying to lump everything into one mechanism. While this may be desirable
in the future, currently Direct2D remote canvas is a separate acceleration mechanism that
needs to co-exist with the WebGL acceleration, and so being able to toggle both on or off
for testing is desirable.

Differential Revision: https://phabricator.services.mozilla.com/D194352
2023-12-05 09:37:03 +00:00
Karl Tomlinson e01e8e4950 Bug 1863846 change VideoInfo::Rotation to non-nested enum class VideoRotation so that it can be forward declared r=aosmond,media-playback-reviewers,padenot
Differential Revision: https://phabricator.services.mozilla.com/D193163
2023-11-29 01:44:45 +00:00
Kelsey Gilbert 41ab84efb9 Bug 1864988 - Don't call CreateDataSourceSurfaceByCloning on null. r=gfx-reviewers,aosmond
Differential Revision: https://phabricator.services.mozilla.com/D194936
2023-11-29 01:27:36 +00:00
Peter Van der Beken e3989e26b1 Bug 1866220 - Force UniquePtr<…> return type for functions called from bindings for things marked as NewObject and returning a non-refcounted object. r=farre
Differential Revision: https://phabricator.services.mozilla.com/D194468
2023-11-24 10:38:18 +00:00
Tom Schuster ea0560e8fe Bug 1847990 - Canvas fingerprinting detection heuristics. r=lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D188340
2023-11-13 10:05:22 +00:00
Peter Van der Beken 44a577eec3 Bug 1849037 - Add ErrorResult to TypedArray::Create. r=necko-reviewers,extension-reviewers,media-playback-reviewers,webidl,profiler-reviewers,farre,padenot,smaug,robwu,jesup,aabh
Differential Revision: https://phabricator.services.mozilla.com/D191418
2023-11-11 08:24:05 +00:00
Stanca Serban 2685d35c49 Backed out 3 changesets (bug 1849037) for causing mochitests failures in test_gamepad_extensions.html.
Backed out changeset 27fd9f6f57ea (bug 1849037)
Backed out changeset 89aa49de2473 (bug 1849037)
Backed out changeset c336a8c78928 (bug 1849037)
2023-11-08 17:12:40 +02:00
Peter Van der Beken 2b267480e6 Bug 1849037 - Add ErrorResult to TypedArray::Create. r=necko-reviewers,extension-reviewers,media-playback-reviewers,webidl,profiler-reviewers,farre,padenot,smaug,robwu,jesup
Differential Revision: https://phabricator.services.mozilla.com/D191418
2023-11-08 11:29:05 +00:00
Emilio Cobos Álvarez aea252eda2 Bug 1857945 - Don't flush from SVGFilterObserverListForCanvasContext::OnRenderingChange. r=longsonr
Differential Revision: https://phabricator.services.mozilla.com/D191208
2023-10-18 23:12:05 +00:00
Tom Ritter 073f56f67a Bug 1852541: Do not randomize the canvas if it is one uniform pattern r=timhuang,jgilbert
Differential Revision: https://phabricator.services.mozilla.com/D188133
2023-10-11 14:56:45 +00:00
Cristian Tuns 5293640c25 Backed out 3 changesets (bug 1852541) for causing build bustages in nsRFPService.cpp CLOSED TREE
Backed out changeset 21d022246ce0 (bug 1852541)
Backed out changeset 4e369c26c1f6 (bug 1852541)
Backed out changeset 8832d7e6c0dc (bug 1852541)
2023-10-10 12:07:55 -04:00
Tom Ritter 511c8ac27c Bug 1852541: Do not randomize the canvas if it is one uniform pattern r=timhuang,jgilbert
Differential Revision: https://phabricator.services.mozilla.com/D188133
2023-10-10 15:03:52 +00:00
Robert Longson 183fe53435 Bug 1857986 - add null check for mCanvasStyle r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D190546
2023-10-10 09:26:22 +00:00
Robert Longson 80cdbb4c16 Bug 1494263 part 1 - pass filterFrames around rather than getting them again and again r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D189704
2023-10-04 20:54:13 +00:00
Iulian Moraru cb0d7ccce8 Backed out 2 changesets (bug 1852541) for causing build bustages + bc failures. CLOSED TREE
Backed out changeset 7f516f079dd4 (bug 1852541)
Backed out changeset 9dea05c869be (bug 1852541)
2023-09-26 02:27:15 +03:00
Tom Ritter ab0d4828fa Bug 1852541: Do not randomize the canvas if it is one uniform pattern r=timhuang,jgilbert
Differential Revision: https://phabricator.services.mozilla.com/D188133
2023-09-25 21:22:39 +00:00
Cosmin Sabou f9be6e64d4 Backed out 2 changesets (bug 1852541) for causing build bustages on nsRFPService.cpp. CLOSED TREE
Backed out changeset dbb5ce808936 (bug 1852541)
Backed out changeset 6dff3776d3d5 (bug 1852541)
2023-09-25 21:37:30 +03:00
Tom Ritter a77109e532 Bug 1852541: Do not randomize the canvas if it is one uniform pattern r=timhuang,jgilbert
Differential Revision: https://phabricator.services.mozilla.com/D188133
2023-09-25 18:06:13 +00:00
Andrew Osmond f475176d43 Bug 1854467 - Avoid using ExtractSubrect with OffscreenCanvas. r=gfx-reviewers,jrmuizel
With OffscreenCanvas, mCanvasElement may be null, so we need to check
for that case when deciding whether or not we need to use ExtractSubrect
when calling DrawImage.

Differential Revision: https://phabricator.services.mozilla.com/D188877
2023-09-21 21:29:30 +00:00
Peter Van der Beken 627ac90e0c Bug 1690111 - Use new TypedArray APIs for processing data. r=farre,media-playback-reviewers,padenot,chunmin,sfink
Depends on D152497

Differential Revision: https://phabricator.services.mozilla.com/D152498
2023-09-20 09:42:02 +00:00
Robert Longson 4a4ce85eea Bug 1287054 part 2 - support vw, vh, vmin and vmax units for non-CSS lengths r=emilio,jgilbert
Differential Revision: https://phabricator.services.mozilla.com/D180619
2023-09-12 21:10:55 +00:00
Robert Longson 1516885758 Bug 1287054 part 1 - support rem, ch, ic and cap units for non-CSS lengths r=emilio,jgilbert
Differential Revision: https://phabricator.services.mozilla.com/D180618
2023-09-12 21:10:54 +00:00
Andrew Osmond 42d06b7a2b Bug 1851943 - Clip coordinates correctly for source negative coordinates when drawing to canvas. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D188017
2023-09-12 20:00:24 +00:00
Sandor Molnar 212efc2d8b Backed out 2 changesets (bug 1287054) for causing wpt failures in svg/types/scripted/SVGLength-ch.html CLOSED TREE
Backed out changeset 4cca882e069d (bug 1287054)
Backed out changeset 2f48a6566514 (bug 1287054)
2023-09-12 16:02:43 +03:00