[cairo] [PATCH 3/3] gl: Increase default VBO size on GL to 1M

Bryce Harrington bryce at osg.samsung.com
Thu Jul 31 18:51:35 PDT 2014


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 <bryce at osg.samsung.com>
---
 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 bb0772a..bf704c6 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 c1104b6..cb915c8 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;
 
-- 
1.7.9.5



More information about the cairo mailing list