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>
(cherry picked from commit 255f4bb290)
This commit is contained in:
Konstantin Seurer 2024-06-12 16:13:27 +02:00 committed by Eric Engestrom
parent 320f0197d1
commit 790aa9a2a5
2 changed files with 8 additions and 7 deletions

View file

@ -1114,7 +1114,7 @@
"description": "llvmpipe: Only evict cache entries if a fence is available",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "7ebf7f49a052c75f49496e31f7b3ccca716d30e5",
"notes": null

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);
}
}
}