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

284 Коммитов

Автор SHA1 Сообщение Дата
sotaro 3ece048a1b Bug 1829063 - Split video overlay feature of software decoded video from nsIGfxInfo::FEATURE_VIDEO_OVERLAY r=gfx-reviewers,lsalzman
Current gecko enables "software decoded video overlay" only when "hardware decoded video overlay" is enabled. On current release, "hardware decoded video overlay" is not enabled yet with non-Intel GPU, then "software decoded video overlay" is not yet enabled on release. It is not good. We want to enable "software decoded video overlay" independently from "hardware decoded video overlay". Then settings of video overlay is split between "hardware decoded video overlay" and "software decoded video overlay". Then "software decoded video overlay" could be enabled/disabled independently from status of "hardware decoded video overlay".

* settings of hardware decoded video overlay
- nsIGfxInfo::FEATURE_VIDEO_OVERLAY:
- gfx.webrender.dcomp-video-hw-overlay-win
- gfx.webrender.dcomp-video-hw-overlay-win-force-enabled
- gfxVars::UseWebRenderDCompVideoHwOverlayWin()

* settings of software decoded video overlay
- nsIGfxInfo::FEATURE_VIDEO_SOFTWARE_OVERLAY
- gfx.webrender.dcomp-video-sw-overlay-win
- gfx.webrender.dcomp-video-sw-overlay-win-force-enabled
- gfxVars::UseWebRenderDCompVideoSwOverlayWin()

Differential Revision: https://phabricator.services.mozilla.com/D175993
2023-06-22 00:21:07 +00:00
Andrew Osmond 90299327da Bug 1827222 - GPUProcessManager should not allow (re)initialization during shutdown. r=jnicol
We already avoid launching the GPU process during shutdown, but shutdown
could happen after we initiated the launch and before it completes. Top
level IPDL protocols assert that we don't create them during shutdown,
so we need to be more diligent about checking for that.

Differential Revision: https://phabricator.services.mozilla.com/D175054
2023-05-02 14:56:26 +00:00
sotaro 53393b26d4 Bug 1811160 - Disable out-of-process WebGL and accelerated canvas when GPU process does not exists on android r=gfx-reviewers,lsalzman
On Android, GPU process exists by default. When GPU process does not exist, an error should disable GPU process.

On Android, WebGL handling process could easily crash. The crash could trigger disable GPU process. Current out-of-process WebGL implementation creates WebGLParent in parent process. Then a crash in parent process could be triggered by WebGL. Then it seems better to disable out-of-process WebGL when GPU process does not exist.

And it seems also better to disable accelerated canvas, since it uses WebGL for acceleration.

Differential Revision: https://phabricator.services.mozilla.com/D167512
2023-01-24 06:05:13 +00:00
Andrew Osmond 8471c103b9 Bug 1799016 - Ensure gfxVar updates are applied to GPU process before recreating compositor sessions. r=jnicol
When we fallback without recreating the GPU process, we should ensure
that the gfxVar updates have been processed before recreating the
compositor sessions. This is achieved by blocking on the sync
PGPU::SendDeviceStatus IPDL message. This additional sync message only
happens during fallback and thus should be fairly cheap.

Differential Revision: https://phabricator.services.mozilla.com/D162020
2022-11-15 14:28:30 +00:00
Florian Queze ea6e6f4fa1 Bug 1671490 - Mark the GPU process as being in the foreground whenever the parent process is in the foreground to make their priorities (and priority boosts) match, r=bas.
Differential Revision: https://phabricator.services.mozilla.com/D161065
2022-11-14 16:05:34 +00:00
Andrew Osmond 9d245b8325 Bug 1794722 - Part 2. Remove all uses of gfxVars::UseWebRender(). r=jrmuizel,media-playback-reviewers,alwu
This is always true.

Differential Revision: https://phabricator.services.mozilla.com/D160121
2022-10-28 12:36:06 +00:00
Cristian Tuns 1303ee58d8 Backed out 3 changesets (bug 1794722) for causing multiple failures on RemoteProcessMonitor CLOSED TREE
Backed out changeset 0217af5b1aa6 (bug 1794722)
Backed out changeset d7805be9dfb3 (bug 1794722)
Backed out changeset 0093f071f1a5 (bug 1794722)
2022-10-27 20:52:36 -04:00
Andrew Osmond 93abf26cbc Bug 1794722 - Part 2. Remove all uses of gfxVars::UseWebRender(). r=jrmuizel,media-playback-reviewers,alwu
This is always true.

Differential Revision: https://phabricator.services.mozilla.com/D160121
2022-10-28 00:08:03 +00:00
Jamie Nicol 4e75ea7392 Bug 1797068 - Ensure GPU process gets disabled after certain number of unstable launch attempts. r=aosmond
This was accidentally broken in bug 1768197.

Depends on D160042

Differential Revision: https://phabricator.services.mozilla.com/D160043
2022-10-24 14:53:41 +00:00
alwu 3d1bc29d56 Bug 1785738 - part4 : run media engine in the new utility process. r=gerard-majax,azebrowski
This patch moves the media engine from the RDD process to the new
utility process, and create video bridge between the new utility process
and the GPU process in order to share the texture.

Differential Revision: https://phabricator.services.mozilla.com/D155901
2022-09-03 00:53:59 +00:00
Jamie Nicol 00cdec76f5 Bug 1775480 - Add more crash annotations for bug 1772839. r=gfx-reviewers,aosmond
Add crash annotations for the total number of webrender renderers, as
well as the number that are currently not paused, as this error could
be caused by having multiple renderers in a resumed state
concurrently. Additionally, add some gfxCriticalNotes for potentially
relevant error cases.

Differential Revision: https://phabricator.services.mozilla.com/D150000
2022-06-22 15:31:56 +00:00
Jamie Nicol 2cf59fe695 Bug 1767128 - Rework and re-enable SurfaceControl rendering path on Android. r=agi,gfx-reviewers,aosmond
In bug 1762424 we introduced a rendering path on Android using the
SurfaceControl API, in order to work around a bug preventing recovery
from a GPU process crash. However, the initial implementation caused
this bug: repeatedly sending the same SurfaceControl objects over AIDL
to the GPU process resulted in them being leaked, eventually causing
severe display issues. Not only were we duplicating the SurfaceControl
for each widget, but each time a widget was resized too.

This patch reworks our usage of the SurfaceControl API to avoid ever
having to send them cross-process. Instead, we create a single child
SurfaceControl object for each SurfaceControl that is attached to a
widget. (Typically there will be a single one shared between all
widgets, changing only when the app is paused and resumed, which is
much fewer than one per widget per resize.)

In the parent process we obtain the Surfaces that will be rendered in
to from the child SurfaceControls, and only send those Surfaces to the
GPU process. Thankfully unlike SurfaceControls, sending Surfaces
cross-process does not cause leaks. When the GPU process dies we
simply destroy all of the child SurfaceControls, and recreate them
again on-demand.

Differential Revision: https://phabricator.services.mozilla.com/D147437
2022-05-31 18:41:07 +00:00
Andrew Osmond 2b6582e69d Bug 1768197 - Handle WebRenderError errors more gracefully. r=jrmuizel
WebRenderErrors errors after initialization will often be memory/driver
related. We can try to recover from this more gracefully by tearing down
the compositors instead of just crashing when we have finished falling
back. If one has a GPU process, it will be killed, and otherwise, it
will simulate a device reset in the parent process. This graceful
recovery can only be used if the process is declared "stable", according
to existing criteria for the GPU process (minimum uptime and frames
composited).

Differential Revision: https://phabricator.services.mozilla.com/D146477
2022-05-20 17:02:55 +00:00
Tom Ritter 981a623dfe Bug 1752332: Remove the blocklisting check in ::OnPreferenceChange r=KrisWright
Now that we send everything (except sometimes the user value
is sanitized) we should no longer perform this check.

This is also good because it eliminates security code you
have to have (and thus accidently omitting it is a
vulnerability) and changes it to security code that happens
automatically, and is enforced by the compiler (via mandatory
ctor argument.)

Depends on D141414

Differential Revision: https://phabricator.services.mozilla.com/D141415
2022-04-27 12:57:36 +00:00
Tom Ritter ea3a8f9f97 Bug 1752332: Correctly populate the sanitized bit for PreferenceUpdate r=KrisWright
PreferenceUpdate is the IPC message notifying a child process
that a preference has been updated. To correctly decide whether
or not a value should be sanitized in it, we need to know
what type of destination process it is; we add parameters to
Preferences::GetPreference indicating that.

Inside of ToDomPref we call ShouldSanitizePreference to
correctly populate the sanitized bit.

Depends on D141412

Differential Revision: https://phabricator.services.mozilla.com/D141413
2022-04-27 12:57:36 +00:00
Tom Ritter ce8ed8e849 Bug 1752332: Rename ShouldSyncPreference to ShouldSanitizePreference r=KrisWright
This simplifies the number of negations needed,
and makes things easy to understand. I think
anyway; I know that without renaming it I made
several annoying-to-diagnose negation errors...

Depends on D141411

Differential Revision: https://phabricator.services.mozilla.com/D141412
2022-04-27 12:57:35 +00:00
Tom Ritter dae964f1a8 Bug 1752332: Tell ShouldSyncPreference if the destination is a web content process r=KrisWright
A couple places where it might be a web content process
still pass 'false' - this will be corrected in a later
patch.

Depends on D141410

Differential Revision: https://phabricator.services.mozilla.com/D141411
2022-04-27 12:57:35 +00:00
Tom Ritter 32adae1779 Bug 1752332: Move ShouldSyncPreferences to Preferences module r=KrisWright
Depends on D141409

Differential Revision: https://phabricator.services.mozilla.com/D141410
2022-04-27 12:57:34 +00:00
Tom Ritter 1e49cf60d8 Bug 1752332: Add a sanitized property to prefs r=KrisWright
Differential Revision: https://phabricator.services.mozilla.com/D141408
2022-04-27 12:57:34 +00:00
Mike Hommey af7d5859d7 Bug 1766377 - Fix some sign-compare warnings by using ProcessId more consistently. r=nika,necko-reviewers,kershaw
dom/media/ipc/RDDProcessManager.cpp(320,21): error: comparison of integers of different signs: 'base::ProcessId' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare]
      gpuProcessPid != -1 ? gpuProcessPid : base::GetCurrentProcId();
      ~~~~~~~~~~~~~ ^  ~~
