Commit graph

4665 commits

Author SHA1 Message Date
Lee Salzman
bc141685d7 Bug 1829026 - Fix checkpoint size. r=bobowen
Differential Revision: https://phabricator.services.mozilla.com/D196160
2023-12-12 12:49:05 +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
Andrew Osmond
e96409bd27 Bug 1869346 - Rework how canvas accesses shared surfaces in the compositor process. r=gfx-reviewers,lsalzman
This patch adds plumbing to allow sharing ExternalImageId via
SurfaceDescriptor. This will be used in a future patch by WebGL and
WebGPU to avoid extra copies. It also refactors how CanvasTranslator
gets a SourceSurfaceSharedDataWrapper pointer by ensuring the surfaces
are kept alive long enough even if the CompositorManagerParent actor is
destroyed before CanvasManagerParent and its children. Now we keep the
surfaces around until all of these dependent objects have been freed.

Differential Revision: https://phabricator.services.mozilla.com/D196067
2023-12-11 20:44:44 +00:00
Cristian Tuns
b2a8f52ab9 Backed out changeset 11451cccc88c (bug 1869346) for causing build bustages in ipc_message_utils.h CLOSED TREE 2023-12-11 14:36:54 -05:00
Andrew Osmond
6314ebb312 Bug 1869346 - Rework how canvas accesses shared surfaces in the compositor process. r=gfx-reviewers,lsalzman
This patch adds plumbing to allow sharing ExternalImageId via
SurfaceDescriptor. This will be used in a future patch by WebGL and
WebGPU to avoid extra copies. It also refactors how CanvasTranslator
gets a SourceSurfaceSharedDataWrapper pointer by ensuring the surfaces
are kept alive long enough even if the CompositorManagerParent actor is
destroyed before CanvasManagerParent and its children. Now we keep the
surfaces around until all of these dependent objects have been freed.

Differential Revision: https://phabricator.services.mozilla.com/D196067
2023-12-11 18:22:21 +00:00
Andrew Osmond
af2a522211 Bug 1869199 - Use namespace instead of process ID for ownership in SharedSurfacesParent. r=gfx-reviewers,lsalzman
The process IDs can be recycled by the platform, but we guarantee that
each new content process gets a new namespace ID.

Differential Revision: https://phabricator.services.mozilla.com/D195994
2023-12-11 02:05:18 +00:00
Otto Länd
0f01c0dc05 Bug 1869168: apply code formatting via Lando
# ignore-this-changeset
2023-12-10 22:48:51 +00:00
Andrew Osmond
42a9cdf826 Bug 1869168 - Part 2. Make SharedSurfacesParent::Get use CompositorManagerParent::WaitForSharedSurface. r=gfx-reviewers,lsalzman
This patch switches us from an arbitrary 50ms timeout to an IPDL based
method to force the event/IPDL queue to be flushed. We also no longer
block if we are already on the Compositor thread, because if there are
events pending to add the required surface, they will be stuck waiting
behind us.

Differential Revision: https://phabricator.services.mozilla.com/D195965
2023-12-10 22:46:06 +00:00
Andrew Osmond
a6b5391796 Bug 1869168 - Part 1. Expose CompositorManagerParent::WaitForSharedSurface to partially flush IPDL queue. r=gfx-reviewers,lsalzman
This patch reworks CompositorManagerParent to be able to:

1) Get the owning IPDL actor for a given namespace
2) Rework shutdown to be more consistent
3) Block until either the relevant shared surface is added or the actor
   is destroyed.

Differential Revision: https://phabricator.services.mozilla.com/D195964
2023-12-10 22:46:06 +00:00
Andrew Osmond
a5f0efa367 Bug 1869085 - Make CanvasManagerParent use content parent ID for recording textures. r=bobowen
Differential Revision: https://phabricator.services.mozilla.com/D195957
2023-12-09 20:16:02 +00:00
sotaro
86d050de4e Bug 1866412 - Add FenceD3D11 for wrapping ID3D11Fence r=gfx-reviewers,jrmuizel
The change is a preparation for Bug 1865984, Bug 1863474 and Bug 1861605.

FenceD3D11 is going to be used by Bug 1865984 and Bug 1863474. And FileHandleWrapper is going to be added for wrapping shared handle of ID3D11Fence and ID3D11Texture2D(Bug 1861605).

For now, FenceInfo is expected to be delivered just during creating TextureHost. It works for WebGL and WebGPU.

Differential Revision: https://phabricator.services.mozilla.com/D194612
2023-12-09 11:55:15 +00:00
Bob Owen
418567a664 Bug 1863914: Use multiple shmem buffers for remote canvas recording. r=aosmond
This replaces the use of a single large ring buffer.
The buffers are still processed in parallel and are recycled to reduce
allocation. Events that do not fit in the default sized buffer have a separate
buffer created to fit them. These large buffers are not recycled.
Separate shared memory is used for readback, with a single shmem cached for this
purpose. Generally only one cached shmem should be required, because the
operations that usually readback the data do it straight away.

