mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-03-06 08:10:36 +01:00
cairo-gl: Make VBO size run-time settable
The default VBO size was reduced from 256k to 16k last year in commit
90860241 due to problems with larger VBOs on embedded hardware.
However, that change resulted in a 5% performance impact to the
firefox-fishbowl benchmark when using the spans or traps compositors.
This patch doesn't change the VBO size, but does permit it to be
altered via an environment variable, to facilitate testing.
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
This commit is contained in:
parent
8479b60867
commit
036f47c345
4 changed files with 30 additions and 4 deletions
|
|
@ -875,7 +875,7 @@ _cairo_gl_composite_prepare_buffer (cairo_gl_context_t *ctx,
|
|||
ctx->primitive_type = primitive_type;
|
||||
}
|
||||
|
||||
if (ctx->vb_offset + n_vertices * ctx->vertex_size > CAIRO_GL_VBO_SIZE)
|
||||
if (ctx->vb_offset + n_vertices * ctx->vertex_size > _cairo_gl_get_vbo_size())
|
||||
_cairo_gl_composite_flush (ctx);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -297,7 +297,7 @@ _cairo_gl_context_init (cairo_gl_context_t *ctx)
|
|||
if (unlikely (status))
|
||||
return status;
|
||||
|
||||
ctx->vb = malloc (CAIRO_GL_VBO_SIZE);
|
||||
ctx->vb = malloc (_cairo_gl_get_vbo_size());
|
||||
if (unlikely (ctx->vb == NULL)) {
|
||||
_cairo_cache_fini (&ctx->gradients);
|
||||
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@
|
|||
* Alexandros Frantzis <alexandros.frantzis@linaro.org>
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include "cairoint.h"
|
||||
#include "cairo-gl-private.h"
|
||||
|
||||
|
|
@ -71,6 +73,26 @@ _cairo_gl_get_flavor (void)
|
|||
return flavor;
|
||||
}
|
||||
|
||||
long
|
||||
_cairo_gl_get_vbo_size (void)
|
||||
{
|
||||
static long vbo_size = -1;
|
||||
|
||||
if (vbo_size < 0) {
|
||||
const char *env = getenv ("CAIRO_GL_VBO_SIZE");
|
||||
if (env == NULL) {
|
||||
vbo_size = CAIRO_GL_VBO_SIZE_DEFAULT;
|
||||
} else {
|
||||
errno = 0;
|
||||
vbo_size = strtol (env, NULL, 10);
|
||||
assert (errno == 0);
|
||||
assert (vbo_size > 0);
|
||||
}
|
||||
}
|
||||
|
||||
return vbo_size;
|
||||
}
|
||||
|
||||
cairo_bool_t
|
||||
_cairo_gl_has_extension (const char *ext)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -93,8 +93,9 @@
|
|||
|
||||
/* VBO size that we allocate, smaller size means we gotta flush more often,
|
||||
* but larger means hogging more memory and can cause trouble for drivers
|
||||
* (especially on embedded devices). */
|
||||
#define CAIRO_GL_VBO_SIZE (16*1024)
|
||||
* (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)
|
||||
|
||||
typedef struct _cairo_gl_surface cairo_gl_surface_t;
|
||||
|
||||
|
|
@ -702,6 +703,9 @@ _cairo_gl_get_version (void);
|
|||
cairo_private cairo_gl_flavor_t
|
||||
_cairo_gl_get_flavor (void);
|
||||
|
||||
cairo_private long
|
||||
_cairo_gl_get_vbo_size (void);
|
||||
|
||||
cairo_private cairo_bool_t
|
||||
_cairo_gl_has_extension (const char *ext);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue