From 402b456a3229f6c7f1550e66bbd8125c253a4ff1 Mon Sep 17 00:00:00 2001 From: Bryce Harrington Date: Thu, 31 Jul 2014 17:58:15 -0700 Subject: [PATCH] gl: Increase default VBO size on GL to 1M The default VBO size was reduced from 256k to 16k because embedded devices had trouble with the larger memory demands of a big VBO. My testing[1] indicates this incurred a 5% performance loss on at least one of Cairo's performance tests. Further testing showed that with late-model graphics cards, further performance benefits can be seen with even larger VBO sizes, up to 8.3% at 1M for Intel. Now that we can set the vbo size differently for different backends, set it to the lower value (16k) for EGL, and higher (1M) for GL. 1: http://www.bryceharrington.org/wordpress/2013/08/vbo-size/ Signed-off-by: Bryce Harrington --- src/cairo-egl-context.c | 6 ++++++ src/cairo-gl-private.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/cairo-egl-context.c b/src/cairo-egl-context.c index bb0772ab4..bf704c630 100644 --- a/src/cairo-egl-context.c +++ b/src/cairo-egl-context.c @@ -244,6 +244,12 @@ cairo_egl_device_create (EGLDisplay dpy, EGLContext egl) return _cairo_gl_context_create_in_error (status); } + /* Tune the default VBO size to reduce overhead on embedded devices. + * This smaller size means that flushing needs to be done more often, + * but it is less demanding of scarce memory on embedded devices. + */ + ctx->base.vbo_size = 16*1024; + eglMakeCurrent (dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); return &ctx->base.base; diff --git a/src/cairo-gl-private.h b/src/cairo-gl-private.h index c1104b6ee..cb915c8cf 100644 --- a/src/cairo-gl-private.h +++ b/src/cairo-gl-private.h @@ -95,7 +95,7 @@ * but larger means hogging more memory and can cause trouble for drivers * (especially on embedded devices). Use the CAIRO_GL_VBO_SIZE environment * variable to set this to a different size. */ -#define CAIRO_GL_VBO_SIZE_DEFAULT (16*1024) +#define CAIRO_GL_VBO_SIZE_DEFAULT (1024*1024) typedef struct _cairo_gl_surface cairo_gl_surface_t;