Differential Revision: https://phabricator.services.mozilla.com/D193207
2023-12-08 16:11:27 +00:00
Narcis Beleuzu
cc338968d0 Backed out changeset 71b6060b6015 (bug 1863914) for causing Bug 1868934 2023-12-08 13:18:52 +02:00
Stanca Serban
b57f879b5e Backed out changeset 54e35266f616 (bug 1866412) for causing bp-nu bustages in RenderD3D11TextureHost.cpp. CLOSED TREE 2023-12-08 11:00:31 +02:00
sotaro
3e3409b160 Bug 1866412 - Add FenceD3D11 for wrapping ID3D11Fence r=gfx-reviewers,jrmuizel
The change is a preparation for Bug 1865984, Bug 1863474 and Bug 1861605.

FenceD3D11 is going to be used by Bug 1865984 and Bug 1863474. And FileHandleWrapper is going to be added for wrapping shared handle of ID3D11Fence and ID3D11Texture2D(Bug 1861605).

For now, FenceInfo is expected to be delivered just during creating TextureHost. It works for WebGL and WebGPU.

Differential Revision: https://phabricator.services.mozilla.com/D194612
2023-12-08 05:13:57 +00:00
Bob Owen
c48cc82e5c Bug 1863914: Use multiple shmem buffers for remote canvas recording. r=aosmond
This replaces the use of a single large ring buffer.
The buffers are still processed in parallel and are recycled to reduce
allocation. Events that do not fit in the default sized buffer have a separate
buffer created to fit them. These large buffers are not recycled.
Separate shared memory is used for readback, with a single shmem cached for this
purpose. Generally only one cached shmem should be required, because the
operations that usually readback the data do it straight away.

Differential Revision: https://phabricator.services.mozilla.com/D193207
2023-12-07 17:27:24 +00:00
Andrew Osmond
ec51df1bde Bug 1868397 - Make WebGL use VideoBridge to avoid copies with GPUVideoImage. r=jgilbert
This patch makes it so that WebGL that runs in the compositor process
can take advantage of the fact that GPUVideoImage should have an already
created TextureHost between the compositor process and the producing
utility process. For software decoders, this will allow us to avoid a
copy into a shmem from the utility process, and another copy into a
shmem to the compositor process.

Differential Revision: https://phabricator.services.mozilla.com/D195559
2023-12-06 19:31:32 +00:00
Andrew Osmond
8fa44d23a8 Bug 1868396 - Part 2. Add plumbing to VideoBridge to allow off Compositor thread access to textures. r=gfx-reviewers,lsalzman
Depends on D195557

Differential Revision: https://phabricator.services.mozilla.com/D195558
2023-12-05 16:25:52 +00:00
Andrew Osmond
ab80481870 Bug 1868396 - Part 1. Rework VideoBridgeParent shutdown to close explicitly. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D195557
2023-12-05 16:25:52 +00:00
Andrew Osmond
fa0605af64 Bug 1854669. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D194537
2023-12-05 15:23: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
Hiroyuki Ikezoe
7f283c3839 Bug 1715179 - Propagate transform matrix and relevant zoom values to convert CSSRect/CSSPoint in OOPIF to top level content document cooords. r=botond
Depends on D186324

Differential Revision: https://phabricator.services.mozilla.com/D186325
2023-12-04 09:31:23 +00:00
Hiroyuki Ikezoe
f89be3e0e6 Bug 1715179 - Propagate VisualViewport rect and the root scrollable rect and use them on the main-thread. r=botond
Depends on D186323

Differential Revision: https://phabricator.services.mozilla.com/D186324
2023-12-04 09:31:22 +00:00
Stanca Serban
2b58cc84d0 Backed out 5 changesets (bug 1715179) for causing mochitests failures in test_group_double_tap_zoom-2.html. CLOSED TREE
Backed out changeset 600afc2dc0ca (bug 1715179)
Backed out changeset 75c2c7f6230e (bug 1715179)
Backed out changeset b851e0aff383 (bug 1715179)
Backed out changeset 0acfcbbdf460 (bug 1715179)
Backed out changeset b0c83c964ccf (bug 1715179)
2023-11-28 18:45:32 +02:00
Hiroyuki Ikezoe
ed4976ed3c Bug 1715179 - Propagate transform matrix and relevant zoom values to convert CSSRect/CSSPoint in OOPIF to top level content document cooords. r=botond
Depends on D186324

Differential Revision: https://phabricator.services.mozilla.com/D186325
2023-11-28 09:42:22 +00:00
Hiroyuki Ikezoe
b2f944eea1 Bug 1715179 - Propagate VisualViewport rect and the root scrollable rect and use them on the main-thread. r=botond
Depends on D186323

Differential Revision: https://phabricator.services.mozilla.com/D186324
2023-11-28 09:42:21 +00:00
Karl Tomlinson
7ac9b7561d Bug 1863846 convert MediaInfo::Rotation to WrRotation before creating a WebRender command r=aosmond
This adds some separation between MediaInfo.h and WebRender, avoiding the
include of MediaInfo.h in WebRenderMessages.h.

Depends on D193161

Differential Revision: https://phabricator.services.mozilla.com/D193162
2023-11-27 19:40:47 +00:00
Natalia Csoregi
00e5d5a924 Backed out changeset 2b56c2b2837a (bug 1863914) for causing bustage on CanvasDrawEventRecorder.h. CLOSED TREE 2023-11-22 16:31:15 +02:00
Bob Owen
818e1b42b7 Bug 1863914: Use multiple shmem buffers for remote canvas recording. r=aosmond
This replaces the use of a single large ring buffer.
The buffers are still processed in parallel and are recycled to reduce
allocation. Events that do not fit in the default sized buffer have a separate
buffer created to fit them. These large buffers are not recycled.
Separate shared memory is used for readback, with a single shmem cached for this
purpose. Generally only one cached shmem should be required, because the
operations that usually readback the data do it straight away.

