Fluctuating frame rate in windowed mode with Direct3D

When using the direct3d video driver with the display in windowed mode (full screen or otherwise), the frame rate sporadically dips, resulting in distorted audio and choppy video.

It does not appear to have any relation to the amount of load placed on the GPU/CPU. It happens just as frequently in less demanding cores like fceux as it does in more taxing ones like bsnes for example.

Also, somewhat peculiarly, in the video settings page of retroarch, the estimated frame rate value will consistently drop by about a frame each time i apply the current estimate with x.

OpenGL works satisfactorily in full screen mode, and has a solid 60.002 frame rate in both windowed and exclusive full screen, but suffers from occasional stuttering in windowed mode. Raising the refresh rate slightly seems to alleviate this, but I’m not sure why.

Has anyone had any success obtaining a stable frame rate with the D3D driver in windowed mode?

I should note that I’m using the latest stable 64-bit build and my graphics card is a GTX 970.

PS: it’s probably unrelated, but retroarch segfaults on exit if the d3d driver is loaded. This doesn’t happen on the stable 32-bit build.

It’s DWM desktop composition that causes these kinds of performance issues and unfortunately it cant be disabled on Windows 8 and higher.

I’ve disabled the UxSms service responsible for dwm.exe and although the issue has improved drastically, there is still some residual jitter, enough to cause noticeable stuttering.

Any more ideas?

Thanks.