Module: wine Branch: master Commit: 53978351a07cd81b38ed37e08f7c213d95cb79f7 URL: https://source.winehq.org/git/wine.git/?a=commit;h=53978351a07cd81b38ed37e08...
Author: Jacek Caban jacek@codeweavers.com Date: Mon Apr 18 14:41:05 2022 +0200
winex11: Use pthread for D3DKMT locking.
Signed-off-by: Jacek Caban jacek@codeweavers.com Signed-off-by: Huw Davies huw@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/winex11.drv/x11drv_main.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-)
diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index 49aff9571bc..c286d2fd1f2 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -95,14 +95,7 @@ static int (*old_error_handler)( Display *, XErrorEvent * ); static BOOL use_xim = TRUE; static WCHAR input_style[20];
-static CRITICAL_SECTION x11drv_section; -static CRITICAL_SECTION_DEBUG critsect_debug = -{ - 0, 0, &x11drv_section, - { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList }, - 0, 0, { (DWORD_PTR)(__FILE__ ": x11drv_section") } -}; -static CRITICAL_SECTION x11drv_section = { &critsect_debug, -1, 0, 0, 0, 0 }; +static pthread_mutex_t d3dkmt_mutex = PTHREAD_MUTEX_INITIALIZER;
static CRITICAL_SECTION x11drv_error_section; static CRITICAL_SECTION_DEBUG x11drv_error_section_debug = @@ -863,7 +856,7 @@ NTSTATUS CDECL X11DRV_D3DKMTSetVidPnSourceOwner( const D3DKMT_SETVIDPNSOURCEOWNE
TRACE("(%p)\n", desc);
- EnterCriticalSection( &x11drv_section ); + pthread_mutex_lock( &d3dkmt_mutex );
/* Check parameters */ for (i = 0; i < desc->VidPnSourceCount; ++i) @@ -962,7 +955,7 @@ NTSTATUS CDECL X11DRV_D3DKMTSetVidPnSourceOwner( const D3DKMT_SETVIDPNSOURCEOWNE }
done: - LeaveCriticalSection( &x11drv_section ); + pthread_mutex_unlock( &d3dkmt_mutex ); return status; }
@@ -978,15 +971,15 @@ NTSTATUS CDECL X11DRV_D3DKMTCheckVidPnExclusiveOwnership( const D3DKMT_CHECKVIDP if (!desc || !desc->hAdapter) return STATUS_INVALID_PARAMETER;
- EnterCriticalSection( &x11drv_section ); + pthread_mutex_lock( &d3dkmt_mutex ); LIST_FOR_EACH_ENTRY( source, &d3dkmt_vidpn_sources, struct d3dkmt_vidpn_source, entry ) { if (source->id == desc->VidPnSourceId && source->type == D3DKMT_VIDPNSOURCEOWNER_EXCLUSIVE) { - LeaveCriticalSection( &x11drv_section ); + pthread_mutex_unlock( &d3dkmt_mutex ); return STATUS_GRAPHICS_PRESENT_OCCLUDED; } } - LeaveCriticalSection( &x11drv_section ); + pthread_mutex_unlock( &d3dkmt_mutex ); return STATUS_SUCCESS; }