diff options
author | Rohan Garg <[email protected]> | 2019-08-30 18:00:13 +0200 |
---|---|---|
committer | Boris Brezillon <[email protected]> | 2019-08-30 22:10:49 +0200 |
commit | b2ff2dfc2a8797260d7b87a5cc6188d891f713ff (patch) | |
tree | 82a932b7d39f61ab3ba8040d47983eb781883c75 /src/gallium/drivers/panfrost/pan_screen.c | |
parent | 6b0dc3d53011b384798bcdb5d5e804d7482a3247 (diff) |
panfrost: protect access to shared bo cache and transient pool
Both the BO cache and the transient pool are shared across
context's. Protect access to these with mutexes.
Signed-off-by: Rohan Garg <[email protected]>
Reviewed-by: Boris Brezillon <[email protected]>
Reviewed-by: Alyssa Rosenzweig <[email protected]>
Signed-off-by: Boris Brezillon <[email protected]>
Diffstat (limited to 'src/gallium/drivers/panfrost/pan_screen.c')
-rw-r--r-- | src/gallium/drivers/panfrost/pan_screen.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gallium/drivers/panfrost/pan_screen.c b/src/gallium/drivers/panfrost/pan_screen.c index 5c288f52bbd..bd826808fd6 100644 --- a/src/gallium/drivers/panfrost/pan_screen.c +++ b/src/gallium/drivers/panfrost/pan_screen.c @@ -542,6 +542,8 @@ panfrost_destroy_screen(struct pipe_screen *pscreen) { struct panfrost_screen *screen = pan_screen(pscreen); panfrost_bo_cache_evict_all(screen); + pthread_mutex_destroy(&screen->bo_cache_lock); + pthread_mutex_destroy(&screen->transient_lock); drmFreeVersion(screen->kernel_version); ralloc_free(screen); } @@ -639,8 +641,10 @@ panfrost_create_screen(int fd, struct renderonly *ro) return NULL; } + pthread_mutex_init(&screen->transient_lock, NULL); util_dynarray_init(&screen->transient_bo, screen); + pthread_mutex_init(&screen->bo_cache_lock, NULL); for (unsigned i = 0; i < ARRAY_SIZE(screen->bo_cache); ++i) list_inithead(&screen->bo_cache[i]); |