On Windows 8.1 and above, we can create swap chains with a latency waitable object that signals when the runtime can guarantee a desired minimum latency (to DWM when windowed and display when fullscreen).
Described here: https://docs.microsoft.com/en-us/windows/uwp/gaming/reduce-latency-with-dxgi-1-3-swap-chains
I've tested this locally and it seems to behave as expected.
We could use this to unblock the proposed offscreen canvas commit() API. For other platforms, we could block until next vsync or when SwapBuffers returns.
Blockers:
1. We switch between direct composition surface and swap chain depending on if we are currently using overlays or not. The latency feedback API only works with swap chains. If we're using direct composition surface, we should signal on next vsync maybe?
2. We can acquire the handle for the waitable object after creating the swap chain so we could potentially pass it to another process. But we recreate swap chains on resize so we'll have to update the handle somehow. The alternative of plumbing IPC from GPU to browser to renderer a la begin frame is not great either.
Comment 1 by kbr@chromium.org
, Mar 15 2018