dom/media/ipc/RDDProcessManager.cpp(332,21): error: comparison of integers of different signs: 'base::ProcessId' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare]
  if (gpuProcessPid != -1) {
      ~~~~~~~~~~~~~ ^  ~~
gfx/layers/ipc/SharedSurfacesParent.cpp(360,38): error: comparison of integers of different signs: 'base::ProcessId' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare]
    if (!gpm || gpm->GPUProcessPid() != -1) {
                ~~~~~~~~~~~~~~~~~~~~ ^  ~~
ipc/glue/MessageChannel.cpp(2145,13): error: comparison of integers of different signs: 'int32_t' (aka 'int') and 'const base::ProcessId' (aka 'const unsigned long') [-Werror,-Wsign-compare]
    if (pid != base::kInvalidProcessId &&
        ~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~

Differential Revision: https://phabricator.services.mozilla.com/D144688
2022-04-27 07:45:19 +00:00
Butkovits Atila c891bf41e7 Backed out 17 changesets (bug 1752332) for causing crashes at JS::AutoAssertNoGC::AutoAssertNoGC(JSContext*). CLOSED TREE
Backed out changeset eaa4213b9e08 (bug 1752332)
Backed out changeset 2d794b61fbf7 (bug 1752332)
Backed out changeset 69cbec3e9a11 (bug 1752332)
Backed out changeset 022a68e8d603 (bug 1752332)
Backed out changeset 1ff8656b362d (bug 1752332)
Backed out changeset 46ea5b4f9ad3 (bug 1752332)
Backed out changeset e1dcb4c7cb88 (bug 1752332)
Backed out changeset f9d6bc72406f (bug 1752332)
Backed out changeset dd02b8ef0219 (bug 1752332)
Backed out changeset 3e60b77153a3 (bug 1752332)
Backed out changeset ce93b08837d2 (bug 1752332)
Backed out changeset d165042105ea (bug 1752332)
Backed out changeset 22b910308ecd (bug 1752332)
Backed out changeset d2e748ccd01c (bug 1752332)
Backed out changeset a89203990075 (bug 1752332)
Backed out changeset b580c2a3bac0 (bug 1752332)
Backed out changeset a2d5880b528f (bug 1752332)
2022-04-25 17:55:17 +03:00
Tom Ritter 790bbf4ea8 Bug 1752332: Remove the blocklisting check in ::OnPreferenceChange r=KrisWright
Now that we send everything (except sometimes the user value
is sanitized) we should no longer perform this check.

This is also good because it eliminates security code you
have to have (and thus accidently omitting it is a
vulnerability) and changes it to security code that happens
automatically, and is enforced by the compiler (via mandatory
ctor argument.)

Depends on D141414

Differential Revision: https://phabricator.services.mozilla.com/D141415
2022-04-25 13:54:01 +00:00
Tom Ritter f9201a6b3f Bug 1752332: Correctly populate the sanitized bit for PreferenceUpdate r=KrisWright
PreferenceUpdate is the IPC message notifying a child process
that a preference has been updated. To correctly decide whether
or not a value should be sanitized in it, we need to know
what type of destination process it is; we add parameters to
Preferences::GetPreference indicating that.

Inside of ToDomPref we call ShouldSanitizePreference to
correctly populate the sanitized bit.

Depends on D141412

Differential Revision: https://phabricator.services.mozilla.com/D141413
2022-04-25 13:54:01 +00:00
Tom Ritter e7d695f54c Bug 1752332: Rename ShouldSyncPreference to ShouldSanitizePreference r=KrisWright
This simplifies the number of negations needed,
and makes things easy to understand. I think
anyway; I know that without renaming it I made
several annoying-to-diagnose negation errors...

Depends on D141411

Differential Revision: https://phabricator.services.mozilla.com/D141412
2022-04-25 13:54:00 +00:00
Tom Ritter ef6d930532 Bug 1752332: Tell ShouldSyncPreference if the destination is a web content process r=KrisWright
A couple places where it might be a web content process
still pass 'false' - this will be corrected in a later
patch.

Depends on D141410

Differential Revision: https://phabricator.services.mozilla.com/D141411
2022-04-25 13:54:00 +00:00
Tom Ritter 4ef13ee7f8 Bug 1752332: Move ShouldSyncPreferences to Preferences module r=KrisWright
Depends on D141409

Differential Revision: https://phabricator.services.mozilla.com/D141410
2022-04-25 13:53:59 +00:00
Tom Ritter ef57c7df72 Bug 1752332: Add a sanitized property to prefs r=KrisWright
Differential Revision: https://phabricator.services.mozilla.com/D141408
2022-04-25 13:53:59 +00:00
Cristian Tuns 467d2abfd0 Backed out 16 changesets (bug 1752332) for causing gtest failures CLOSED TREE
Backed out changeset 2523f5463789 (bug 1752332)
Backed out changeset 8d2932869cbd (bug 1752332)
Backed out changeset 7d159898e81d (bug 1752332)
Backed out changeset 5b9bbe252fec (bug 1752332)
Backed out changeset aeb79413e987 (bug 1752332)
Backed out changeset c184c517de91 (bug 1752332)
Backed out changeset 1bc4f1780f37 (bug 1752332)
Backed out changeset 2b78f295d903 (bug 1752332)
Backed out changeset 21f015b60220 (bug 1752332)
Backed out changeset a74095dfe3da (bug 1752332)
Backed out changeset 4b04bf33486e (bug 1752332)
Backed out changeset 8566711743a8 (bug 1752332)
Backed out changeset eec507d87b2b (bug 1752332)
Backed out changeset ef50d2618c7f (bug 1752332)
Backed out changeset 1b4d316e7f20 (bug 1752332)
Backed out changeset e40a778cb93f (bug 1752332)
2022-04-20 17:23:11 -04:00
Tom Ritter 80d036e297 Bug 1752332: Remove the blocklisting check in ::OnPreferenceChange r=KrisWright
Now that we send everything (except sometimes the user value
is sanitized) we should no longer perform this check.

This is also good because it eliminates security code you
have to have (and thus accidently omitting it is a
vulnerability) and changes it to security code that happens
automatically, and is enforced by the compiler (via mandatory
ctor argument.)

Depends on D141414

Differential Revision: https://phabricator.services.mozilla.com/D141415
2022-04-20 20:21:45 +00:00
Tom Ritter 1cc103189e Bug 1752332: Correctly populate the sanitized bit for PreferenceUpdate r=KrisWright
PreferenceUpdate is the IPC message notifying a child process
that a preference has been updated. To correctly decide whether
or not a value should be sanitized in it, we need to know
what type of destination process it is; we add parameters to
Preferences::GetPreference indicating that.

Inside of ToDomPref we call ShouldSanitizePreference to
correctly populate the sanitized bit.

Depends on D141412

Differential Revision: https://phabricator.services.mozilla.com/D141413
2022-04-20 20:21:44 +00:00
Tom Ritter e9bd1a1b96 Bug 1752332: Rename ShouldSyncPreference to ShouldSanitizePreference r=KrisWright
This simplifies the number of negations needed,
and makes things easy to understand. I think
anyway; I know that without renaming it I made
several annoying-to-diagnose negation errors...

Depends on D141411

Differential Revision: https://phabricator.services.mozilla.com/D141412
2022-04-20 20:21:44 +00:00
Tom Ritter a7e00d1b86 Bug 1752332: Tell ShouldSyncPreference if the destination is a web content process r=KrisWright
A couple places where it might be a web content process
still pass 'false' - this will be corrected in a later
patch.

Depends on D141410

Differential Revision: https://phabricator.services.mozilla.com/D141411
2022-04-20 20:21:44 +00:00
Tom Ritter a77e0fbeb2 Bug 1752332: Move ShouldSyncPreferences to Preferences module r=KrisWright
Depends on D141409

Differential Revision: https://phabricator.services.mozilla.com/D141410
2022-04-20 20:21:43 +00:00
Tom Ritter f0860a2493 Bug 1752332: Add a sanitized property to prefs r=KrisWright
Differential Revision: https://phabricator.services.mozilla.com/D141408
2022-04-20 20:21:42 +00:00
Cristian Tuns 6e25a12cb7 Backed out 16 changesets (bug 1752332) for causing multiple failures on StaticPrefList_media.h
Backed out changeset ec6a5f016318 (bug 1752332)
Backed out changeset 10ac6886fa5e (bug 1752332)
Backed out changeset d37dec5c0d9e (bug 1752332)
Backed out changeset 258d19fe4e28 (bug 1752332)
Backed out changeset 52f6b46250a3 (bug 1752332)
Backed out changeset ab5c00d2fb02 (bug 1752332)
Backed out changeset d72dc14eeafd (bug 1752332)
Backed out changeset 061cdf612d0e (bug 1752332)
Backed out changeset 26707a82d896 (bug 1752332)
Backed out changeset 01ca344dedbf (bug 1752332)
Backed out changeset 22c6c04046b1 (bug 1752332)
Backed out changeset ce809df435e1 (bug 1752332)
Backed out changeset 185026a397b0 (bug 1752332)
Backed out changeset 9dfd530f26b8 (bug 1752332)
Backed out changeset deadcb975866 (bug 1752332)
Backed out changeset 4944ae34f15b (bug 1752332)
2022-04-20 13:10:55 -04:00
Tom Ritter ef01345335 Bug 1752332: Remove the blocklisting check in ::OnPreferenceChange r=KrisWright
Now that we send everything (except sometimes the user value
is sanitized) we should no longer perform this check.

This is also good because it eliminates security code you
have to have (and thus accidently omitting it is a
vulnerability) and changes it to security code that happens
automatically, and is enforced by the compiler (via mandatory
ctor argument.)

Depends on D141414

Differential Revision: https://phabricator.services.mozilla.com/D141415
2022-04-20 15:44:39 +00:00
Tom Ritter c674d31eba Bug 1752332: Correctly populate the sanitized bit for PreferenceUpdate r=KrisWright
PreferenceUpdate is the IPC message notifying a child process
that a preference has been updated. To correctly decide whether
or not a value should be sanitized in it, we need to know
what type of destination process it is; we add parameters to
Preferences::GetPreference indicating that.

Inside of ToDomPref we call ShouldSanitizePreference to
correctly populate the sanitized bit.

Depends on D141412

Differential Revision: https://phabricator.services.mozilla.com/D141413
2022-04-20 15:44:38 +00:00
Tom Ritter d9fb7a4c74 Bug 1752332: Rename ShouldSyncPreference to ShouldSanitizePreference r=KrisWright
This simplifies the number of negations needed,
and makes things easy to understand. I think
anyway; I know that without renaming it I made
several annoying-to-diagnose negation errors...

Depends on D141411

Differential Revision: https://phabricator.services.mozilla.com/D141412
2022-04-20 15:44:37 +00:00
Tom Ritter bc1d73db3c Bug 1752332: Tell ShouldSyncPreference if the destination is a web content process r=KrisWright
A couple places where it might be a web content process
still pass 'false' - this will be corrected in a later
patch.

Depends on D141410

Differential Revision: https://phabricator.services.mozilla.com/D141411
2022-04-20 15:44:37 +00:00
Tom Ritter 288e606baf Bug 1752332: Move ShouldSyncPreferences to Preferences module r=KrisWright
Depends on D141409

Differential Revision: https://phabricator.services.mozilla.com/D141410
2022-04-20 15:44:37 +00:00
Tom Ritter 30221b51c4 Bug 1752332: Add a sanitized property to prefs r=KrisWright
Differential Revision: https://phabricator.services.mozilla.com/D141408
2022-04-20 15:44:36 +00:00
Jamie Nicol 5dc0cd786f Bug 1762424 - Force crash if unable to create Surface after trying all fallback configurations. r=gfx-reviewers,nical
In bug 1762025 we found ourselves in a situation where we are unable
to ever create an EGLSurface, meaning we were continually attempting
to initialize a compositor, encountering a NEW_SURFACE webrender
error, causing us to tear down the compositor and create a new one,
repeating the cycle indefinitely.

This leaves the user with an unusable browser. We'd be better off
simply crashing. This patch adds a flag to FallbackFromAcceleration(),
which forces a crash if we have already exhausted all of the fallback
options. When calling FallbackFromAcceleration due to a NEW_SURFACE
error we set the flag to true. It may also be worthwhile setting this
flag for more errors in the future.

Differential Revision: https://phabricator.services.mozilla.com/D143486
2022-04-18 18:11:08 +00:00
Jens Stutte cbf1df6c09 Bug 1763893: Avoid late creation of the GPU process. r=aosmond
The GPU process is destroyed in `ShutdownPhase::XPCOMShutdown` thus we shall not try to create it if we are in or beyond that phase.
Actually we might want to consider to block the creation even earlier if it does not exist, maybe from `ShutdownPhase::AppShutdown`, but this patch wants to just repair the crashes.

Differential Revision: https://phabricator.services.mozilla.com/D143349
2022-04-11 11:49:21 +00:00
Florian Quèze 253d6198c8 Bug 1757202 - Make the inner window id of the browser window available in the compositor bridge, r=mstange.
Differential Revision: https://phabricator.services.mozilla.com/D139730
2022-03-11 07:49:04 +00:00
sotaro 7991ca6079 Bug 1757879 - Make SimulateDeviceReset() similar to actual device reset handling r=ipc-reviewers,gfx-reviewers,lsalzman,mccr8
SimulateDeviceReset() works differently from actual device reset handling. It seems better to make SimulateDeviceReset() more similar to actual device reset handling.

Differential Revision: https://phabricator.services.mozilla.com/D140161
2022-03-08 23:14:28 +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
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
Jamie Nicol 72a1b5cd91 Bug 1755381 - Avoid relaunching GPU process immediately on Android if app is in background. r=agi,aosmond
If the android system kills the GPU process to free memory while the
app is in the background, then we want to avoid immediately restarting
the GPU process.

To achieve this, we make GPUProcessManager keep track of whether it is
in the foreground or background. If HandleProcessLost() gets called
while in the background then we destroy the existing compositor
sessions as before, but return early instead of immediately
relaunching the process. If the process has not been launched when the
app later gets foregrounded then we do so then.

The final part of HandleProcessLost(), which reinitializes the content
bridges and emits the "compositor-reinitialized" signal, has been
moved to a new function ReinitializeRendering(). If the GPU process
has been disabled, this gets called as-before at the end of
HandleProcessLost(). When the GPU process is enabled, however, we now
call it from OnProcessLaunchComplete(), so that it gets called
regardless of whether the process is launched immediately or after a
delay.

While we're here, rename the functions RebuildRemoteSessions() and
RebuildInProcessSessions() to DestroyRemoteCompositorSessions() and
DestroyInProcessCompositorSessions(), to better reflect what they
actually do: the "rebuilding" part occurs later on. Also update the
mega-comment documenting the restart sequence, as it was somewhat
outdated.

In case a caller of EnsureGPUReady() gets called before the foreground
signal arrives (eg in nsBaseWidget::CreateCompositorSession() due to a
refresh tick paint), make EnsureGPUReady() launch the GPU process
itself if the GPU process is enabled but not yet launched. As a
consequence, to avoid launching the GPU process unnecessarily, change
a couple callers of EnsureGPUReady() to simply check whether the
process is enabled instead.

Additionally, guard against a null pointer deref if the compositor has
been destroyed when the widget receives a memory pressure event. This
is now more likely to occur as there may be a gap between the
compositor being destroyed and recreated.

Differential Revision: https://phabricator.services.mozilla.com/D139042
2022-02-22 15:59:13 +00:00
Dan Minor 01831135cc Bug 1751936 - Update users of SharedPreferenceSerializer to pass ShouldSyncPreference; r=tjr
Differential Revision: https://phabricator.services.mozilla.com/D137476
2022-02-07 16:44:18 +00:00