Differential Revision: https://phabricator.services.mozilla.com/D193207
2023-11-22 11:52:08 +00:00
sotaro
55a951769f Bug 1865426 - Enable uploading to NV12 ID3D11Texture2D with WebRender(Software D3D11) r=gfx-reviewers,lsalzman
With the change, yuv BufferTexture is uploaded to D3D11 NV12 texture also if webrender supports D3D11 and NV12.

Calling GpuProcessD3D11TextureMap::GetTexture() is changed from RenderDXGITextureHost::EnsureD3D11Texture2DWithGL() to RenderDXGITextureHost::EnsureD3D11Texture2D(), since the EnsureD3D11Texture2DWithGL() is not called with WebRender(Software D3D11).

Differential Revision: https://phabricator.services.mozilla.com/D194171
2023-11-21 10:45:34 +00:00
Hiroyuki Ikezoe
150dbc6970 Bug 1856088 - Handle scroll anchor adjustments as an absolute scroll position updates behind a pref. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D190888
2023-10-25 05:55:26 +00:00
Andrew Osmond
1735eca794 Bug 1860677 - Do not create task queue for CanvasTranslator if not using workers. r=gfx-reviewers,lsalzman
The task queue makes NS_DECL_OWNINGEVENTTARGET confusing for single
threaded uses, when the canvas expects it can just dispatch to the
CanvasRenderThread directly.

Differential Revision: https://phabricator.services.mozilla.com/D191697
2023-10-24 12:43:37 +00:00
Jesse Schwartzentruber
940ca37879 Bug 1860594 - Add nullptr checks in CanvasTranslator. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D191660
2023-10-23 21:30:13 +00:00
Sylvestre Ledru
d0f6c7fc66 Bug 1856795 - Remove redundant member init r=emilio
Done with:
./mach static-analysis check --checks="-*, readability-redundant-member-init" --fix .

https://clang.llvm.org/extra/clang-tidy/checks/readability/redundant-member-init.html

Differential Revision: https://phabricator.services.mozilla.com/D190002
2023-10-15 15:29:02 +00:00
Cristina Horotan
6a90f5eded Backed out 2 changesets (bug 1856795) for causing build bustage at BasicEvents.h CLOSED TREE
Backed out changeset 1d98b028923a (bug 1856795)
Backed out changeset eae2ac93e17c (bug 1856795)
2023-10-14 21:42:14 +03:00
Sylvestre Ledru
cc8a0ee742 Bug 1856795 - Remove redundant member init r=emilio
Done with:
./mach static-analysis check --checks="-*, readability-redundant-member-init" --fix .

https://clang.llvm.org/extra/clang-tidy/checks/readability/redundant-member-init.html

Differential Revision: https://phabricator.services.mozilla.com/D190002
2023-10-14 17:34:26 +00:00
Emilio Cobos Álvarez
25c0d10932 Bug 1624819 - Remove TaskCategory and other quantum dom remnants. r=smaug,media-playback-reviewers,credential-management-reviewers,cookie-reviewers,places-reviewers,win-reviewers,valentin,mhowell,sgalich,alwu
Sorry this is not a particularly easy patch to review. But it should be
mostly straight-forward.

I kept Document::Dispatch mostly for convenience, but could be
cleaned-up too / changed by SchedulerGroup::Dispatch. Similarly maybe
that can just be NS_DispatchToMainThread if we add an NS_IsMainThread
check there or something (to preserve shutdown semantics).

Differential Revision: https://phabricator.services.mozilla.com/D190450
2023-10-10 08:51:12 +00:00
Botond Ballo
3cf823a745 Bug 1777416 - Avoid GetStateForRoot() incorrectly returning a non-root LayerTreeState. r=hiro
In the case where the LayerTreeState for the input content LayersID
was found, but its mParent was null for some reason, the function
was incorrectly returning the content LayerTreeState.

Instead, in such a case, where the root LayerTreeState cannot be
looked up, the function should return null.

Differential Revision: https://phabricator.services.mozilla.com/D190143
2023-10-05 05:46:02 +00:00
sotaro
ab881cf89b Bug 1856520 - Set DXGI_SWAP_CHAIN_FLAG_DISPLAY_ONLY to Video swap chain of video overlay when video is DRM protected on Windows r=gfx-reviewers,lsalzman
DRM info is delivered from SharedPlanarYCbCrImage to DCSurfaceVideo

Differential Revision: https://phabricator.services.mozilla.com/D190141
2023-10-05 03:43:01 +00:00
sotaro
9d4503313f Bug 1855277 - Add a capability to upload yuv video to NV12 ID3D11Texture2D at WebRenderImageHost on Windows r=gfx-reviewers,lsalzman
TextureHostWrapperD3D11 is created in WebRenderImageHost::GetAsTextureHostForComposite() if possible. TextureHostWrapperD3D11 usage could reduce ID3D11Texture2D usage compared to Bug 1753373. And its usage adds video overlay support of DRM protected video.

