Support fast readbacks in CopyToSwapChain with async present
Categories
(Core :: Graphics: Canvas2D, defect)
Tracking
()
Tracking | Status | |
---|---|---|
firefox104 | --- | fixed |
People
(Reporter: lsalzman, Assigned: lsalzman)
References
(Blocks 2 open bugs)
Details
Attachments
(5 files)
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
Bug 1777426 - Add pref to force async present to sync anyway so we can use remote textures. r?sotaro
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review |
Currently CopyToSwapChain creates spurious copies of the back buffer when SharedSurfaces aren't exportable (= ToSurfaceDescriptor returns Nothing from SharedSurface_Basic). These then later get read back into a CPU memory buffer when PresentFrontBufferToCompositor is used to send the buffer to RemoteTextureMap.
Conceptually, we want Present/CopyToSwapChain to just do the right thing and automatically push buffers to RemoteTextureMap, rather than secondarily needing a hidden call to PresentFrontBufferToCompositor. Then we can get rid of the need to create front buffers whose only purpose is to shuttle data to PresentFrontBufferToCompositor which then shuttles it RemoteTextureMap.
Assignee | ||
Comment 1•2 years ago
|
||
Currently CopyToSwapChain creates spurious copies of the back buffer when SharedSurfaces aren't exportable (= ToSurfaceDescriptor returns Nothing from SharedSurface_Basic). These then later get read back into a CPU memory buffer when PresentFrontBufferToCompositor is used to send the buffer to RemoteTextureMap. This has associated performance and memory costs.
Conceptually, we want Present/CopyToSwapChain to just do the right thing and automatically push buffers to RemoteTextureMap, rather than secondarily needing a hidden call to PresentFrontBufferToCompositor. Then we can get rid of the need to create front buffers whose only purpose is to shuttle data to PresentFrontBufferToCompositor which then shuttles it RemoteTextureMap.
This patch achieves this by refactoring the guts of PresentFrontBufferToCompositor into Present/CopyToSwapChain. The remote texture ids are sent along inside SwapChainOptions if async present is enabled. Those remote texture ids are cached in ClientWebGLContext so that GetFrontBuffer can return them without any subsequent need for an IPDL call.
On the parent side, CopyToSwapChain will now notice if async present is to be used and if a SurfaceFactory does not generate SharedSurfaces that can be exported. In that case it cuts out the middle man and reads from the WebGLFramebuffer's back buffer directly into a CPU buffer to send to RemoteTextureMap.
Assignee | ||
Comment 2•2 years ago
|
||
With async present we can now rely on being able to do readbacks from WebGL
in the GPU process, rather than needing CopySnapshotTo to accelerate this in
the content process. Just remove CopySnapshotTo since it doesn't help anymore.
Depends on D150720
Assignee | ||
Comment 3•2 years ago
|
||
Depends on D150720
Assignee | ||
Comment 4•2 years ago
|
||
Depends on D150720
Assignee | ||
Comment 5•2 years ago
|
||
Depends on D150721
Pushed by lsalzman@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/b9f43d8a6c2d Support fast readbacks in CopyToSwapChain with async present. r=sotaro,jgilbert https://hg.mozilla.org/integration/autoland/rev/d14ac16006c6 Add pref to force async present to sync anyway so we can use remote textures. r=sotaro https://hg.mozilla.org/integration/autoland/rev/7bd6e0c436e7 Add gfx.canvas.accelerated.async-present for toggling async present with Canvas2D independent of WebGL. r=aosmond https://hg.mozilla.org/integration/autoland/rev/2fdaa8eca97c Remove CopySnapshotTo in favor of async present. r=aosmond https://hg.mozilla.org/integration/autoland/rev/509b05b741a2 Ensure MemoryTextureData frees memory when owned by RemoteTextureMap. r=aosmond,gfx-reviewers
Comment 7•2 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/b9f43d8a6c2d
https://hg.mozilla.org/mozilla-central/rev/d14ac16006c6
https://hg.mozilla.org/mozilla-central/rev/7bd6e0c436e7
https://hg.mozilla.org/mozilla-central/rev/2fdaa8eca97c
https://hg.mozilla.org/mozilla-central/rev/509b05b741a2
Comment hidden (obsolete) |
Updated•2 years ago
|
Updated•2 years ago
|
Description
•