Closed Bug 1420825 Opened 7 years ago Closed 4 years ago

Paint mask layers on the Paint Thread

Categories

(Core :: Graphics: Layers, enhancement, P3)

40 Branch
enhancement

Tracking

()

RESOLVED WONTFIX

People

(Reporter: dvander, Assigned: dvander)

References

Details

Currently mask ImageLayers are rasterized on the main thread by FrameLayerBuilder. The input is a list of rounded rects (corner radii) and the output is an 8-bit mask texture. Matt and I discussed today how to get all of this off the main thread. One idea is to eliminate mask rasterization entirely by sending the rounded rects to the compositor's shaders, and having the pixel shader do the mask dynamically. Unfortunately, it's not so easy. The first problem scenario is that FLB can combine multiple rounded rects into a single mask, resulting in an arbitrary number of radii. Second, we can have multiple masks if there are nested scroll frames, and the compositor has to combine those masks together based on scroll positions. Handling this is actually easy in the old compositor. For each draw call with more than one mask, it creates temporary surfaces and applies each mask one by one. It's expensive, but that model can handle an arbitrary stream of rounded borders without ever having to rasterize them. Advanced Layers is different: it combines the masks into a single texture, caches the result, and only has to mask each layer once. It's cheaper, but it means the masks must be rasterized before AL starts rendering. To eliminate rasterization, AL could adopt the compositor's model, making the common case faster and the rare cases much slower. Another option is to always upload the radii, and then let the compositor decide if it wants to rasterize+cache them or take a shader fast-path. The downside to this is that it's a fair bit of complexity and it could potentially hurt the framerate, or jank APZ/OMTA. Finally, we could just send mask layers to the paint thread. We could still get some benefit by having FLB identify simple cases, skip rasterization, and send the radii instead. But the benefit would be quite small compared to rasterizing masks asynchronously. So tl;dr - we'd like to start by moving mask layers to the paint thread, and then we can see if any follow-up work makes sense.
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.