The TextureHostWrapperD3D11 wraps YUV BufferTextureHost and instead exposes DXGITextureHostD3D11 to WebRender. The DXGITextureHostD3D11 holds GpuProcessTextureId of ID3D11Texture2D. The ID3D11Texture2D is allocated and data updated in TextureUpdate thread.

If the ID3D11Texture2D is not ready, a wait happened by calling GpuProcessD3D11TextureMap::WaitTextureReady() in Render thread.

Differential Revision: https://phabricator.services.mozilla.com/D189882
2023-10-04 02:08:40 +00:00
Cosmin Sabou
9ca5a22ccf Backed out changeset 2dbe440f2e2c (bug 1855277) for causing non-unified bustages on GpuProcessD3D11TextureMap.cpp. CLOSED TREE 2023-10-03 23:04:42 +03:00
sotaro
75cc639421 Bug 1855277 - Add a capability to upload yuv video to NV12 ID3D11Texture2D at WebRenderImageHost on Windows r=gfx-reviewers,lsalzman
TextureHostWrapperD3D11 is created in WebRenderImageHost::GetAsTextureHostForComposite() if possible.  TextureHostWrapperD3D11 usage could reduce ID3D11Texture2D usage compared to  Bug 1753373. And  its usage adds video overlay support of DRM protected video.

The TextureHostWrapperD3D11 wraps YUV BufferTextureHost and instead exposes DXGITextureHostD3D11 to WebRender. The DXGITextureHostD3D11 holds GpuProcessTextureId of ID3D11Texture2D. The ID3D11Texture2D is allocated and data updated in TextureUpdate thread.

If the ID3D11Texture2D is not ready, a wait happened by calling GpuProcessD3D11TextureMap::WaitTextureReady() in Render thread.

Differential Revision: https://phabricator.services.mozilla.com/D189882
2023-10-03 18:52:06 +00:00
Andrew Osmond
d438fd5bd3 Bug 1852145 - Part 3. Make PCanvasManager manage PCanvas. r=gfx-reviewers,lsalzman
This patch makes the PCanvasManager protocol manage the PCanvas
protocol. This allows us to share a top level protocol and message
channel, as well as use the same thread as we need for WebGL. This will
allow future patches to do record/replay for WebGL, particularly for
configurations that do not support threadsafe GL.

Differential Revision: https://phabricator.services.mozilla.com/D187721
2023-09-25 16:18:36 +00:00
Andrew Osmond
f1d22fb2f1 Bug 1852145 - Part 1. Refactor CanvasRenderThread to represent a virtual thread. r=gfx-reviewers,lsalzman
Prior to this patch, CanvasRenderThread represents the concrete thread
we would spawn if gfxVars::UseCanvasRenderThread() returned true.
CanvasManagerParent was responsible for checking our state and deciding
between using the Compositor, Renderer and CanvasRender threads.

This patch makes the CanvasRenderThread class represent a virtual
thread. It will spawn a CanvasRender thread if necessary. Other classes
may use the abstraction to run on the correct thread without having to
duplicate the selection logic.

Differential Revision: https://phabricator.services.mozilla.com/D187719
2023-09-25 16:18:35 +00:00
Andrew Osmond
620833163a Bug 1852144 - Disable remote canvas globally in case of unrecoverable error. r=gfx-reviewers,lsalzman
This patch makes the remote canvas enabled state global. If we failed to
create a context, then it cannot recover, so we should never try again.
In the event of stream errors, it is likely due to virtual memory
shortages.

Differential Revision: https://phabricator.services.mozilla.com/D187718
2023-09-25 16:18:35 +00:00
Hiroyuki Ikezoe
0841d615c2 Bug 1768393 - Add the snap area into ScrollSnapRange. r=botond
We could avoid adding the snap area into ScrollSnapRange if we added two
additional flags representing whether the snap area size is larger than the
snapport into SnapTarget and drop ScrollSnapRange entirely. But it would
be inefficient in most cases since such larger snap area cases are uncommon, we
will not find any larger snap areas while iterating over
ScrollSnapInfo::mSnapTargets.

Differential Revision: https://phabricator.services.mozilla.com/D184340
2023-09-12 01:33:19 +00:00
Hiroyuki Ikezoe
a871c68b32 Bug 1768393 - Introduce SnapPoint to wrap a pair of Maybe<nscoord>. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D184337
2023-09-12 01:33:18 +00:00
Hiroyuki Ikezoe
3b13152733 Bug 1768393 - Split out ScrollSnapInfo. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D184333
2023-09-12 01:33:17 +00:00
Bob Owen
a056e205c2 Bug 1851636: Don't create a new buffer if we fail to process the drop buffer event. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D187558
2023-09-06 16:37:56 +00:00
Bob Owen
c1c73dc306 Bug 1846686: Remove DataSourceSurfaces when adding SourceSurfaces to CanvasTranslator. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D186171
2023-09-03 10:49:49 +00:00
Emilio Cobos Álvarez
c7d8e549f3 Bug 1848357 - Cleanup layer observer handling. r=mconley,gfx-reviewers,bradwerth
This seems to work, and turns out I need to fix this before bug 1847584,
because the epoch handling breaks with those patches in the case
customize mode sets display: none on browser elements.

Instead of dealing with epochs, just always report the last "has layers"
state to BrowserParent. This is both simpler and more reliable (there
were a couple hacks in WebRenderBridgeParent to make sure we notified
even though a transaction failed).

