This gives CompositorBridgeParent its own namespace accessors, so the
pending bridge can be updated with the namespace from the
CompositorManagerParent.
Differential Revision: https://phabricator.services.mozilla.com/D292650
This reverts commit 39f0cac6d0.
Revert "Bug 2023443 Part 1: Ensure ownership of external images in various WR actors. r=gfx-reviewers,nical,aosmond"
This reverts commit aff292f9db.
Future patches to make WebRenderLayerManager able to be initialised
asynchronously will be made simpler if we can rely on mWrChild always
being non-null. This patch achieves this by moving the first part of
Initialize(), which creates the WebRenderBridgeChild, to a static
Create() function, which then passes the non-null WebRenderBridgeChild
to the constructor. Some existing but now redundant null checks are
removed.
Unfortunately there is a chicken or egg problem, as
WebRenderLayerManager::Create() requires a pointer to the
CompositorBridgeChild, but the CompositorBridgeChild is created by the
CompositorSession which requires the WebRenderLayerManager in order to
call CompositorBridgeChild::InitForWidget().
To solve this we remove the WebRenderLayerManager argument from
CompositorBridgeChild::InitForWidget(), and instead have the widget
call the function CompositorBridgeChild::CreateLayerManager() to
obtain the layer manager.
Differential Revision: https://phabricator.services.mozilla.com/D291522
This limits the abilities of the GPU process more appropriately than
the previous approach which used a generic message that could
dispatch any observer notification.
Differential Revision: https://phabricator.services.mozilla.com/D288592
remote_backbuffer::Provider is only used for SWGL with software
compositing. When we are using SWGL + D3D11 compositing, or full
hardware WebRender, we don't use it, and if we need to fallback, we will
do so by explicitly recreating the remote compositors.
For now, until bug 2007373 is able to land, we will still create these
threads for SWGL + D3D11 compositing since it can implicitly fallback if
it is failing at CompositorD3D11 creation.
Differential Revision: https://phabricator.services.mozilla.com/D277342
This call being synchronous currently ensures that
CompositorBridgeParent::RecvInitialize() has completed prior to
GPUParent::RecvInitAPZInputBridge() or
GPUParent::RecvInitUiCompositorController() being called. These both
require that the LayerTreeState corresponding to their aRootLayersId
has already been added to the map.
By moving these messages from PGPU to PCompositorBridge we can
guarantee this ordering while making Initialize() asynchronous.
Differential Revision: https://phabricator.services.mozilla.com/D273239
Instead of doing it just afterwards. The motivation for this is to
provide access to the CompositorBridgeChild when initializing the
UiCompositorController, which will be required by the next patch in
the series.
This should have no effect in the successful case. In case of failure,
however, it will now take the OnProcessUnexpectedShutdown() path and
perhaps retry creating the GPU process, rather than just immediately
disabling it. This brings it in line with how we handle failure to
create the session's other actors.
Differential Revision: https://phabricator.services.mozilla.com/D273238
This reverts commit c19fcf010e.
Revert "Bug 2001152 - Initialize UiCompositorController along with rest of CompositorSession. r=aosmond"
This reverts commit cbe021867d.
This call being synchronous currently ensures that
CompositorBridgeParent::RecvInitialize() has completed prior to
GPUParent::RecvInitAPZInputBridge() or
GPUParent::RecvInitUiCompositorController() being called. These both
require that the LayerTreeState corresponding to their aRootLayersId
has already been added to the map.
By moving these messages from PGPU to PCompositorBridge we can
guarantee this ordering while making Initialize() asynchronous.
Differential Revision: https://phabricator.services.mozilla.com/D273239
Instead of doing it just afterwards. The motivation for this is to
provide access to the CompositorBridgeChild when initializing the
UiCompositorController, which will be required by the next patch in
the series.
This should have no effect in the successful case. In case of failure,
however, it will now take the OnProcessUnexpectedShutdown() path and
perhaps retry creating the GPU process, rather than just immediately
disabling it. This brings it in line with how we handle failure to
create the session's other actors.
Differential Revision: https://phabricator.services.mozilla.com/D273238
In bug 1981068 we made GPUProcessManager remove its battery observer
in xpcom-will-shutdown rather than xpcom-shutdown, to ensure there are
no outstanding observers when MacPowerInformationService shuts down in
response to xpcom-shutdown. However, if the GPU process launch
completes after xpcom-will-shutdown but before xpcom-shutdown, then we
will create a new battery observer, causing the assertion that there
are no outstanding observers during xpcom-shutdown to fail.
This patch avoids this by checking the shutdown phase prior to
creating the observer. Temporarily running without the observer is
harmless, and the GPU process will be shutdown imminently anyway.
Differential Revision: https://phabricator.services.mozilla.com/D272843
This one-time sets the priority of the gpu process, which should have a
lasting effect, because it's not set anywhere else.
Differential Revision: https://phabricator.services.mozilla.com/D272101
This reverts commit 58ac339f24.
Revert "Bug 1985327 Part 2: Make Windows handle PROCESS_PRIORITY_FOREGROUND_HIGH. r=gfx-reviewers,lsalzman"
This reverts commit 0c524cd109.
Revert "Bug 1985327 Part 1: Elevate the priority of gpu process at process launch. r=gfx-reviewers,lsalzman"
This reverts commit d251e90a0e.
This one-time sets the priority of the gpu process, which should have a
lasting effect, because it's not set anywhere else.
Differential Revision: https://phabricator.services.mozilla.com/D272101
This patch simplifies that device reset logic to ensure that we always
finish completing a device reset, regardless of our present state. This
is because once we are in the middle of a device reset, we fail to
create new compositor sessions. So even if we managed to somehow
partially recover (particularly from the Windows perspective) or never
had a full reset, we should always complete the transaction to make the
parent process recreate all of its compositor sessions, in process or
remote.
We also now unify that device reset handling from nsWindow::Paint on
Windows so that if there are multiple pathways we trigger the same
device reset, we will always complete handling it properly.
Differential Revision: https://phabricator.services.mozilla.com/D271126
This patch makes it so that we silently fail to setup the GPU process
and its associated IPDL actors on Android when we are in the background.
This is because Android limits our ability to keep a GPU process when
backgrounded, and the higher levels should have an ability to recover
from this situation for content processes when brought back into the
foreground. It also resets the unstable and launch attempt counters when
the fore/background state changes to be more forgiving of GPU process
crashes during the transitions.
When the GPU process is relaunched, it will also destroy the fallback
renderers created on Android, so that the next paint will properly
request remote compositing.
Differential Revision: https://phabricator.services.mozilla.com/D267679
Simulating device resets for parent process compositing is problematic
because we need to dispatch to handle device resets, but the compositor
session creation never lets go of the main thread to allow those events
to be processed.
In reality most platforms have a GPU process now, and if we disable the
GPU process, we use Software WebRender, for which a simulated device
reset is unlikely to help anyways. The only exception is on Linux, but
it is not that common to fail to create a compositor, so it is probably
okay to fall back to Software WebRender right away.
Similarly, killing the GPU process is also a problem for the same
reason. We need to clean up inline, and there are some reentrancy
concerns. Once we investigate those, we can land a later patch to
re-enable this for the compositor session path.
Differential Revision: https://phabricator.services.mozilla.com/D271214
This patch reduces the complexity in EnsureGPUReady to account for
different failure scenarios that are not properly handled with the
current logic.
We can fail to initialize a GPU process because:
1) We are already in shutdown.
2) The initial launch request itself fails.
3) The launch response fails.
4) The GPUChild actor fails its first sync IPDL call.
We were failing to account for the fact that 4) can both fail, and not
disable the GPU process to allow for a retry of the launch.
Now instead we simplify the logic to:
1) Early exit for the most common success cases.
2) Only check for shutdown once after that.
3) Reduce the necessary logic, trusting (with asserts) that the
expected methods will be called to set our state correctly.
4) Make disabling WebRender without restarting the GPU process perform
the necessary synchronization inline, since it is going to happen
shortly anyways due to the config change and compositor resets.
Differential Revision: https://phabricator.services.mozilla.com/D270555
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.
In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.
One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.
Most of the heavy lifting was done through:
$ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
$ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'
Differential Revision: https://phabricator.services.mozilla.com/D268706
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.
In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.
One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.
Most of the heavy lifting was done through:
$ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
$ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'
Differential Revision: https://phabricator.services.mozilla.com/D268706
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.
In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.
One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.
Most of the heavy lifting was done through:
$ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
$ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'
Differential Revision: https://phabricator.services.mozilla.com/D268706
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.
In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.
One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.
Most of the heavy lifting was done through:
$ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
$ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'
Differential Revision: https://phabricator.services.mozilla.com/D268706
This avoids calls to GPUProcessManager::EnsureGPUReady as well as making
it more manageable to avoid relaunching the GPU process while in the
background on Android.
Differential Revision: https://phabricator.services.mozilla.com/D269115
This avoids calls to GPUProcessManager::EnsureGPUReady as well as making
it more manageable to avoid relaunching the GPU process while in the
background on Android.
Differential Revision: https://phabricator.services.mozilla.com/D269115
The distinction between nsBaseWidget and nsIWidget is useless as all our
implementations use the former.
So just merge both.
Differential Revision: https://phabricator.services.mozilla.com/D268518
This should have no functional change, but does make it easier to reason
about what call paths depend on EnsureGPUReady by removing the
redundancy, and making the error codes it returns clearer/more obvious.
Differential Revision: https://phabricator.services.mozilla.com/D268277
This should have no functional change, but does make it easier to reason
about what call paths depend on EnsureGPUReady by removing the
redundancy, and making the error codes it returns clearer/more obvious.
Differential Revision: https://phabricator.services.mozilla.com/D268277
We only need to wait for a GPU process to finish launching if it is in
progress, so that we can include it in the report.
Differential Revision: https://phabricator.services.mozilla.com/D268197
While we want to treat backgrounding as a situation where we expect the
GPU process to crash, we don't want to record it as having been once
stable for the purposes of crashing the parent process. Otherwise that
will cause users who background Firefox immediately after launch to
supposedly have had a stable GPU process, and crash the parent if we
want to fallback to the parent process for compositing.
Differential Revision: https://phabricator.services.mozilla.com/D268215
We only need to wait for a GPU process to finish launching if it is in
progress, so that we can include it in the report.
Differential Revision: https://phabricator.services.mozilla.com/D268197
This reduces the pathways from which we can create a GPU process. In
this case, it should not be necessary because we either 1) have a GPU
process already, in which case we can send an IPDL message to destroy
it, 2) are compositing in the parent process, in which case we won't
relaunch it, or 3) we don't have a GPU process at this moment, but need
one, and the layer ID isn't valid anyways.
Differential Revision: https://phabricator.services.mozilla.com/D268189
This is only used by APZ right now, and if the GPU process had to be
launched to dispatch this observer event, there would have been no state
to update, so we can just refuse to dispatch.
Differential Revision: https://phabricator.services.mozilla.com/D268196