diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2023-03-03 19:23:18 +0100 |
---|---|---|
committer | Marge Bot <marge-bot@gnome.org> | 2023-03-03 20:17:01 +0000 |
commit | ab3b12052d7ce7e0d87c07028548d392678e0c40 (patch) | |
tree | 0ed4964848bef25fa557babbc63cd1dafada3949 /cogl | |
parent | ae2ceeda0b53a63b93efc2788c60cd368342410f (diff) | |
download | mutter-ab3b12052d7ce7e0d87c07028548d392678e0c40.tar.gz |
cogl: Trap GLX call with error trap
This is a X request that may result in errors, so it is better
to have covered by an error trap.
It is thus far not, explicitly at least, which means other less
lenient error traps might not like what happens here. Make the
error trap threeway between backend, x11 and cogl happen less
by chance here.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2864>
Diffstat (limited to 'cogl')
-rw-r--r-- | cogl/cogl/winsys/cogl-onscreen-glx.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/cogl/cogl/winsys/cogl-onscreen-glx.c b/cogl/cogl/winsys/cogl-onscreen-glx.c index 8bbb508b7..f6d14fd50 100644 --- a/cogl/cogl/winsys/cogl-onscreen-glx.c +++ b/cogl/cogl/winsys/cogl-onscreen-glx.c @@ -539,16 +539,20 @@ cogl_onscreen_glx_get_buffer_age (CoglOnscreen *onscreen) CoglOnscreenGlx *onscreen_glx = COGL_ONSCREEN_GLX (onscreen); CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); CoglContext *context = cogl_framebuffer_get_context (framebuffer); + CoglDisplay *display = context->display; CoglXlibRenderer *xlib_renderer = _cogl_xlib_renderer_get_data (context->display->renderer); CoglGLXRenderer *glx_renderer = context->display->renderer->winsys; + CoglXlibTrapState old_state; GLXDrawable drawable; - unsigned int age; + unsigned int age = 0; if (!_cogl_winsys_has_feature (COGL_WINSYS_FEATURE_BUFFER_AGE)) return 0; drawable = onscreen_glx->glxwin ? onscreen_glx->glxwin : onscreen_glx->xwin; + _cogl_xlib_renderer_trap_errors (display->renderer, &old_state); glx_renderer->glXQueryDrawable (xlib_renderer->xdpy, drawable, GLX_BACK_BUFFER_AGE_EXT, &age); + _cogl_xlib_renderer_untrap_errors (display->renderer, &old_state); return age; } |