diff options
Diffstat (limited to 'src/cairo-egl-context.c')
-rw-r--r-- | src/cairo-egl-context.c | 53 |
1 files changed, 38 insertions, 15 deletions
diff --git a/src/cairo-egl-context.c b/src/cairo-egl-context.c index 0a13c6aac..5884f619a 100644 --- a/src/cairo-egl-context.c +++ b/src/cairo-egl-context.c @@ -41,6 +41,7 @@ #include "cairo-gl-private.h" #include "cairo-error-private.h" +#include "cairo-ttrace.h" #if CAIRO_HAS_EVASGL_SURFACE && CAIRO_HAS_GLESV2_SURFACE extern void glActiveTexture (GLenum texture); @@ -179,21 +180,25 @@ static void _egl_swap_buffers (void *abstract_ctx, cairo_gl_surface_t *abstract_surface) { + CAIRO_TRACE_BEGIN (__func__); cairo_egl_context_t *ctx = abstract_ctx; cairo_egl_surface_t *surface = (cairo_egl_surface_t *) abstract_surface; eglSwapBuffers (ctx->display, surface->egl); + CAIRO_TRACE_END (__func__); } static void _egl_destroy (void *abstract_ctx) { + CAIRO_TRACE_BEGIN (__func__); cairo_egl_context_t *ctx = abstract_ctx; eglMakeCurrent (ctx->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); if (ctx->dummy_surface != EGL_NO_SURFACE) eglDestroySurface (ctx->display, ctx->dummy_surface); + CAIRO_TRACE_END (__func__); } static cairo_bool_t @@ -269,6 +274,7 @@ _cairo_egl_get_proc_address (void *data, const char *name) cairo_device_t * cairo_egl_device_create (EGLDisplay dpy, EGLContext egl) { + CAIRO_TRACE_BEGIN (__func__); cairo_egl_context_t *ctx; cairo_status_t status; int attribs[] = { @@ -280,8 +286,10 @@ cairo_egl_device_create (EGLDisplay dpy, EGLContext egl) EGLint numConfigs; ctx = calloc (1, sizeof (cairo_egl_context_t)); - if (unlikely (ctx == NULL)) - return _cairo_gl_context_create_in_error (CAIRO_STATUS_NO_MEMORY); + if (unlikely (ctx == NULL)) { + CAIRO_TRACE_END (__func__); + return _cairo_gl_context_create_in_error (CAIRO_STATUS_NO_MEMORY); + } ctx->display = dpy; ctx->context = egl; @@ -315,11 +323,13 @@ cairo_egl_device_create (EGLDisplay dpy, EGLContext egl) ctx->dummy_surface = eglCreatePbufferSurface (dpy, config, attribs); if (ctx->dummy_surface == NULL) { free (ctx); + CAIRO_TRACE_END (__func__); return _cairo_gl_context_create_in_error (CAIRO_STATUS_NO_MEMORY); } if (!eglMakeCurrent (dpy, ctx->dummy_surface, ctx->dummy_surface, egl)) { free (ctx); + CAIRO_TRACE_END (__func__); return _cairo_gl_context_create_in_error (CAIRO_STATUS_NO_MEMORY); } } @@ -327,16 +337,18 @@ cairo_egl_device_create (EGLDisplay dpy, EGLContext egl) status = _cairo_gl_dispatch_init (&ctx->base.dispatch, _cairo_egl_get_proc_address, NULL); if (unlikely (status)) { - free (ctx); - return _cairo_gl_context_create_in_error (status); + free (ctx); + CAIRO_TRACE_END (__func__); + return _cairo_gl_context_create_in_error (status); } status = _cairo_gl_context_init (&ctx->base); if (unlikely (status)) { - if (ctx->dummy_surface != EGL_NO_SURFACE) - eglDestroySurface (dpy, ctx->dummy_surface); - free (ctx); - return _cairo_gl_context_create_in_error (status); + if (ctx->dummy_surface != EGL_NO_SURFACE) + eglDestroySurface (dpy, ctx->dummy_surface); + free (ctx); + CAIRO_TRACE_END (__func__); + return _cairo_gl_context_create_in_error (status); } /* Tune the default VBO size to reduce overhead on embedded devices. @@ -349,6 +361,7 @@ cairo_egl_device_create (EGLDisplay dpy, EGLContext egl) ctx->current_surface = EGL_NO_SURFACE; + CAIRO_TRACE_END (__func__); return &ctx->base.base; } @@ -358,25 +371,35 @@ cairo_gl_surface_create_for_egl (cairo_device_t *device, int width, int height) { + CAIRO_TRACE_BEGIN (__func__); cairo_egl_surface_t *surface; - if (unlikely (device->status)) - return _cairo_surface_create_in_error (device->status); + if (unlikely (device->status)) { + CAIRO_TRACE_END (__func__); + return _cairo_surface_create_in_error (device->status); + } - if (device->backend->type != CAIRO_DEVICE_TYPE_GL) - return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_SURFACE_TYPE_MISMATCH)); + if (device->backend->type != CAIRO_DEVICE_TYPE_GL) { + CAIRO_TRACE_END (__func__); + return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_SURFACE_TYPE_MISMATCH)); + } - if (width <= 0 || height <= 0) + if (width <= 0 || height <= 0) { + CAIRO_TRACE_END (__func__); return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_SIZE)); + } surface = calloc (1, sizeof (cairo_egl_surface_t)); - if (unlikely (surface == NULL)) - return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY)); + if (unlikely (surface == NULL)) { + CAIRO_TRACE_END (__func__); + return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY)); + } _cairo_gl_surface_init (device, &surface->base, CAIRO_CONTENT_COLOR_ALPHA, width, height); surface->egl = egl; + CAIRO_TRACE_END (__func__); return &surface->base.base; } |