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

16528 Коммитов

Автор SHA1 Сообщение Дата
Andrew Osmond a18bf8a50c Bug 1754978 - Part 2. Switch WebGPU to use async image pipelines for display. r=kvark
This patch removes more main thread dependencies from the content side
of WebGPU. Instead of issuing a resource update for an external image,
we now use an async image pipeline in conjunction with
CompositableInProcessManager from part 1. This allows us to update the
HTMLCanvasElement bound to the WebGPU device without having to go
through the main thread, or even the content process after the swap
chain update / readback has been requested.

Differential Revision: https://phabricator.services.mozilla.com/D138887
2022-02-16 22:23:20 +00:00
Andrew Osmond 23a67affe1 Bug 1754978 - Part 1. Refactor CompositableHandle infrastructure to allow in-process driven handles. r=sotaro
For WebGPU, we produce the textures in the compositor process and the
content process doesn't need to be that involved except for hooking up
the texture to the display list. Currently this is done via an external
image ID.

Given that WebGPU needs to work with OffscreenCanvas, it would be best
if its display pipeline was consistent whether it was gotten from an
HTMLCanvasElement, OffscreenCanvas on the main thread, or on a worker
thread. As such, using an AsyncImagePipeline would be best.

However there is no real need to bounce the handles across process
boundaries. Hence this patch which adds CompositableInProcessManager.
This static class is responsible for collecting WebRenderImageHost
objects backed by TextureHost objects which do not leave the compositor
process. This will allow WebGPUParent to schedule compositions directly
in future patches.

Differential Revision: https://phabricator.services.mozilla.com/D138588
2022-02-16 22:23:19 +00:00
Emilio Cobos Álvarez 51f5539b57 Bug 1754813 - Make Hal::ScreenOrientation an enum class. r=gsvelto,m_kato,geckoview-reviewers
This adds proper IPC validation too.

Differential Revision: https://phabricator.services.mozilla.com/D138461
2022-02-14 07:51:06 +00:00
Lee Salzman 5c61fe02e5 Bug 1754130 - Support presenting a WebGLFramebuffer to its own swap chain without opaque FB. r=aosmond,jgilbert
Most of the support for presenting a WebGLFramebuffer to a swap chain existed as part of the
mechanism for opaque WebXR framebuffer support. However, such "opaque" framebuffer are meant
to be opaque in the sense that their attachments can't be inspected or changed, which does
not provide the requisite level of control for efficiently implementing Canvas2D snapshots.

To this end, the existing Present mechanism is slightly extended to allow presenting to the
swap chain already present in WebGLFramebuffer without the existence of a corresponding
MozFramebuffer.

This also fixes a bug in that AsWebgl() was no longer being utilized in CanvasRenderer, such
that a new mechanism that routed GetFrontBuffer() was needed to fix the code rot.

There are also some efforts to remove a couple redundant copies I noticed in profiles along
the way.

Differential Revision: https://phabricator.services.mozilla.com/D138119
2022-02-11 19:49:56 +00:00
Marian-Vasile Laza 610558649b Backed out 3 changesets (bug 1754130) for causing mochitest failures. CLOSED TREE
Backed out changeset 7fea32057b92 (bug 1754130)
Backed out changeset 1ac8f10e0025 (bug 1754130)
Backed out changeset 3d56b847ddf9 (bug 1754130)
2022-02-11 18:30:11 +02:00
Lee Salzman 4fb52bf9bc Bug 1754130 - Support presenting a WebGLFramebuffer to its own swap chain without opaque FB. r=aosmond,jgilbert
Most of the support for presenting a WebGLFramebuffer to a swap chain existed as part of the
mechanism for opaque WebXR framebuffer support. However, such "opaque" framebuffer are meant
to be opaque in the sense that their attachments can't be inspected or changed, which does
not provide the requisite level of control for efficiently implementing Canvas2D snapshots.

To this end, the existing Present mechanism is slightly extended to allow presenting to the
swap chain already present in WebGLFramebuffer without the existence of a corresponding
MozFramebuffer.

This also fixes a bug in that AsWebgl() was no longer being utilized in CanvasRenderer, such
that a new mechanism that routed GetFrontBuffer() was needed to fix the code rot.

