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>
}
if (svga_buffer_has_hw_storage(sbuf)) {
+ /* Note: we may wind up flushing here and unmapping other buffers
+ * which leads to recursively locking ss->swc_mutex.
+ */
svga_buffer_hw_storage_unmap(svga, sbuf);
}
}
(void) mtx_init(&svgascreen->tex_mutex, mtx_plain);
- (void) mtx_init(&svgascreen->swc_mutex, mtx_plain);
+ (void) mtx_init(&svgascreen->swc_mutex, mtx_recursive);
svga_screen_cache_init(svgascreen);