EGL backend: Check if implementation supports swap interval of 1 before setting it
REVIEW: 110023
This commit is contained in:
parent
c9f852a73f
commit
84c904d6f9
1 changed files with 15 additions and 6 deletions
|
@ -88,12 +88,21 @@ void EglOnXBackend::init()
|
||||||
if (surfaceHasSubPost) {
|
if (surfaceHasSubPost) {
|
||||||
kDebug(1212) << "EGL implementation and surface support eglPostSubBufferNV, let's use it";
|
kDebug(1212) << "EGL implementation and surface support eglPostSubBufferNV, let's use it";
|
||||||
|
|
||||||
// set swap interval appropriately
|
if (options->glPreferBufferSwap() != Options::NoSwapEncourage) {
|
||||||
const bool wantSync = options->glPreferBufferSwap() != Options::NoSwapEncourage;
|
// check if swap interval 1 is supported
|
||||||
const EGLBoolean res = eglSwapInterval(dpy, wantSync ? 1 : 0);
|
EGLint val;
|
||||||
if (res && wantSync) {
|
eglGetConfigAttrib(dpy, config, EGL_MAX_SWAP_INTERVAL, &val);
|
||||||
kDebug(1212) << "Enabled v-sync";
|
if (val >= 1) {
|
||||||
setHasWaitSync(true);
|
if (eglSwapInterval(dpy, 1)) {
|
||||||
|
kDebug(1212) << "Enabled v-sync";
|
||||||
|
setHasWaitSync(true);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
kWarning(1212) << "Cannot enable v-sync as max. swap interval is" << val;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// disable v-sync
|
||||||
|
eglSwapInterval(dpy, 0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* In the GLX backend, we fall back to using glCopyPixels if we have no extension providing support for partial screen updates.
|
/* In the GLX backend, we fall back to using glCopyPixels if we have no extension providing support for partial screen updates.
|
||||||
|
|
Loading…
Reference in a new issue