zink: move buffer hashlist clear to normal batch state reset

this is threaded now so it doesn't need to be in the submit thread

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37068>
This commit is contained in:
Mike Blumenkrantz 2025-02-13 12:23:25 -05:00 committed by Marge Bot
parent a184a4ca30
commit cdb9bec202
2 changed files with 2 additions and 16 deletions

View file

@ -81,6 +81,8 @@ reset_batch_state_internal(struct zink_screen *screen, struct zink_batch_state *
reset_obj(screen, bs, obj);
}
memset(&bs->buffer_indices_hashlist, -1, sizeof(bs->buffer_indices_hashlist));
/* queries must only be destroyed once they are inactive */
set_foreach_remove(&bs->active_queries, entry) {
struct zink_query *query = (void*)entry->key;
@ -618,11 +620,6 @@ post_submit(void *data, void *gdata, int thread_index)
/* throttle in case something crazy is happening */
zink_screen_timeline_wait(screen, bs->fence.batch_id - 2500, OS_TIMEOUT_INFINITE);
}
/* this resets the buffer hashlist for the state's next use */
if (bs->hashlist_min != UINT16_MAX)
/* only reset a min/max region */
memset(&bs->buffer_indices_hashlist[bs->hashlist_min], -1, (bs->hashlist_max - bs->hashlist_min + 1) * sizeof(int16_t));
bs->hashlist_min = bs->hashlist_max = UINT16_MAX;
}
typedef enum {
@ -944,13 +941,6 @@ zink_end_batch(struct zink_context *ctx)
}
}
ALWAYS_INLINE static void
batch_hashlist_update(struct zink_batch_state *bs, unsigned hash)
{
bs->hashlist_min = bs->hashlist_min == UINT16_MAX ? hash : MIN2(hash, bs->hashlist_min);
bs->hashlist_max = bs->hashlist_max == UINT16_MAX ? hash : MAX2(hash, bs->hashlist_max);
}
static int
batch_find_resource(struct zink_batch_state *bs, struct zink_resource_object *obj, struct zink_batch_obj_list *list)
{
@ -974,7 +964,6 @@ batch_find_resource(struct zink_batch_state *bs, struct zink_resource_object *ob
* will collide here: ^ and here: ^,
* meaning that we should get very few collisions in the end. */
bs->buffer_indices_hashlist[hash] = i & (BUFFER_HASHLIST_SIZE-1);
batch_hashlist_update(bs, hash);
return i;
}
}
@ -1045,7 +1034,6 @@ batch_reference_resource_move_internal(struct zink_batch_state *bs, struct zink_
list->objs[idx] = res->obj;
unsigned hash = bo->unique_id & (BUFFER_HASHLIST_SIZE-1);
bs->buffer_indices_hashlist[hash] = idx & 0x7fff;
batch_hashlist_update(bs, hash);
bs->last_added_obj = res->obj;
if (!(res->base.b.flags & PIPE_RESOURCE_FLAG_SPARSE)) {
bs->resource_size += res->obj->size;

View file

@ -637,8 +637,6 @@ struct zink_batch_state {
* batch_find_resource uses this hint to speed up buffers look up.
*/
int16_t buffer_indices_hashlist[BUFFER_HASHLIST_SIZE];
uint16_t hashlist_min;
uint16_t hashlist_max;
struct zink_batch_obj_list real_objs;
struct zink_batch_obj_list slab_objs;
struct zink_batch_obj_list sparse_objs;