cogl/egl: Warn when we fail to query a buffer age.

In order to avoid log spamming, just warn once it starts to happen, not
on every frame for every onscreen. Just knowing that this is happening
is a hint that something's going wrong.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/906
This commit is contained in:
Carlos Garnacho 2019-10-30 13:34:32 +01:00 committed by Georges Basile Stavracas Neto
parent f4f7e31303
commit 6ee7c0f486

View File

@ -697,12 +697,22 @@ _cogl_winsys_onscreen_get_buffer_age (CoglOnscreen *onscreen)
CoglRendererEGL *egl_renderer = renderer->winsys;
CoglOnscreenEGL *egl_onscreen = onscreen->winsys;
EGLSurface surface = egl_onscreen->egl_surface;
static gboolean warned = FALSE;
int age;
if (!(egl_renderer->private_features & COGL_EGL_WINSYS_FEATURE_BUFFER_AGE))
return 0;
eglQuerySurface (egl_renderer->edpy, surface, EGL_BUFFER_AGE_EXT, &age);
if (!eglQuerySurface (egl_renderer->edpy, surface, EGL_BUFFER_AGE_EXT, &age))
{
if (!warned)
g_critical ("Failed to query buffer age, got error %x", eglGetError ());
warned = TRUE;
}
else
{
warned = FALSE;
}
return age;
}