Commit graph

328 commits

Author SHA1 Message Date
sotaro
b0f638846b Bug 1823844 - Add error log to RenderThread::Start() r=gfx-reviewers,aosmond
Differential Revision: https://phabricator.services.mozilla.com/D173246
2023-03-23 00:34:52 +00:00
sotaro
9ca40310af Bug 1823352 - A little code cleanup in RenderThread r=gfx-reviewers,aosmond
Preparation for Bug 1804233

Differential Revision: https://phabricator.services.mozilla.com/D172981
2023-03-21 00:24:27 +00:00
sotaro
b2f1baf7c4 Bug 1812498 - Destroy RenderBufferTextureHosts that use VideoBridgeParent's Shmems in VideoBridgeParent::OnChannelError() r=lsalzman
Destroy RenderBufferTextureHosts that use VideoBridgeParent's Shmems before destroying all VideoBridgeParent's Shmems by PVideoBridgeParent::OnChannelError().

Differential Revision: https://phabricator.services.mozilla.com/D169796
2023-03-17 00:35:03 +00:00
sotaro
5abd63997f Bug 1822459 - Use UniquePtr in mWindowInfos r=gfx-reviewers,ErichDonGubler
With UniquePtr, RenderThread::RemoveRenderer() becomes simpler.

Differential Revision: https://phabricator.services.mozilla.com/D172644
2023-03-16 00:59:19 +00:00
Chris Martin
b42c4425d0 Bug 1816559 - Remote compositor recording from GPU process r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D170514
2023-03-14 13:31:37 +00:00
Lee Salzman
646e8918c1 Bug 1777849 - Disable FEATURE_THREADSAFE_GL on X11 and GLX. r=gfx-reviewers,ahale,aosmond
LibX11 versions prior to 1.7 have a race condition that made it unsafe to use
in multiple threads. Since Firefox 104, we created a CanvasRender thread that
is used to service WebGL commands off the Renderer thread so that WebGL does
not block WebRender. If WebGL uses GLX, this can lead us to using GLX on the
two different threads. In combination with an unsafe version of libX11, this
can lead to severe instability.

Further evidence points to the fact that the fix in 1.7 may have caused further
crashes that were not resolved until 1.7.4. Yet other reports indicate other
drivers than Mesa may still have issues even after 1.7.4. Ultimately, there
may be no safe version of libX11 to use right now.

However, GLX, which uses libX11, is considered legacy at this point, with many
users transitioning to EGL instead. It seems reasonable to not allow GLX to be
used from multiple threads at all, unless overridden by a pref, to work around
this.

We already have a FEATURE_THREADSAFE_GL in place to denote this, which was
currently used mainly for Nouveau which is also unsafe to use on multiple
threads. If this feature fails, the CanvasRender thread is not used, and
all WebGL commands go back to being on the Renderer thread as normal, avoiding
the problem.

A further snag is that recent ANGLE updates required a larger CanvasRenderer
thread stack size to avoid exhausting the stack. This patch uncovers the fact
that the Renderer and Compositor threads did not similarly have their stack
sizes adjusted in case WebGL is running on those threads instead.

Differential Revision: https://phabricator.services.mozilla.com/D170992
2023-02-25 22:49:51 +00:00
Stanca Serban
ebf9b1f7bd Backed out changeset 42afa6604694 (bug 1777849) for causing build bustages in RenderThread.cpp. CLOSED TREE 2023-02-26 00:42:52 +02:00
Lee Salzman
ada52201da Bug 1777849 - Disable FEATURE_THREADSAFE_GL on X11 and GLX. r=gfx-reviewers,ahale,aosmond
LibX11 versions prior to 1.7 have a race condition that made it unsafe to use
in multiple threads. Since Firefox 104, we created a CanvasRender thread that
is used to service WebGL commands off the Renderer thread so that WebGL does
not block WebRender. If WebGL uses GLX, this can lead us to using GLX on the
two different threads. In combination with an unsafe version of libX11, this
can lead to severe instability.