AsyncTabSwitcher pretty much already deals with this correctly because
it already needs to deal with browsers that already have layers, we only
had to loosen some assertions for potentially previous messages which
are fine.

Differential Revision: https://phabricator.services.mozilla.com/D187203
2023-09-01 17:09:27 +00:00
Bob Owen
6724c55c52 Bug 1841891: Only use a larger canvas ring buffer when in the foreground. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D186544
2023-08-29 19:17:45 +00:00
Bob Owen
d9ca68fb6b Bug 1846687: Don't allow CanvasTranslator to be initialized twice. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D185548
2023-08-10 08:31:24 +00:00
sotaro
2cae2b6402 Bug 1847665 - Reduce SyncObjectD3D11Host::Synchronize() call in RenderCompositorANGLE::BeginFrame() r=gfx-reviewers,lsalzman
SyncObjectD3D11Host::Synchronize() could spend time when GPU is busy.
The Synchronize() call is not necessary when all RenderDXGITextureHosts have GpuProcessTextureId or KeyedMutex.

Differential Revision: https://phabricator.services.mozilla.com/D185619
2023-08-08 04:50:54 +00:00
Randell Jesup
56d24176a5 Bug 1841936: add a CreateAPZCTreeManager() method r=dlrobertson
Differential Revision: https://phabricator.services.mozilla.com/D182919
2023-07-07 03:34:17 +00:00
Norisz Fay
d3ea4f2f3f Backed out changeset adab0b54bd33 (bug 1841936) for causing bustages on APZTestCommon.h CLOSED TREE 2023-07-07 02:13:46 +03:00
Randell Jesup
b18cc2bacc Bug 1841936: add a CreateAPZCTreeManager() method r=dlrobertson
Differential Revision: https://phabricator.services.mozilla.com/D182919
2023-07-06 22:03:35 +00:00
sotaro
c5cba984e2 Bug 1839235 - Protect VideoBridgeChild's singleton with a StaticMutex r=lsalzman
Protect  sVideoBridge like ImageBridgeChild::GetSingleton() to avoid race condition.

Differential Revision: https://phabricator.services.mozilla.com/D181844
2023-07-06 00:09:03 +00:00
Boris Chiou
3523b747c5 Bug 1598156 - Part 8: Support Compositor animations for all basic shapes. r=emilio,hiro
This patch sends the information of border-radius to the compositor as
well, so we can use it if offset-path uses coord-box only.

Note:
We repaint the frame if border-radius property gets changed, and rebuild
the display item. In this case, we resend the transaction of compositor
animation as well. Therefore, we don't have to block the compositor animations
if they depends on border-radius (i.e. use coord-box only).

We may need a better way to check what should we pass to the compositor,
for motion path, in Bug 1838977.

Differential Revision: https://phabricator.services.mozilla.com/D179631
2023-06-26 23:23:55 +00:00
Boris Chiou
dfd2e54386 Bug 1598156 - Part 3: Remove RayReferenceData. r=emilio
I'd like to reuse the data in RayReferenceData for all basic shapes,
so unpack RayReferenceData and drop this struct.

Also, use `nsPoint` for the current position and use `nsRect` for coord-box
because we use these types (i.e. app units) in ShapeUtils.

Besides, remove the usage of Maybe from nsStyleTransformMatrix.h and
just accept the pointer of ResolvedMotionPathData to avoid including
the entire header.

No behavior change.

Differential Revision: https://phabricator.services.mozilla.com/D181008
2023-06-26 23:23:54 +00:00
Timothy Nikkel
cb5dd67397 Bug 1839109. Don't send animated image updates to throttled refresh drivers. r=gfx-reviewers,bradwerth
The patch for bug 1830753 stops these for CompositorBridgeChild's that are recorded as paused. That fixes the problem for animated images that are in the top level chrome document, but doesn't fix the problem for images in a content tab because the CompositorBridgeChild in the content process is not aware the compositor is paused. So instead we check the throttled state of the refresh driver. Since we only have access to the layer manager at this point it is a bit of a trip to get the refresh driver but very possible.

Differential Revision: https://phabricator.services.mozilla.com/D181353
2023-06-21 05:17:45 +00:00
Jeff Muizelaar
066cf0ea29 Bug 1838762 - Use a uint8_t for EventType. r=lsalzman
This reduces the serialization size a little.

Differential Revision: https://phabricator.services.mozilla.com/D181177
2023-06-17 03:06:29 +00:00
Timothy Nikkel
b6234f57f4 Bug 1830753. Don't send animated image updates to paused compositors. r=bradwerth,gfx-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D179393
2023-06-12 23:36:53 +00:00
Boris Chiou
887d4b5da8 Bug 1820070 - Part 4: Send offset-position to the compositor. r=emilio
We send offset-position to the compositor, just like other similar
properties, e.g. offset-rotate, offset-anchor. This includes extracting
this animation value, doing serialization and sending it via IPC.

So now we can run the animation of ray() on the compositor properly.

