Optimize presentation feedback on Windows |
|
Issue descriptionPresentation feedback on Windows uses GPUTimer which wraps command buffer queries and ultimately d3d11 fences through ANGLE. This is suboptimal because it uses quite a bit of CPU (measured ~3% using ETW profiling). It is also incorrect because completion of GPU work is not the same as presentation, and there's no way to determine latency after GPU work is complete. I experimented with using DXGI_FRAME_STATISTICS from IDXGISwapChain::GetFrameStatistics(), and it looks like we can use it this way: 1) Num. of outstanding Presents = Num. of times Present() is called - stats.PresentCount (Num. of Presents() displayed on screen) 2) Present latency in DWM = stats.SyncRefreshCount - stats.PresentRefreshCount There's some complexity because with DirectComposition the root surface switches between swap chain and IDCompositionSurface, and we can use get frame statistics only from swap chains. Here's a prototype with support for EGLTimestampClient in DirectCompositionSurfaceWin using frame statistics with fallback when swap chain isn't used: https://chromium-review.googlesource.com/c/chromium/src/+/1266696 Making this work for non-DirectComposition path will involve more work, maybe exposing the swap chain via ANGLE? geofflang@ jmadill@ thoughts?
,
Oct 9
Thanks! Sync values should be sufficient to calculate number of outstanding frames for presentation feedback. Calculating DWM present latency needs PresentRefreshCount which isn't present in sync values. That's not a high priority right now though.
,
Nov 16
Note: GetFrameStatistics only works for fullscreen (DXGI_SWAP_CHAIN_DESC::Windowed) swap chains, or flip mode swap chains both windowed and fullscreen. So the ANGLE extension won't really work here, but that's ok since we've gone back to using direct composition whenever possible anyway. |
|
►
Sign in to add a comment |
|
Comment 1 by geoffl...@chromium.org
, Oct 9