Further evidence points to the fact that the fix in 1.7 may have caused further
crashes that were not resolved until 1.7.4. Yet other reports indicate other
drivers than Mesa may still have issues even after 1.7.4. Ultimately, there
may be no safe version of libX11 to use right now.

However, GLX, which uses libX11, is considered legacy at this point, with many
users transitioning to EGL instead. It seems reasonable to not allow GLX to be
used from multiple threads at all, unless overridden by a pref, to work around
this.

We already have a FEATURE_THREADSAFE_GL in place to denote this, which was
currently used mainly for Nouveau which is also unsafe to use on multiple
threads. If this feature fails, the CanvasRender thread is not used, and
all WebGL commands go back to being on the Renderer thread as normal, avoiding
the problem.

A further snag is that recent ANGLE updates required a larger CanvasRenderer
thread stack size to avoid exhausting the stack. This patch uncovers the fact
that the Renderer and Compositor threads did not similarly have their stack
sizes adjusted in case WebGL is running on those threads instead.

Differential Revision: https://phabricator.services.mozilla.com/D170992
2023-02-25 22:20:50 +00:00
Erich Gubler
d6a6a3a83d Bug 1753349 (4/9): refactor: rename CreateEGLPBufferOffscreenContext to CreateWithoutSurface r=jgilbert
This was interesting enough that @jgilbert wanted this, so I'm including this for completeness in
the current patch stack.

Split out from @jgilbert's D164308.

Differential Revision: https://phabricator.services.mozilla.com/D166709
2023-01-19 04:47:52 +00:00
Erich Gubler
5ae49e0bf7 Bug 1753349 (2/9): refactor: inline size argument to GLContextEGL::CreateEGLPBufferOffscreenContext r=jgilbert
This is basically an implementation detail that the existing callers doesn't really need to know.
Factor it out.

Split out from @jgilbert's D164308.

Differential Revision: https://phabricator.services.mozilla.com/D166707
2023-01-19 04:47:51 +00:00
Stanca Serban
cee760ed88 Backed out 9 changesets (bug 1753349) for causing failures in PoolAlloc.cpp. CLOSED TREE
Backed out changeset 84a5f26fe60b (bug 1753349)
Backed out changeset 28e0175becf4 (bug 1753349)
Backed out changeset 0ffcaedc8046 (bug 1753349)
Backed out changeset 2043cc15deec (bug 1753349)
Backed out changeset 556557955d59 (bug 1753349)
Backed out changeset cbb9e6545343 (bug 1753349)
Backed out changeset bed90cd9beb6 (bug 1753349)
Backed out changeset 1b71f995ae95 (bug 1753349)
Backed out changeset 1ad75c8ea7a4 (bug 1753349)
2023-01-18 23:58:22 +02:00
Erich Gubler
d420b3bbab Bug 1753349 (4/9): refactor: rename CreateEGLPBufferOffscreenContext to CreateWithoutSurface r=jgilbert
This was interesting enough that @jgilbert wanted this, so I'm including this for completeness in
the current patch stack.

Split out from @jgilbert's D164308.

Differential Revision: https://phabricator.services.mozilla.com/D166709
2023-01-18 20:56:10 +00:00
Erich Gubler
80acad2332 Bug 1753349 (2/9): refactor: inline size argument to GLContextEGL::CreateEGLPBufferOffscreenContext r=jgilbert
This is basically an implementation detail that the existing callers doesn't really need to know.
Factor it out.

Split out from @jgilbert's D164308.

Differential Revision: https://phabricator.services.mozilla.com/D166707
2023-01-18 20:56:09 +00:00
sotaro
954c16acec Bug 1805209 - Use RemoteTexture for WebGPU r=gfx-reviewers,lsalzman
WebGPU uses CompositableInProcessManager to push TextureHost directly from WebGPUParent to WebRender. But CompositableInProcessManager plumbing has a problem and caused Bug 1805209.

gecko already has a similar mechanism, called RemoteTextureMap. It is used in oop WebGL. If WebGPU uses RemoteTextureMap instead of CompositableInProcessManager, both WebGPU and oop WebGL use same mechanism.

WebGPUParent pushes a new texture to RemoteTextureMap. The RemoteTextureMap notifies the pushed texture to WebRenderImageHost.

Before the change, only one TextureHost is used for one swap chain. With the change, multiple TextureHosts are used for one swap chain with recycling.

The changes are followings.

- Use RemoteTextureMap instead of CompositableInProcessManager.
- Use RemoteTextureOwnerId instead of CompositableHandle.
- Use WebRenderCanvasData instead of WebRenderInProcessImageData.
- Add remote texture pushed callback functionality to RemoteTextureMap. With it, RemoteTextureMap notifies a new pushed remote texture to WebRenderImageHost.
- Remove CompositableInProcessManager.

Differential Revision: https://phabricator.services.mozilla.com/D164890
2022-12-23 20:41:02 +00:00
Nicolas Silva
e716fc4f7b Bug 1797975 - Replace wr_notifier_nop_frame_done with an argument in new_frame_ready. r=gfx-reviewers,bradwerth
it started as a single method new_frame_ready with a composite parameter, to be split into two functions that end up calling the same HandleFrameOneDoc with a composite parameter so the extra function doesn't provide anything.

Differential Revision: https://phabricator.services.mozilla.com/D162299
2022-11-21 14:10:29 +00:00
Nicolas Silva
ed0908ee88 Bug 1797975 - Simplify the pending frame count tracking code. r=gfx-reviewers,bradwerth
Only transactions that contain the generate_frame flag are tracked by the pending frame and frame build counters.
This patch attempts to make this clearer with two small adjustments:

Firstly by putting the IncPendingFrameCount call right next to Transaction::GenerateFrame.

Secondly, undoing the hack in wr_notifier_wake_up. The latter is called outside of normal rendered/tracked frames and was calling HandleFrameOneDoc which decrements the rendered frame counter. To compensate it had to manually increment both counters via IncPendingFrameCount and manually decrement the built frame counter via DecPendingFrameBuildCount. Instead this patch introduces the aTrackedFrame argument so that HandleFrameOneDoc only fiddles with the counters when needed and wake_up does not have to hack around it.

Differential Revision: https://phabricator.services.mozilla.com/D162298
2022-11-21 14:10:29 +00:00
Nicolas Silva
af16db6234 Bug 1797975 - Remove outdated comments about mIsRendering. r=gfx-reviewers,bradwerth
mIsRendering does not appear to exist (anymore).

Differential Revision: https://phabricator.services.mozilla.com/D162296
2022-11-21 14:10:28 +00:00
Nicolas Silva
5a18024f2b Bug 1797975 - Rename CompositeIfNeeded into RetrySkippedComposite. r=gfx-reviewers,bradwerth
The previous name could have related to any situation where a composite is needed such as when animating or receiving transactions, but the function is actually specifically about scheduling a new composite if the previous one was skipped.

Differential Revision: https://phabricator.services.mozilla.com/D162295
2022-11-21 14:10:28 +00:00
Nicolas Silva
6352b3770e Bug 1797975 - Simplify the compositor throttling logic. r=gfx-reviewers,bradwerth
- Ensure that the pending frame count is decremented by HandleFrameOneDoc even after some of the rare early-outs.
- Always check TooManyPendingFrames in CompositeToTarget.

It is unclear that these will actually catch (all of) the extraneous skipped frames. If anything, the simplification will make further investigation easier.

Differential Revision: https://phabricator.services.mozilla.com/D162294
2022-11-21 14:10:27 +00:00
Jens Stutte
91630e2b39 Bug 1798630 - Use nsThread::Shutdown for the RenderThread. r=gfx-reviewers,sotaro
Differential Revision: https://phabricator.services.mozilla.com/D161026
2022-11-04 08:17:04 +00:00
Emilio Cobos Álvarez
42b7f1a58c Bug 1780788 - Use abstract strings as in-arguments for ipdl. r=nika,necko-reviewers,media-playback-reviewers,alwu,dragana
This prevents copies and avoids the hack we have to avoid this, which
right now is using nsDependent{C,}String.

Non-virtual actors can still use `nsString` if they need to on the
receiving end.

Differential Revision: https://phabricator.services.mozilla.com/D152519
2022-07-25 20:19:48 +00:00
Bas Schouten
548a858362 Bug 1780431: Fix Compositing PerfStat and do minor cleanup in the process. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D152291
2022-07-21 20:31:49 +00:00
Lee Salzman
f1344407b0 Bug 1779953 - Ensure MaybeRecordFrame is called before EndFrame. r=tnikkel
If MaybeRecordFrame is called after EndFrame, this means we are reading from
the back buffer state immediately after a call to SwapBuffers. The state of
the back buffer is undefined in that scenario, and mostly was just returning
old frames. We actually want to call MaybeRecordFrame before EndFrame, so we
get the valid contents of the back buffer before it is swapped out.

Differential Revision: https://phabricator.services.mozilla.com/D151988
2022-07-20 16:55:20 +00:00
Bas Schouten
0a72fd804b Bug 1778395 - Part 2: Record time between frame creation and the start of rendering. r=jrmuizel,chutten
Differential Revision: https://phabricator.services.mozilla.com/D151185
2022-07-12 14:59:09 +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
Bas Schouten
eb25f54ea0 Bug 1772216: Add telemetry probe to measure time spent waiting for the GPU. r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D148075
2022-06-08 13:41:19 +00:00
Norisz Fay
fd3fe8a239 Backed out 2 changesets (bug 1772216, bug 1772223) for causing webrender build bustages CLOSED TREE
Backed out changeset ec001981dfae (bug 1772223)
Backed out changeset 94fa038eea8e (bug 1772216)
2022-06-08 05:25:42 +03:00
Bas Schouten
71c8e37424 Bug 1772216: Add telemetry probe to measure time spent waiting for the GPU. r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D148075
2022-06-08 02:11:07 +00:00
Mike Hommey
dace8a4e06 Bug 1766561 - Use %p for pointer types. r=gfx-reviewers,rkraesig,nika,jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D144913
2022-05-03 20:49:06 +00:00
Nicolas Silva
752a0ee047 Bug 1763405 - Use a higher priority for the renderer thread. r=gfx-reviewers,jnicol
The renderer thread is at the end of the rendering pipeline. For smoothness it is important that it completes its work quickly as soon as it receives some. It does not produce work for other threads so we don't risk of causing some build up. On the other hand, the higher priority will help with with avoiding some cases of congestion of work coming from the content process.

This only bumps the priority of the renderer thread as opposed to the entire GPU process (Blink does the latter). This is because we currently have too many thread on the GPU process so there is a risk of completely starving other processes. It's still something we want to consider and might be safer after we have done the work of reducing the number of threads.

Differential Revision: https://phabricator.services.mozilla.com/D143056
2022-04-07 09:37:45 +00:00
Andrew Osmond
dfd75c103a Bug 1761832 - Protect GLLibraryEGL singleton against race conditions. r=jgilbert
Differential Revision: https://phabricator.services.mozilla.com/D142257
2022-03-28 21:16:58 +00:00
Florian Quèze
9c9aca9d89 Bug 1757202 - Include the inner window id in the existing Composite markers, r=mstange.
Differential Revision: https://phabricator.services.mozilla.com/D139731
2022-03-11 07:49:05 +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
Andrew Osmond
45ae50555d 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-18 15:59:12 +00:00
Iulian Moraru
3dbfe82835 Backed out 2 changesets (bug 1754978) for causing valgrind bustages.
Backed out changeset 491a985fc34a (bug 1754978)
Backed out changeset 98983bf9eaed (bug 1754978)
2022-02-18 00:36:31 +02: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
sotaro
a0a0c88a98 Bug 1754388 - Forward more functions in RenderTextureHostWrapper r=gfx-reviewers,aosmond
This is a preparation for Bug 1754330.

Differential Revision: https://phabricator.services.mozilla.com/D138258
2022-02-09 13:44:13 +00:00
sotaro
f9873bede0 Bug 1722447 - Add YUV SwapChain support to hardware decoded video r=gfx-reviewers,nical
Implementation is borrowed from chromium's SwapChainPresenter.

Differential Revision: https://phabricator.services.mozilla.com/D136460
2022-01-26 00:17:37 +00:00
sotaro
54e275e8ad Bug 1749183 - Fix RenderThread::HandleDeviceReset() for simulate device reset r=gfx-reviewers,aosmond
Current RenderThread::HandleDeviceReset() does nothing for simulate device reset.

Differential Revision: https://phabricator.services.mozilla.com/D135590
2022-01-20 00:22:36 +00:00
sotaro
5de1ee0b12 Bug 1750557 - Clear RenderTextureHosts in RenderThread::ShutDownTask() r=gfx-reviewers,aosmond
Need to destroy RenderTextureHosts in RenderThread::ShutDownTask().

Differential Revision: https://phabricator.services.mozilla.com/D136124
2022-01-19 00:05:48 +00:00
sotaro
a1fc801ef7 Bug 1743972 - Reduce Runnable usage in RenderThread::AddRenderTextureOp() r=gfx-reviewers,nical
Differential Revision: https://phabricator.services.mozilla.com/D132666
2021-12-06 23:23:20 +00:00
sotaro
e589a4b731 Bug 1744186 - A bit of clean up of RenderThread::HandleDeviceReset() r=gfx-reviewers,nical
Differential Revision: https://phabricator.services.mozilla.com/D132762
2021-12-06 23:22:53 +00:00
sotaro
8fd3a5894c Bug 1740675 - Cleanup device handling around RenderThread r=nical,gfx-reviewers
RenderCompositorANGLE::ShutdownEGLLibraryIfNecessary() is not necessary since Bug 1656034 fix. Device reset handling could be more platform independent.

Differential Revision: https://phabricator.services.mozilla.com/D130960
2021-11-25 02:49:29 +00:00
Nicolas Silva
df84c8ca7c Bug 1741742 - Put the window ID in the composite profile marker name. r=gfx-reviewers,jrmuizel
It's useful to be able to see in profiles when multiple windows are being rendered.

Differential Revision: https://phabricator.services.mozilla.com/D131510
2021-11-19 10:07:59 +00:00
sotaro
1b44e05e92 Bug 1741784 - Remove unused code around CompositableHost r=gfx-reviewers,nical
Differential Revision: https://phabricator.services.mozilla.com/D131466
2021-11-19 07:41:29 +00:00
Narcis Beleuzu
ce6ad351e2 Backed out changeset 12736f9bf7b5 (bug 1741784) for compositor leakchecks. CLOSED TREE 2021-11-18 18:07:09 +02:00
sotaro
2dc3b69cde Bug 1741784 - Remove unused code around CompositableHost r=gfx-reviewers,nical
Differential Revision: https://phabricator.services.mozilla.com/D131466
2021-11-18 14:16:35 +00:00
Alexandru Michis
b4ca6a1ac3 Backed out changeset 413c914dd84b (bug 1740675) for causing geckoview failures.
CLOSED TREE
2021-11-17 04:50:58 +02:00
sotaro
8ca63c894d Bug 1740675 - Cleanup device handling around RenderThread r=nical,gfx-reviewers
RenderCompositorANGLE::ShutdownEGLLibraryIfNecessary() is not necessary since Bug 1656034 fix. Device reset handling could be more platform independent.

Differential Revision: https://phabricator.services.mozilla.com/D130960
2021-11-17 01:18:05 +00:00
sotaro
e13c31b137 Bug 1739553 - Use wr::ExternalImageId in more places r=gfx-reviewers,bradwerth
It could make code more explicit.

Differential Revision: https://phabricator.services.mozilla.com/D130434
2021-11-07 07:26:45 +00:00