Closed Bug 1734649 Opened 3 years ago Closed 3 years ago

Implement IPC plumbing to create worker accessible WebGL instances

Categories

(Core :: Graphics, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
96 Branch
Tracking Status
firefox96 --- fixed

People

(Reporter: aosmond, Assigned: aosmond)

References

Details

Attachments

(4 files)

In this bug, we will add the IPC plumbing necessary to create WebGL instances off the main thread in the content process, while the backend runs on a dedicated background thread in the compositor process.

This patch adds the necessary IPDL plumbing to allow us to create WebGL
instances off the main thread in the content process, and on a dedicated
background thread in the compositor process. This will be used by future
patches for offscreen canvas support.

Attachment #9244791 - Attachment description: Bug 1734649 - Add POffscreenCanvasManager to manage offscreen WebGL instances. → Bug 1734649 - Create POffscreenCanvasManager to manage WebGL instances.

This patch causes us to move WebGL execution in the compositor process
from the Compositor thread to the Renderer thread. This has the
advantage of keeping all of our GL calls on the same thread, which makes
us work more like a typical application. This makes the drivers happy,
especially on Linux, and may allow us to move forward with OOP WebGL on
Linux.

Attachment #9244791 - Attachment description: Bug 1734649 - Create POffscreenCanvasManager to manage WebGL instances. → Bug 1734649 - Part 1. Create PCanvasManager to manage WebGL instances.
Attachment #9244893 - Attachment description: Bug 1734649 - Switch to always allocating PWebGL instances via OffscreenCanvasManager. → Bug 1734649 - Part 2. Switch to always allocating PWebGL instances via CanvasManager.

IsAccelAngleSupported would always indicate ANGLE support on Windows but
we have a specific variant of GLLibraryEGL::CreateDisplay for use with
ANGLE which bypasses this check for the WebRender compositor. It is
otherwise only used for WebGL and non-Windows, so we can skip the
assertions here.

Attachment #9244791 - Attachment description: Bug 1734649 - Part 1. Create PCanvasManager to manage WebGL instances. → Bug 1734649 - Part 2. Create PCanvasManager to manage WebGL instances.
Attachment #9244893 - Attachment description: Bug 1734649 - Part 2. Switch to always allocating PWebGL instances via CanvasManager. → Bug 1734649 - Part 3. Switch to always allocating PWebGL instances via CanvasManager.

Now that WebGL runs on the Renderer thread in the compositor process
when OOP, we can now lift the threadsafe condition on Linux preventing
WebGL OOP. Regardless of webgl.out-of-process's setting, we should
always prefer by default to run worker WebGL contexts OOP to avoid
similar threadsafe conflicts in the content process.

Pushed by aosmond@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/1bd87627df8b
Part 1. Remove checks for WebRender based on RenderThread. r=jgilbert
https://hg.mozilla.org/integration/autoland/rev/413ecffe1156
Part 2. Create PCanvasManager to manage WebGL instances. r=jrmuizel
https://hg.mozilla.org/integration/autoland/rev/a3e4a30c587a
Part 3. Switch to always allocating PWebGL instances via CanvasManager. r=jgilbert
https://hg.mozilla.org/integration/autoland/rev/9cae29707d33
Part 4. Lift some conditions preventing WebGL OOP. r=jgilbert
Regressions: 1739677
Regressions: 1739996
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: