mirror of
https://gitee.com/openharmony/third_party_mesa3d
synced 2024-11-27 17:40:43 +00:00
anv/allocator: Compare to start_offset in state_pool_free_no_vg
Ind11e4738a8
, we started using a start_offset to allow us to allocate pools where the base address isn't at the start of the pool. This is useful for binding table pools which want to be relative to surface state base address (more or less), among other things. However, we had a bug where, if you have a negative offset, everything returned to the pool would end up being returned to the "back" of the pool. This isn't what we want for binding tables in the softpin world. This was causing us to never actually re-use any binding table blocks. How this passed CTS, I have no idea. Closes: #3100 Fixes:d11e4738a8
"anv/allocator: Add a start_offset to anv_state_pool" Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5395>
This commit is contained in:
parent
5d547858da
commit
0c37cbf807
@ -1025,7 +1025,7 @@ anv_state_pool_alloc_no_vg(struct anv_state_pool *pool,
|
||||
state = anv_free_list_pop(&pool->buckets[bucket].free_list,
|
||||
&pool->table);
|
||||
if (state) {
|
||||
assert(state->offset >= 0);
|
||||
assert(state->offset >= pool->start_offset);
|
||||
goto done;
|
||||
}
|
||||
|
||||
@ -1120,9 +1120,12 @@ anv_state_pool_alloc_back(struct anv_state_pool *pool)
|
||||
struct anv_state *state;
|
||||
uint32_t alloc_size = pool->block_size;
|
||||
|
||||
/* This function is only used with pools where start_offset == 0 */
|
||||
assert(pool->start_offset == 0);
|
||||
|
||||
state = anv_free_list_pop(&pool->back_alloc_free_list, &pool->table);
|
||||
if (state) {
|
||||
assert(state->offset < 0);
|
||||
assert(state->offset < pool->start_offset);
|
||||
goto done;
|
||||
}
|
||||
|
||||
@ -1149,7 +1152,7 @@ anv_state_pool_free_no_vg(struct anv_state_pool *pool, struct anv_state state)
|
||||
assert(util_is_power_of_two_or_zero(state.alloc_size));
|
||||
unsigned bucket = anv_state_pool_get_bucket(state.alloc_size);
|
||||
|
||||
if (state.offset < 0) {
|
||||
if (state.offset < pool->start_offset) {
|
||||
assert(state.alloc_size == pool->block_size);
|
||||
anv_free_list_push(&pool->back_alloc_free_list,
|
||||
&pool->table, state.idx, 1);
|
||||
|
Loading…
Reference in New Issue
Block a user