llvmpipe: use align_malloc for all structs containing ALIGN16 members

Unless the struct is allocated aligned, aligning the members isn't very
helpful.
This commit is contained in:
Keith Whitwell 2009-08-18 20:25:37 +01:00 committed by José Fonseca
parent 49d83fdc45
commit a22f87c994
4 changed files with 22 additions and 8 deletions

View File

@ -106,7 +106,7 @@ static void llvmpipe_destroy( struct pipe_context *pipe )
}
}
FREE( llvmpipe );
align_free( llvmpipe );
}
static unsigned int
@ -143,11 +143,17 @@ llvmpipe_is_buffer_referenced( struct pipe_context *pipe,
struct pipe_context *
llvmpipe_create( struct pipe_screen *screen )
{
struct llvmpipe_context *llvmpipe = CALLOC_STRUCT(llvmpipe_context);
struct llvmpipe_context *llvmpipe;
uint i;
llvmpipe = align_malloc(sizeof(struct llvmpipe_context), 16);
if (!llvmpipe)
return NULL;
util_init_math();
memset(llvmpipe, 0, sizeof *llvmpipe);
llvmpipe->pipe.winsys = screen->winsys;
llvmpipe->pipe.screen = screen;
llvmpipe->pipe.destroy = llvmpipe_destroy;

View File

@ -237,7 +237,7 @@ shade_begin(struct quad_stage *qs)
static void
shade_destroy(struct quad_stage *qs)
{
FREE( qs );
align_free( qs );
}
@ -246,10 +246,12 @@ lp_quad_shade_stage( struct llvmpipe_context *llvmpipe )
{
struct quad_shade_stage *qss;
qss = CALLOC_STRUCT(quad_shade_stage);
qss = align_malloc(sizeof(struct quad_shade_stage), 16);
if (!qss)
return NULL;
memset(qss, 0, sizeof *qss);
qss->stage.llvmpipe = llvmpipe;
qss->stage.begin = shade_begin;
qss->stage.run = shade_quads;

View File

@ -1358,7 +1358,7 @@ void setup_prepare( struct setup_context *setup )
void setup_destroy_context( struct setup_context *setup )
{
FREE( setup );
align_free( setup );
}
@ -1367,9 +1367,14 @@ void setup_destroy_context( struct setup_context *setup )
*/
struct setup_context *setup_create_context( struct llvmpipe_context *llvmpipe )
{
struct setup_context *setup = CALLOC_STRUCT(setup_context);
struct setup_context *setup;
unsigned i;
setup = align_malloc(sizeof(struct setup_context), 16);
if (!setup)
return NULL;
memset(setup, 0, sizeof *setup);
setup->llvmpipe = llvmpipe;
for (i = 0; i < MAX_QUADS; i++) {

View File

@ -88,8 +88,9 @@ lp_create_tile_cache( struct pipe_screen *screen )
struct llvmpipe_tile_cache *tc;
uint pos;
tc = CALLOC_STRUCT( llvmpipe_tile_cache );
tc = align_malloc( sizeof(struct llvmpipe_tile_cache), 16 );
if (tc) {
memset(tc, 0, sizeof *tc);
tc->screen = screen;
for (pos = 0; pos < NUM_ENTRIES; pos++) {
tc->entries[pos].addr.bits.invalid = 1;
@ -118,7 +119,7 @@ lp_destroy_tile_cache(struct llvmpipe_tile_cache *tc)
screen->tex_transfer_destroy(tc->tex_trans);
}
FREE( tc );
align_free( tc );
}