mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 11:48:06 +02:00
anv/allocator: Rename anv_free_list2 to anv_free_list.
Now that we removed the original anv_free_list, we can now use its name. Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
parent
234c9d8a40
commit
54e21e145e
2 changed files with 30 additions and 31 deletions
|
|
@ -99,8 +99,7 @@
|
|||
|
||||
/* Allocations are always at least 64 byte aligned, so 1 is an invalid value.
|
||||
* We use it to indicate the free list is empty. */
|
||||
#define EMPTY 1
|
||||
#define EMPTY2 UINT32_MAX
|
||||
#define EMPTY UINT32_MAX
|
||||
|
||||
#define PAGE_SIZE 4096
|
||||
|
||||
|
|
@ -327,11 +326,11 @@ anv_state_table_add(struct anv_state_table *table, uint32_t *idx,
|
|||
}
|
||||
|
||||
void
|
||||
anv_free_list_push2(union anv_free_list2 *list,
|
||||
struct anv_state_table *table,
|
||||
uint32_t first, uint32_t count)
|
||||
anv_free_list_push(union anv_free_list *list,
|
||||
struct anv_state_table *table,
|
||||
uint32_t first, uint32_t count)
|
||||
{
|
||||
union anv_free_list2 current, old, new;
|
||||
union anv_free_list current, old, new;
|
||||
uint32_t last = first;
|
||||
|
||||
for (uint32_t i = 1; i < count; i++, last++)
|
||||
|
|
@ -348,13 +347,13 @@ anv_free_list_push2(union anv_free_list2 *list,
|
|||
}
|
||||
|
||||
struct anv_state *
|
||||
anv_free_list_pop2(union anv_free_list2 *list,
|
||||
struct anv_state_table *table)
|
||||
anv_free_list_pop(union anv_free_list *list,
|
||||
struct anv_state_table *table)
|
||||
{
|
||||
union anv_free_list2 current, new, old;
|
||||
union anv_free_list current, new, old;
|
||||
|
||||
current.u64 = list->u64;
|
||||
while (current.offset != EMPTY2) {
|
||||
while (current.offset != EMPTY) {
|
||||
__sync_synchronize();
|
||||
new.offset = table->map[current.offset].next;
|
||||
new.count = current.count + 1;
|
||||
|
|
@ -830,9 +829,9 @@ anv_state_pool_init(struct anv_state_pool *pool,
|
|||
|
||||
assert(util_is_power_of_two_or_zero(block_size));
|
||||
pool->block_size = block_size;
|
||||
pool->back_alloc_free_list = ANV_FREE_LIST2_EMPTY;
|
||||
pool->back_alloc_free_list = ANV_FREE_LIST_EMPTY;
|
||||
for (unsigned i = 0; i < ANV_STATE_BUCKETS; i++) {
|
||||
pool->buckets[i].free_list = ANV_FREE_LIST2_EMPTY;
|
||||
pool->buckets[i].free_list = ANV_FREE_LIST_EMPTY;
|
||||
pool->buckets[i].block.next = 0;
|
||||
pool->buckets[i].block.end = 0;
|
||||
}
|
||||
|
|
@ -929,8 +928,8 @@ anv_state_pool_return_blocks(struct anv_state_pool *pool,
|
|||
}
|
||||
|
||||
uint32_t block_bucket = anv_state_pool_get_bucket(block_size);
|
||||
anv_free_list_push2(&pool->buckets[block_bucket].free_list,
|
||||
&pool->table, st_idx, count);
|
||||
anv_free_list_push(&pool->buckets[block_bucket].free_list,
|
||||
&pool->table, st_idx, count);
|
||||
}
|
||||
|
||||
static struct anv_state
|
||||
|
|
@ -944,8 +943,8 @@ anv_state_pool_alloc_no_vg(struct anv_state_pool *pool,
|
|||
int32_t offset;
|
||||
|
||||
/* Try free list first. */
|
||||
state = anv_free_list_pop2(&pool->buckets[bucket].free_list,
|
||||
&pool->table);
|
||||
state = anv_free_list_pop(&pool->buckets[bucket].free_list,
|
||||
&pool->table);
|
||||
if (state) {
|
||||
assert(state->offset >= 0);
|
||||
goto done;
|
||||
|
|
@ -953,7 +952,7 @@ anv_state_pool_alloc_no_vg(struct anv_state_pool *pool,
|
|||
|
||||
/* Try to grab a chunk from some larger bucket and split it up */
|
||||
for (unsigned b = bucket + 1; b < ANV_STATE_BUCKETS; b++) {
|
||||
state = anv_free_list_pop2(&pool->buckets[b].free_list, &pool->table);
|
||||
state = anv_free_list_pop(&pool->buckets[b].free_list, &pool->table);
|
||||
if (state) {
|
||||
unsigned chunk_size = anv_state_pool_get_bucket_size(b);
|
||||
int32_t chunk_offset = state->offset;
|
||||
|
|
@ -1046,7 +1045,7 @@ anv_state_pool_alloc_back(struct anv_state_pool *pool)
|
|||
struct anv_state *state;
|
||||
uint32_t alloc_size = pool->block_size;
|
||||
|
||||
state = anv_free_list_pop2(&pool->back_alloc_free_list, &pool->table);
|
||||
state = anv_free_list_pop(&pool->back_alloc_free_list, &pool->table);
|
||||
if (state) {
|
||||
assert(state->offset < 0);
|
||||
goto done;
|
||||
|
|
@ -1077,11 +1076,11 @@ anv_state_pool_free_no_vg(struct anv_state_pool *pool, struct anv_state state)
|
|||
|
||||
if (state.offset < 0) {
|
||||
assert(state.alloc_size == pool->block_size);
|
||||
anv_free_list_push2(&pool->back_alloc_free_list,
|
||||
&pool->table, state.idx, 1);
|
||||
anv_free_list_push(&pool->back_alloc_free_list,
|
||||
&pool->table, state.idx, 1);
|
||||
} else {
|
||||
anv_free_list_push2(&pool->buckets[bucket].free_list,
|
||||
&pool->table, state.idx, 1);
|
||||
anv_free_list_push(&pool->buckets[bucket].free_list,
|
||||
&pool->table, state.idx, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -606,7 +606,7 @@ anv_bo_init(struct anv_bo *bo, uint32_t gem_handle, uint64_t size)
|
|||
* both the block pool and the state pools. Unfortunately, in order to
|
||||
* solve the ABA problem, we can't use a single uint32_t head.
|
||||
*/
|
||||
union anv_free_list2 {
|
||||
union anv_free_list {
|
||||
struct {
|
||||
uint32_t offset;
|
||||
|
||||
|
|
@ -616,7 +616,7 @@ union anv_free_list2 {
|
|||
uint64_t u64;
|
||||
};
|
||||
|
||||
#define ANV_FREE_LIST2_EMPTY ((union anv_free_list2) { { UINT32_MAX, 0 } })
|
||||
#define ANV_FREE_LIST_EMPTY ((union anv_free_list) { { UINT32_MAX, 0 } })
|
||||
|
||||
struct anv_block_state {
|
||||
union {
|
||||
|
|
@ -694,7 +694,7 @@ struct anv_state {
|
|||
#define ANV_STATE_NULL ((struct anv_state) { .alloc_size = 0 })
|
||||
|
||||
struct anv_fixed_size_state_pool {
|
||||
union anv_free_list2 free_list;
|
||||
union anv_free_list free_list;
|
||||
struct anv_block_state block;
|
||||
};
|
||||
|
||||
|
|
@ -726,7 +726,7 @@ struct anv_state_pool {
|
|||
uint32_t block_size;
|
||||
|
||||
/** Free list for "back" allocations */
|
||||
union anv_free_list2 back_alloc_free_list;
|
||||
union anv_free_list back_alloc_free_list;
|
||||
|
||||
struct anv_fixed_size_state_pool buckets[ANV_STATE_BUCKETS];
|
||||
};
|
||||
|
|
@ -787,11 +787,11 @@ VkResult anv_state_table_init(struct anv_state_table *table,
|
|||
void anv_state_table_finish(struct anv_state_table *table);
|
||||
VkResult anv_state_table_add(struct anv_state_table *table, uint32_t *idx,
|
||||
uint32_t count);
|
||||
void anv_free_list_push2(union anv_free_list2 *list,
|
||||
struct anv_state_table *table,
|
||||
uint32_t idx, uint32_t count);
|
||||
struct anv_state* anv_free_list_pop2(union anv_free_list2 *list,
|
||||
struct anv_state_table *table);
|
||||
void anv_free_list_push(union anv_free_list *list,
|
||||
struct anv_state_table *table,
|
||||
uint32_t idx, uint32_t count);
|
||||
struct anv_state* anv_free_list_pop(union anv_free_list *list,
|
||||
struct anv_state_table *table);
|
||||
|
||||
|
||||
static inline struct anv_state *
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue