Platform/GFX/Surfaces/Use cases
From MozillaWiki
Use cases for surfaces in Gecko. (Parenthetical list items are optional, but future-looking)
WebGL
Production by Content:
- (Producible in workers)
- (Backbuffer is allocated lazily on any draw/read/query of the backbuffer)
- (Wait on Fence that prevents early writes to an in-use buffer)
- Backbuffer is read/writeable at any time during JS execution.
- 'Present' events cause us to detach the backbuffer frame, create a Fence, and submit it towards the consumer.
Consumption in Compositor:
- Request the most recently submitted frame (from the producer), and Wait on the Fence to establish frame completeness.
- (Ability to, instead: Request the most-recently-complete frame, likely polling for frame completion)
- If new frame retrieved, recycle old frame.
- (Fence before recycle, so we're sure we're done reading before we begin writing)
- Frame is considered read-only.
- Avoid unnecessary readbacks and uploads.
- Consumed frame persists until overridden by a newer frame. (WebGL can stop producing at any time)
Consumption in Content:
- (Ability to readback the current frontbuffer? (Can be slow))