Lines Matching defs:table
143 anv_state_table_expand_range(struct anv_state_table *table, uint32_t size);
146 anv_state_table_init(struct anv_state_table *table,
152 table->device = device;
158 table->fd = os_create_anonymous_file(BLOCK_POOL_MEMFD_SIZE, "state table");
159 if (table->fd == -1)
162 if (!u_vector_init(&table->cleanups, 8,
168 table->state.next = 0;
169 table->state.end = 0;
170 table->size = 0;
173 result = anv_state_table_expand_range(table, initial_size);
180 u_vector_finish(&table->cleanups);
182 close(table->fd);
188 anv_state_table_expand_range(struct anv_state_table *table, uint32_t size)
194 assert(size >= table->state.end);
198 return vk_error(table->device, VK_ERROR_OUT_OF_HOST_MEMORY);
200 cleanup = u_vector_add(&table->cleanups);
202 return vk_error(table->device, VK_ERROR_OUT_OF_HOST_MEMORY);
213 MAP_SHARED | MAP_POPULATE, table->fd, 0);
215 return vk_errorf(table->device, VK_ERROR_OUT_OF_HOST_MEMORY,
222 table->map = map;
223 table->size = size;
229 anv_state_table_grow(struct anv_state_table *table)
233 uint32_t used = align_u32(table->state.next * ANV_STATE_ENTRY_SIZE,
235 uint32_t old_size = table->size;
255 assert(size > table->size);
257 result = anv_state_table_expand_range(table, size);
264 anv_state_table_finish(struct anv_state_table *table)
268 u_vector_foreach(cleanup, &table->cleanups) {
273 u_vector_finish(&table->cleanups);
275 close(table->fd);
279 anv_state_table_add(struct anv_state_table *table, uint32_t *idx,
288 state.u64 = __sync_fetch_and_add(&table->state.u64, count);
290 assert(table->map);
291 struct anv_free_entry *entry = &table->map[state.next];
305 result = anv_state_table_grow(table);
308 new.end = table->size / ANV_STATE_ENTRY_SIZE;
311 old.u64 = __sync_lock_test_and_set(&table->state.u64, new.u64);
313 futex_wake(&table->state.end, INT_MAX);
315 futex_wait(&table->state.end, state.end, NULL);
323 struct anv_state_table *table,
330 table->map[last].next = last + 1;
335 table->map[last].next = current.offset;
344 struct anv_state_table *table)
351 new.offset = table->map[current.offset].next;
355 struct anv_free_entry *entry = &table->map[current.offset];
859 result = anv_state_table_init(&pool->table, device, 64);
882 anv_state_table_finish(&pool->table);
945 /** Helper to push a chunk into the state table.
947 * It creates 'count' entries into the state table and update their sizes,
962 UNUSED VkResult result = anv_state_table_add(&pool->table, &st_idx, count);
965 /* update states that were added back to the state table */
966 struct anv_state *state_i = anv_state_table_get(&pool->table,
977 &pool->table, st_idx, count);
1044 &pool->table);
1052 state = anv_free_list_pop(&pool->buckets[b].free_list, &pool->table);
1107 UNUSED VkResult result = anv_state_table_add(&pool->table, &idx, 1);
1110 state = anv_state_table_get(&pool->table, idx);
1144 state = anv_free_list_pop(&pool->back_alloc_free_list, &pool->table);
1154 UNUSED VkResult result = anv_state_table_add(&pool->table, &idx, 1);
1157 state = anv_state_table_get(&pool->table, idx);
1176 &pool->table, state.idx, 1);
1179 &pool->table, state.idx, 1);
1303 anv_free_list_push(&pool->reserved_blocks, &pool->pool->table, state.idx, 1);
1312 while ((state = anv_free_list_pop(&pool->reserved_blocks, &pool->pool->table))) {
1322 return *anv_free_list_pop(&pool->reserved_blocks, &pool->pool->table);
1329 anv_free_list_push(&pool->reserved_blocks, &pool->pool->table, state.idx, 1);