Differential Revision: https://phabricator.services.mozilla.com/D179862
2023-06-06 21:40:52 +00:00
Mike Hommey
1903893346 Bug 1836890 - Remove uses of chromium's OS_* macros in Gecko code. r=nika,media-playback-reviewers,keeler,gfx-reviewers,emilio,necko-reviewers,kershaw,karlt,jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D180039
2023-06-06 20:00:47 +00:00
Kelsey Gilbert
9e95322526 Bug 1836410 - Break ref cycle by s/RefPtr/WeakPtr/<CanvasClient> in RingBufferWriterServices. r=bobowen
Cycle is:
CanvasClient
->CanvasDrawEventRecorder
->CanvasEventRingBuffer
->RingBufferWriterServices
->CanvasClient

Differential Revision: https://phabricator.services.mozilla.com/D179749
2023-06-05 17:53:17 +00:00
Jens Stutte
669b302e69 Bug 1789811 - Move ReentrantMonitorAutoEnter close to the monitor usage in SynchronousTask. r=bradwerth
Differential Revision: https://phabricator.services.mozilla.com/D179807
2023-06-05 08:03:14 +00:00
sotaro
111037957d Bug 1835984 - Add Add KnowsCompositor::SupportsD3D11NV12() r=gfx-reviewers,lsalzman
DeviceManagerDx::Get()->CanUseNV12() needs D3D11Device in current process. The SupportsD3D11NV12() could be used without D3D11Device in current process.

It is preparation for Bug 1834039.

Differential Revision: https://phabricator.services.mozilla.com/D179532
2023-05-31 17:05:16 +00:00
Nika Layzell
2f2588cf4f Bug 1828389 - Ensure IPC channel is closed with error after KillHard, r=ipc-reviewers,mccr8
This patch changes KillHard() such that the IPC channel is immediately
shut down with an error after a KillHard() is performed. This is done by
fixing the previously-broken CLOSE_CHANNEL_WITH_ERROR support in
ShutDownProcess, and calling that method after KillHard().

This ensures that after the process has been killed, no further messages
will be delivered and processed, even if they were sent before the
process was killed.

In addition, the assertions and KillHard calls which are disabled for
fuzzing were changed to also shut down the channel, making fuzzing IPC
errors cause the connection to be terminated like it is in production
for these actors.

This change does not impact actors which ignore processing errors.

Differential Revision: https://phabricator.services.mozilla.com/D178383
2023-05-26 17:44:57 +00:00
Stanca Serban
0d97343733 Backed out 2 changesets (bug 1807049, bug 1828389) for mozilla::ThreadEventTarget::Dispatch xpcshell related crashes. CLOSED TREE
Backed out changeset bbd8b8bbf677 (bug 1828389)
Backed out changeset 03bd5f26f9af (bug 1807049)
2023-05-20 07:38:09 +03:00
Nika Layzell
c3ca248eeb Bug 1828389 - Ensure IPC channel is closed with error after KillHard, r=ipc-reviewers,mccr8
This patch changes KillHard() such that the IPC channel is immediately
shut down with an error after a KillHard() is performed. This is done by
fixing the previously-broken CLOSE_CHANNEL_WITH_ERROR support in
ShutDownProcess, and calling that method after KillHard().

This ensures that after the process has been killed, no further messages
will be delivered and processed, even if they were sent before the
process was killed.

In addition, the assertions and KillHard calls which are disabled for
fuzzing were changed to also shut down the channel, making fuzzing IPC
errors cause the connection to be terminated like it is in production
for these actors.

This change does not impact actors which ignore processing errors.

Differential Revision: https://phabricator.services.mozilla.com/D178383
2023-05-19 19:21:08 +00:00
sotaro
f38eea44fe Bug 1827340 - Update WebRender settings only from root WebRenderBridgeParent r=lsalzman
WebRenderAPI::UpdateDebugFlags() call from non-root WebRenderBridgeParent is not necessary.

Differential Revision: https://phabricator.services.mozilla.com/D177454
2023-05-12 00:53:27 +00:00
Jamie Nicol
ba52b0e1e3 Bug 1824083 - Request new Surface from application when resuming compositor fails on Android. r=gfx-reviewers,geckoview-reviewers,nical,m_kato
We see a fair number of crashes caused by failing to create an EGL
surface when resuming the compositor on Android. We believe that in
the vast majority of these cases the Surface we have been provided by
the OS is in an invalid state, and therefore we will never succeed in
creating an EGL surface from it.

Currently when creating the EGL surface fails we raise a NEW_SURFACE
webrender error. This causes us to fall back through webrender
configurations, reinitialize the compositors, and eventually crash
when we are still unable to resume. None of this will help when the
Android Surface we have been provided is in this invalid state.

This patch therefore avoids raising the webrender error initially, and
instead gives the widget an opportunity to handle the failure. The
widget uses the new GeckoView API added in the previous patch in this
series to request a new Surface from the application. This will cause
another resume event immediately afterwards with a new - and hopefully
valid - surface, allowing the EGL surface to be created and the
compositor to be successfully resumed. If we are still unable to
create an EGL surface after this, then we will raise the webrender
error as before, likely eventually resulting in a crash.