There are also some efforts to remove a couple redundant copies I noticed in profiles along
the way.

Differential Revision: https://phabricator.services.mozilla.com/D138119
2022-02-11 15:36:30 +00:00
Timothy Nikkel 39fc8c4f14 Bug 1742241. Add test. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D137960
2022-02-11 11:56:45 +00:00
Andrew Osmond 5e0eefe182 Bug 1754556 - Update WebGPU external image resource only after present is complete. r=kvark
This patch ensures that we only update the external image resource for
WebGPU when there has been an actual change for the resource. In order
to guarantee this, we wait for the present to complete, and only then
issue the update. WebRenderBridgeChild::SendResourceUpdates will also
trigger a frame generation if any resources were changed, which means we
don't need to trigger a paint on the frame itself anymore.

Note that we still have a race condition when we write into the
MemoryTextureHost while in PresentCallback, and the renderer thread may
be accessing the pixel data to upload to the GPU.

Differential Revision: https://phabricator.services.mozilla.com/D138349
2022-02-11 01:26:42 +00:00
sotaro e42dbf611e Bug 1754330 - Enable RenderExternalTextureHost usage for BufferTextureHost that id wrapped by GPUVideoTextureHost r=gfx-reviewers,aosmond
Current GPUVideoTextureHost, which wraps BufferTextureHost does not create additional copies of the texture data. Then we could remove calling DisableExternalTextures() in GPUVideoTextureHost::EnsureWrappedTextureHost().
And IsWrapingBufferTextureHost() is added for handling a case that BufferTextureHost is wrapped by GPUVideoTextureHost.

Differential Revision: https://phabricator.services.mozilla.com/D138227
2022-02-10 14:14:54 +00:00
Hiroyuki Ikezoe d2a5d872c9 Bug 1753436 - Bump up APZ scroll generation only if it's necessary. r=botond
APZ scroll generation doesn't need to be bumped up if the target APZC's
scroll position isn't changed.

Differential Revision: https://phabricator.services.mozilla.com/D138071
2022-02-10 05:11:13 +00:00
Nika Layzell dabb46c84d Bug 1736371 - Default new actors to be refcounted, r=alwu,media-playback-reviewers,mccr8
The changes to ipdl actors were mechanical, and largely automated using
a script.

Differential Revision: https://phabricator.services.mozilla.com/D137237
2022-02-09 17:29:47 +00:00
Nika Layzell 91ec85c593 Bug 1752444 - Part 2: Rewrite direct_call.py protocols to use {Parent,Child}Impl attributes, r=ipc-reviewers,media-playback-reviewers,alwu,mccr8
This is a mechanical change which was performed by a script based on the
contents of direct_call.py, and then manually checked over to fix
various rewriting bugs caused by my glorified sed script. See the
previous part for more context on the change.

Differential Revision: https://phabricator.services.mozilla.com/D137227
2022-02-09 17:29:46 +00:00
Nika Layzell 9919099425 Bug 1738734 - Directly pass around handles rather than using TransportDescriptor, r=jld,media-playback-reviewers,alwu
This simplifies the logic around descriptors significantly, which is
especially useful considering how few places use the type. There is a
small change required on Windows to create the NamedPipe directly and
transfer around each end's handle, rather than connecting between
processes after the fact.

A named pipe has to be used, rather than an anonymous pipe, as
bidirectional communication is required.

Differential Revision: https://phabricator.services.mozilla.com/D130381
2022-02-08 23:53:45 +00:00
Nika Layzell 486c5fc2c4 Bug 1751071 - Correctly forward-declare/import included but unused types in ipdlh headers, r=ipc-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D137164
2022-02-08 23:53:44 +00:00
Hiroyuki Ikezoe 5669bdab0e Bug 1754129 - Add a mochitest for scroll linked effects. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D136207
2022-02-08 21:10:24 +00:00
Hiroyuki Ikezoe 46166484e0 Bug 1754129 - Factor out a function to collect APZTestData for the given element. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D138110
2022-02-08 21:10:24 +00:00
criss 45adb4f480 Backed out changeset aaa24080aa76 (bug 1754129) for causing failures on test_group_scroll_linked_effect.html. CLOSED TREE 2022-02-08 14:23:29 +02:00
Jamie Nicol a01c2107a2 Bug 1754159 - Correctly wait for GPU process to be restarted in test. r=tnikkel
Bug 1742985 added the test helper_zoom_after_gpu_process_restart.html,
but it doesn't actually get run on any platform with the GPU process
enabled. (Due to bug 1495580 on windows, and because the GPU process
isn't yet enabled on android.)

The test kills the GPU process, then tries to wait for it to be
restarted before proceeding. However, the function
ensureGPUProcessReadyForTests doesn't always work as intended, as the
GPUProcessManager may not have yet noticed that the process has been
killed, and therefore may return immediately from EnsureGPUReady.

This patch removes the buggy ensureGPUProcessReadyForTests function,
and instead makes the test wait for the "compositor-reinitialized"
topic to be observed.

Differential Revision: https://phabricator.services.mozilla.com/D138125
2022-02-08 12:06:15 +00:00
Hiroyuki Ikezoe faa402f507 Bug 1754129 - Add a mochitest for scroll linked effects. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D136207
2022-02-08 09:49:38 +00:00
sotaro 8967cd0a71 Bug 1753575 - Make BufferTextureData of ffmpeg decoded video recycled again r=gfx-reviewers,nical
Before Bug 1713276  fix, BufferTextureData of ffmpeg decoded video was recycled.
ShmemTextureData::CropYCbCrPlanes() changed BufferDescriptor. And it blocks the BufferTextureData to be recycled. The BufferDescriptor needs to be restored to original value before recycling.

Differential Revision: https://phabricator.services.mozilla.com/D137829
2022-02-07 23:15:25 +00:00
Emilio Cobos Álvarez b699e8cdc8 Bug 1753995 - Remove nsDOMWindowUtils.screenPixelsPerCSSPixel. r=smaug,dholbert
For all purposes, this is the same as devicePixelRatio. It was meant to
skip the resistFingerprinting check the devicePixelRatio getter does,
but we do that now using CallerType in WebIDL, so if we cared about that
for these tests (which we don't) we could just do
SpecialPowers.wrap(window).devicePixelRatio.

As a follow-up we could move the NoOverride to window for symmetry. But
it's only used by devtools touch simulation so not sure if worth it.

Differential Revision: https://phabricator.services.mozilla.com/D138021
2022-02-07 18:23:36 +00:00
Jed Davis 8deabc42dd Bug 1753340 - Increase compositor stack size limit to deal with Mesa and OOP WebGL. r=jgilbert
Some versions of Mesa, including what we currently use on CI, need more
stack memory than what we currently provide on the compositor thread
order to pass the WebGL test suite in out-of-process mode.  This patch
increases the limit and re-enables the previously broken tests.

(Testing on Try found that the threshold was somewhere between 384k and
448k, but because this depends on a third-party library and content
controlled input, I'm giving it 512k so we have some safety margin.)

Differential Revision: https://phabricator.services.mozilla.com/D137787
2022-02-04 17:56:34 +00:00
Andrew Osmond 8f1c963ed3 Bug 1746538 - Make PWebGPU managed by PCanvasManager. r=kvark
Similar to PWebGL, we want PCanvasManager to manage the PWebGPU
protocol. This will allow us to reuse the machinery that works for both
the main thread, and arbitrary worker threads to create PWebGPU
protocols.

For now, the only owner is still the main thread, so it should work very
similarly as to how it does with PCompositorBridge.

This patch also introduces some quality of life changes, such as making
the protocol ref-counted, and avoiding respinning the wheel for
CanSend() for IPDL actors.

Differential Revision: https://phabricator.services.mozilla.com/D134097
2022-02-02 20:49:23 +00:00
Sandor Molnar 6035b5cf95 Backed out changeset ba6624225635 (bug 1738734) for causing build bustages in ipc/PUtilityProcessParent. 2022-02-01 00:57:12 +02:00
Nika Layzell c45d6350d4 Bug 1738734 - Directly pass around handles rather than using TransportDescriptor, r=jld,media-playback-reviewers,alwu
This simplifies the logic around descriptors significantly, which is
especially useful considering how few places use the type. There is a
small change required on Windows to create the NamedPipe directly and
transfer around each end's handle, rather than connecting between
processes after the fact.

A named pipe has to be used, rather than an anonymous pipe, as
bidirectional communication is required.

Differential Revision: https://phabricator.services.mozilla.com/D130381
2022-01-31 22:26:05 +00:00
Hiroyuki Ikezoe c0048dceb1 Bug 1571758 - Inform multiple sampled scroll offsets to WR and pick the most appropriate one in WR. r=botond
This change mitigates the gap between the external_scroll_offset informed from
the main-thread and scroll_offset informed from APZ.

Some wrench reftests for this change are in the next commit.

Differential Revision: https://phabricator.services.mozilla.com/D133444
2022-01-31 09:40:35 +00:00
Hiroyuki Ikezoe 860a49babe Bug 1571758 - Inform apz scroll generation to WebRender's ScrollFrame from the main-thread. r=botond
Also inform a flat representing whether the frame's document has scroll-linked
effect or not.

Differential Revision: https://phabricator.services.mozilla.com/D133442
2022-01-31 09:40:35 +00:00
Hiroyuki Ikezoe 994eac4d91 Bug 1571758 - Add an optional index argument to some APZC methods to be able to get an arbirary sampled metrics. r=botond
In a subsequent change, we'd like to use them for each SampledAPZCState.

Differential Revision: https://phabricator.services.mozilla.com/D133441
2022-01-31 09:40:34 +00:00
Hiroyuki Ikezoe f388ce7623 Bug 1571758 - Factor out GetAsyncScrollDeltaForSampling. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D133440
2022-01-31 09:40:34 +00:00
Hiroyuki Ikezoe 562a98e9cc Bug 1571758 - Introduce scroll generation in APZC and SampledAPZCState and inform it to the scrollable frame on the main-thread via RepaintRequest. r=botond
The reason why the global ScrollGeneration::sCounter doesn't work for the APZ
case is the APZ sampler thread is per our top level browser window, so if
there are multiple browser windows at the same time, the sCounter will be muted
from different sampler threads.

Differential Revision: https://phabricator.services.mozilla.com/D133439
2022-01-31 09:40:33 +00:00
Robert Mader 48aa55faf4 Bug 1752469 - Remove Gnome specific workaround using PauseCompositor(), r=gfx-reviewers,lsalzman
This was originally implemented in D111662 to work around a crash
that otherwise would get triggered in Gnome/Mutter.
The fix for that crash has been available for a couple of month now,
thus remove the workaround again.

This may help preventing flickering for menus in certain situations.

Differential Revision: https://phabricator.services.mozilla.com/D137251
2022-01-28 04:24:16 +00:00
Robert Mader 21149596d5 Bug 1750443 - Stop rounding buffer clips, r=gfx-reviewers,lsalzman
Rounding the values to integers appears to be to aggressive in some
situations. The rounding was introduced to work around floating
point errors under the assumption that we'd always end up with integer
values. However, apparently we sometimes compute values `<0.5`, making
us end up with `0`, triggering a protocol errer.
Replace that with an intersection with the actual buffer size. This
will slightly increase wire communication, but should avoid the
crashes.

Differential Revision: https://phabricator.services.mozilla.com/D137249
2022-01-28 04:23:19 +00:00
Randell Jesup bc46840119 Bug 1752171: Remove unused lock from CompositorBridgeChild r=gfx-reviewers,jrmuizel
Currently the lock is only taken on a single thread, where all other accesses occur

Differential Revision: https://phabricator.services.mozilla.com/D137184
2022-01-27 19:01:01 +00:00
Botond Ballo 6a16ed29b1 Bug 1751789 - Better handle the case where the deferred transform item's ASR is a descendant of the current item's ASR. r=tnikkel
Depends on D136828

Differential Revision: https://phabricator.services.mozilla.com/D136829
2022-01-27 01:08:21 +00:00
Botond Ballo 50da83a816 Bug 1751789 - Move variables related to the deferred transform item into NewLayerData, and compute them before the recursion. r=tnikkel
It's valid to move their computations before the recursion because
their inputs (the current display item and the stacking context's
deferred transform item) do not change over the course of the
recursive call.

Depends on D136827

Differential Revision: https://phabricator.services.mozilla.com/D136828
2022-01-27 01:08:20 +00:00
Botond Ballo 884b90a57c Bug 1751789 - Move stopAtAsr into NewLayerData and compute it before the recursion. r=tnikkel
We are moving its computation before a balanced pair of
mAsrStack.push_back() and mAsrStack.pop() calls, so its
value remains the same.

Depends on D136826

Differential Revision: https://phabricator.services.mozilla.com/D136827
2022-01-27 01:08:20 +00:00
Botond Ballo 2de04c9b92 Bug 1751789 - Introduce NewLayerData helper structure. r=tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D136826
2022-01-27 01:08:19 +00:00
Gabriele Svelto 971d0cdf38 Bug 1751041 - Compute the process startup timestamp early during startup r=glandium
Previously the process startup timestamp was computed lazily but this caused
some issues with some of our static analysis infra (see bug 1678152). This
moves computing the timestamp early during process startup and makes it happen
unconditionally.

Differential Revision: https://phabricator.services.mozilla.com/D136406
2022-01-26 19:57:41 +00:00
Randell Jesup 9464c527d6 Bug 1752168: Remove unused fields from CompositorBridgeChild r=gfx-reviewers,bradwerth,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D137054
2022-01-26 19:13:50 +00:00
Agi Sferro b1f93026e6 Bug 1745996 - Send a memory pressure event when deactivating sessions. r=jnicol,calu
WebRender retains about 50MBs of memory for every window. When switching
between lots of tabs on Android (where 1 tab = 1 window), this can cause
problems as the app will consume a significant amount of memory.

To avoid this problem, we send a memory pressure event whenever a session is
deactivated, which signals to WebRender that it should deallocate the memory.

This message is sent on a delay of 10s to avoid interfering with tab switching,
and we cancel the message if the tab becomes active again before we fire the
memory pressure event.

Co-Authored-By: Cathy Lu <calu@mozilla.com>
Co-Authored-By: Jonathan Almeida [:jonalmeida] <jonalmeida942@gmail.com>

Differential Revision: https://phabricator.services.mozilla.com/D136965
2022-01-26 16:40:56 +00:00
Emilio Cobos Álvarez 57da66db7e Bug 1747409 - Add a test. r=botond
Confirmed that it fails without the patch with:

```
Expected at least one hit result in the APZTestData
    SimpleTest.ok@SimpleTest/SimpleTest.js:417:16
    runSubtestsSeriallyInFreshWindows/</advanceSubtestExecution/spawnTest/w.ok@gfx/layers/apz/test/mochitest/apz_test_utils.js:479:32
    hitTest@gfx/layers/apz/test/mochitest/apz_test_utils.js:833:5
    test@gfx/layers/apz/test/mochitest/helper_hittest_fixed_item_over_oop_iframe.html:48:18
```

Differential Revision: https://phabricator.services.mozilla.com/D136912
2022-01-25 22:02:56 +00:00
Emilio Cobos Álvarez 5658c78eef Bug 1747409 - Don't optimize away hit-test info items across remote frame boundaries. r=miko,gfx-reviewers
This is the actual fix. Any tests to crib from would be greatly appreciated.

Depends on D136895

Differential Revision: https://phabricator.services.mozilla.com/D136896
2022-01-25 22:02:56 +00:00
Nika Layzell 09d88e5fd2 Bug 1749059 - Remove Quantum DOM support from IPDL, r=ipc-reviewers,mccr8
This is no longer necessary as the Quantum DOM project is no longer
happening, and removing support simplifies various components inside of
IPDL.

As some code used the support to get a `nsISerialEventTarget` for an
actor's worker thread, that method was replaced with a method which
instead pulls the nsISerialEventTarget from the MessageChannel and
should work on all actors.

Differential Revision: https://phabricator.services.mozilla.com/D135411
2022-01-25 20:29:46 +00:00
Noemi Erli f471472a6b Backed out 2 changesets (bug 1678152, bug 1751041) for causing failures in test_missing_intermediate.js CLOSED TREE
Backed out changeset 034ae0e4c467 (bug 1751041)
Backed out changeset 46640f068ae4 (bug 1678152)
2022-01-25 20:09:51 +02:00
Gabriele Svelto 6ef49e257c Bug 1751041 - Compute the process startup timestamp early during startup r=glandium
Previously the process startup timestamp was computed lazily but this caused
some issues with some of our static analysis infra (see bug 1678152). This
moves computing the timestamp early during process startup and makes it happen
unconditionally.

Differential Revision: https://phabricator.services.mozilla.com/D136406
2022-01-25 16:41:21 +00:00
stransky 1258fa891e Bug 1750389 [Linux] Use DMABuf modifiers for all planes for YUV surfaces r=emilio
Recently DMABuf modifiers are not correctly implemented for YUV surfaces - when a modifier is present we use it
for all planes to create EGLImage.
In this patch we import modifiers for all used YUV planes and use them correctly for particular planes.

Differential Revision: https://phabricator.services.mozilla.com/D136782
2022-01-25 07:03:13 +00:00
alwu 72bf19ec27 Bug 1713276 - part1 : allocate shmem for ffmpeg to store decoded data directly. r=stransky,gfx-reviewers,sotaro,jgilbert,media-playback-reviewers
This implements a customized buffer allocator for ffmpeg decoder to allow it to store decoded data on shmem, so decoded data can be shared with the compositor process without doing extra copy.

As ffmpeg decoder needs a special alignment which will be larger than the actual image, we would need to crop the planes by telling plane descriptor correct place size in order to display image correctly.

Otherwise, showing a larger image causes visible incorrect border on the right and bottom of the actual image.

This will help improve the performance of software decoding while using ffmpeg and ffvpx, which is about h264 and vpx on Linux, vpx on Windows and MacOS.

Inaddition, Here is a result [1] showing that how much improvement using shmem can help.

[1] https://bit.ly/3dy4rya

Differential Revision: https://phabricator.services.mozilla.com/D130220
2022-01-25 02:44:59 +00:00
stransky a5eed5ff52 Bug 1743638 [Linux] Make VideoFramePool thread safe r=alwu,media-playback-reviewers
Make VideoFramePool thread safe to avoid multiple access during software decode to DMABuf:

- Create Mutex for VideoFramePool access
- Mark surface as used when it's provided by VideoFramePool to avoid race conditions.

Differential Revision: https://phabricator.services.mozilla.com/D135557
2022-01-24 11:59:42 +00:00
Butkovits Atila ea3ded4926 Backed out 5 changesets (bug 1713276) for causing reftest failures at color_quads/720p.png.bt709.bt709.pc.yuv420p10.vp9.webm. CLOSED TREE
Backed out changeset 9ac49fde0e53 (bug 1713276)
Backed out changeset 21a1cb173d50 (bug 1713276)
Backed out changeset d8e319535a01 (bug 1713276)
Backed out changeset 0a1be4875045 (bug 1713276)
Backed out changeset b2676297c6ff (bug 1713276)
2022-01-22 23:14:05 +02:00
alwu aa9cadb959 Bug 1713276 - part1 : allocate shmem for ffmpeg to store decoded data directly. r=stransky,gfx-reviewers,sotaro,jgilbert,media-playback-reviewers
This implements a customized buffer allocator for ffmpeg decoder to allow it to store decoded data on shmem, so decoded data can be shared with the compositor process without doing extra copy.

As ffmpeg decoder needs a special alignment which will be larger than the actual image, we would need to crop the planes by telling plane descriptor correct place size in order to display image correctly.

Otherwise, showing a larger image causes visible incorrect border on the right and bottom of the actual image.

This will help improve the performance of software decoding while using ffmpeg and ffvpx, which is about h264 and vpx on Linux, vpx on Windows and MacOS.

Inaddition, Here is a result [1] showing that how much improvement using shmem can help.

[1] https://bit.ly/3dy4rya

Differential Revision: https://phabricator.services.mozilla.com/D130220
2022-01-22 17:25:22 +00:00