Commit Graph

42563 Commits

Author SHA1 Message Date
Jamie Nicol
ffb15c5a6b Bug 1757766 - Avoid using NS_DISPATCH_SYNC in UiCompositorController::Destroy. r=gfx-reviewers,aosmond
On Android, we must dispatch UiCompositorController::Destroy to run on
the UI thread synchronously. We were using NS_DISPATCH_SYNC to do so,
but that works by starting a nested event loop that continues to
execute tasks on the thread we have dispatched from. This means that
we can start to execute a task which calls
nsBaseWidget::CreateCompositor whilst we are midway through
nsBaseWidget::DestroyCompositor. As well as generally seeming like a
terrible idea, this also causes an assertion failure in some tests.

To avoid this use SynchronousTask rather than NS_DISPATCH_SYNC, as it
actually blocks synchronously. Additionally, do the same thing for
APZInputBridgeChild::Destroy, as it is called from the same location
and poses the same risk.

Ideally we wouldn't have to call UiCompositorControllerChild::Destroy
synchronously at all, but it was added in bug 1392705 to fix severe
crashes. It might be a good idea to re-evaluate whether it is still
required at some point in the future.

Differential Revision: https://phabricator.services.mozilla.com/D140084
2022-03-02 18:52:08 +00:00
Lee Salzman
05d60c01fa Bug 1752457 - Don't normalize zero halfway-vector in SpecularLightingSoftware. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D139967
2022-03-02 18:24:28 +00:00
smolnar
0ae36bf20f Backed out changeset 8a8ff9d086f4 (bug 1757766) for causing build bustages in gfx/layers/ipc/UiCompositorControllerChild.cpp CLOSED TREE 2022-03-02 19:59:29 +02:00
Jamie Nicol
a30d089e14 Bug 1757766 - Avoid using NS_DISPATCH_SYNC in UiCompositorController::Destroy. r=gfx-reviewers,aosmond
On Android, we must dispatch UiCompositorController::Destroy to run on
the UI thread synchronously. We were using NS_DISPATCH_SYNC to do so,
but that works by starting a nested event loop that continues to
execute tasks on the thread we have dispatched from. This means that
we can start to execute a task which calls
nsBaseWidget::CreateCompositor whilst we are midway through
nsBaseWidget::DestroyCompositor. As well as generally seeming like a
terrible idea, this also causes an assertion failure in some tests.

To avoid this use SynchronousTask rather than NS_DISPATCH_SYNC, as it
actually blocks synchronously. Additionally, do the same thing for
APZInputBridgeChild::Destroy, as it is called from the same location
and poses the same risk.

Ideally we wouldn't have to call UiCompositorControllerChild::Destroy
synchronously at all, but it was added in bug 1392705 to fix severe
crashes. It might be a good idea to re-evaluate whether it is still
required at some point in the future.

Differential Revision: https://phabricator.services.mozilla.com/D140084
2022-03-02 17:43:33 +00:00
Jamie Nicol
6918615b37 Bug 1756700 - Delay compositor creation on Android to allow time for GPU process to launch. r=gfx-reviewers,geckoview-reviewers,aosmond,calu
We noticed a cold_view_nav_start regression on Fenix from enabling the
GPU process, and profiles showed time spent synchronously waiting for
the GPU process to launch. This occured because the compositor was
being created in nsWindow::Create, and as it requires the GPU process
to be running it had to block until launch completed. The process is
launched when the gfxPlatform is first initialized, but that was only
occuring immediately prior to creating the compositor, which did not
give it enough time to complete asynchronously.

This patch makes it so that we initialize the gfxPlatform slightly
earlier, and importantly delay creating the compositor until it is
actually required. This gives the process enough time to launch
asynchronously meaning we do not have to block.

We started deliberately creating the compositor early on Android
because of bug 1453501, to avoid a race condition where the compositor
didn't exist when RemoteLayerTreeOwner::Initialize was called, causing
us to use a basic layer manager. However, since bug 1741156 landed we
now create the compositor on-demand, meaning this is no longer a
possibility.

