Use of wined3d_mutex?

Max TenEyck Woodbury max at mtew.isa-geek.net
Wed Feb 26 13:13:31 CST 2014


I have been looking at the use of the wined3d_mutex_lock and
wined3d_mutex_unlock functions in the drawing code.  I strongly suspect
that it is being badly over-used.

In particular, user call back functions are being called in several
places with this mutex held.  If the callback starts another thread to
do something graphical where the thread needs the mutex, and then waits
for the thread to finish, both threads will hang until the mutex times
out.  There are also places where a function that takes out the mutex
is called with the mutex already held.

Switching to another terminal window and back again sometimes breaks
these deadlocks.  It used to be that I had to do this several times 
doing a 'make test', but it just takes a long time now.  (Yes, years ago 
I left the test running for several hours when I went out for a few 
hours and it was still hung when I got back.  That does not happen now,)

This shows up running Guild Wars 2.  I have a CPU monitor running while
I play and I can see the game chomping on both cores, except that the
game will sometimes hang for 30-45 seconds and then resume.

I am in the process of annotating the drawing routines use of the
mutex, and there is simply a lot of code to go through.  Could someone
with a good understanding of the drawing part of wine comment please.

In particular, are there places where the lock-like action of the
reference counts can be used in place of taking out the mutex?

max



More information about the wine-devel mailing list