Closed Bug 1182712 Opened 11 years ago Closed 2 years ago

Missed opportunity to use ColorLayers

Categories

(Core :: Graphics: Layers, defect)

defect

Tracking

()

RESOLVED INVALID
Tracking Status
firefox42 --- affected

People

(Reporter: botond, Unassigned)

Details

(Whiteboard: [gfx-noted])

STR: 1. Load http://chrislord.net/files/mozilla/scroll-snap-overflow-animation.html in the B2G browser 2. Look at the layer tree The type of layer built for the content is PaintedLayer. It would be nice if it were ColorLayers instead.
We only optimize a PaintedLayer to a ColorLayer if the layer only contains one color display item. In the testcase, layer building puts all color display items into the same layer (because they scroll together with each other), so we'd have to split the layer into multiple layers to get ColorLayers. But we don't do that. I think the reason is that it would increase composition overdraw - we'd rather pay the cost once than on every composition.
(In reply to Markus Stange [:mstange] from comment #1) > We only optimize a PaintedLayer to a ColorLayer if the layer only contains > one color display item. In the testcase, layer building puts all color > display items into the same layer (because they scroll together with each > other), so we'd have to split the layer into multiple layers to get > ColorLayers. But we don't do that. I think the reason is that it would > increase composition overdraw - we'd rather pay the cost once than on every > composition. Although in this page, the colours don't overlap and they're opaque (so no overdraw) and using colour layers would greatly reduce memory use and mean we don't have to sample a texture when drawing, so composition may actually get faster?
(In reply to Markus Stange [:mstange] from comment #1) > We only optimize a PaintedLayer to a ColorLayer if the layer only contains > one color display item. This isn't really true anymore. I changed the FLM code to build a color layer if there's a single color display item covering the layer (likewise a single image covering everything for image layers). I think the question here is how much computing would we have to do to find these cases, up to how many color layers would be generate. But more importantly how often does this happen in the wild? Are we willing to spend time implementing this given that it's unlikely to really have an impact in the wild with our rendering performance.
(In reply to Chris Lord [:cwiiis] from comment #2) > Although in this page, the colours don't overlap and they're opaque (so no > overdraw) and using colour layers would greatly reduce memory use and mean > we don't have to sample a texture when drawing, so composition may actually > get faster? That is true. (In reply to Benoit Girard (:BenWa) from comment #3) > But more importantly how often does this happen in the wild? Are we willing > to spend time implementing this given that it's unlikely to really have an > impact in the wild with our rendering performance. You're right, this is the question we should be asking.
Generally, I find (quite un-scientifically) that we barely ever use color layers, and I see a lot of tiles filled with a single opaque color while browsing around. Perhaps we could try to do this optimization at the tile level ? if a tile is only affected by an opaque rect with a solid color, use a new kind of tile that just renders a color rectangle on the compositor ? I haven't looked into how simple it is to detect this from the display list (probably not trivial), but the rest would be very simple to write.
I've been wanting to look at a simpler version of this. When we accumulate items in FLB and generated a PaintedLayer we already keep track of something like the solid color region. When we have a PaintedLayer where a big part of the edges are a solid color we could generated a PaintedLayer + ColorLayer if the savings are large enough. This should be doable with only a fairly minor change to FLB. Again I'm not sure if the real world saving would be noticeable.
Whiteboard: [gfx-noted]
Severity: normal → S3

No longer valid

Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.