Differential Revision: https://phabricator.services.mozilla.com/D176721
2023-05-10 15:50:22 +00:00
Sandor Molnar
84e52573e7 Backed out 4 changesets (bug 1824083) for causing build bustages in include/mozilla/webrender/RenderCompositorOGLSWGL.h CLOSED TREE
Backed out changeset 7c1be037e345 (bug 1824083)
Backed out changeset bf5c5929ef7b (bug 1824083)
Backed out changeset 6fad491b84be (bug 1824083)
Backed out changeset 57ae9c87c467 (bug 1824083)
2023-05-10 18:01:13 +03:00
Jamie Nicol
d3fb4b5d33 Bug 1824083 - Request new Surface from application when resuming compositor fails on Android. r=gfx-reviewers,geckoview-reviewers,nical,m_kato
We see a fair number of crashes caused by failing to create an EGL
surface when resuming the compositor on Android. We believe that in
the vast majority of these cases the Surface we have been provided by
the OS is in an invalid state, and therefore we will never succeed in
creating an EGL surface from it.

Currently when creating the EGL surface fails we raise a NEW_SURFACE
webrender error. This causes us to fall back through webrender
configurations, reinitialize the compositors, and eventually crash
when we are still unable to resume. None of this will help when the
Android Surface we have been provided is in this invalid state.

This patch therefore avoids raising the webrender error initially, and
instead gives the widget an opportunity to handle the failure. The
widget uses the new GeckoView API added in the previous patch in this
series to request a new Surface from the application. This will cause
another resume event immediately afterwards with a new - and hopefully
valid - surface, allowing the EGL surface to be created and the
compositor to be successfully resumed. If we are still unable to
create an EGL surface after this, then we will raise the webrender
error as before, likely eventually resulting in a crash.

Differential Revision: https://phabricator.services.mozilla.com/D176721
2023-05-10 14:44:50 +00:00
Dan Robertson
3e22d70394 Bug 1774875 - Immediately fire click events for non-scrollable elements. r=botond,geckoview-reviewers,m_kato
Non-scrollable elements are immediately activated on touch-start, so it
is not necessary to delay firing the synthesized mouse and click events.

Differential Revision: https://phabricator.services.mozilla.com/D169727
2023-04-20 13:26:25 +00:00
Nika Layzell
955b2aeaef Bug 1824465 - Part 13: Make PVideoBridge refcounted, r=ipc-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D173728
2023-04-19 22:10:09 +00:00
Nika Layzell
65fcf6d598 Bug 1824465 - Part 12: Make PUICompositorController refcounted, r=ipc-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D173727
2023-04-19 22:10:09 +00:00
Nika Layzell
b6c54cb5d6 Bug 1824465 - Part 11: Make PImageBridge refcounted, r=ipc-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D173726
2023-04-19 22:10:09 +00:00
Nika Layzell
4f2755434a Bug 1824465 - Part 10: Make PCompositorManager refcounted, r=ipc-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D173725
2023-04-19 22:10:08 +00:00
sotaro
62a86ac73d Bug 1828088 - Handle wait of async RemoteTexture at WebRenderAPI r=gfx-reviewers,lsalzman
In current m-c, async RemoteTexture wait at RenderThread stops window update when the wait is too long. If async RemoteTexture is handled by WebRenderAPI, window could be updated during long async RemoteTexture wait.

async RemoteTexture wait of root WebRenderBridgeParent are disabled to simplify WebRenderAPI's wait handling.

offscreen canvas case is handled by WebRenderImageHost by Bug 1827578.

Differential Revision: https://phabricator.services.mozilla.com/D175590
2023-04-18 20:38:20 +00:00
Cristian Tuns
f65f34399a Backed out 2 changesets (bug 1753565) for causing bc failures in browser_proton_moreTools_panel.js CLOSED TREE
Backed out changeset 817b0cf1e4e0 (bug 1753565)
Backed out changeset 947534ff1319 (bug 1753565)
2023-04-18 02:03:20 -04:00
Dan Robertson
e4776501d3 Bug 1753565 - Disable smooth scrolls if prefers-reduced-motion. r=botond
If the user has the prefers-reduced-motion system setting enabled, do
not enable smooth scrolls.

Differential Revision: https://phabricator.services.mozilla.com/D172446
2023-04-18 04:11:10 +00:00
Bob Owen
85d921c123 Bug 1825169: Process off main thread deletions in DrawEventRecorderPrivate::AddStoredObject. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D174952
2023-04-17 15:23:42 +00:00
sotaro
df6f2ba3e7 Bug 1827578 - Async wait remote texture ready of offscreen canvas at WebRenderImageHost r=gfx-reviewers,lsalzman
It should be OK to wait remote texture ready of offscreen canvas at WebRenderImageHost. Offscreen canvas uses ImageBridge. And ImageBridge works asynchronously.

WebRenderImageHost::UseRemoteTexture() is split to WebRenderImageHost::PushPendingRemoteTexture() and WebRenderImageHost::UseRemoteTexture(). It is for handling RemoteTexture ready callback in WebRenderImageHost.

