Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use set interval setting to fix performance degration for AMD graphics adapters #11681

Merged
merged 1 commit into from
Jun 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/widget/openglwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,29 @@ OpenGLWindow::OpenGLWindow(WGLWidget* pWidget)
QSurfaceFormat format;
format.setVersion(2, 1);
format.setProfile(QSurfaceFormat::CoreProfile);

// setSwapInterval sets the application preferred swap interval
// in minimum number of video frames that are displayed before a buffer swap occurs
// - 0 will turn the vertical refresh syncing off
// - 1 (default) means swapping after drawig a video frame to the buffer
// - n means swapping after drawing n video frames to the buffer
//
// The vertical sync setting requested by the OpenGL application, can be overwritten
// if a user changes the "Wait for vertical refresh" setting in AMD graphic drivers
// for Windows.

#if defined(__APPLE__)
// On OS X, syncing to vsync has good performance FPS-wise and
// eliminates tearing. (This is an comment from pre QOpenGLWindow times)
format.setSwapInterval(1);
#else
// It seems that on Windows (at least for some AMD drivers), the setting 1 is not
// not properly handled. We saw frame rates divided by exact integers, like it should
// be with values >1 (see https://github.com/mixxxdj/mixxx/issues/11617)
// Reported as https://bugreports.qt.io/browse/QTBUG-114882
// On Linux, horrible FPS were seen with "VSync off" before switching to QOpenGLWindow too
format.setSwapInterval(0);
#endif
setFormat(format);
}

Expand Down