x11: Introduce an envvar to prevent sync'ing to vblanks

This can be useful if you want to ensure that the buffer swap operation
won't block.

CCBUG: 433094
This commit is contained in:
Vlad Zahorodnii 2021-02-18 14:30:28 +02:00
parent e179fb697d
commit fb93037ca7

View file

@ -237,11 +237,16 @@ void GlxBackend::init()
supportsSwapEvent = false;
}
static bool syncToVblankDisabled = qEnvironmentVariableIsSet("KWIN_X11_NO_SYNC_TO_VBLANK");
if (!syncToVblankDisabled) {
if (haveSwapInterval) {
setSwapInterval(1);
} else {
qCWarning(KWIN_X11STANDALONE) << "glSwapInterval is unsupported";
}
} else {
setSwapInterval(0); // disable vsync if possible
}
if (glPlatform->isVirtualBox()) {
// VirtualBox does not support glxQueryDrawable