Differential Revision: https://phabricator.services.mozilla.com/D175226
2023-04-13 21:38:24 +00:00
Noemi Erli
d637b3f05e Backed out 24 changesets (bug 1824465) for causing failures in nsISupportsImpl.cpp CLOSED TREE
Backed out changeset a5c8f22b7170 (bug 1824465)
Backed out changeset b551b655ac72 (bug 1824465)
Backed out changeset 0e6768a6419c (bug 1824465)
Backed out changeset fb115ebb7fe0 (bug 1824465)
Backed out changeset aaa7a2c8aa3b (bug 1824465)
Backed out changeset 7ef94bfa90b3 (bug 1824465)
Backed out changeset a4238fd6b86f (bug 1824465)
Backed out changeset 3a88e4cfbe45 (bug 1824465)
Backed out changeset 40c2467d3162 (bug 1824465)
Backed out changeset 8f900395c72c (bug 1824465)
Backed out changeset 92e4c6e4d73c (bug 1824465)
Backed out changeset 445c5d5d9661 (bug 1824465)
Backed out changeset de51ed5389d9 (bug 1824465)
Backed out changeset 72049d72bcb6 (bug 1824465)
Backed out changeset 126773c2427a (bug 1824465)
Backed out changeset 886e76bc80be (bug 1824465)
Backed out changeset a69a851411f0 (bug 1824465)
Backed out changeset 703599cf6189 (bug 1824465)
Backed out changeset 11ecb78ebc15 (bug 1824465)
Backed out changeset 563255aaa1e1 (bug 1824465)
Backed out changeset d1bf32c2a6c6 (bug 1824465)
Backed out changeset ef28b2777487 (bug 1824465)
Backed out changeset a2015d354bb1 (bug 1824465)
Backed out changeset 31d6b53fdc6a (bug 1824465)
2023-04-06 01:50:55 +03:00
Nika Layzell
4f7b1df1f8 Bug 1824465 - Part 13: Make PVideoBridge refcounted, r=ipc-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D173728
2023-04-05 21:33:41 +00:00
Nika Layzell
eb59041574 Bug 1824465 - Part 12: Make PUICompositorController refcounted, r=ipc-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D173727
2023-04-05 21:33:40 +00:00
Nika Layzell
45fa86b30d Bug 1824465 - Part 11: Make PImageBridge refcounted, r=ipc-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D173726
2023-04-05 21:33:40 +00:00
Nika Layzell
631b0dc7ba Bug 1824465 - Part 10: Make PCompositorManager refcounted, r=ipc-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D173725
2023-04-05 21:33:40 +00:00
Botond Ballo
2740392b19 Bug 1824480 - Remove ScrollMetadata::mBackgroundColor which is no longer used. r=dlrobertson
This field appears to be unused since bug 1349418.

Differential Revision: https://phabricator.services.mozilla.com/D173598
2023-04-04 18:00:38 +00:00
Botond Ballo
538557d8e6 Bug 1825887 - Restore documentation for PWebRenderBridge APIs duplicated from PLayerTransaction. r=dlrobertson
Differential Revision: https://phabricator.services.mozilla.com/D174347
2023-04-04 17:41:34 +00:00
Ray Kraesig
f3d76a51df Bug 1820066 [2/3] - Allow in-process use of the compositor window r=sotaro
The in-process compositor assumes that no compositor window was present.
This is not guaranteed to be true if, for example, the preference
`gfx.webrender.flip-sequential` is set.

Make the in-process compositor more closely mirror the out-of-process
compositor. (At present this effectively just means calling ::SetParent
on the compositor window.)

Differential Revision: https://phabricator.services.mozilla.com/D172733
2023-03-27 16:54:13 +00:00
Christian Holler (:decoder)
3cb30b35f1 Bug 1821010 - Remove legacy IPC fuzzing code. r=truber,nika
Differential Revision: https://phabricator.services.mozilla.com/D171981
2023-03-23 14:53:22 +00:00
Sandor Molnar
39587cae6b Backed out 3 changesets (bug 1820066) for causing xpc failures in widget/headless/tests/test_headless.js CLOSED TREE
Backed out changeset 501d93d8c9eb (bug 1820066)
Backed out changeset ec623d25b138 (bug 1820066)
Backed out changeset c34dfd018abb (bug 1820066)
2023-03-22 22:54:53 +02:00
Ray Kraesig
cfe1fff87e Bug 1820066 [2/3] - Allow in-process use of the compositor window r=sotaro
The in-process compositor assumes that no compositor window was present.
This is not guaranteed to be true if, for example, the preference
`gfx.webrender.flip-sequential` is set.

Make the in-process compositor more closely mirror the out-of-process
compositor. (At present this effectively just means calling ::SetParent
on the compositor window.)

Differential Revision: https://phabricator.services.mozilla.com/D172733
2023-03-22 15:09:24 +00:00
Nika Layzell
0ed9cfe9b6 Bug 1815177 - Use a custom ReadResult to reduce branching during IPDL deserialization, r=ipc-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D169954
2023-03-20 15:40:38 +00:00
Nika Layzell
f47e7d485e Bug 1607634 - Part 4b: Changes for not-nullable actor types being wrapped in NotNull, r=ipc-reviewers,necko-reviewers,mccr8
These are the code changes required by the IPDL changes in part 4a.

Differential Revision: https://phabricator.services.mozilla.com/D168887
2023-03-20 15:40:36 +00:00
Nika Layzell
78fa962afb Bug 1814683 - Part 1: Combine parent/child fields in IPDL structs/unions, r=ipc-reviewers,necko-reviewers,mccr8
This combines the multiple fields or variants which were previously used to
track sided types like protocol types into a single field wrapped with a
SideVariant.

This will be used in the next part to avoid the need for default constructors
for actor types allowing the proper types to be used.

Differential Revision: https://phabricator.services.mozilla.com/D168879
2023-03-20 15:40:31 +00:00