winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
February 2022
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
1495 discussions
Start a n
N
ew thread
Jacek Caban : win32u: Move NtUserSetWinEventHook implementation from user32.
by Alexandre Julliard
16 Feb '22
16 Feb '22
Module: wine Branch: master Commit: d76b38ffb640885c6d798d8f3a2558907694dcf2 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=d76b38ffb640885c6d798d8f…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Wed Feb 16 12:29:56 2022 +0100 win32u: Move NtUserSetWinEventHook implementation from user32. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/user32/hook.c | 54 +++++++----------------------------------------- dlls/win32u/hook.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++ dlls/win32u/syscall.c | 1 + dlls/win32u/win32u.spec | 2 +- dlls/wow64win/syscall.h | 1 + dlls/wow64win/user.c | 19 +++++++++++++++++ include/ntuser.h | 3 +++ 7 files changed, 87 insertions(+), 48 deletions(-) diff --git a/dlls/user32/hook.c b/dlls/user32/hook.c index 26bde944175..edcc3143ab4 100644 --- a/dlls/user32/hook.c +++ b/dlls/user32/hook.c @@ -709,61 +709,21 @@ HWINEVENTHOOK WINAPI SetWinEventHook(DWORD event_min, DWORD event_max, HMODULE inst, WINEVENTPROC proc, DWORD pid, DWORD tid, DWORD flags) { - HWINEVENTHOOK handle = 0; WCHAR module[MAX_PATH]; - DWORD len; + UNICODE_STRING str; + DWORD len = 0; TRACE("%d,%d,%p,%p,%08x,%04x,%08x\n", event_min, event_max, inst, proc, pid, tid, flags); - if (inst) - { - if (!(len = GetModuleFileNameW(inst, module, MAX_PATH)) || len >= MAX_PATH) - inst = 0; - } - - if ((flags & WINEVENT_INCONTEXT) && !inst) - { - SetLastError(ERROR_HOOK_NEEDS_HMOD); - return 0; - } - - if (event_min > event_max) + if (inst && (!(len = GetModuleFileNameW( inst, module, MAX_PATH )) || len >= MAX_PATH)) { - SetLastError(ERROR_INVALID_HOOK_FILTER); - return 0; - } - - /* FIXME: what if the tid or pid belongs to another process? */ - if (tid) /* thread-local hook */ inst = 0; - - SERVER_START_REQ( set_hook ) - { - req->id = WH_WINEVENT; - req->pid = pid; - req->tid = tid; - req->event_min = event_min; - req->event_max = event_max; - req->flags = flags; - req->unicode = 1; - if (inst) /* make proc relative to the module base */ - { - req->proc = wine_server_client_ptr( (void *)((char *)proc - (char *)inst) ); - wine_server_add_data( req, module, lstrlenW(module) * sizeof(WCHAR) ); - } - else req->proc = wine_server_client_ptr( proc ); - - if (!wine_server_call_err( req )) - { - handle = wine_server_ptr_handle( reply->handle ); - get_user_thread_info()->active_hooks = reply->active_hooks; - } + len = 0; } - SERVER_END_REQ; - - TRACE("-> %p\n", handle); - return handle; + str.Buffer = module; + str.Length = str.MaximumLength = len * sizeof(WCHAR); + return NtUserSetWinEventHook( event_min, event_max, inst, &str, proc, pid, tid, flags ); } static inline BOOL find_first_hook(DWORD id, DWORD event, HWND hwnd, LONG object_id, diff --git a/dlls/win32u/hook.c b/dlls/win32u/hook.c index 02520a025f8..46f6efe1b1b 100644 --- a/dlls/win32u/hook.c +++ b/dlls/win32u/hook.c @@ -26,10 +26,65 @@ #include "win32u_private.h" #include "ntuser_private.h" #include "wine/server.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(hook); #define WH_WINEVENT (WH_MAXHOOK+1) +/*********************************************************************** + * NtUserSetWinEventHook (win32u.@) + */ +HWINEVENTHOOK WINAPI NtUserSetWinEventHook( DWORD event_min, DWORD event_max, HMODULE inst, + UNICODE_STRING *module, WINEVENTPROC proc, + DWORD pid, DWORD tid, DWORD flags ) +{ + HWINEVENTHOOK handle = 0; + + if ((flags & WINEVENT_INCONTEXT) && !inst) + { + SetLastError(ERROR_HOOK_NEEDS_HMOD); + return 0; + } + + if (event_min > event_max) + { + SetLastError(ERROR_INVALID_HOOK_FILTER); + return 0; + } + + /* FIXME: what if the tid or pid belongs to another process? */ + if (tid) inst = 0; /* thread-local hook */ + + SERVER_START_REQ( set_hook ) + { + req->id = WH_WINEVENT; + req->pid = pid; + req->tid = tid; + req->event_min = event_min; + req->event_max = event_max; + req->flags = flags; + req->unicode = 1; + if (inst) /* make proc relative to the module base */ + { + req->proc = wine_server_client_ptr( (void *)((char *)proc - (char *)inst) ); + wine_server_add_data( req, module->Buffer, module->Length ); + } + else req->proc = wine_server_client_ptr( proc ); + + if (!wine_server_call_err( req )) + { + handle = wine_server_ptr_handle( reply->handle ); + get_user_thread_info()->active_hooks = reply->active_hooks; + } + } + SERVER_END_REQ; + + TRACE("-> %p\n", handle); + return handle; +} + /*********************************************************************** * NtUserUnhookWinEvent (win32u.@) */ diff --git a/dlls/win32u/syscall.c b/dlls/win32u/syscall.c index d698dc31743..e2b88dcc62e 100644 --- a/dlls/win32u/syscall.c +++ b/dlls/win32u/syscall.c @@ -139,6 +139,7 @@ static void * const syscalls[] = NtUserSetProcessWindowStation, NtUserSetProp, NtUserSetThreadDesktop, + NtUserSetWinEventHook, NtUserUnhookWinEvent, }; diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec index 42bfc1bb4c4..7de0af5d959 100644 --- a/dlls/win32u/win32u.spec +++ b/dlls/win32u/win32u.spec @@ -1237,7 +1237,7 @@ @ stub NtUserSetThreadLayoutHandles @ stub NtUserSetThreadState @ stub NtUserSetTimer -@ stub NtUserSetWinEventHook +@ stdcall -syscall NtUserSetWinEventHook(long long long ptr ptr long long long) @ stub NtUserSetWindowArrangement @ stub NtUserSetWindowBand @ stub NtUserSetWindowCompositionAttribute diff --git a/dlls/wow64win/syscall.h b/dlls/wow64win/syscall.h index 3b852147dc1..a0292bb881f 100644 --- a/dlls/wow64win/syscall.h +++ b/dlls/wow64win/syscall.h @@ -126,6 +126,7 @@ SYSCALL_ENTRY( NtUserSetProcessWindowStation ) \ SYSCALL_ENTRY( NtUserSetProp ) \ SYSCALL_ENTRY( NtUserSetThreadDesktop ) \ + SYSCALL_ENTRY( NtUserSetWinEventHook ) \ SYSCALL_ENTRY( NtUserUnhookWinEvent ) #endif /* __WOW64WIN_SYSCALL_H */ diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c index c55af5233a8..b610b510ebc 100644 --- a/dlls/wow64win/user.c +++ b/dlls/wow64win/user.c @@ -356,6 +356,25 @@ NTSTATUS WINAPI wow64_NtUserGetDoubleClickTime( UINT *args ) return NtUserGetDoubleClickTime(); } +NTSTATUS WINAPI wow64_NtUserSetWinEventHook( UINT *args ) +{ + DWORD event_min = get_ulong( &args ); + DWORD event_max = get_ulong( &args ); + HMODULE inst = get_handle( &args ); + UNICODE_STRING32 *module32 = get_ptr( &args ); + WINEVENTPROC proc = get_ptr(&args ); + DWORD pid = get_ulong( &args ); + DWORD tid = get_ulong( &args ); + DWORD flags = get_ulong( &args ); + UNICODE_STRING module; + HWINEVENTHOOK ret; + + ret = NtUserSetWinEventHook( event_min, event_max, inst, + unicode_str_32to64( &module, module32 ), + proc, pid, tid, flags ); + return HandleToUlong( ret ); +} + NTSTATUS WINAPI wow64_NtUserUnhookWinEvent( UINT *args ) { HWINEVENTHOOK handle = get_handle( &args ); diff --git a/include/ntuser.h b/include/ntuser.h index 499c9bf809e..65e9d20d90a 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -179,6 +179,9 @@ BOOL WINAPI NtUserSetProcessWindowStation( HWINSTA handle ); BOOL WINAPI NtUserSetProp( HWND hwnd, const WCHAR *str, HANDLE handle ); BOOL WINAPI NtUserSetSysColors( INT count, const INT *colors, const COLORREF *values ); BOOL WINAPI NtUserSetThreadDesktop( HDESK handle ); +HWINEVENTHOOK WINAPI NtUserSetWinEventHook( DWORD event_min, DWORD event_max, HMODULE inst, + UNICODE_STRING *module, WINEVENTPROC proc, + DWORD pid, DWORD tid, DWORD flags ); INT WINAPI NtUserShowCursor( BOOL show ); BOOL WINAPI NtUserSystemParametersInfo( UINT action, UINT val, void *ptr, UINT winini ); BOOL WINAPI NtUserSystemParametersInfoForDpi( UINT action, UINT val, PVOID ptr, UINT winini, UINT dpi );
1
0
0
0
Jacek Caban : win32u: Move NtUserUnhookWinEvent implementation from user32.
by Alexandre Julliard
16 Feb '22
16 Feb '22
Module: wine Branch: master Commit: 0e37c674881cf43c0a87bbfe3d3cf5925aed730d URL:
https://source.winehq.org/git/wine.git/?a=commit;h=0e37c674881cf43c0a87bbfe…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Wed Feb 16 12:29:43 2022 +0100 win32u: Move NtUserUnhookWinEvent implementation from user32. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/user32/hook.c | 28 ---------------------------- dlls/user32/user32.spec | 2 +- dlls/win32u/Makefile.in | 1 + dlls/win32u/hook.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ dlls/win32u/syscall.c | 1 + dlls/win32u/win32u.spec | 2 +- dlls/wow64win/syscall.h | 3 ++- dlls/wow64win/user.c | 7 +++++++ include/ntuser.h | 1 + 9 files changed, 63 insertions(+), 31 deletions(-) diff --git a/dlls/user32/hook.c b/dlls/user32/hook.c index 94a31239c24..26bde944175 100644 --- a/dlls/user32/hook.c +++ b/dlls/user32/hook.c @@ -766,34 +766,6 @@ HWINEVENTHOOK WINAPI SetWinEventHook(DWORD event_min, DWORD event_max, return handle; } - -/*********************************************************************** - * UnhookWinEvent [USER32.@] - * - * Remove an event hook for a set of events. - * - * PARAMS - * hEventHook [I] Event hook to remove - * - * RETURNS - * Success: TRUE. The event hook has been removed. - * Failure: FALSE, if hEventHook is invalid. - */ -BOOL WINAPI UnhookWinEvent(HWINEVENTHOOK hEventHook) -{ - BOOL ret; - - SERVER_START_REQ( remove_hook ) - { - req->handle = wine_server_user_handle( hEventHook ); - req->id = WH_WINEVENT; - ret = !wine_server_call_err( req ); - if (ret) get_user_thread_info()->active_hooks = reply->active_hooks; - } - SERVER_END_REQ; - return ret; -} - static inline BOOL find_first_hook(DWORD id, DWORD event, HWND hwnd, LONG object_id, LONG child_id, struct hook_info *info) { diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec index aec29dfa4cf..112b79049ce 100644 --- a/dlls/user32/user32.spec +++ b/dlls/user32/user32.spec @@ -770,7 +770,7 @@ @ stdcall TranslateMDISysAccel(long ptr) @ stdcall TranslateMessage(ptr) # @ stub TranslateMessageEx -@ stdcall UnhookWinEvent(long) +@ stdcall UnhookWinEvent(long) NtUserUnhookWinEvent @ stdcall UnhookWindowsHook(long ptr) @ stdcall UnhookWindowsHookEx(long) @ stdcall UnionRect(ptr ptr ptr) diff --git a/dlls/win32u/Makefile.in b/dlls/win32u/Makefile.in index 76fd4396c7d..68849a802ec 100644 --- a/dlls/win32u/Makefile.in +++ b/dlls/win32u/Makefile.in @@ -28,6 +28,7 @@ C_SRCS = \ font.c \ freetype.c \ gdiobj.c \ + hook.c \ input.c \ main.c \ mapping.c \ diff --git a/dlls/win32u/hook.c b/dlls/win32u/hook.c new file mode 100644 index 00000000000..02520a025f8 --- /dev/null +++ b/dlls/win32u/hook.c @@ -0,0 +1,49 @@ +/* + * Windows hook functions + * + * Copyright 2002 Alexandre Julliard + * Copyright 2005 Dmitry Timoshkov + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#if 0 +#pragma makedep unix +#endif + +#include "win32u_private.h" +#include "ntuser_private.h" +#include "wine/server.h" + +#define WH_WINEVENT (WH_MAXHOOK+1) + + +/*********************************************************************** + * NtUserUnhookWinEvent (win32u.@) + */ +BOOL WINAPI NtUserUnhookWinEvent( HWINEVENTHOOK handle ) +{ + BOOL ret; + + SERVER_START_REQ( remove_hook ) + { + req->handle = wine_server_user_handle( handle ); + req->id = WH_WINEVENT; + ret = !wine_server_call_err( req ); + if (ret) get_user_thread_info()->active_hooks = reply->active_hooks; + } + SERVER_END_REQ; + return ret; +} diff --git a/dlls/win32u/syscall.c b/dlls/win32u/syscall.c index 69d0e1ff66f..d698dc31743 100644 --- a/dlls/win32u/syscall.c +++ b/dlls/win32u/syscall.c @@ -139,6 +139,7 @@ static void * const syscalls[] = NtUserSetProcessWindowStation, NtUserSetProp, NtUserSetThreadDesktop, + NtUserUnhookWinEvent, }; static BYTE arguments[ARRAY_SIZE(syscalls)]; diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec index abdb11cc266..42bfc1bb4c4 100644 --- a/dlls/win32u/win32u.spec +++ b/dlls/win32u/win32u.spec @@ -1284,7 +1284,7 @@ @ stub NtUserTranslateAccelerator @ stub NtUserTranslateMessage @ stub NtUserUndelegateInput -@ stub NtUserUnhookWinEvent +@ stdcall -syscall NtUserUnhookWinEvent(long) @ stub NtUserUnhookWindowsHookEx @ stub NtUserUnloadKeyboardLayout @ stub NtUserUnlockWindowStation diff --git a/dlls/wow64win/syscall.h b/dlls/wow64win/syscall.h index 54919f7b3fd..3b852147dc1 100644 --- a/dlls/wow64win/syscall.h +++ b/dlls/wow64win/syscall.h @@ -125,6 +125,7 @@ SYSCALL_ENTRY( NtUserSetProcessDpiAwarenessContext ) \ SYSCALL_ENTRY( NtUserSetProcessWindowStation ) \ SYSCALL_ENTRY( NtUserSetProp ) \ - SYSCALL_ENTRY( NtUserSetThreadDesktop ) + SYSCALL_ENTRY( NtUserSetThreadDesktop ) \ + SYSCALL_ENTRY( NtUserUnhookWinEvent ) #endif /* __WOW64WIN_SYSCALL_H */ diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c index 02623d089a4..c55af5233a8 100644 --- a/dlls/wow64win/user.c +++ b/dlls/wow64win/user.c @@ -355,3 +355,10 @@ NTSTATUS WINAPI wow64_NtUserGetDoubleClickTime( UINT *args ) { return NtUserGetDoubleClickTime(); } + +NTSTATUS WINAPI wow64_NtUserUnhookWinEvent( UINT *args ) +{ + HWINEVENTHOOK handle = get_handle( &args ); + + return NtUserUnhookWinEvent( handle ); +} diff --git a/include/ntuser.h b/include/ntuser.h index 9ed3385e17e..499c9bf809e 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -184,6 +184,7 @@ BOOL WINAPI NtUserSystemParametersInfo( UINT action, UINT val, void *ptr, UIN BOOL WINAPI NtUserSystemParametersInfoForDpi( UINT action, UINT val, PVOID ptr, UINT winini, UINT dpi ); INT WINAPI NtUserToUnicodeEx( UINT virt, UINT scan, const BYTE *state, WCHAR *str, int size, UINT flags, HKL layout ); +BOOL WINAPI NtUserUnhookWinEvent( HWINEVENTHOOK hEventHook ); BOOL WINAPI NtUserUnregisterHotKey( HWND hwnd, INT id ); WORD WINAPI NtUserVkKeyScanEx( WCHAR chr, HKL layout );
1
0
0
0
Nikolay Sivov : mfplay: Shutdown sources when media items are released.
by Alexandre Julliard
16 Feb '22
16 Feb '22
Module: wine Branch: master Commit: 3e4f4c020ac1942876c4cb696440bc21964dd50f URL:
https://source.winehq.org/git/wine.git/?a=commit;h=3e4f4c020ac1942876c4cb69…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Wed Feb 16 11:53:53 2022 +0300 mfplay: Shutdown sources when media items are released. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mfplay/player.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/dlls/mfplay/player.c b/dlls/mfplay/player.c index d36bde8fec7..7d9a4da8649 100644 --- a/dlls/mfplay/player.c +++ b/dlls/mfplay/player.c @@ -61,6 +61,11 @@ static inline const char *debugstr_normalized_rect(const MFVideoNormalizedRect * struct media_player; +enum media_item_flags +{ + MEDIA_ITEM_SOURCE_NEEDS_SHUTDOWN = 0x1, +}; + struct media_item { IMFPMediaItem IMFPMediaItem_iface; @@ -73,6 +78,7 @@ struct media_item IUnknown *object; LONGLONG start_position; LONGLONG stop_position; + unsigned int flags; }; struct media_player @@ -359,7 +365,11 @@ static ULONG WINAPI media_item_Release(IMFPMediaItem *iface) if (item->player) IMFPMediaPlayer_Release(&item->player->IMFPMediaPlayer_iface); if (item->source) + { + if (item->flags & MEDIA_ITEM_SOURCE_NEEDS_SHUTDOWN) + IMFMediaSource_Shutdown(item->source); IMFMediaSource_Release(item->source); + } if (item->pd) IMFPresentationDescriptor_Release(item->pd); if (item->object) @@ -1189,6 +1199,7 @@ static HRESULT media_player_create_item_from_url(struct media_player *player, IMFPMediaItem_Release(&item->IMFPMediaItem_iface); return E_OUTOFMEMORY; } + item->flags |= MEDIA_ITEM_SOURCE_NEEDS_SHUTDOWN; if (sync) { @@ -1244,11 +1255,11 @@ static HRESULT WINAPI media_player_CreateMediaItemFromURL(IMFPMediaPlayer *iface static HRESULT media_player_create_item_from_object(struct media_player *player, IUnknown *object, BOOL sync, DWORD_PTR user_data, IMFPMediaItem **ret) { + IMFMediaSource *source = NULL; + IMFByteStream *stream = NULL; struct media_item *item; MF_OBJECT_TYPE obj_type; HRESULT hr; - IMFByteStream *stream = NULL; - IMFMediaSource *source = NULL; *ret = NULL; @@ -1268,6 +1279,9 @@ static HRESULT media_player_create_item_from_object(struct media_player *player, return E_UNEXPECTED; } + if (source) + item->flags |= MEDIA_ITEM_SOURCE_NEEDS_SHUTDOWN; + if (sync) { if (stream)
1
0
0
0
Nikolay Sivov : winegstreamer: Maintain playback rate value for the media source.
by Alexandre Julliard
16 Feb '22
16 Feb '22
Module: wine Branch: master Commit: decfb2b2ab3fba596afa4be56109b83ade93ef2f URL:
https://source.winehq.org/git/wine.git/?a=commit;h=decfb2b2ab3fba596afa4be5…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Wed Feb 16 11:53:32 2022 +0300 winegstreamer: Maintain playback rate value for the media source. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winegstreamer/media_source.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c index 9a77cf72c07..bccbf888a4a 100644 --- a/dlls/winegstreamer/media_source.c +++ b/dlls/winegstreamer/media_source.c @@ -105,6 +105,7 @@ struct media_source SOURCE_RUNNING, SOURCE_SHUTDOWN, } state; + float rate; HANDLE read_thread; bool read_thread_shutdown; @@ -1110,6 +1111,7 @@ static ULONG WINAPI media_source_rate_control_Release(IMFRateControl *iface) static HRESULT WINAPI media_source_rate_control_SetRate(IMFRateControl *iface, BOOL thin, float rate) { struct media_source *source = impl_from_IMFRateControl(iface); + HRESULT hr; FIXME("%p, %d, %f.\n", iface, thin, rate); @@ -1119,20 +1121,24 @@ static HRESULT WINAPI media_source_rate_control_SetRate(IMFRateControl *iface, B if (thin) return MF_E_THINNING_UNSUPPORTED; - if (rate != 1.0f) - return MF_E_UNSUPPORTED_RATE; + if (FAILED(hr = IMFRateSupport_IsRateSupported(&source->IMFRateSupport_iface, thin, rate, NULL))) + return hr; + + source->rate = rate; return IMFMediaEventQueue_QueueEventParamVar(source->event_queue, MESourceRateChanged, &GUID_NULL, S_OK, NULL); } static HRESULT WINAPI media_source_rate_control_GetRate(IMFRateControl *iface, BOOL *thin, float *rate) { + struct media_source *source = impl_from_IMFRateControl(iface); + TRACE("%p, %p, %p.\n", iface, thin, rate); if (thin) *thin = FALSE; - *rate = 1.0f; + *rate = source->rate; return S_OK; } @@ -1427,6 +1433,7 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, struct media_ object->ref = 1; object->byte_stream = bytestream; IMFByteStream_AddRef(bytestream); + object->rate = 1.0f; if (FAILED(hr = MFCreateEventQueue(&object->event_queue))) goto fail;
1
0
0
0
Nikolay Sivov : mf/evr: Fix rate limits methods.
by Alexandre Julliard
16 Feb '22
16 Feb '22
Module: wine Branch: master Commit: ae9997380e8d8f89cb6609d744b0895be20b6845 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=ae9997380e8d8f89cb6609d7…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Wed Feb 16 11:53:31 2022 +0300 mf/evr: Fix rate limits methods. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mf/evr.c | 33 ++++++++++++++++++++++++++++----- dlls/mf/tests/mf.c | 21 +++++++++++++++++---- 2 files changed, 45 insertions(+), 9 deletions(-) diff --git a/dlls/mf/evr.c b/dlls/mf/evr.c index 1d7c792fb1a..b035b8b601b 100644 --- a/dlls/mf/evr.c +++ b/dlls/mf/evr.c @@ -16,6 +16,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include <float.h> + #define COBJMACROS #include "mf_private.h" @@ -2730,25 +2732,46 @@ static HRESULT WINAPI video_renderer_rate_support_GetSlowestRate(IMFRateSupport BOOL thin, float *rate) { struct video_renderer *renderer = impl_from_IMFRateSupport(iface); + HRESULT hr = S_OK; TRACE("%p, %d, %d, %p.\n", iface, direction, thin, rate); + EnterCriticalSection(&renderer->cs); if (renderer->flags & EVR_SHUT_DOWN) - return MF_E_SHUTDOWN; - - *rate = 0.0f; + hr = MF_E_SHUTDOWN; + else if (!rate) + hr = E_POINTER; + else + { + *rate = 0.0f; + } + LeaveCriticalSection(&renderer->cs); - return S_OK; + return hr; } static HRESULT WINAPI video_renderer_rate_support_GetFastestRate(IMFRateSupport *iface, MFRATE_DIRECTION direction, BOOL thin, float *rate) { struct video_renderer *renderer = impl_from_IMFRateSupport(iface); + HRESULT hr = S_OK; TRACE("%p, %d, %d, %p.\n", iface, direction, thin, rate); - return renderer->flags & EVR_SHUT_DOWN ? MF_E_SHUTDOWN : MF_E_INVALIDREQUEST; + EnterCriticalSection(&renderer->cs); + if (renderer->flags & EVR_SHUT_DOWN) + hr = MF_E_SHUTDOWN; + else if (!rate) + hr = E_POINTER; + else if (video_renderer_is_main_stream_configured(renderer)) + { + *rate = direction == MFRATE_FORWARD ? FLT_MAX : -FLT_MAX; + } + else + hr = MF_E_INVALIDREQUEST; + LeaveCriticalSection(&renderer->cs); + + return hr; } static HRESULT WINAPI video_renderer_rate_support_IsRateSupported(IMFRateSupport *iface, BOOL thin, float rate, diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index 58c7cbbadd4..b3f50665e79 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -4612,6 +4612,9 @@ todo_wine { hr = IMFRateSupport_GetFastestRate(rs, MFRATE_REVERSE, TRUE, &rate); ok(hr == MF_E_INVALIDREQUEST, "Unexpected hr %#x.\n", hr); + hr = IMFRateSupport_GetFastestRate(rs, MFRATE_REVERSE, TRUE, NULL); + ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr); + for (i = 0; i < ARRAY_SIZE(supported_rates); ++i) { rate = supported_rates[i] + 1.0f; @@ -4661,16 +4664,20 @@ todo_wine { rate = 0.0f; hr = IMFRateSupport_GetFastestRate(rs, MFRATE_FORWARD, TRUE, &rate); -todo_wine { ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(rate == FLT_MAX, "Unexpected rate %f.\n", rate); -} + rate = 0.0f; hr = IMFRateSupport_GetFastestRate(rs, MFRATE_REVERSE, TRUE, &rate); -todo_wine { ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(rate == -FLT_MAX, "Unexpected rate %f.\n", rate); -} + + hr = IMFRateSupport_GetFastestRate(rs, MFRATE_REVERSE, TRUE, NULL); + ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr); + + hr = IMFRateSupport_GetSlowestRate(rs, MFRATE_REVERSE, TRUE, NULL); + ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr); + for (i = 0; i < ARRAY_SIZE(supported_rates); ++i) { rate = supported_rates[i] + 1.0f; @@ -4709,6 +4716,12 @@ todo_wine { hr = IMFRateSupport_GetFastestRate(rs, MFRATE_FORWARD, FALSE, &rate); ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); + hr = IMFRateSupport_GetSlowestRate(rs, MFRATE_FORWARD, FALSE, NULL); + ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); + + hr = IMFRateSupport_GetFastestRate(rs, MFRATE_FORWARD, FALSE, NULL); + ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); + hr = IMFRateSupport_IsRateSupported(rs, TRUE, 1.0f, &rate); ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr);
1
0
0
0
Nikolay Sivov : mf/evr: Implement IsRateSupported().
by Alexandre Julliard
16 Feb '22
16 Feb '22
Module: wine Branch: master Commit: 1d2e6e6a6382405765bf2391d1239c7f30816c4b URL:
https://source.winehq.org/git/wine.git/?a=commit;h=1d2e6e6a6382405765bf2391…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Wed Feb 16 11:53:30 2022 +0300 mf/evr: Implement IsRateSupported(). Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mf/evr.c | 33 ++++++++++++++++++-- dlls/mf/tests/mf.c | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 121 insertions(+), 4 deletions(-) diff --git a/dlls/mf/evr.c b/dlls/mf/evr.c index eae8338df7a..1d7c792fb1a 100644 --- a/dlls/mf/evr.c +++ b/dlls/mf/evr.c @@ -2715,6 +2715,17 @@ static ULONG WINAPI video_renderer_rate_support_Release(IMFRateSupport *iface) return IMFMediaSink_Release(&renderer->IMFMediaSink_iface); } +static BOOL video_renderer_is_main_stream_configured(const struct video_renderer *renderer) +{ + IMFMediaType *media_type; + HRESULT hr; + + if (SUCCEEDED(hr = IMFTransform_GetInputCurrentType(renderer->mixer, 0, &media_type))) + IMFMediaType_Release(media_type); + + return SUCCEEDED(hr); +} + static HRESULT WINAPI video_renderer_rate_support_GetSlowestRate(IMFRateSupport *iface, MFRATE_DIRECTION direction, BOOL thin, float *rate) { @@ -2741,11 +2752,27 @@ static HRESULT WINAPI video_renderer_rate_support_GetFastestRate(IMFRateSupport } static HRESULT WINAPI video_renderer_rate_support_IsRateSupported(IMFRateSupport *iface, BOOL thin, float rate, - float *nearest_supported_rate) + float *nearest_rate) { - FIXME("%p, %d, %f, %p.\n", iface, thin, rate, nearest_supported_rate); + struct video_renderer *renderer = impl_from_IMFRateSupport(iface); + HRESULT hr = S_OK; - return E_NOTIMPL; + TRACE("%p, %d, %f, %p.\n", iface, thin, rate, nearest_rate); + + EnterCriticalSection(&renderer->cs); + if (renderer->flags & EVR_SHUT_DOWN) + hr = MF_E_SHUTDOWN; + else + { + if (!thin && !video_renderer_is_main_stream_configured(renderer)) + hr = MF_E_INVALIDREQUEST; + + if (nearest_rate) + *nearest_rate = rate; + } + LeaveCriticalSection(&renderer->cs); + + return hr; } static const IMFRateSupportVtbl video_renderer_rate_support_vtbl = diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index 6bde7568202..58c7cbbadd4 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -4258,6 +4258,10 @@ if (SUCCEEDED(hr)) static void test_evr(void) { + static const float supported_rates[] = + { + 0.0f, 1.0f, -20.0f, 20.0f, 1000.0f, -1000.0f, + }; IMFVideoSampleAllocatorCallback *allocator_callback; IMFStreamSink *stream_sink, *stream_sink2; IMFVideoDisplayControl *display_control; @@ -4275,8 +4279,9 @@ static void test_evr(void) IMFRateSupport *rs; LONG sample_count; IMFSample *sample; - IUnknown *unk; + unsigned int i; UINT64 window3; + IUnknown *unk; float rate; HRESULT hr; GUID guid; @@ -4607,6 +4612,88 @@ todo_wine { hr = IMFRateSupport_GetFastestRate(rs, MFRATE_REVERSE, TRUE, &rate); ok(hr == MF_E_INVALIDREQUEST, "Unexpected hr %#x.\n", hr); + for (i = 0; i < ARRAY_SIZE(supported_rates); ++i) + { + rate = supported_rates[i] + 1.0f; + hr = IMFRateSupport_IsRateSupported(rs, TRUE, supported_rates[i], &rate); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(rate == supported_rates[i], "Unexpected rate %f.\n", rate); + + rate = supported_rates[i] + 1.0f; + hr = IMFRateSupport_IsRateSupported(rs, FALSE, supported_rates[i], &rate); + ok(hr == MF_E_INVALIDREQUEST, "Unexpected hr %#x.\n", hr); + ok(rate == supported_rates[i], "Unexpected rate %f.\n", rate); + + hr = IMFRateSupport_IsRateSupported(rs, TRUE, supported_rates[i], NULL); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + hr = IMFRateSupport_IsRateSupported(rs, FALSE, supported_rates[i], NULL); + ok(hr == MF_E_INVALIDREQUEST, "Unexpected hr %#x.\n", hr); + } + + /* Configuring stream type make rate support work. */ + hr = IMFMediaSink_GetStreamSinkById(sink, 0, &stream_sink); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + hr = IMFStreamSink_GetMediaTypeHandler(stream_sink, &type_handler); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + hr = MFCreateMediaType(&media_type); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + hr = IMFMediaType_SetGUID(media_type, &MF_MT_MAJOR_TYPE, &MFMediaType_Video); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + hr = IMFMediaType_SetGUID(media_type, &MF_MT_SUBTYPE, &MFVideoFormat_RGB32); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + hr = IMFMediaType_SetUINT64(media_type, &MF_MT_FRAME_SIZE, (UINT64)64 << 32 | 64); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + hr = IMFMediaType_SetUINT32(media_type, &MF_MT_ALL_SAMPLES_INDEPENDENT, TRUE); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + hr = IMFMediaTypeHandler_SetCurrentMediaType(type_handler, media_type); + ok(hr == S_OK, "Failed to set current type, hr %#x.\n", hr); + + rate = 1.0f; + hr = IMFRateSupport_GetSlowestRate(rs, MFRATE_FORWARD, TRUE, &rate); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(rate == 0.0f, "Unexpected rate %f.\n", rate); + + rate = 1.0f; + hr = IMFRateSupport_GetSlowestRate(rs, MFRATE_REVERSE, TRUE, &rate); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(rate == 0.0f, "Unexpected rate %f.\n", rate); + + rate = 0.0f; + hr = IMFRateSupport_GetFastestRate(rs, MFRATE_FORWARD, TRUE, &rate); +todo_wine { + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(rate == FLT_MAX, "Unexpected rate %f.\n", rate); +} + rate = 0.0f; + hr = IMFRateSupport_GetFastestRate(rs, MFRATE_REVERSE, TRUE, &rate); +todo_wine { + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(rate == -FLT_MAX, "Unexpected rate %f.\n", rate); +} + for (i = 0; i < ARRAY_SIZE(supported_rates); ++i) + { + rate = supported_rates[i] + 1.0f; + hr = IMFRateSupport_IsRateSupported(rs, TRUE, supported_rates[i], &rate); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(rate == supported_rates[i], "Unexpected rate %f.\n", rate); + + rate = supported_rates[i] + 1.0f; + hr = IMFRateSupport_IsRateSupported(rs, FALSE, supported_rates[i], &rate); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(rate == supported_rates[i], "Unexpected rate %f.\n", rate); + + hr = IMFRateSupport_IsRateSupported(rs, TRUE, supported_rates[i], NULL); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + hr = IMFRateSupport_IsRateSupported(rs, FALSE, supported_rates[i], NULL); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + } + + IMFMediaTypeHandler_Release(type_handler); + IMFMediaType_Release(media_type); + IMFStreamSink_Release(stream_sink); + hr = IMFMediaSink_Shutdown(sink); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); @@ -4622,6 +4709,9 @@ todo_wine { hr = IMFRateSupport_GetFastestRate(rs, MFRATE_FORWARD, FALSE, &rate); ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); + hr = IMFRateSupport_IsRateSupported(rs, TRUE, 1.0f, &rate); + ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); + IMFPresentationClock_Release(clock); IMFActivate_Release(activate);
1
0
0
0
Dmitry Timoshkov : riched20/tests: Add a test to see what richedit class flavours should be available.
by Alexandre Julliard
16 Feb '22
16 Feb '22
Module: wine Branch: master Commit: d54a0e2bea4548bb5d9c0cca9f918d7c46591e23 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=d54a0e2bea4548bb5d9c0cca…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Wed Feb 16 10:44:30 2022 +0300 riched20/tests: Add a test to see what richedit class flavours should be available. Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/riched20/tests/editor.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c index 85f7c00383a..20bf0358712 100644 --- a/dlls/riched20/tests/editor.c +++ b/dlls/riched20/tests/editor.c @@ -8994,6 +8994,38 @@ static void test_EM_SELECTIONTYPE(void) DestroyWindow(hwnd); } +static void test_window_classes(void) +{ + static const struct + { + const char *class; + BOOL success; + } test[] = + { + { "RichEdit", FALSE }, + { "RichEdit20A", TRUE }, + { "RichEdit20W", TRUE }, + { "RichEdit50A", FALSE }, + { "RichEdit50W", FALSE } + }; + int i; + HWND hwnd; + + for (i = 0; i < sizeof(test)/sizeof(test[0]); i++) + { + SetLastError(0xdeadbeef); + hwnd = CreateWindowExA(0, test[i].class, NULL, WS_POPUP, 0, 0, 0, 0, 0, 0, 0, NULL); + todo_wine_if(!strcmp(test[i].class, "RichEdit50A") || !strcmp(test[i].class, "RichEdit50W")) + ok(!hwnd == !test[i].success, "CreateWindow(%s) should %s\n", + test[i].class, test[i].success ? "succeed" : "fail"); + if (!hwnd) + todo_wine + ok(GetLastError() == ERROR_CANNOT_FIND_WND_CLASS, "got %u\n", GetLastError()); + else + DestroyWindow(hwnd); + } +} + START_TEST( editor ) { BOOL ret; @@ -9003,6 +9035,7 @@ START_TEST( editor ) ok(hmoduleRichEdit != NULL, "error: %d\n", (int) GetLastError()); is_lang_japanese = (PRIMARYLANGID(GetSystemDefaultLangID()) == LANG_JAPANESE); + test_window_classes(); test_WM_CHAR(); test_EM_FINDTEXT(FALSE); test_EM_FINDTEXT(TRUE);
1
0
0
0
Zebediah Figura : wined3d: Don't use persistent BOs from the client thread if we might need to do vertex attribute conversion.
by Alexandre Julliard
16 Feb '22
16 Feb '22
Module: wine Branch: master Commit: ec5a71068b850b6c2aa98b81393b1479465c249e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=ec5a71068b850b6c2aa98b81…
Author: Zebediah Figura <zfigura(a)codeweavers.com> Date: Tue Feb 15 21:28:12 2022 -0600 wined3d: Don't use persistent BOs from the client thread if we might need to do vertex attribute conversion. Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wined3d/cs.c | 9 +++++++++ dlls/wined3d/shader_spirv.c | 2 ++ 2 files changed, 11 insertions(+) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index 63d8628cea7..9f4a39cfe7e 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -3077,12 +3077,21 @@ static bool wined3d_cs_map_upload_bo(struct wined3d_device_context *context, str * a texture can be invalidated to even count. */ if (resource->type == WINED3D_RTYPE_BUFFER && (flags & (WINED3D_MAP_DISCARD | WINED3D_MAP_NOOVERWRITE))) { + const struct wined3d_d3d_info *d3d_info = &context->device->adapter->d3d_info; struct wined3d_client_resource *client = &resource->client; struct wined3d_device *device = context->device; struct wined3d_bo_address addr; struct wined3d_bo *bo; uint8_t *map_ptr; + /* We can't use persistent maps if we might need to do vertex attribute + * conversion; that will cause the CS thread to invalidate the BO. */ + if (!d3d_info->xyzrhw || !d3d_info->vertex_bgra || !d3d_info->ffp_generic_attributes) + { + TRACE("Not returning a persistent buffer because we might need to do vertex attribute conversion.\n"); + return NULL; + } + if (flags & WINED3D_MAP_DISCARD) { if (!device->adapter->adapter_ops->adapter_alloc_bo(device, resource, sub_resource_idx, &addr)) diff --git a/dlls/wined3d/shader_spirv.c b/dlls/wined3d/shader_spirv.c index 1e6a03040b9..9ad11f34ebd 100644 --- a/dlls/wined3d/shader_spirv.c +++ b/dlls/wined3d/shader_spirv.c @@ -1176,6 +1176,8 @@ static void spirv_vertex_pipe_vk_vp_enable(const struct wined3d_context *context static void spirv_vertex_pipe_vk_vp_get_caps(const struct wined3d_adapter *adapter, struct wined3d_vertex_caps *caps) { memset(caps, 0, sizeof(*caps)); + caps->xyzrhw = TRUE; + caps->ffp_generic_attributes = TRUE; } static uint32_t spirv_vertex_pipe_vk_vp_get_emul_mask(const struct wined3d_gl_info *gl_info)
1
0
0
0
Zebediah Figura : wined3d: Allow passing a NULL context to wined3d_device_gl_create_bo().
by Alexandre Julliard
16 Feb '22
16 Feb '22
Module: wine Branch: master Commit: 95173d6f6592a3ebd1985277a080f007efcb815c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=95173d6f6592a3ebd1985277…
Author: Zebediah Figura <zfigura(a)codeweavers.com> Date: Tue Feb 15 21:28:11 2022 -0600 wined3d: Allow passing a NULL context to wined3d_device_gl_create_bo(). Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wined3d/device.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index e302e1917a6..9488e8c642e 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -961,11 +961,15 @@ static void device_init_swapchain_state(struct wined3d_device *device, struct wi static struct wined3d_allocator_chunk *wined3d_allocator_gl_create_chunk(struct wined3d_allocator *allocator, struct wined3d_context *context, unsigned int memory_type, size_t chunk_size) { - struct wined3d_context_gl *context_gl = wined3d_context_gl(context); struct wined3d_allocator_chunk_gl *chunk_gl; + struct wined3d_context_gl *context_gl; TRACE("allocator %p, context %p, memory_type %u, chunk_size %zu.\n", allocator, context, memory_type, chunk_size); + if (!context) + return NULL; + context_gl = wined3d_context_gl(context); + if (!(chunk_gl = heap_alloc(sizeof(*chunk_gl)))) return NULL; @@ -1063,12 +1067,13 @@ static struct wined3d_allocator_block *wined3d_device_gl_allocate_memory(struct if (size > WINED3D_ALLOCATOR_CHUNK_SIZE / 2) { - *id = wined3d_context_gl_allocate_vram_chunk_buffer(context_gl, memory_type, size); + if (context_gl) + *id = wined3d_context_gl_allocate_vram_chunk_buffer(context_gl, memory_type, size); wined3d_device_gl_allocator_unlock(device_gl); return NULL; } - if (!(block = wined3d_allocator_allocate(allocator, &context_gl->c, memory_type, size))) + if (!(block = wined3d_allocator_allocate(allocator, context_gl ? &context_gl->c : NULL, memory_type, size))) { wined3d_device_gl_allocator_unlock(device_gl); *id = 0; @@ -1119,7 +1124,7 @@ bool wined3d_device_gl_create_bo(struct wined3d_device_gl *device_gl, struct win if ((memory = wined3d_device_gl_allocate_memory(device_gl, context_gl, memory_type_idx, size, &id))) buffer_offset = memory->offset; } - else + else if (context_gl) { WARN_(d3d_perf)("Not allocating chunk memory for binding type %#x.\n", binding); id = wined3d_context_gl_allocate_vram_chunk_buffer(context_gl, memory_type_idx, size); @@ -1133,6 +1138,9 @@ bool wined3d_device_gl_create_bo(struct wined3d_device_gl *device_gl, struct win } else { + if (!context_gl) + return false; + GL_EXTCALL(glGenBuffers(1, &id)); if (!id) {
1
0
0
0
Zebediah Figura : wined3d: Protect access to the OpenGL wined3d_allocator with a critical section.
by Alexandre Julliard
16 Feb '22
16 Feb '22
Module: wine Branch: master Commit: 4a3cefab75e797398923c54340beb5764c42a28e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=4a3cefab75e797398923c543…
Author: Zebediah Figura <zfigura(a)codeweavers.com> Date: Tue Feb 15 21:28:10 2022 -0600 wined3d: Protect access to the OpenGL wined3d_allocator with a critical section. Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wined3d/adapter_gl.c | 4 ++++ dlls/wined3d/context_gl.c | 12 ++++++++++-- dlls/wined3d/device.c | 5 +++++ dlls/wined3d/wined3d_private.h | 11 +++++++++++ 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c index 2e31d140dd5..bc54f46222f 100644 --- a/dlls/wined3d/adapter_gl.c +++ b/dlls/wined3d/adapter_gl.c @@ -4274,6 +4274,8 @@ static HRESULT adapter_gl_create_device(struct wined3d *wined3d, const struct wi return hr; } + wined3d_lock_init(&device_gl->allocator_cs, "wined3d_device_gl.allocator_cs"); + *device = &device_gl->d; return WINED3D_OK; } @@ -4283,6 +4285,8 @@ static void adapter_gl_destroy_device(struct wined3d_device *device) struct wined3d_device_gl *device_gl = wined3d_device_gl(device); wined3d_device_cleanup(&device_gl->d); + wined3d_lock_cleanup(&device_gl->allocator_cs); + heap_free(device_gl->retired_blocks); heap_free(device_gl); } diff --git a/dlls/wined3d/context_gl.c b/dlls/wined3d/context_gl.c index 8901bafcce3..8217d04686c 100644 --- a/dlls/wined3d/context_gl.c +++ b/dlls/wined3d/context_gl.c @@ -2629,6 +2629,14 @@ static void wined3d_context_gl_poll_fences(struct wined3d_context_gl *context_gl } } +static void wined3d_device_gl_free_memory(struct wined3d_device_gl *device_gl, struct wined3d_allocator_block *block) +{ + assert(block->chunk->allocator == &device_gl->allocator); + wined3d_device_gl_allocator_lock(device_gl); + wined3d_allocator_block_free(block); + wined3d_device_gl_allocator_unlock(device_gl); +} + static void wined3d_context_gl_cleanup_resources(struct wined3d_context_gl *context_gl) { struct wined3d_device_gl *device_gl = wined3d_device_gl(context_gl->c.device); @@ -2651,7 +2659,7 @@ static void wined3d_context_gl_cleanup_resources(struct wined3d_context_gl *cont continue; } - wined3d_allocator_block_free(r->block); + wined3d_device_gl_free_memory(device_gl, r->block); if (i != --count) *r = blocks[count]; else @@ -2718,7 +2726,7 @@ static void wined3d_context_gl_destroy_allocator_block(struct wined3d_context_gl if (device_gl->completed_fence_id > fence_id) { - wined3d_allocator_block_free(block); + wined3d_device_gl_free_memory(device_gl, block); TRACE("Freed block %p.\n", block); return; } diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 84d2e3a0ce8..e302e1917a6 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -1059,20 +1059,25 @@ static struct wined3d_allocator_block *wined3d_device_gl_allocate_memory(struct struct wined3d_allocator *allocator = &device_gl->allocator; struct wined3d_allocator_block *block; + wined3d_device_gl_allocator_lock(device_gl); + if (size > WINED3D_ALLOCATOR_CHUNK_SIZE / 2) { *id = wined3d_context_gl_allocate_vram_chunk_buffer(context_gl, memory_type, size); + wined3d_device_gl_allocator_unlock(device_gl); return NULL; } if (!(block = wined3d_allocator_allocate(allocator, &context_gl->c, memory_type, size))) { + wined3d_device_gl_allocator_unlock(device_gl); *id = 0; return NULL; } *id = wined3d_allocator_chunk_gl(block->chunk)->gl_buffer; + wined3d_device_gl_allocator_unlock(device_gl); return block; } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 48b760edc1b..96ce75fbb58 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -4194,6 +4194,7 @@ struct wined3d_device_gl /* Textures for when no other textures are bound. */ struct wined3d_dummy_textures dummy_textures; + CRITICAL_SECTION allocator_cs; struct wined3d_allocator allocator; uint64_t completed_fence_id; uint64_t current_fence_id; @@ -4212,6 +4213,16 @@ static inline struct wined3d_device_gl *wined3d_device_gl(struct wined3d_device return CONTAINING_RECORD(device, struct wined3d_device_gl, d); } +static inline void wined3d_device_gl_allocator_lock(struct wined3d_device_gl *device_gl) +{ + EnterCriticalSection(&device_gl->allocator_cs); +} + +static inline void wined3d_device_gl_allocator_unlock(struct wined3d_device_gl *device_gl) +{ + LeaveCriticalSection(&device_gl->allocator_cs); +} + bool wined3d_device_gl_create_bo(struct wined3d_device_gl *device_gl, struct wined3d_context_gl *context_gl, GLsizeiptr size, GLenum binding, GLenum usage, bool coherent, GLbitfield flags, struct wined3d_bo_gl *bo) DECLSPEC_HIDDEN;
1
0
0
0
← Newer
1
...
60
61
62
63
64
65
66
...
150
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
Results per page:
10
25
50
100
200