tim.auld

OpenGL SwapBuffers taking ~80ms with FreeSync

Discussion created by tim.auld on Jan 31, 2019
Latest reply on Feb 22, 2019 by dorisyan

My game 'Forts' has a serious problem with AMD video cards when the monitor has FreeSync enabled and VSync is on, even if FreeSync is not enabled in Radeon Settings.

 

At first frame rates are normal at 90 fps, but if there's a delay and frames are missed, the driver goes into a state where it's waiting excessively. It drops the frame rate down to 13 fps, which is unplayable. Sometimes it recovers, but usually not. Sometimes it alternates resulting in about 23 fps.

 

I've put some basic profiling in, and in the following case I have gone to the options screen. There is a 587ms gap in display frames, and after that SwapBuffers is taking about 80ms. The UI scene is not complex, just some plain textured quads including text, and in any other circumstance it renders with no performance issues.

 

Last swap 1.1, SwapBuffers 10.1
Last swap 1.0, SwapBuffers 10.1
Last swap 1.0, SwapBuffers 10.1
Last swap 1.0, SwapBuffers 10.1
MainMenu: Options
Last swap 587.1, SwapBuffers 9.0
Last swap 1.5, SwapBuffers 85.1
Last swap 1.4, SwapBuffers 82.7
Last swap 1.4, SwapBuffers 80.3
Last swap 1.4, SwapBuffers 78.1

 

I have tried to create a minimal sample exhibiting the problem, but it recovers quickly after the delay to full frame rate. I'm happy to supply Steam keys for AMD engineers to reproduce the problem, or experiment with the code on my end. Any assistance debugging this would be greatly appreciated.

 

My test setup is:

AMD Ryzen 5 2600 with Wraith Stealth 6-core CPU at stock speed

Radeon RX 580 ARMOR MK2 8G OC at stock speed
8GB 3000MHz DDR4 (dual channel)
MSI B450M Mortar Titanium motherboard (unsure which bios version)

ASUS MG279Q QHD 144Hz FreeSync 27in IPS Gaming Monitor

Windows 10 Pro 64-bit

Render loop is basically:

// Windows message pump
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

// setup camera and draw scene (fixed pipeline)
glFlush();
SwapBuffers(hdc);

Outcomes