From 99ae9e8d7d57ae37629754edd5b1e3716611827f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristian=20H=C3=B8gsberg?= Date: Fri, 19 Feb 2010 13:16:57 -0500 Subject: [PATCH] Drop macro wrappers for the aligned memory functions --- src/mesa/drivers/dri/ffb/ffb_vb.c | 4 ++-- src/mesa/drivers/dri/gamma/gamma_vb.c | 4 ++-- src/mesa/drivers/dri/i810/i810screen.c | 6 +++--- src/mesa/drivers/dri/i810/i810vb.c | 4 ++-- src/mesa/drivers/dri/mach64/mach64_context.c | 4 ++-- src/mesa/drivers/dri/mach64/mach64_vb.c | 4 ++-- src/mesa/drivers/dri/mga/mgavb.c | 4 ++-- src/mesa/drivers/dri/tdfx/tdfx_vb.c | 4 ++-- src/mesa/drivers/glide/fxvb.c | 4 ++-- src/mesa/main/imports.h | 11 ----------- src/mesa/math/m_debug_norm.c | 4 ++-- src/mesa/math/m_debug_xform.c | 4 ++-- src/mesa/math/m_matrix.c | 8 ++++---- src/mesa/math/m_vector.c | 4 ++-- src/mesa/tnl/t_vb_program.c | 4 ++-- src/mesa/tnl/t_vb_vertex.c | 4 ++-- src/mesa/tnl/t_vertex.c | 4 ++-- src/mesa/vbo/vbo_exec_api.c | 4 ++-- 18 files changed, 37 insertions(+), 48 deletions(-) diff --git a/src/mesa/drivers/dri/ffb/ffb_vb.c b/src/mesa/drivers/dri/ffb/ffb_vb.c index ca8ffb27219..a53e7c74319 100644 --- a/src/mesa/drivers/dri/ffb/ffb_vb.c +++ b/src/mesa/drivers/dri/ffb/ffb_vb.c @@ -185,7 +185,7 @@ void ffbInitVB( GLcontext *ctx ) ffbContextPtr fmesa = FFB_CONTEXT(ctx); GLuint size = TNL_CONTEXT(ctx)->vb.Size; - fmesa->verts = (ffb_vertex *)ALIGN_MALLOC(size * sizeof(ffb_vertex), 32); + fmesa->verts = (ffb_vertex *)_mesa_align_malloc(size * sizeof(ffb_vertex), 32); { static int firsttime = 1; @@ -201,7 +201,7 @@ void ffbFreeVB( GLcontext *ctx ) { ffbContextPtr fmesa = FFB_CONTEXT(ctx); if (fmesa->verts) { - ALIGN_FREE(fmesa->verts); + _mesa_align_free(fmesa->verts); fmesa->verts = 0; } } diff --git a/src/mesa/drivers/dri/gamma/gamma_vb.c b/src/mesa/drivers/dri/gamma/gamma_vb.c index c11cfd281aa..013f856dcde 100644 --- a/src/mesa/drivers/dri/gamma/gamma_vb.c +++ b/src/mesa/drivers/dri/gamma/gamma_vb.c @@ -338,7 +338,7 @@ void gammaInitVB( GLcontext *ctx ) gammaContextPtr gmesa = GAMMA_CONTEXT(ctx); GLuint size = TNL_CONTEXT(ctx)->vb.Size; - gmesa->verts = (GLubyte *)ALIGN_MALLOC(size * 4 * 16, 32); + gmesa->verts = (GLubyte *)_mesa_align_malloc(size * 4 * 16, 32); { static int firsttime = 1; @@ -355,7 +355,7 @@ void gammaFreeVB( GLcontext *ctx ) { gammaContextPtr gmesa = GAMMA_CONTEXT(ctx); if (gmesa->verts) { - ALIGN_FREE(gmesa->verts); + _mesa_align_free(gmesa->verts); gmesa->verts = 0; } } diff --git a/src/mesa/drivers/dri/i810/i810screen.c b/src/mesa/drivers/dri/i810/i810screen.c index 1c4deef319f..56708c97cbb 100644 --- a/src/mesa/drivers/dri/i810/i810screen.c +++ b/src/mesa/drivers/dri/i810/i810screen.c @@ -131,12 +131,12 @@ static drmBufMapPtr i810_create_empty_buffers(void) { drmBufMapPtr retval; - retval = (drmBufMapPtr)ALIGN_MALLOC(sizeof(drmBufMap), 32); + retval = (drmBufMapPtr)_mesa_align_malloc(sizeof(drmBufMap), 32); if(retval == NULL) return NULL; memset(retval, 0, sizeof(drmBufMap)); - retval->list = (drmBufPtr)ALIGN_MALLOC(sizeof(drmBuf) * I810_DMA_BUF_NR, 32); + retval->list = (drmBufPtr)_mesa_align_malloc(sizeof(drmBuf) * I810_DMA_BUF_NR, 32); if(retval->list == NULL) { - ALIGN_FREE(retval); + _mesa_align_free(retval); return NULL; } memset(retval->list, 0, sizeof(drmBuf) * I810_DMA_BUF_NR); diff --git a/src/mesa/drivers/dri/i810/i810vb.c b/src/mesa/drivers/dri/i810/i810vb.c index 09a772258c5..70301a2d2ec 100644 --- a/src/mesa/drivers/dri/i810/i810vb.c +++ b/src/mesa/drivers/dri/i810/i810vb.c @@ -464,7 +464,7 @@ void i810InitVB( GLcontext *ctx ) i810ContextPtr imesa = I810_CONTEXT(ctx); GLuint size = TNL_CONTEXT(ctx)->vb.Size; - imesa->verts = (GLubyte *)ALIGN_MALLOC(size * 4 * 16, 32); + imesa->verts = (GLubyte *)_mesa_align_malloc(size * 4 * 16, 32); { static int firsttime = 1; @@ -480,7 +480,7 @@ void i810FreeVB( GLcontext *ctx ) { i810ContextPtr imesa = I810_CONTEXT(ctx); if (imesa->verts) { - ALIGN_FREE(imesa->verts); + _mesa_align_free(imesa->verts); imesa->verts = 0; } } diff --git a/src/mesa/drivers/dri/mach64/mach64_context.c b/src/mesa/drivers/dri/mach64/mach64_context.c index 11bce31b12c..77e7e53ce04 100644 --- a/src/mesa/drivers/dri/mach64/mach64_context.c +++ b/src/mesa/drivers/dri/mach64/mach64_context.c @@ -211,7 +211,7 @@ GLboolean mach64CreateContext( const __GLcontextModes *glVisual, /* Allocate the vertex buffer */ - mmesa->vert_buf = ALIGN_MALLOC(MACH64_BUFFER_SIZE, 32); + mmesa->vert_buf = _mesa_align_malloc(MACH64_BUFFER_SIZE, 32); if ( !mmesa->vert_buf ) return GL_FALSE; mmesa->vert_used = 0; @@ -291,7 +291,7 @@ void mach64DestroyContext( __DRIcontext *driContextPriv ) /* Free the vertex buffer */ if ( mmesa->vert_buf ) - ALIGN_FREE( mmesa->vert_buf ); + _mesa_align_free( mmesa->vert_buf ); /* free the Mesa context */ mmesa->glCtx->DriverCtx = NULL; diff --git a/src/mesa/drivers/dri/mach64/mach64_vb.c b/src/mesa/drivers/dri/mach64/mach64_vb.c index 00da8353769..046aff28a8c 100644 --- a/src/mesa/drivers/dri/mach64/mach64_vb.c +++ b/src/mesa/drivers/dri/mach64/mach64_vb.c @@ -619,7 +619,7 @@ void mach64InitVB( GLcontext *ctx ) mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); GLuint size = TNL_CONTEXT(ctx)->vb.Size; - mmesa->verts = (GLubyte *)ALIGN_MALLOC(size * 4 * 16, 32); + mmesa->verts = (GLubyte *)_mesa_align_malloc(size * 4 * 16, 32); { static int firsttime = 1; @@ -635,7 +635,7 @@ void mach64FreeVB( GLcontext *ctx ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); if (mmesa->verts) { - ALIGN_FREE(mmesa->verts); + _mesa_align_free(mmesa->verts); mmesa->verts = 0; } } diff --git a/src/mesa/drivers/dri/mga/mgavb.c b/src/mesa/drivers/dri/mga/mgavb.c index def5109863c..71bbf33f230 100644 --- a/src/mesa/drivers/dri/mga/mgavb.c +++ b/src/mesa/drivers/dri/mga/mgavb.c @@ -451,7 +451,7 @@ void mgaInitVB( GLcontext *ctx ) mgaContextPtr mmesa = MGA_CONTEXT(ctx); GLuint size = TNL_CONTEXT(ctx)->vb.Size; - mmesa->verts = (GLubyte *)ALIGN_MALLOC(size * sizeof(mgaVertex), 32); + mmesa->verts = (GLubyte *)_mesa_align_malloc(size * sizeof(mgaVertex), 32); { static int firsttime = 1; @@ -471,7 +471,7 @@ void mgaFreeVB( GLcontext *ctx ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); if (mmesa->verts) { - ALIGN_FREE(mmesa->verts); + _mesa_align_free(mmesa->verts); mmesa->verts = 0; } } diff --git a/src/mesa/drivers/dri/tdfx/tdfx_vb.c b/src/mesa/drivers/dri/tdfx/tdfx_vb.c index 0f3c877a3e7..546d89aa846 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_vb.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_vb.c @@ -331,7 +331,7 @@ void tdfxInitVB( GLcontext *ctx ) firsttime = 0; } - fxMesa->verts = ALIGN_MALLOC(size * sizeof(tdfxVertex), 32); + fxMesa->verts = _mesa_align_malloc(size * sizeof(tdfxVertex), 32); fxMesa->vertexFormat = TDFX_LAYOUT_TINY; fxMesa->SetupIndex = TDFX_XYZ_BIT|TDFX_RGBA_BIT; } @@ -341,7 +341,7 @@ void tdfxFreeVB( GLcontext *ctx ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); if (fxMesa->verts) { - ALIGN_FREE(fxMesa->verts); + _mesa_align_free(fxMesa->verts); fxMesa->verts = 0; } } diff --git a/src/mesa/drivers/glide/fxvb.c b/src/mesa/drivers/glide/fxvb.c index cc9ad0e8b83..64453cbe4b5 100644 --- a/src/mesa/drivers/glide/fxvb.c +++ b/src/mesa/drivers/glide/fxvb.c @@ -808,7 +808,7 @@ void fxAllocVB( GLcontext *ctx ) firsttime = 0; } - fxMesa->verts = (GrVertex *)ALIGN_MALLOC(size * sizeof(GrVertex), 32); + fxMesa->verts = (GrVertex *)_mesa_align_malloc(size * sizeof(GrVertex), 32); fxMesa->SetupIndex = SETUP_XYZW|SETUP_RGBA; } @@ -817,7 +817,7 @@ void fxFreeVB( GLcontext *ctx ) { fxMesaContext fxMesa = FX_CONTEXT(ctx); if (fxMesa->verts) { - ALIGN_FREE(fxMesa->verts); + _mesa_align_free(fxMesa->verts); fxMesa->verts = 0; } } diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index a65c6a615fe..269d985f1e1 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -60,17 +60,6 @@ extern "C" { /** Free memory */ #define FREE(PTR) free(PTR) -/** Allocate \p BYTES aligned at \p N bytes */ -#define ALIGN_MALLOC(BYTES, N) _mesa_align_malloc(BYTES, N) -/** Allocate and zero \p BYTES bytes aligned at \p N bytes */ -#define ALIGN_CALLOC(BYTES, N) _mesa_align_calloc(BYTES, N) -/** Allocate a structure of type \p T aligned at \p N bytes */ -#define ALIGN_MALLOC_STRUCT(T, N) (struct T *) _mesa_align_malloc(sizeof(struct T), N) -/** Allocate and zero a structure of type \p T aligned at \p N bytes */ -#define ALIGN_CALLOC_STRUCT(T, N) (struct T *) _mesa_align_calloc(sizeof(struct T), N) -/** Free aligned memory */ -#define ALIGN_FREE(PTR) _mesa_align_free(PTR) - /*@}*/ diff --git a/src/mesa/math/m_debug_norm.c b/src/mesa/math/m_debug_norm.c index 546e8641da4..710bad14dd1 100644 --- a/src/mesa/math/m_debug_norm.c +++ b/src/mesa/math/m_debug_norm.c @@ -208,7 +208,7 @@ static int test_norm_function( normal_func func, int mtype, long *cycles ) (void) cycles; - mat->m = (GLfloat *) ALIGN_MALLOC( 16 * sizeof(GLfloat), 16 ); + mat->m = (GLfloat *) _mesa_align_malloc( 16 * sizeof(GLfloat), 16 ); mat->inv = m = mat->m; init_matrix( m ); @@ -327,7 +327,7 @@ static int test_norm_function( normal_func func, int mtype, long *cycles ) } } - ALIGN_FREE( mat->m ); + _mesa_align_free( mat->m ); return 1; } diff --git a/src/mesa/math/m_debug_xform.c b/src/mesa/math/m_debug_xform.c index df1bc8aadfa..46bd4545170 100644 --- a/src/mesa/math/m_debug_xform.c +++ b/src/mesa/math/m_debug_xform.c @@ -183,7 +183,7 @@ static int test_transform_function( transform_func func, int psize, return 0; } - mat->m = (GLfloat *) ALIGN_MALLOC( 16 * sizeof(GLfloat), 16 ); + mat->m = (GLfloat *) _mesa_align_malloc( 16 * sizeof(GLfloat), 16 ); mat->type = mtypes[mtype]; m = mat->m; @@ -273,7 +273,7 @@ static int test_transform_function( transform_func func, int psize, } } - ALIGN_FREE( mat->m ); + _mesa_align_free( mat->m ); return 1; } diff --git a/src/mesa/math/m_matrix.c b/src/mesa/math/m_matrix.c index e810d6deb82..ef8a40fbecb 100644 --- a/src/mesa/math/m_matrix.c +++ b/src/mesa/math/m_matrix.c @@ -1484,7 +1484,7 @@ _math_matrix_loadf( GLmatrix *mat, const GLfloat *m ) void _math_matrix_ctr( GLmatrix *m ) { - m->m = (GLfloat *) ALIGN_MALLOC( 16 * sizeof(GLfloat), 16 ); + m->m = (GLfloat *) _mesa_align_malloc( 16 * sizeof(GLfloat), 16 ); if (m->m) memcpy( m->m, Identity, sizeof(Identity) ); m->inv = NULL; @@ -1503,11 +1503,11 @@ void _math_matrix_dtr( GLmatrix *m ) { if (m->m) { - ALIGN_FREE( m->m ); + _mesa_align_free( m->m ); m->m = NULL; } if (m->inv) { - ALIGN_FREE( m->inv ); + _mesa_align_free( m->inv ); m->inv = NULL; } } @@ -1523,7 +1523,7 @@ void _math_matrix_alloc_inv( GLmatrix *m ) { if (!m->inv) { - m->inv = (GLfloat *) ALIGN_MALLOC( 16 * sizeof(GLfloat), 16 ); + m->inv = (GLfloat *) _mesa_align_malloc( 16 * sizeof(GLfloat), 16 ); if (m->inv) memcpy( m->inv, Identity, 16 * sizeof(GLfloat) ); } diff --git a/src/mesa/math/m_vector.c b/src/mesa/math/m_vector.c index 65c381f383e..fbd63fd923c 100644 --- a/src/mesa/math/m_vector.c +++ b/src/mesa/math/m_vector.c @@ -101,7 +101,7 @@ _mesa_vector4f_alloc( GLvector4f *v, GLbitfield flags, GLuint count, { v->stride = 4 * sizeof(GLfloat); v->size = 2; - v->storage = ALIGN_MALLOC( count * 4 * sizeof(GLfloat), alignment ); + v->storage = _mesa_align_malloc( count * 4 * sizeof(GLfloat), alignment ); v->storage_count = count; v->start = (GLfloat *) v->storage; v->data = (GLfloat (*)[4]) v->storage; @@ -119,7 +119,7 @@ void _mesa_vector4f_free( GLvector4f *v ) { if (v->flags & VEC_MALLOC) { - ALIGN_FREE( v->storage ); + _mesa_align_free( v->storage ); v->data = NULL; v->start = NULL; v->storage = NULL; diff --git a/src/mesa/tnl/t_vb_program.c b/src/mesa/tnl/t_vb_program.c index 5351b5fe41f..0137e52fc40 100644 --- a/src/mesa/tnl/t_vb_program.c +++ b/src/mesa/tnl/t_vb_program.c @@ -514,7 +514,7 @@ init_vp(GLcontext *ctx, struct tnl_pipeline_stage *stage) /* a few other misc allocations */ _mesa_vector4f_alloc( &store->ndcCoords, 0, size, 32 ); - store->clipmask = (GLubyte *) ALIGN_MALLOC(sizeof(GLubyte)*size, 32 ); + store->clipmask = (GLubyte *) _mesa_align_malloc(sizeof(GLubyte)*size, 32 ); return GL_TRUE; } @@ -537,7 +537,7 @@ dtr(struct tnl_pipeline_stage *stage) /* free misc arrays */ _mesa_vector4f_free( &store->ndcCoords ); - ALIGN_FREE( store->clipmask ); + _mesa_align_free( store->clipmask ); FREE( store ); stage->privatePtr = NULL; diff --git a/src/mesa/tnl/t_vb_vertex.c b/src/mesa/tnl/t_vb_vertex.c index bc7e0951ec8..a2753425633 100644 --- a/src/mesa/tnl/t_vb_vertex.c +++ b/src/mesa/tnl/t_vb_vertex.c @@ -246,7 +246,7 @@ static GLboolean init_vertex_stage( GLcontext *ctx, _mesa_vector4f_alloc( &store->clip, 0, size, 32 ); _mesa_vector4f_alloc( &store->proj, 0, size, 32 ); - store->clipmask = (GLubyte *) ALIGN_MALLOC(sizeof(GLubyte)*size, 32 ); + store->clipmask = (GLubyte *) _mesa_align_malloc(sizeof(GLubyte)*size, 32 ); if (!store->clipmask || !store->eye.data || @@ -265,7 +265,7 @@ static void dtr( struct tnl_pipeline_stage *stage ) _mesa_vector4f_free( &store->eye ); _mesa_vector4f_free( &store->clip ); _mesa_vector4f_free( &store->proj ); - ALIGN_FREE( store->clipmask ); + _mesa_align_free( store->clipmask ); FREE(store); stage->privatePtr = NULL; stage->run = init_vertex_stage; diff --git a/src/mesa/tnl/t_vertex.c b/src/mesa/tnl/t_vertex.c index b35d6a284e5..c1b1570232a 100644 --- a/src/mesa/tnl/t_vertex.c +++ b/src/mesa/tnl/t_vertex.c @@ -494,7 +494,7 @@ void _tnl_init_vertices( GLcontext *ctx, if (max_vertex_size > vtx->max_vertex_size) { _tnl_free_vertices( ctx ); vtx->max_vertex_size = max_vertex_size; - vtx->vertex_buf = (GLubyte *)ALIGN_CALLOC(vb_size * max_vertex_size, 32 ); + vtx->vertex_buf = (GLubyte *)_mesa_align_calloc(vb_size * max_vertex_size, 32 ); invalidate_funcs(vtx); } @@ -541,7 +541,7 @@ void _tnl_free_vertices( GLcontext *ctx ) struct tnl_clipspace_fastpath *fp, *tmp; if (vtx->vertex_buf) { - ALIGN_FREE(vtx->vertex_buf); + _mesa_align_free(vtx->vertex_buf); vtx->vertex_buf = NULL; } diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index aa7f1c40b1d..3dde982371d 100644 --- a/src/mesa/vbo/vbo_exec_api.c +++ b/src/mesa/vbo/vbo_exec_api.c @@ -781,7 +781,7 @@ void vbo_exec_vtx_init( struct vbo_exec_context *exec ) ctx->Shared->NullBufferObj); ASSERT(!exec->vtx.buffer_map); - exec->vtx.buffer_map = (GLfloat *)ALIGN_MALLOC(VBO_VERT_BUFFER_SIZE, 64); + exec->vtx.buffer_map = (GLfloat *)_mesa_align_malloc(VBO_VERT_BUFFER_SIZE, 64); exec->vtx.buffer_ptr = exec->vtx.buffer_map; vbo_exec_vtxfmt_init( exec ); @@ -835,7 +835,7 @@ void vbo_exec_vtx_destroy( struct vbo_exec_context *exec ) ASSERT(exec->vtx.bufferobj->Name == 0 || exec->vtx.bufferobj->Name == IMM_BUFFER_NAME); if (exec->vtx.bufferobj->Name == 0) { - ALIGN_FREE(exec->vtx.buffer_map); + _mesa_align_free(exec->vtx.buffer_map); exec->vtx.buffer_map = NULL; exec->vtx.buffer_ptr = NULL; } -- 2.30.2