From 6ee7c0f486e8827241fa881d398d97720346df46 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Wed, 30 Oct 2019 13:34:32 +0100 Subject: [PATCH] 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 --- cogl/cogl/winsys/cogl-winsys-egl.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/cogl/cogl/winsys/cogl-winsys-egl.c b/cogl/cogl/winsys/cogl-winsys-egl.c index f2b439a67..6e7fb9781 100644 --- a/cogl/cogl/winsys/cogl-winsys-egl.c +++ b/cogl/cogl/winsys/cogl-winsys-egl.c @@ -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; }