Delaying compositor creation can, however, uncover another race
condition. If the UICompositorControllerChild is opened on the UI
thread before the main thread is able to set its pointer to the
widget, then the java GeckoSession will never be notified that the
compositor has been opened, and composition will never be
resumed. This patch fixes this issue by setting the
UiCompositorControllerChild's widget pointer in its constructor rather
than immediately afterwards.

Differential Revision: https://phabricator.services.mozilla.com/D139842
2022-03-02 16:56:28 +00:00
Jeff Muizelaar
96997a4322 Bug 1757574 - Reduce the maximum number of high priority WrWorker threads. r=nical
This cuts the time spent doing get_ct_font on macOS in half because of
various contention issues. It should also reduce overall memory usage
for large fonts because we have half as many threads loading the
fonts.

Differential Revision: https://phabricator.services.mozilla.com/D139946
2022-03-02 15:27:31 +00:00
Lee Salzman
619a501c21 Bug 1757449 - Make WR NativeFontHandle use String instead of CGFont on macOS. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D139882
2022-03-02 10:11:05 +00:00
criss
b13da6025c Backed out changeset e0f1d94942ce (bug 1757449) for causing build bustages on macOs. CLOSED TREE 2022-03-02 12:02:50 +02:00
Lee Salzman
a3df467ef4 Bug 1757449 - Make WR NativeFontHandle use String instead of CGFont on macOS. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D139882
2022-03-02 09:34:31 +00:00
Florian Quèze
7e7760e643 Bug 1757587 - Remove non-webrender CompositorAnimationStorage code that seems unused, r=mstange.
Differential Revision: https://phabricator.services.mozilla.com/D139957
2022-03-01 23:08:15 +00:00
Markus Stange
3ce08a4e07 Bug 1676760 - Rename Add/RemoveChildRefreshTimer. r=smaug
It is used by far more than just content process refresh driver timers.

Differential Revision: https://phabricator.services.mozilla.com/D139769
2022-03-01 22:48:19 +00:00
Markus Stange
d85ed119fd Bug 1676760 - Remove unused RefreshTimerVsyncDispatcher::SetParentRefreshTimer. r=smaug
Even in the parent process, VsyncRefreshDriverTimer uses AddChildRefreshTimer.

Differential Revision: https://phabricator.services.mozilla.com/D139768
2022-03-01 22:48:19 +00:00
Cristian Tuns
956c714ac3 Backed out changeset 0946d4ce352f (bug 1756700) for causing geckoview crashes. CLOSED TREE 2022-03-01 18:11:55 -05:00
Jamie Nicol
b3781363fb Bug 1756700 - Delay compositor creation on Android to allow time for GPU process to launch. r=gfx-reviewers,geckoview-reviewers,aosmond,calu
We noticed a cold_view_nav_start regression on Fenix from enabling the
GPU process, and profiles showed time spent synchronously waiting for
the GPU process to launch. This occured because the compositor was
being created in nsWindow::Create, and as it requires the GPU process
to be running it had to block until launch completed. The process is
launched when the gfxPlatform is first initialized, but that was only
occuring immediately prior to creating the compositor, which did not
give it enough time to complete asynchronously.

This patch makes it so that we initialize the gfxPlatform slightly
earlier, and importantly delay creating the compositor until it is
actually required. This gives the process enough time to launch
asynchronously meaning we do not have to block.

We started deliberately creating the compositor early on Android
because of bug 1453501, to avoid a race condition where the compositor
didn't exist when RemoteLayerTreeOwner::Initialize was called, causing
us to use a basic layer manager. However, since bug 1741156 landed we
now create the compositor on-demand, meaning this is no longer a
possibility.

Delaying compositor creation can, however, uncover another race
condition. If the UICompositorControllerChild is opened on the UI
thread before the main thread is able to set its pointer to the
widget, then the java GeckoSession will never be notified that the
compositor has been opened, and composition will never be
resumed. This patch fixes this issue by setting the
UiCompositorControllerChild's widget pointer in its constructor rather
than immediately afterwards.

