Closed Bug 889953 Opened 11 years ago Closed 11 years ago

transformed color layers seem to cause intermediate surfaces

Categories

(Core :: Graphics: Layers, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla25

People

(Reporter: jrmuizel, Unassigned)

References

Details

Attachments

(1 file, 2 obsolete files)

      No description provided.
Blocks: 889957
When we optimize a ThebesLayer into a ColorLayer we always set a clip rect onto the ColorLayer.

If the parent of the ColorLayer is a transformed ContainerLayer, then this forces an intermediate surface.

We can't skip the intermediate surface, because folding the ContainerLayer transform onto the child would require us to clip to a non-axis-aligned rectangle, which we don't support.

Above URL has a large number of layers that hit this.

A few possible options:

* Don't optimize ThebesLayers to ImageLayers if it's going to force a temporary
  - This would be a huge memory regression for the above page. Sadness

* Set the visible region on the colour layers and change the layer implementations to restrict drawing to, and drop the clip rect.

* Add a pre-transform clip property to layers and use this.

* Detect that the ColorLayer has no transform (or a simple translation only), and treat the clip as being pre-transform. Adjust the layer implementations to apply this by adjusting the quad rect to draw.
Attached patch Don't clip ColorLayers (obsolete) — Splinter Review
We should just require that ColorLayers don't render outside their visible region.

All the accelerated and OMTC backends do this already, it's only BasicLayers.

I don't think it costs us anything on BasicLayers either, we won't clip to the clip rect, but will clip to the visible region (which is always a rect) instead.

This is a pretty huge perf win for this page at least.
Attachment #771004 - Flags: review?(roc)
(In reply to Matt Woodrow (:mattwoodrow) from comment #1)
> Above URL has a large number of layers that hit this.

There is no URL.

(In reply to Matt Woodrow (:mattwoodrow) from comment #2)
> We should just require that ColorLayers don't render outside their visible
> region.

I am not a fan of this. Up till now, visible regions have just been advisory; using a bigger one would not be a bug. Now it will be.

How about just adding a rectangle property to ColorLayer and say that ColorLayer fills that rectangle, instead of the whole plane?
(In reply to Robert O'Callahan (:roc) (Mozilla Corporation) from comment #3)
> (In reply to Matt Woodrow (:mattwoodrow) from comment #1)
> > Above URL has a large number of layers that hit this.
> 
> There is no URL.

http://threejs.org/examples/css3d_molecules.html

"Graphite" create a lot of layers.
Attached patch Don't clip ColorLayers v2 (obsolete) — Splinter Review
Ok, fine with me.
Attachment #771004 - Attachment is obsolete: true
Attachment #771004 - Flags: review?(roc)
Attachment #772238 - Flags: review?(roc)
Comment on attachment 772238 [details] [diff] [review]
Don't clip ColorLayers v2

Review of attachment 772238 [details] [diff] [review]:
-----------------------------------------------------------------

::: gfx/layers/basic/BasicColorLayer.cpp
@@ +42,1 @@
>      PaintColorTo(mColor, GetEffectiveOpacity(), aContext, aMaskLayer);

Wouldn't it be faster to do a fillrect than to clip+paint?
Attachment #772238 - Flags: review?(roc) → review+
The clips used by ColorLayers are clipped to device space with BasicLayers. This makes the ColorLayer bounds do the same.

It also adds a new gfxContext::Rectangle overload to make this more obvious, the current bool param isn't clear.
Attachment #772238 - Attachment is obsolete: true
Attachment #772967 - Flags: review?(roc)
https://hg.mozilla.org/mozilla-central/rev/a38f49d05074
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla25
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: