W3C home > Mailing lists > Public > public-fx@w3.org > January to March 2011

Re: Thoughts on canvas compositing

From: Simon Fraser <smfr@me.com>
Date: Mon, 17 Jan 2011 10:52:17 -0800
Message-id: <E96C4B1F-2E95-454B-9D91-4AB46F592D37@me.com>
Cc: Charles Pritchard <chuck@jumis.com>, "robert@ocallahan.org" <robert@ocallahan.org>, "public-canvas-api@w3.org" <public-canvas-api@w3.org>, "public-fx@w3.org" <public-fx@w3.org>
To: Paul Bakaus <pbakaus@zynga.com>
On Jan 17, 2011, at 12:47 AM, Paul Bakaus wrote:

> Hi everyone,
> 
> Thanks for the input, very appreciated. Let me add some additional thoughts regarding your answers:
> 
> - GPU context handling of Canvas: This is interesting, since I've been testing the creation of GPU contexts extensively with WebKit, but without Canvas. Yes, you are creating fast GPU contexts, but the problem then is the opposite: All adjacent elements or close-by elements (seems to be filtered by z-index ranges, and proximity) will also go into the GPU path, unfortunately allocating way more memory than mobile browsers can handle. This isn't even canvas specific, I wonder if anything can be done about it.

In WebKit, we look at the z-order hierarchy, sometimes taking geometry into account, to determine what gets into GPU-backed layers. There are various trade-offs here between animation performance, memory usage etc. Generally speaking, if you push your canvas frontwards in the z-order tree, then fewer other elements will hit the GPU path.

> - Fullscreen API: I've totally forgot about this possibility, this sounds like a great way for browsers to bypass compositing if fullscreen. Thanks for the pointer!
> 
> - Attributes: I admit it is not beautiful, I'm all for simplicity. A valid alternative would be to detect if the canvas and all elements overlapping or underlapping it have a non-transparent background value set, and then go faster. I'm unsure with browser internals, but I suspect there might be a heavily optimized route ahead if no alpha transparency is involved.

Right, this could be something that the browser could detect and optimize for.

Simon
Received on Monday, 17 January 2011 18:53:08 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 17 January 2011 18:53:08 GMT