llvmpipe: asst. clean-ups in lp_scene.h

Signed-off-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16937>
This commit is contained in:
Brian Paul 2022-05-20 13:32:50 -06:00 committed by Marge Bot
parent c1ddfa15a4
commit 8432e0ee3d

View file

@ -71,10 +71,10 @@ struct lp_rast_state;
/* switch to a non-pointer value for this: /* switch to a non-pointer value for this:
*/ */
typedef void (*lp_rast_cmd_func)( struct lp_rasterizer_task *, typedef void (*lp_rast_cmd_func)(struct lp_rasterizer_task *,
const union lp_rast_cmd_arg ); const union lp_rast_cmd_arg);
struct cmd_block { struct cmd_block {
uint8_t cmd[CMD_BLOCK_MAX]; uint8_t cmd[CMD_BLOCK_MAX];
union lp_rast_cmd_arg arg[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. * For each screen tile we have one of these bins.
*/ */
struct cmd_bin { 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 *head;
struct cmd_block *tail; struct cmd_block *tail;
}; };
/** /**
* This stores bulk data which is used for all memory allocations * 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); void lp_scene_destroy(struct lp_scene *scene);
boolean lp_scene_is_empty(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_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_block *lp_scene_new_cmd_block(struct lp_scene *scene,
struct cmd_bin *bin ); struct cmd_bin *bin);
boolean lp_scene_add_resource_reference(struct lp_scene *scene, boolean lp_scene_add_resource_reference(struct lp_scene *scene,
struct pipe_resource *resource, struct pipe_resource *resource,
@ -222,7 +222,7 @@ boolean lp_scene_add_resource_reference(struct lp_scene *scene,
boolean writeable); boolean writeable);
unsigned lp_scene_is_resource_referenced(const struct lp_scene *scene, 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, boolean lp_scene_add_frag_shader_reference(struct lp_scene *scene,
struct lp_fragment_shader_variant *variant); 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. * Grow the block list if needed.
*/ */
static inline void * 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_list *list = &scene->data;
struct data_block *block = list->head; struct data_block *block = list->head;
@ -244,11 +244,11 @@ lp_scene_alloc( struct lp_scene *scene, unsigned size)
if (LP_DEBUG & DEBUG_MEM) if (LP_DEBUG & DEBUG_MEM)
debug_printf("alloc %u block %u/%u tot %u/%u\n", debug_printf("alloc %u block %u/%u tot %u/%u\n",
size, block->used, (unsigned)DATA_BLOCK_SIZE, size, block->used, (unsigned)DATA_BLOCK_SIZE,
scene->scene_size, LP_SCENE_MAX_SIZE); scene->scene_size, LP_SCENE_MAX_SIZE);
if (block->used + size > DATA_BLOCK_SIZE) { if (block->used + size > DATA_BLOCK_SIZE) {
block = lp_scene_new_data_block( scene ); block = lp_scene_new_data_block(scene);
if (!block) { if (!block) {
/* out of memory */ /* out of memory */
return NULL; return NULL;
@ -267,8 +267,8 @@ lp_scene_alloc( struct lp_scene *scene, unsigned size)
* As above, but with specific alignment. * As above, but with specific alignment.
*/ */
static inline void * static inline void *
lp_scene_alloc_aligned( struct lp_scene *scene, unsigned size, lp_scene_alloc_aligned(struct lp_scene *scene, unsigned size,
unsigned alignment ) unsigned alignment)
{ {
struct data_block_list *list = &scene->data; struct data_block_list *list = &scene->data;
struct data_block *block = list->head; 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) if (LP_DEBUG & DEBUG_MEM)
debug_printf("alloc %u block %u/%u tot %u/%u\n", debug_printf("alloc %u block %u/%u tot %u/%u\n",
size + alignment - 1, size + alignment - 1,
block->used, (unsigned)DATA_BLOCK_SIZE, block->used, (unsigned)DATA_BLOCK_SIZE,
scene->scene_size, LP_SCENE_MAX_SIZE); scene->scene_size, LP_SCENE_MAX_SIZE);
if (block->used + size + alignment - 1 > DATA_BLOCK_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) if (!block)
return NULL; 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]. /* Add a command to bin[x][y].
*/ */
static inline boolean static inline boolean
lp_scene_bin_command( struct lp_scene *scene, lp_scene_bin_command(struct lp_scene *scene,
unsigned x, unsigned y, unsigned x, unsigned y,
unsigned cmd, unsigned cmd,
union lp_rast_cmd_arg arg ) union lp_rast_cmd_arg arg)
{ {
struct cmd_bin *bin = lp_scene_get_bin(scene, x, y); struct cmd_bin *bin = lp_scene_get_bin(scene, x, y);
struct cmd_block *tail = bin->tail; struct cmd_block *tail = bin->tail;
@ -325,7 +325,7 @@ lp_scene_bin_command( struct lp_scene *scene,
assert(cmd < LP_RAST_OP_MAX); assert(cmd < LP_RAST_OP_MAX);
if (tail == NULL || tail->count == CMD_BLOCK_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) { if (!tail) {
return FALSE; return FALSE;
} }
@ -338,17 +338,17 @@ lp_scene_bin_command( struct lp_scene *scene,
tail->arg[i] = arg; tail->arg[i] = arg;
tail->count++; tail->count++;
} }
return TRUE; return TRUE;
} }
static inline boolean static inline boolean
lp_scene_bin_cmd_with_state( struct lp_scene *scene, lp_scene_bin_cmd_with_state(struct lp_scene *scene,
unsigned x, unsigned y, unsigned x, unsigned y,
const struct lp_rast_state *state, const struct lp_rast_state *state,
unsigned cmd, unsigned cmd,
union lp_rast_cmd_arg arg ) union lp_rast_cmd_arg arg)
{ {
struct cmd_bin *bin = lp_scene_get_bin(scene, x, y); 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; 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 FALSE;
return TRUE; return TRUE;
@ -370,14 +370,13 @@ lp_scene_bin_cmd_with_state( struct lp_scene *scene,
/* Add a command to all active bins. /* Add a command to all active bins.
*/ */
static inline boolean static inline boolean
lp_scene_bin_everywhere( struct lp_scene *scene, lp_scene_bin_everywhere(struct lp_scene *scene,
unsigned cmd, unsigned cmd,
const union lp_rast_cmd_arg arg ) const union lp_rast_cmd_arg arg)
{ {
unsigned i, j; for (unsigned i = 0; i < scene->tiles_x; i++) {
for (i = 0; i < scene->tiles_x; i++) { for (unsigned j = 0; j < scene->tiles_y; j++) {
for (j = 0; j < scene->tiles_y; j++) { if (!lp_scene_bin_command(scene, i, j, cmd, arg))
if (!lp_scene_bin_command( scene, i, j, cmd, arg ))
return FALSE; return FALSE;
} }
} }
@ -387,17 +386,17 @@ lp_scene_bin_everywhere( struct lp_scene *scene,
static inline unsigned 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; return scene->tiles_x * scene->tiles_y;
} }
void void
lp_scene_bin_iter_begin( struct lp_scene *scene ); lp_scene_bin_iter_begin(struct lp_scene *scene);
struct cmd_bin * 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); lp_scene_end_rasterization(struct lp_scene *scene);
#endif /* LP_BIN_H */ #endif /* LP_BIN_H */