mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 00:00:11 +01:00
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:
parent
c1ddfa15a4
commit
8432e0ee3d
1 changed files with 43 additions and 47 deletions
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue