From 8432e0ee3d3deb7542fa0cefadef0eafaedea167 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 20 May 2022 13:32:50 -0600 Subject: [PATCH] llvmpipe: asst. clean-ups in lp_scene.h Signed-off-by: Brian Paul Reviewed-by: Roland Scheidegger Part-of: --- src/gallium/drivers/llvmpipe/lp_scene.h | 90 ++++++++++++------------- 1 file changed, 43 insertions(+), 47 deletions(-) diff --git a/src/gallium/drivers/llvmpipe/lp_scene.h b/src/gallium/drivers/llvmpipe/lp_scene.h index 8d72998f9e0..ba1974957da 100644 --- a/src/gallium/drivers/llvmpipe/lp_scene.h +++ b/src/gallium/drivers/llvmpipe/lp_scene.h @@ -71,10 +71,10 @@ struct lp_rast_state; /* switch to a non-pointer value for this: */ -typedef void (*lp_rast_cmd_func)( struct lp_rasterizer_task *, - const union lp_rast_cmd_arg ); +typedef void (*lp_rast_cmd_func)(struct lp_rasterizer_task *, + const union lp_rast_cmd_arg); + - struct cmd_block { uint8_t cmd[CMD_BLOCK_MAX]; union lp_rast_cmd_arg arg[CMD_BLOCK_MAX]; @@ -95,11 +95,11 @@ struct data_block { * For each screen tile we have one of these bins. */ struct cmd_bin { - const struct lp_rast_state *last_state; /* most recent state set in bin */ + const struct lp_rast_state *last_state; /* most recent state set in bin */ struct cmd_block *head; struct cmd_block *tail; }; - + /** * This stores bulk data which is used for all memory allocations @@ -207,14 +207,14 @@ struct lp_scene *lp_scene_create(struct lp_setup_context *setup); void lp_scene_destroy(struct lp_scene *scene); -boolean lp_scene_is_empty(struct lp_scene *scene ); -boolean lp_scene_is_oom(struct lp_scene *scene ); +boolean lp_scene_is_empty(struct lp_scene *scene); +boolean lp_scene_is_oom(struct lp_scene *scene); -struct data_block *lp_scene_new_data_block( struct lp_scene *scene ); +struct data_block *lp_scene_new_data_block(struct lp_scene *scene); -struct cmd_block *lp_scene_new_cmd_block( struct lp_scene *scene, - struct cmd_bin *bin ); +struct cmd_block *lp_scene_new_cmd_block(struct lp_scene *scene, + struct cmd_bin *bin); boolean lp_scene_add_resource_reference(struct lp_scene *scene, struct pipe_resource *resource, @@ -222,7 +222,7 @@ boolean lp_scene_add_resource_reference(struct lp_scene *scene, boolean writeable); unsigned lp_scene_is_resource_referenced(const struct lp_scene *scene, - const struct pipe_resource *resource ); + const struct pipe_resource *resource); boolean lp_scene_add_frag_shader_reference(struct lp_scene *scene, struct lp_fragment_shader_variant *variant); @@ -234,7 +234,7 @@ boolean lp_scene_add_frag_shader_reference(struct lp_scene *scene, * Grow the block list if needed. */ static inline void * -lp_scene_alloc( struct lp_scene *scene, unsigned size) +lp_scene_alloc(struct lp_scene *scene, unsigned size) { struct data_block_list *list = &scene->data; struct data_block *block = list->head; @@ -244,11 +244,11 @@ lp_scene_alloc( struct lp_scene *scene, unsigned size) if (LP_DEBUG & DEBUG_MEM) debug_printf("alloc %u block %u/%u tot %u/%u\n", - size, block->used, (unsigned)DATA_BLOCK_SIZE, - scene->scene_size, LP_SCENE_MAX_SIZE); + size, block->used, (unsigned)DATA_BLOCK_SIZE, + scene->scene_size, LP_SCENE_MAX_SIZE); if (block->used + size > DATA_BLOCK_SIZE) { - block = lp_scene_new_data_block( scene ); + block = lp_scene_new_data_block(scene); if (!block) { /* out of memory */ return NULL; @@ -267,8 +267,8 @@ lp_scene_alloc( struct lp_scene *scene, unsigned size) * As above, but with specific alignment. */ static inline void * -lp_scene_alloc_aligned( struct lp_scene *scene, unsigned size, - unsigned alignment ) +lp_scene_alloc_aligned(struct lp_scene *scene, unsigned size, + unsigned alignment) { struct data_block_list *list = &scene->data; struct data_block *block = list->head; @@ -277,12 +277,12 @@ lp_scene_alloc_aligned( struct lp_scene *scene, unsigned size, if (LP_DEBUG & DEBUG_MEM) debug_printf("alloc %u block %u/%u tot %u/%u\n", - size + alignment - 1, - block->used, (unsigned)DATA_BLOCK_SIZE, - scene->scene_size, LP_SCENE_MAX_SIZE); - + size + alignment - 1, + block->used, (unsigned)DATA_BLOCK_SIZE, + scene->scene_size, LP_SCENE_MAX_SIZE); + if (block->used + size + alignment - 1 > DATA_BLOCK_SIZE) { - block = lp_scene_new_data_block( scene ); + block = lp_scene_new_data_block(scene); if (!block) return NULL; } @@ -312,10 +312,10 @@ lp_scene_bin_reset(struct lp_scene *scene, unsigned x, unsigned y); /* Add a command to bin[x][y]. */ static inline boolean -lp_scene_bin_command( struct lp_scene *scene, - unsigned x, unsigned y, - unsigned cmd, - union lp_rast_cmd_arg arg ) +lp_scene_bin_command(struct lp_scene *scene, + unsigned x, unsigned y, + unsigned cmd, + union lp_rast_cmd_arg arg) { struct cmd_bin *bin = lp_scene_get_bin(scene, x, y); struct cmd_block *tail = bin->tail; @@ -325,7 +325,7 @@ lp_scene_bin_command( struct lp_scene *scene, assert(cmd < LP_RAST_OP_MAX); if (tail == NULL || tail->count == CMD_BLOCK_MAX) { - tail = lp_scene_new_cmd_block( scene, bin ); + tail = lp_scene_new_cmd_block(scene, bin); if (!tail) { return FALSE; } @@ -338,17 +338,17 @@ lp_scene_bin_command( struct lp_scene *scene, tail->arg[i] = arg; tail->count++; } - + return TRUE; } static inline boolean -lp_scene_bin_cmd_with_state( struct lp_scene *scene, - unsigned x, unsigned y, - const struct lp_rast_state *state, - unsigned cmd, - union lp_rast_cmd_arg arg ) +lp_scene_bin_cmd_with_state(struct lp_scene *scene, + unsigned x, unsigned y, + const struct lp_rast_state *state, + unsigned cmd, + union lp_rast_cmd_arg arg) { struct cmd_bin *bin = lp_scene_get_bin(scene, x, y); @@ -360,7 +360,7 @@ lp_scene_bin_cmd_with_state( struct lp_scene *scene, return FALSE; } - if (!lp_scene_bin_command( scene, x, y, cmd, arg )) + if (!lp_scene_bin_command(scene, x, y, cmd, arg)) return FALSE; return TRUE; @@ -370,14 +370,13 @@ lp_scene_bin_cmd_with_state( struct lp_scene *scene, /* Add a command to all active bins. */ static inline boolean -lp_scene_bin_everywhere( struct lp_scene *scene, - unsigned cmd, - const union lp_rast_cmd_arg arg ) +lp_scene_bin_everywhere(struct lp_scene *scene, + unsigned cmd, + const union lp_rast_cmd_arg arg) { - unsigned i, j; - for (i = 0; i < scene->tiles_x; i++) { - for (j = 0; j < scene->tiles_y; j++) { - if (!lp_scene_bin_command( scene, i, j, cmd, arg )) + for (unsigned i = 0; i < scene->tiles_x; i++) { + for (unsigned j = 0; j < scene->tiles_y; j++) { + if (!lp_scene_bin_command(scene, i, j, cmd, arg)) return FALSE; } } @@ -387,17 +386,17 @@ lp_scene_bin_everywhere( struct lp_scene *scene, static inline unsigned -lp_scene_get_num_bins( const struct lp_scene *scene ) +lp_scene_get_num_bins(const struct lp_scene *scene) { return scene->tiles_x * scene->tiles_y; } void -lp_scene_bin_iter_begin( struct lp_scene *scene ); +lp_scene_bin_iter_begin(struct lp_scene *scene); struct cmd_bin * -lp_scene_bin_iter_next( struct lp_scene *scene, int *x, int *y ); +lp_scene_bin_iter_next(struct lp_scene *scene, int *x, int *y); @@ -420,7 +419,4 @@ void lp_scene_end_rasterization(struct lp_scene *scene); - - - #endif /* LP_BIN_H */