Differential Revision: https://phabricator.services.mozilla.com/D139842
2022-03-01 22:09:44 +00:00
Glenn Watson
f36af647ca Bug 1757201 - Fix mix-blend mode on parent surfaces with snapping enabled r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D139904
2022-03-01 21:01:40 +00:00
Noemi Erli
e4c2b99c8e Backed out changeset 7aaefe97188d (bug 1757201) for causing bustage in mix-blend-layers.yaml CLOSED TREE 2022-03-01 22:42:09 +02:00
Glenn Watson
ea8cb44b81 Bug 1757201 - Fix mix-blend mode on parent surfaces with snapping enabled r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D139904
2022-03-01 20:05:54 +00:00
Ryan VanderMeulen
ba43141112 Bug 1756664 - Update HarfBuzz to 3.4.0. r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D139411
2022-03-01 17:37:04 +00:00
Jeff Muizelaar
76ca55d0b9 Bug 1757454 - Remove code for working with CGFonts. r=lsalzman
Bug 1744851 removed the need for creating variations using a CGFont.
This removes some of the support code that was left behind and completes
the reverting of the initial fix for bug 1675185: c8875713fd6d193e6b017da0a88c264b7bdd9a78

Differential Revision: https://phabricator.services.mozilla.com/D139886
2022-03-01 16:06:01 +00:00
Jonathan Kew
331c406f5c Bug 1756720 - When using legacy MS Symbol fonts, map character codes from the U+00xx range to the PUA range U+F0xx found in the cmap subtables. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D139724
2022-03-01 15:22:56 +00:00
Butkovits Atila
0dedf487f0 Backed out changeset 207c7cefa9db (bug 1757454) for causing WR bustages. CLOSED TREE 2022-03-01 17:27:27 +02:00
Jeff Muizelaar
e2fb461ea3 Bug 1757454 - Remove code for working with CGFonts. r=lsalzman
Bug 1744851 removed the need for creating variations using a CGFont.
This removes some of the support code that was left behind and completes
the reverting of the initial fix for bug 1675185: c8875713fd6d193e6b017da0a88c264b7bdd9a78

Differential Revision: https://phabricator.services.mozilla.com/D139886
2022-03-01 14:57:17 +00:00
Butkovits Atila
84fea240ab Backed out changeset db75af2b4f4e (bug 1748788) for causing webrender crashes (bug 1707052). CLOSED TREE 2022-03-01 16:10:26 +02:00
Timothy Nikkel
22b5bfa1de Bug 1756762. When the root scroll frame is destroyed, reset the visual viewport offset on it's presshell. r=botond
The regular scroll position restoration code will restore it.

Specifically, in ScrollFrameHelper::SaveState

https://searchfox.org/mozilla-central/rev/44ae61c5eeb150cb77b6b8511ceee7ddd6892cb7/layout/generic/nsGfxScrollFrame.cpp#7376

we store the visual viewport offset. ScrollFrameHelper::ScrollToRestoredPosition will try to restore both the layout scroll offset and the visual viewport offset by calling ScrollToWithOrigin (which leads to ScrollToImpl) and PresShell::ScrollToVisual respectively.

I observed the following sequence of events when running gfx/layers/apz/test/mochitest/browser_test_background_tab_load_scroll.js in one of the cases that it fails for me locally.

