llvmpipe: Only evict cache entries if a fence is available

Makes sure that no chaders are running when accessing sample_functions.

Fixes: 7ebf7f4 ("llvmpipe: Compile sample functioins on demand")
Reviewed-by: Roland Scheidegger <roland.scheidegger@broadcom.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29699>
This commit is contained in:
Konstantin Seurer 2024-06-12 16:13:27 +02:00 committed by Marge Bot
parent 5941bee017
commit 255f4bb290

View file

@ -1021,13 +1021,14 @@ llvmpipe_clear_sample_functions_cache(struct llvmpipe_context *ctx, struct pipe_
simple_mtx_unlock(&matrix->lock);
if (fence)
if (fence) {
ctx->pipe.screen->fence_finish(ctx->pipe.screen, NULL, *fence, OS_TIMEOUT_INFINITE);
/* All work is finished, it's safe to move cache entries into the table. */
hash_table_foreach_remove(matrix->cache, entry) {
struct sample_function_cache_key *key = (void *)entry->key;
key->texture_functions->sample_functions[key->sampler_index][key->sample_key] = entry->data;
free(key);
/* All work is finished, it's safe to move cache entries into the table. */
hash_table_foreach_remove(matrix->cache, entry) {
struct sample_function_cache_key *key = (void *)entry->key;
key->texture_functions->sample_functions[key->sampler_index][key->sample_key] = entry->data;
free(key);
}
}
}