From bdf035ea6f784b90a6cbfd4ce16f3188ab15b2d3 Mon Sep 17 00:00:00 2001 From: Axel Davy Date: Wed, 15 Mar 2017 22:53:36 +0100 Subject: [PATCH] st/nine: Use atomics for available_texture_mem Resource dtor can be executed in the worker thread. Use atomic to avoid threading safety issues. CC: "17.0" Signed-off-by: Axel Davy Tested-by: James Harvey --- src/gallium/state_trackers/nine/resource9.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/state_trackers/nine/resource9.c b/src/gallium/state_trackers/nine/resource9.c index c5837241747..852801624a9 100644 --- a/src/gallium/state_trackers/nine/resource9.c +++ b/src/gallium/state_trackers/nine/resource9.c @@ -79,7 +79,7 @@ NineResource9_ctor( struct NineResource9 *This, if (This->info.target != PIPE_BUFFER) { This->size = util_resource_size(&This->info); - This->base.device->available_texture_mem -= This->size; + p_atomic_add(&This->base.device->available_texture_mem, -This->size); if (This->base.device->available_texture_mem <= This->base.device->available_texture_limit) { return D3DERR_OUTOFVIDEOMEMORY; @@ -111,7 +111,7 @@ NineResource9_dtor( struct NineResource9 *This ) /* NOTE: size is 0, unless something has actually been allocated */ if (This->base.device) - This->base.device->available_texture_mem += This->size; + p_atomic_add(&This->base.device->available_texture_mem, This->size); NineUnknown_dtor(&This->base); } -- 2.30.2