-ScrollFrameHelper::NotifyApzTransaction is called after sending a transaction to webrender, this sets mAllowScrollOriginDowngrade = true.
-the scroll frame is destroyed and re-created (I'm not sure why this destroy and re-create happened, I didn't investigate), we call SaveState and RestoreState. So now mLastScrollOrigin == Other, and mAllowScrollOriginDowngrade == true.
-the test calls ScrollBy, so we get a call to ScrollToImpl with aOrigin == Relative
-aOrigin gets changed to Other here https://searchfox.org/mozilla-central/rev/9b0bdcc37419e6765223358a31a4a54d62e1cd97/layout/generic/nsGfxScrollFrame.cpp#2979
-the code just below that determines that it is not a downgrade, so we update mLastScrollOrigin to Other (not a change) and set mAllowScrollOriginDowngrade = false
-ScrollFrameHelper::NotifyApzTransaction is _not_ called (probably because we are in a background tab), so mAllowScrollOriginDowngrade remains false
-the scroll frame is now at position 20000 and the visual viewport offset (stored on the presshell) is also 20000.
-the scroll frame is destroyed and re-created (this one I investigated, it's because the font subsystem has finished loading and asks for a global reconstruct https://searchfox.org/mozilla-central/rev/9b0bdcc37419e6765223358a31a4a54d62e1cd97/layout/base/PresShell.cpp#9830), we call SaveState and RestoreState. So mLastScrollOrigin == Other, and mAllowScrollOriginDowngrade == true (the same values.
-we get a call to ScrollToRestoredPosition for the newly re-created scroll frame, we are trying to scroll from the current layout scroll position of 0 to the one we had before destruction and re-creation (20000). The visual viewport offset that is stored on the presshell has not been affected, it is still 20000.
-this gets to ScrollToImpl and with aOrigin == Restore
-we arrive at https://searchfox.org/mozilla-central/rev/9b0bdcc37419e6765223358a31a4a54d62e1cd97/layout/generic/nsGfxScrollFrame.cpp#3000 and Restore is a downgrade from Other, and mAllowScrollOriginDowngrade is false so we do not change mLastScrollOrigin (still Other) and mAllowScrollOriginDowngrade remains false
-we arrive at the code in ScrollToImpl that updates the visual viewport offset on the presshell https://searchfox.org/mozilla-central/rev/9b0bdcc37419e6765223358a31a4a54d62e1cd97/layout/generic/nsGfxScrollFrame.cpp#3232
-mLastScrollOrigin is Other, which can clobber apz, so we enter the if and add the difference between the before/after layout scroll position from this ScrollToImpl call (20000-0 = 20000) to the visual viewport offset (20000), getting 40000, which gets clamped to the max ~38000.
-and now the layout scroll position and the visual viewport offset have been detached when they shouldn't be.

If we reset the visual viewport offset when the scroll frame is destroyed we avoid the problem here.

Differential Revision: https://phabricator.services.mozilla.com/D139792
2022-03-01 01:51:27 +00:00
Marian-Vasile Laza
a0a962b604 Backed out changeset cd5ac5f6ff6e (bug 1756720) for causing reftest failures on 399636-standards-css.html. CLOSED TREE 2022-02-28 16:53:40 -08:00
Glenn Watson
4144c8d651 Bug 1757002 - Fix incorrect scaling of large surfaces r=gfx-reviewers,aosmond
Fixes a typo introduced when rebasing the original patch

Differential Revision: https://phabricator.services.mozilla.com/D139883
2022-02-28 23:22:11 +00:00
Nika Layzell
a2fec877d8 Bug 1751948 - Part 4: Correctly initialize OtherPid() for in-process actors, r=ipc-reviewers,mccr8
Before this change, OtherPid() would only be initialized for one side of an
actor pair when opening an in-process actor using `IToplevelProtocol::Open` or
`IToplevelProtocol::OpenOnSameThread`. This changes the function to directly
accept the other protocol, and initializes the value correctly in all cases.

Differential Revision: https://phabricator.services.mozilla.com/D137168
2022-02-28 21:01:48 +00:00
Nika Layzell
9e65eb911e Bug 1751948 - Part 1: Fix IPDL unified build issues, r=ipc-reviewers,mccr8
The changes in this patch stack will change how IPDL generated files are built,
such that these issues are now surfaced, especially during non-unified builds.

Differential Revision: https://phabricator.services.mozilla.com/D137165
2022-02-28 21:01:47 +00:00
Jonathan Kew
6901bd37b7 Bug 1756720 - When using legacy MS Symbol fonts, map character codes from the U+00xx range to the PUA range U+F0xx found in the cmap subtables. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D139724
2022-02-28 20:38:38 +00:00
Bob Owen
73d19e1f32 Bug 1755470: Assume zero GPU usage in GetGpuTimeSinceProcessStartInMs when win32k locked down. r=florian
Differential Revision: https://phabricator.services.mozilla.com/D139834
2022-02-28 15:59:01 +00:00
criss
482513fd24 Backed out 5 changesets (bug 1749352) for causing GTest failures. CLOSED TREE
Backed out changeset 977e030270db (bug 1749352)
Backed out changeset 8f8afd043413 (bug 1749352)
Backed out changeset 550c693e5dea (bug 1749352)
Backed out changeset c50f4c8331d3 (bug 1749352)
Backed out changeset ba1013d34a9e (bug 1749352)
2022-02-28 08:47:39 +02:00
Glenn Watson
439765c954 Bug 1757259 - Fix snapping on surfaces with 180 + 180 deg rotations r=gfx-reviewers,aosmond
Differential Revision: https://phabricator.services.mozilla.com/D139801
2022-02-28 05:54:42 +00:00
Hiroyuki Ikezoe
c05a6a04a8 Bug 1749352 - Add gtests. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D139561
2022-02-27 23:19:50 +00:00
Markus Stange
a5b1d43de7 Bug 1749352 - Remove unused mFollowedByMomentum. r=botond
Depends on D135922

Differential Revision: https://phabricator.services.mozilla.com/D135923
2022-02-27 23:19:49 +00:00
Markus Stange
0b89caa1e2 Bug 1749352 - Always call ScrollSnapToDestination from OnPanEnd, and ignore mFollowedByMomentum. r=botond
This patch makes us use the same code path for scroll snapping of
zero-velocity OnPanEnd and followed-by-momentum OnPanEnd.
This is preferable because mFollowedByMomentum is unreliable.

Depends on D135921

Differential Revision: https://phabricator.services.mozilla.com/D135922
2022-02-27 23:19:49 +00:00
Markus Stange
45f1667d94 Bug 1749352 - Use ScrollUnit::DEVICE_PIXELS in ScrollSnapToDestination. r=botond
ScrollSnapUtils::GetSnapPointForDestination has different behavior based on
the scroll unit. More specifically, the difference is in CalcSnapPoints::AddEdge:
Unless the unit is DEVICE_PIXELS, this function will only look for snap
points in the scroll direction. For example, if we are currently at position 40,
our destination is 50, and we have snap points at 30 and 100, then we'll only
consider snap point 100, even though snap point 30 would be closer to the destination.
Furthermore, if the destination is at the same position as the current position,
then we will not snap at all.
This behavior makes some sense for discrete-tick wheel scrolling, but I don't think
it is appropriate for touchpad scrolling. ScrollSnapToDestination is called from
OnPanMomentumStart and from AttemptFling; in both these contexts I think it makes
more sense to take all snap points into account.

With this change, it becomes possible to call ScrollSnapToDestination even when
our current velocity is zero. Without this change, we wouldn't scroll snap at
all in that case.

Depends on D135920

Differential Revision: https://phabricator.services.mozilla.com/D135921
2022-02-27 23:19:48 +00:00
Markus Stange
51877e08a5 Bug 1749352 - Don't interrupt scroll snapping animations when we receive a momentum pan event. r=botond
Scroll snapping uses an MSD smooth scroll to animate to the target position.
During the scroll snap animation, any synthesized momentum events
from the OS should be ignored; the scroll snap animation has taken over.

It is possible that this patch has unfortunate consequences when mixing
keyboard and touchpad scrolling. For example, pressing space to scroll down
by a page and then doing a fling with the touchpad might now have different
results.

Differential Revision: https://phabricator.services.mozilla.com/D135920
2022-02-27 23:19:48 +00:00
Olli Pettay
1edf4c885e Bug 1754562, make parent process' idle detection be aware of active RefreshDrivers in the other processes, r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D138504
2022-02-26 22:37:03 +00:00
Lee Salzman
0e447bde60 Bug 1757111 - Report cropped YCbCr sizes in RenderExternalTextureHost. r=jrmuizel
I had assumed in bug 1750858 that we would only need to modify RenderBufferTextureHost.
It turns out macOS will also still use the ffmpeg decoder and so RenderExternalTextureHost
must report cropped YCbCr sizes as well.

Differential Revision: https://phabricator.services.mozilla.com/D139679
2022-02-26 21:12:35 +00:00
Jeff Muizelaar
544b42554c Bug 1757011 - Unify some Moz2D documentation. r=gfx-reviewers,mstange
Differential Revision: https://phabricator.services.mozilla.com/D139601
2022-02-26 18:54:49 +00:00
Randell Jesup
359cf4ab53 Bug 1757189: Remove unneeded lock in FilterNodeLightingSoftware since we don't use OMTP r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D139726
2022-02-25 19:58:24 +00:00
sotaro
4388cf2116 Bug 1748788 - Send parent commands with ClearCachedResources r=gfx-reviewers,nical
RecvClearCachedResources() does not handle parent commands. They are handled by a different transaction. It caused the problem. To avoid the problem, modifying RecvClearCachedResources() as to handle parent commands.

Differential Revision: https://phabricator.services.mozilla.com/D139568
2022-02-25 15:43:19 +00:00
criss
d17f55ed9f Backed out changeset 39bd7bdd12be (bug 1754562) for causing multiple failures. CLOSED TREE 2022-02-25 13:40:50 +02:00
Olli Pettay
89b093258f Bug 1754562, make parent process' idle detection be aware of active RefreshDrivers in the other processes, r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D138504
2022-02-25 10:13:16 +00:00
sotaro
1145ad3b4c Bug 1757123 - Remove BufferTextureData::RestoreOriginalDescriptor() r=gfx-reviewers,jrmuizel
RestoreOriginalDescriptor() is not used since Bug 1750858 fix.

Differential Revision: https://phabricator.services.mozilla.com/D139678
2022-02-25 08:26:43 +00:00
Botond Ballo
69a291009d Bug 1750667 - Make the Rendering Overview page show up in the table of contents. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D136838
2022-02-25 06:16:06 +00:00
Glenn Watson
276701f973 Bug 1757032 - Fix rounding out of snapped off-screen surfaces r=gfx-reviewers,jgilbert
Differential Revision: https://phabricator.services.mozilla.com/D139667
2022-02-25 02:45:46 +00:00
stransky
9358067df4 Bug 1756775 Don't disable HW decoding directly on RDD level as we handle RDD crashes by MediaFormatReader r=alwu
Revert changes from Bug 1752493 as we handle RDD crashes on MediaFormatReader level.

Differential Revision: https://phabricator.services.mozilla.com/D139470
2022-02-24 08:54:04 +00:00
Marian-Vasile Laza
acfb3e797d Merge autoland to mozilla-central. a=merge 2022-02-23 19:49:43 -08:00
Glenn Watson
6e579c034e Bug 1749380 - Part 2 - Performance and quality fixes for part 1. r=gfx-reviewers,nical
* Add support for local scale factors to a surface, allowing it to
  be rasterized in root coordinate space. This allows snapping to
  work across surfaces where the surface transform is a fractional
  offset.

* Calculate scaling factors per rasterized surface and propagate
  them. Ensures correct scale factor calculations when dealing with
  nested preserve-3d contexts with 90-degree axis rotations.

* Support determining exact surface device rect for 2d surfaces
  with fractional surface transforms.

* Fix line decoration cache key size calculations based on world
  scaling factor.

* Remove `get_clipped_device_rect` usage for calculating clip-mask
  surface allocations, use `surface.get_surface_rect` instead. The
  prior method doesn't correctly account for expanded local regions
  from the current dirty rect, resulting in invalidation issues in
  some animated edge cases. Also unifies the way clip-mask surface
  allocations work with the way general render target surface
  allocations work.

Differential Revision: https://phabricator.services.mozilla.com/D138982
2022-02-23 20:49:27 +00:00