[mutter/wip/carlosg/fix-multimonitor-buffer-age: 1/3] cogl/egl: Warn when we fail to query a buffer age.



commit 6df8625524c7985db4b76634db8832541534ef91
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Oct 30 13:34:32 2019 +0100

    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 99dcb8bf3..d849042c5 100644
--- a/cogl/cogl/winsys/cogl-winsys-egl.c
+++ b/cogl/cogl/winsys/cogl-winsys-egl.c
@@ -695,12 +695,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;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]