svga: init svga_screen::swc_mutex with mtx_recursive
authorBrian Paul <brianp@vmware.com>
Tue, 23 May 2017 19:16:56 +0000 (13:16 -0600)
committerBrian Paul <brianp@vmware.com>
Wed, 24 May 2017 17:33:47 +0000 (11:33 -0600)
commit4a6fdeab05227457282fcef28c041fe0eb9369be
tree5f22ea94593494b96f1cc35a0f23a9e9c6c3152c
parent0c84c395f8db8749a181141219fd4eb5aa9305c8
svga: init svga_screen::swc_mutex with mtx_recursive

If the SVGA3D_BindGBSurface() call in svga_buffer_hw_storage_unmap()
fails, we'll flush and that might involve unmapping other buffers.
That leads to a recursive lock on svga_screen::swc_mutex and causes
a deadlock.  Fix this by initializing the mutex with mtx_recursive.

Note that this only happened on Linux, not Windows.  On Windows, the
mutex functions are implemented with Win32 critical sections which
support recursive locking.

Also add a comment about this.

Fixes VMware bug 1831549 (Unigine Tropics demo freeze on Linux).

Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Neha Bhende<bhenden@vmware.com>
src/gallium/drivers/svga/svga_resource_buffer.c
src/gallium/drivers/svga/svga_screen.c