mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-26 05:40:33 +01:00
zink: stop leaking descriptor sets
when migrating a recycled set here, the set was previously invalid and
in the recycled table, meaning it can be reused directly so long as
it's first invalidated
the previous code would instead pop a different set off the allocation array,
leaking this one
cc: mesa-stable
Acked-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15226>
(cherry picked from commit d63f3c31b7)
This commit is contained in:
parent
2caf7b788f
commit
d8e5624984
2 changed files with 11 additions and 3 deletions
|
|
@ -454,7 +454,7 @@
|
|||
"description": "zink: stop leaking descriptor sets",
|
||||
"nominated": true,
|
||||
"nomination_type": 0,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null
|
||||
},
|
||||
|
|
|
|||
|
|
@ -804,20 +804,28 @@ zink_descriptor_set_get(struct zink_context *ctx,
|
|||
|
||||
simple_mtx_lock(&pool->mtx);
|
||||
if (last_set && last_set->hash == hash && desc_state_equal(&last_set->key, &key)) {
|
||||
bool was_recycled = false;
|
||||
zds = last_set;
|
||||
*cache_hit = !zds->invalid;
|
||||
if (zds->recycled) {
|
||||
struct hash_entry *he = _mesa_hash_table_search_pre_hashed(pool->free_desc_sets, hash, &key);
|
||||
if (he)
|
||||
if (he) {
|
||||
was_recycled = true;
|
||||
_mesa_hash_table_remove(pool->free_desc_sets, he);
|
||||
}
|
||||
zds->recycled = false;
|
||||
}
|
||||
if (zds->invalid) {
|
||||
if (zink_batch_usage_exists(zds->batch_uses))
|
||||
punt_invalid_set(zds, NULL);
|
||||
else
|
||||
else {
|
||||
if (was_recycled) {
|
||||
descriptor_set_invalidate(zds);
|
||||
goto out;
|
||||
}
|
||||
/* this set is guaranteed to be in pool->alloc_desc_sets */
|
||||
goto skip_hash_tables;
|
||||
}
|
||||
zds = NULL;
|
||||
}
|
||||
if (zds)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue