Re: Thoughts on canvas compositing

Simon,

Thanks for the confirmation on the z-order thing. This is crucial information for web developers, and I highly suggest you or somebody else out of the WebKit team blogs about when which compositing context is used, and what the reasoning behind the inner workings is.

Anyway, thanks!
Paul

Von: Simon Fraser <smfr@me.com<mailto:smfr@me.com>>
Datum: Mon, 17 Jan 2011 10:52:17 -0800
An: Paul Bakaus <pbakaus@zynga.com<mailto:pbakaus@zynga.com>>
Cc: Charles Pritchard <chuck@jumis.com<mailto:chuck@jumis.com>>, "robert@ocallahan.org<mailto:robert@ocallahan.org>" <robert@ocallahan.org<mailto:robert@ocallahan.org>>, "public-canvas-api@w3.org<mailto:public-canvas-api@w3.org>" <public-canvas-api@w3.org<mailto:public-canvas-api@w3.org>>, "public-fx@w3.org<mailto:public-fx@w3.org>" <public-fx@w3.org<mailto:public-fx@w3.org>>
Betreff: Re: Thoughts on canvas compositing

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 Wednesday, 19 January 2011 10:03:22 UTC