diff options
author | Brian Paul <[email protected]> | 2015-01-26 20:32:58 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2015-01-30 08:48:19 -0700 |
commit | 53b01938ed864e2efaa9389b45e88284eebaaa63 (patch) | |
tree | 99ef1f3c8e9af9f699fa0c927144faccac8f41fa /src/mesa/main/dlist.h | |
parent | fbc3e030e658c2c6d44bac084c3166d1fb737c7e (diff) |
mesa: fix display list 8-byte alignment issue
The _mesa_dlist_alloc() function is only guaranteed to return a pointer
with 4-byte alignment. On 64-bit systems which don't support unaligned
loads (e.g. SPARC or MIPS) this could lead to a bus error in the VBO code.
The solution is to add a new _mesa_dlist_alloc_aligned() function which
will return a pointer to an 8-byte aligned address on 64-bit systems.
This is accomplished by inserting a 4-byte NOP instruction in the display
list when needed.
The only place this actually matters is the VBO code where we need to
allocate a 'struct vbo_save_vertex_list' which needs to be 8-byte
aligned (just as if it were malloc'd).
The gears demo and others hit this bug.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88662
Cc: "10.4" <[email protected]>
Reviewed-by: José Fonseca <[email protected]>
Diffstat (limited to 'src/mesa/main/dlist.h')
-rw-r--r-- | src/mesa/main/dlist.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/mesa/main/dlist.h b/src/mesa/main/dlist.h index c57eb74da6d..6189632d478 100644 --- a/src/mesa/main/dlist.h +++ b/src/mesa/main/dlist.h @@ -60,6 +60,9 @@ extern void _mesa_compile_error( struct gl_context *ctx, GLenum error, const cha extern void *_mesa_dlist_alloc(struct gl_context *ctx, GLuint opcode, GLuint sz); +extern void * +_mesa_dlist_alloc_aligned(struct gl_context *ctx, GLuint opcode, GLuint bytes); + extern GLint _mesa_dlist_alloc_opcode( struct gl_context *ctx, GLuint sz, void (*execute)( struct gl_context *, void * ), void (*destroy)( struct gl_context *, void * ), |