summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorAxel Davy <[email protected]>2017-03-15 22:53:36 +0100
committerAxel Davy <[email protected]>2017-03-26 23:10:38 +0200
commitbdf035ea6f784b90a6cbfd4ce16f3188ab15b2d3 (patch)
treeb1ffb2fe8740498ea99cae07ba061b78a046012a /src/gallium
parentbd85bb51c717a1858157c73adcb689e3986b2134 (diff)
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" <[email protected]> Signed-off-by: Axel Davy <[email protected]> Tested-by: James Harvey <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/state_trackers/nine/resource9.c4
1 files 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);
}