diff options
author | Axel Davy <[email protected]> | 2017-01-05 23:04:09 +0100 |
---|---|---|
committer | Axel Davy <[email protected]> | 2017-01-12 20:33:11 +0100 |
commit | 970556292b37fb9f7a64460a964e7a88503dcab6 (patch) | |
tree | e5d998d46f2ac87b49dc76638f578ef5fa173099 /src/gallium/state_trackers/nine/iunknown.h | |
parent | 5f4359ea0ed54b06d443e0ba040eb73406fc3e34 (diff) |
st/nine: Protect dtors with mutex
When the flag D3DCREATE_MULTITHREAD is set, a global mutex is used
to protect nine calls.
However for performance reasons, AddRef and Release didn't hold the mutex,
and instead used atomics.
Unfortunately at item release, the item can be destroyed, and that
destruction path should be protected by a mutex (at least for
some objects).
Without this patch, it is possible an app thread is in a dtor
while another thread is making gallium nine calls. It is possible
that two threads are using the same gallium pipe, which is forbiden.
The problem has been made worse with csmt, because it can cause hang,
since nine_csmt_process is not threadsafe.
Fixes Hitman hang, and possibly others.
Signed-off-by: Axel Davy <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/nine/iunknown.h')
-rw-r--r-- | src/gallium/state_trackers/nine/iunknown.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/nine/iunknown.h b/src/gallium/state_trackers/nine/iunknown.h index 4b9edaa355e..f9ce7b50c97 100644 --- a/src/gallium/state_trackers/nine/iunknown.h +++ b/src/gallium/state_trackers/nine/iunknown.h @@ -100,6 +100,9 @@ NineUnknown_AddRef( struct NineUnknown *This ); ULONG NINE_WINAPI NineUnknown_Release( struct NineUnknown *This ); +ULONG NINE_WINAPI +NineUnknown_ReleaseWithDtorLock( struct NineUnknown *This ); + HRESULT NINE_WINAPI NineUnknown_GetDevice( struct NineUnknown *This, IDirect3DDevice9 **ppDevice ); |