3

I currently face a problem with DXGI Swapchains (DirectX 11). My C++ application shows (live) video and my goal is to minimize latency. I have no user input to process.

In order to decrease latency I switched to a DXGI_SWAP_EFFECT_FLIP_DISCARD swapchain (I used BitBlt before - see For best performance, use DXGI flip model for further details). I use the following flags:

//Swapchain Init:
            sc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;
            sc.Flags = DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT | DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING;
//Present:
        
            m_pDXGISwapChain->Present(0, DXGI_PRESENT_ALLOW_TEARING);
        

On one computer the swapchain (windowed) goes into the "Hardware: Independent Flip" mode and I have perfectly low latency, as long as I have no other windows in front. On all other computers I tried, I am stuck in the "Composed: Flip" mode with higher latency (~ 25-30 ms more). The software (binary) is exactly the same. I am checking this with PresentMon.

What I find interesting is that on the computer where the independent flip mode works, it is also active without the ALLOW_TEARING flags - from what I understood they should be required for it. I btw also see tearing in this case, but that is a different problem.

I already tried to compare Windows 10 versions, graphic drivers and driver settings. GPU is a Quadro RTX 4000 for all systems. I couldn't spot any difference between the systems.

I would really appreciate any hints on additional preconditions for the independent flip mode I might have missed in the docs. Thanks for your help!

Update1: I updated the "working" system from Nvidia driver 511.09 to 473.47 (latest stable). After that I got the same behavior like on the other systems (no ind. flip). After going back to 511.09 it worked again. So the driver seems to have influence. The other systems also had 511.09 for my original tests though.

Update2: After dealing with all DirectX debug outputs, it still does not work as desired. I manage to get into independent flip mode only in real full screen mode or in windowed mode where the window has no decorations and actually covers the whole screen. Unfortunately, using the Graphics Tools for VS I never enter the independent flip and cannot do further analysis here. But it is interesting that when using the Graphics Tools debug, PresentMon shows Composed Flip, but the Graphics Analyzer from the Graphics Tools shows only DISCARD as SwapEffect for the SwapChain. I would have expected FLIP_DISCARD as I explicitly used DXGI_SWAP_EFFECT_FLIP_DISCARD.

Werner K
  • 31
  • 2
  • Seems strange that with same hardware and code, you get two different behaviors. Are you checking for all error returns and warning that the DirectX (debug) layer can report? Note minimizing latency (like choosing to discard frames) is usually for apps with end-user input. It's usually less needed for "passive" video shows (where some latency doesn't mean you can't achieve good enough frame rate). – Simon Mourier Jun 09 '22 at 17:53
  • Thanks for your answer! I am currently working on the debug mode, but from what I saw up to now I am not sure if it will give new information. I'll post an update as soon as I have something final. I am checking return codes everywhere. It is a passive video show, but latency is important here. Imagine a camera in front of a car you use to drive (not exactly our use case, but similar). I also updated the original post with some new results from my tests. – Werner K Jun 14 '22 at 08:12
  • Indeed, a camera in front of a car is not "a video show", it has implicit user input – Simon Mourier Jun 14 '22 at 08:14
  • I have added an update (Update2) with some new results. Still not clear how to get it to work in windowed mode – Werner K Jun 28 '22 at 10:26

0 Answers0