http://bugs.winehq.org/show_bug.cgi?id=22624
Summary: multithread app using GDI and directx may cause deadlock Product: Wine Version: 1.1.44 Platform: x86 OS/Version: Linux Status: UNCONFIRMED Severity: major Priority: P2 Component: directx-d3d AssignedTo: wine-bugs@winehq.org ReportedBy: drangon.mail@gmail.com
multithread app using GDI and directx may cause deadlock
suppose thread A calling StretchDIBits() while thread B calling DirectDrawCreateEx().
In thread A, StrentchDIBits() will first call GDI_GetObjPtr() in which enter critical section "gdi_section", then call the X11DRV function in which enter critical section "X11DRV_CritSection".
In thread B, DirectDrawCreateEx() will call test_pbo_functionality(), in this function, first call ENTER_GL() which enter critical section "X11DRV_CritSection", then call wglFinish() ( actuall function is X11DRV_wglFinish() ), then call ExtEscape(), then call get_dc_ptr(), in which enter critical section "gdi_section".
Then this two thread may hold one critical section and wait for another, then cause deadlock.
http://bugs.winehq.org/show_bug.cgi?id=22624
--- Comment #1 from drangon drangon.mail@gmail.com 2010-05-08 01:12:53 --- the following patch may temporally avoid the deadlock :
--- wine-1.1.44/dlls/wined3d/directx.c.origin 2010-05-08 11:23:04.431129862 +0800 +++ wine-1.1.44/dlls/wined3d/directx.c 2010-05-08 11:23:40.942207373 +0800 @@ -529,7 +529,9 @@ checkGLcall("Loading the PBO test texture");
GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0)); + LEAVE_GL(); wglFinish(); /* just to be sure */ + ENTER_GL();
memset(check, 0, sizeof(check)); glGetTexImage(GL_TEXTURE_2D, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, check);
http://bugs.winehq.org/show_bug.cgi?id=22624
Roderick Colenbrander thunderbird2k@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |thunderbird2k@gmail.com
--- Comment #2 from Roderick Colenbrander thunderbird2k@gmail.com 2010-05-08 16:02:12 --- We should not make any wgl calls between a ENTER_GL / LEAVE_GL block because of issues like the one you described (see bug 9810). Actually wglFlush/wglFinish are not official WGL calls (they don't go through our gdi32 code) but the same applies to them, so the patch you propose is correct.
http://bugs.winehq.org/show_bug.cgi?id=22624
Dmitry Timoshkov dmitry@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Severity|major |normal
http://bugs.winehq.org/show_bug.cgi?id=22624
Roderick Colenbrander thunderbird2k@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |FIXED
--- Comment #3 from Roderick Colenbrander thunderbird2k@gmail.com 2010-05-14 15:44:28 --- The issue you mentioned has been addressed by commit e91f4ae7761034a67cf909ce5cf569b9294d0031.
If you notice more such issues, feel free to post more bug reports.
Thanks, Roderick
http://bugs.winehq.org/show_bug.cgi?id=22624
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #4 from Alexandre Julliard julliard@winehq.org 2010-05-21 14:40:09 --- Closing bugs fixed in 1.2-rc1.