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
July 2015
----- 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
567 discussions
Start a n
N
ew thread
Jactry Zeng : gdi32: Add multiple font replacement support.
by Alexandre Julliard
17 Jul '15
17 Jul '15
Module: wine Branch: master Commit: c015447d074c535349e42ac3faa2384f8b46a231 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=c015447d074c535349e42ac3f…
Author: Jactry Zeng <jzeng(a)codeweavers.com> Date: Wed Jul 8 21:54:05 2015 +0800 gdi32: Add multiple font replacement support. --- dlls/gdi32/freetype.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index e20e390..e57d1a9 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -2292,12 +2292,24 @@ static void LoadReplaceList(void) dlen = datalen; vlen = valuelen; - while(RegEnumValueW(hkey, i++, value, &vlen, NULL, &type, data, - &dlen) == ERROR_SUCCESS) { - TRACE("Got %s=%s\n", debugstr_w(value), debugstr_w(data)); + while(RegEnumValueW(hkey, i++, value, &vlen, NULL, &type, data, &dlen) == ERROR_SUCCESS) + { /* "NewName"="Oldname" */ if(!find_family_from_any_name(value)) - map_font_family(value, data); + { + if (type == REG_MULTI_SZ) + { + WCHAR *replace = data; + while(*replace) + { + if (map_font_family(value, replace)) + break; + replace += strlenW(replace) + 1; + } + } + else + map_font_family(value, data); + } else TRACE("%s is available. Skip this replacement.\n", debugstr_w(value));
1
0
0
0
Jactry Zeng : gdi32: Add a helper to map font replacement.
by Alexandre Julliard
17 Jul '15
17 Jul '15
Module: wine Branch: master Commit: cb59350ed9e0eee83284bcd1f889315c9ea8607e URL:
http://source.winehq.org/git/wine.git/?a=commit;h=cb59350ed9e0eee83284bcd1f…
Author: Jactry Zeng <jzeng(a)codeweavers.com> Date: Wed Jul 8 21:53:52 2015 +0800 gdi32: Add a helper to map font replacement. --- dlls/gdi32/freetype.c | 45 +++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index 73824ea..e20e390 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -2240,6 +2240,27 @@ static void DumpFontList(void) } } +static BOOL map_font_family(const WCHAR *orig, const WCHAR *repl) +{ + Family *family = find_family_from_any_name(repl); + if (family != NULL) + { + Family *new_family = HeapAlloc(GetProcessHeap(), 0, sizeof(*new_family)); + if (new_family != NULL) + { + TRACE("mapping %s to %s\n", debugstr_w(repl), debugstr_w(orig)); + new_family->FamilyName = strdupW(orig); + new_family->EnglishName = NULL; + list_init(&new_family->faces); + new_family->replacement = &family->faces; + list_add_tail(&font_list, &new_family->entry); + return TRUE; + } + } + TRACE("%s is not available. Skip this replacement.\n", debugstr_w(repl)); + return FALSE; +} + /*********************************************************** * The replacement list is a way to map an entire font * family onto another family. For example adding @@ -2276,30 +2297,10 @@ static void LoadReplaceList(void) TRACE("Got %s=%s\n", debugstr_w(value), debugstr_w(data)); /* "NewName"="Oldname" */ if(!find_family_from_any_name(value)) - { - Family * const family = find_family_from_any_name(data); - if (family != NULL) - { - Family * const new_family = HeapAlloc(GetProcessHeap(), 0, sizeof(*new_family)); - if (new_family != NULL) - { - TRACE("mapping %s to %s\n", debugstr_w(data), debugstr_w(value)); - new_family->FamilyName = strdupW(value); - new_family->EnglishName = NULL; - list_init(&new_family->faces); - new_family->replacement = &family->faces; - list_add_tail(&font_list, &new_family->entry); - } - } - else - { - TRACE("%s is not available. Skip this replacement.\n", debugstr_w(data)); - } - } + map_font_family(value, data); else - { TRACE("%s is available. Skip this replacement.\n", debugstr_w(value)); - } + /* reset dlen and vlen */ dlen = datalen; vlen = valuelen;
1
0
0
0
Alex Henrie : user32: Scroll listbox item completely into view on LB_SETCURSEL.
by Alexandre Julliard
17 Jul '15
17 Jul '15
Module: wine Branch: master Commit: 5caa651732beb7996ee8397929a0805ae2f45882 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=5caa651732beb7996ee839792…
Author: Alex Henrie <alexhenrie24(a)gmail.com> Date: Thu Jul 16 03:30:30 2015 -0600 user32: Scroll listbox item completely into view on LB_SETCURSEL. --- dlls/user32/listbox.c | 2 +- dlls/user32/tests/listbox.c | 33 +++++++++++++++++++++++++++++++-- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/dlls/user32/listbox.c b/dlls/user32/listbox.c index ed60a19..2902ac9 100644 --- a/dlls/user32/listbox.c +++ b/dlls/user32/listbox.c @@ -2855,7 +2855,7 @@ LRESULT ListBoxWndProc_common( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam case LB_SETCURSEL: if (IS_MULTISELECT(descr)) return LB_ERR; - LISTBOX_SetCaretIndex( descr, wParam, FALSE ); + LISTBOX_SetCaretIndex( descr, wParam, TRUE ); ret = LISTBOX_SetSelection( descr, wParam, TRUE, FALSE ); if (ret != LB_ERR) ret = descr->selected_item; return ret; diff --git a/dlls/user32/tests/listbox.c b/dlls/user32/tests/listbox.c index d99a82c..79d18e7 100644 --- a/dlls/user32/tests/listbox.c +++ b/dlls/user32/tests/listbox.c @@ -349,7 +349,7 @@ static void test_ownerdraw(void) ok(exp.caret == got.caret, "expected caret %d, got %d\n", exp.caret, got.caret); \ ok(exp.selcount == got.selcount, "expected selcount %d, got %d\n", exp.selcount, got.selcount); -static void test_selection(void) +static void test_LB_SELITEMRANGE(void) { static const struct listbox_stat test_nosel = { 0, LB_ERR, 0, 0 }; static const struct listbox_stat test_1 = { 0, LB_ERR, 0, 2 }; @@ -429,6 +429,34 @@ static void test_selection(void) DestroyWindow(hLB); } +static void test_LB_SETCURSEL(void) +{ + HWND parent, hLB; + INT ret; + + trace("testing LB_SETCURSEL\n"); + + parent = create_parent(); + assert(parent); + + hLB = create_listbox(LBS_NOINTEGRALHEIGHT | WS_CHILD, parent); + assert(hLB); + + SendMessageA(hLB, LB_SETITEMHEIGHT, 0, 32); + + ret = SendMessageA(hLB, LB_SETCURSEL, 2, 0); + ok(ret == 2, "LB_SETCURSEL returned %d instead of 2\n", ret); + ret = GetScrollPos(hLB, SB_VERT); + ok(ret == 0, "expected vscroll 0, got %d\n", ret); + + ret = SendMessageA(hLB, LB_SETCURSEL, 3, 0); + ok(ret == 3, "LB_SETCURSEL returned %d instead of 3\n", ret); + ret = GetScrollPos(hLB, SB_VERT); + ok(ret == 1, "expected vscroll 1, got %d\n", ret); + + DestroyWindow(hLB); +} + static void test_listbox_height(void) { HWND hList; @@ -1766,7 +1794,8 @@ START_TEST(listbox) check_item_height(); test_ownerdraw(); - test_selection(); + test_LB_SELITEMRANGE(); + test_LB_SETCURSEL(); test_listbox_height(); test_itemfrompoint(); test_listbox_item_data();
1
0
0
0
Alex Henrie : user32: Simplify if-else statement.
by Alexandre Julliard
17 Jul '15
17 Jul '15
Module: wine Branch: master Commit: f6125536948201ee380a44edc0b87a29b0a55af3 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=f6125536948201ee380a44edc…
Author: Alex Henrie <alexhenrie24(a)gmail.com> Date: Thu Jul 16 01:05:25 2015 -0600 user32: Simplify if-else statement. --- dlls/user32/listbox.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dlls/user32/listbox.c b/dlls/user32/listbox.c index 4853c3f..ed60a19 100644 --- a/dlls/user32/listbox.c +++ b/dlls/user32/listbox.c @@ -319,7 +319,8 @@ static LRESULT LISTBOX_SetTopItem( LB_DESCR *descr, INT index, BOOL scroll ) ScrollWindowEx( descr->self, 0, diff, NULL, NULL, 0, NULL, SW_INVALIDATE | SW_ERASE | SW_SCROLLCHILDREN ); } - if (!scroll) InvalidateRect( descr->self, NULL, TRUE ); + else + InvalidateRect( descr->self, NULL, TRUE ); descr->top_item = index; LISTBOX_UpdateScroll( descr ); return LB_OKAY;
1
0
0
0
Sebastian Lackner : vcomp/tests: Add tests for vcomp sections.
by Alexandre Julliard
17 Jul '15
17 Jul '15
Module: wine Branch: master Commit: 57cbcec0c28260458996dd31a0cebc4c628b9b20 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=57cbcec0c28260458996dd31a…
Author: Sebastian Lackner <sebastian(a)fds-team.de> Date: Thu Jul 16 15:01:45 2015 +0200 vcomp/tests: Add tests for vcomp sections. --- dlls/vcomp/tests/vcomp.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/dlls/vcomp/tests/vcomp.c b/dlls/vcomp/tests/vcomp.c index a9b975d..c433991 100644 --- a/dlls/vcomp/tests/vcomp.c +++ b/dlls/vcomp/tests/vcomp.c @@ -33,6 +33,8 @@ static VOID (WINAPI *pReleaseActCtx)(HANDLE); static void (CDECL *p_vcomp_barrier)(void); static void (WINAPIV *p_vcomp_fork)(BOOL ifval, int nargs, void *wrapper, ...); +static void (CDECL *p_vcomp_sections_init)(int n); +static int (CDECL *p_vcomp_sections_next)(void); static void (CDECL *p_vcomp_set_num_threads)(int num_threads); static int (CDECL *pomp_get_max_threads)(void); static int (CDECL *pomp_get_nested)(void); @@ -169,6 +171,8 @@ static BOOL init_vcomp(void) VCOMP_GET_PROC(_vcomp_barrier); VCOMP_GET_PROC(_vcomp_fork); + VCOMP_GET_PROC(_vcomp_sections_init); + VCOMP_GET_PROC(_vcomp_sections_next); VCOMP_GET_PROC(_vcomp_set_num_threads); VCOMP_GET_PROC(omp_get_max_threads); VCOMP_GET_PROC(omp_get_nested); @@ -342,6 +346,52 @@ static void test_vcomp_fork(void) pomp_set_num_threads(max_threads); } +static void CDECL section_cb(LONG *a, LONG *b, LONG *c) +{ + int i; + + p_vcomp_sections_init(20); + while ((i = p_vcomp_sections_next()) != -1) + { + InterlockedIncrement(a); + Sleep(1); + } + + p_vcomp_sections_init(30); + while ((i = p_vcomp_sections_next()) != -1) + { + InterlockedIncrement(b); + Sleep(1); + } + + p_vcomp_sections_init(40); + while ((i = p_vcomp_sections_next()) != -1) + { + InterlockedIncrement(c); + Sleep(1); + } +} + +static void test_vcomp_sections_init(void) +{ + LONG a, b, c; + int max_threads = pomp_get_max_threads(); + int i; + + for (i = 1; i <= 4; i++) + { + pomp_set_num_threads(i); + + a = b = c = 0; + p_vcomp_fork(TRUE, 3, section_cb, &a, &b, &c); + ok(a == 20, "expected a = 20, got %d\n", a); + ok(b == 30, "expected b = 30, got %d\n", b); + ok(c == 40, "expected c = 40, got %d\n", c); + } + + pomp_set_num_threads(max_threads); +} + START_TEST(vcomp) { if (!init_vcomp()) @@ -350,6 +400,7 @@ START_TEST(vcomp) test_omp_get_num_threads(FALSE); test_omp_get_num_threads(TRUE); test_vcomp_fork(); + test_vcomp_sections_init(); release_vcomp(); }
1
0
0
0
Sebastian Lackner : vcomp: Implement _vcomp_sections_init and _vcomp_sections_next.
by Alexandre Julliard
17 Jul '15
17 Jul '15
Module: wine Branch: master Commit: c019ebc82f397d1f5c195d6bfc24697260290f57 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=c019ebc82f397d1f5c195d6bf…
Author: Sebastian Lackner <sebastian(a)fds-team.de> Date: Thu Jul 16 15:01:33 2015 +0200 vcomp: Implement _vcomp_sections_init and _vcomp_sections_next. --- dlls/vcomp/main.c | 48 +++++++++++++++++++++++++++++++++++++++++++++ dlls/vcomp/vcomp.spec | 4 ++-- dlls/vcomp100/vcomp100.spec | 4 ++-- dlls/vcomp90/vcomp90.spec | 4 ++-- 4 files changed, 54 insertions(+), 6 deletions(-) diff --git a/dlls/vcomp/main.c b/dlls/vcomp/main.c index f085f7c..0f8a272 100644 --- a/dlls/vcomp/main.c +++ b/dlls/vcomp/main.c @@ -58,6 +58,9 @@ struct vcomp_thread_data /* only used for concurrent tasks */ struct list entry; CONDITION_VARIABLE cond; + + /* section */ + unsigned int section; }; struct vcomp_team_data @@ -74,6 +77,11 @@ struct vcomp_team_data /* barrier */ unsigned int barrier; int barrier_count; + + /* section */ + unsigned int section; + int num_sections; + int section_index; }; #if defined(__i386__) @@ -301,6 +309,42 @@ void CDECL _vcomp_single_end(void) TRACE("stub\n"); } +void CDECL _vcomp_sections_init(int n) +{ + struct vcomp_thread_data *thread_data = vcomp_get_thread_data(); + struct vcomp_team_data *team_data = thread_data->team; + + TRACE("(%d)\n", n); + + EnterCriticalSection(&vcomp_section); + thread_data->section++; + if ((int)(thread_data->section - team_data->section) > 0) + { + team_data->section = thread_data->section; + team_data->num_sections = n; + team_data->section_index = 0; + } + LeaveCriticalSection(&vcomp_section); +} + +int CDECL _vcomp_sections_next(void) +{ + struct vcomp_thread_data *thread_data = vcomp_get_thread_data(); + struct vcomp_team_data *team_data = thread_data->team; + int i = -1; + + TRACE("()\n"); + + EnterCriticalSection(&vcomp_section); + if (thread_data->section == team_data->section && + team_data->section_index != team_data->num_sections) + { + i = team_data->section_index++; + } + LeaveCriticalSection(&vcomp_section); + return i; +} + static DWORD WINAPI _vcomp_fork_worker(void *param) { struct vcomp_thread_data *thread_data = param; @@ -368,10 +412,12 @@ void WINAPIV _vcomp_fork(BOOL ifval, int nargs, void *wrapper, ...) __ms_va_start(team_data.valist, wrapper); team_data.barrier = 0; team_data.barrier_count = 0; + team_data.section = 0; thread_data.team = &team_data; thread_data.thread_num = 0; thread_data.fork_threads = 0; + thread_data.section = 1; list_init(&thread_data.entry); InitializeConditionVariable(&thread_data.cond); @@ -387,6 +433,7 @@ void WINAPIV _vcomp_fork(BOOL ifval, int nargs, void *wrapper, ...) data->team = &team_data; data->thread_num = team_data.num_threads++; data->fork_threads = 0; + data->section = 1; list_remove(&data->entry); list_add_tail(&thread_data.entry, &data->entry); WakeAllConditionVariable(&data->cond); @@ -405,6 +452,7 @@ void WINAPIV _vcomp_fork(BOOL ifval, int nargs, void *wrapper, ...) data->team = &team_data; data->thread_num = team_data.num_threads; data->fork_threads = 0; + data->section = 1; InitializeConditionVariable(&data->cond); thread = CreateThread(NULL, 0, _vcomp_fork_worker, data, 0, NULL); diff --git a/dlls/vcomp/vcomp.spec b/dlls/vcomp/vcomp.spec index d446574..dfbd184 100644 --- a/dlls/vcomp/vcomp.spec +++ b/dlls/vcomp/vcomp.spec @@ -83,8 +83,8 @@ @ stub _vcomp_reduction_u2 @ stub _vcomp_reduction_u4 @ stub _vcomp_reduction_u8 -@ stub _vcomp_sections_init -@ stub _vcomp_sections_next +@ cdecl _vcomp_sections_init(long) +@ cdecl _vcomp_sections_next() @ cdecl _vcomp_set_num_threads(long) @ cdecl _vcomp_single_begin(long) @ cdecl _vcomp_single_end() diff --git a/dlls/vcomp100/vcomp100.spec b/dlls/vcomp100/vcomp100.spec index 2c04e91..6eb6ae5 100644 --- a/dlls/vcomp100/vcomp100.spec +++ b/dlls/vcomp100/vcomp100.spec @@ -83,8 +83,8 @@ @ stub _vcomp_reduction_u2 @ stub _vcomp_reduction_u4 @ stub _vcomp_reduction_u8 -@ stub _vcomp_sections_init -@ stub _vcomp_sections_next +@ cdecl _vcomp_sections_init(long) vcomp._vcomp_sections_init +@ cdecl _vcomp_sections_next() vcomp._vcomp_sections_next @ cdecl _vcomp_set_num_threads(long) vcomp._vcomp_set_num_threads @ cdecl _vcomp_single_begin(long) vcomp._vcomp_single_begin @ cdecl _vcomp_single_end() vcomp._vcomp_single_end diff --git a/dlls/vcomp90/vcomp90.spec b/dlls/vcomp90/vcomp90.spec index 2c04e91..6eb6ae5 100644 --- a/dlls/vcomp90/vcomp90.spec +++ b/dlls/vcomp90/vcomp90.spec @@ -83,8 +83,8 @@ @ stub _vcomp_reduction_u2 @ stub _vcomp_reduction_u4 @ stub _vcomp_reduction_u8 -@ stub _vcomp_sections_init -@ stub _vcomp_sections_next +@ cdecl _vcomp_sections_init(long) vcomp._vcomp_sections_init +@ cdecl _vcomp_sections_next() vcomp._vcomp_sections_next @ cdecl _vcomp_set_num_threads(long) vcomp._vcomp_set_num_threads @ cdecl _vcomp_single_begin(long) vcomp._vcomp_single_begin @ cdecl _vcomp_single_end() vcomp._vcomp_single_end
1
0
0
0
Dan Kegel : vcomp/tests: Add additional tests for _vcomp_fork.
by Alexandre Julliard
17 Jul '15
17 Jul '15
Module: wine Branch: master Commit: 9c9d60f02047e35e7efda484d59aecb48be8e412 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=9c9d60f02047e35e7efda484d…
Author: Dan Kegel <dank(a)kegel.com> Date: Thu Jul 16 15:01:12 2015 +0200 vcomp/tests: Add additional tests for _vcomp_fork. --- dlls/vcomp/tests/vcomp.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/dlls/vcomp/tests/vcomp.c b/dlls/vcomp/tests/vcomp.c index b084791..a9b975d 100644 --- a/dlls/vcomp/tests/vcomp.c +++ b/dlls/vcomp/tests/vcomp.c @@ -1,6 +1,7 @@ /* * Unit test suite for vcomp * + * Copyright 2012 Dan Kegel * Copyright 2015 Sebastian Lackner * * This library is free software; you can redistribute it and/or @@ -278,6 +279,69 @@ static void test_omp_get_num_threads(BOOL nested) pomp_set_nested(FALSE); } +static void CDECL fork_ptr_cb(LONG *a, LONG *b, LONG *c, LONG *d, LONG *e) +{ + InterlockedIncrement(a); + InterlockedIncrement(b); + InterlockedIncrement(c); + InterlockedIncrement(d); + InterlockedIncrement(e); +} + +static void CDECL fork_uintptr_cb(UINT_PTR a, UINT_PTR b, UINT_PTR c, UINT_PTR d, UINT_PTR e) +{ + ok(a == 1, "expected a == 1, got %p\n", (void *)a); + ok(b == MAXUINT_PTR - 2, "expected b == MAXUINT_PTR - 2, got %p\n", (void *)b); + ok(c == 3, "expected c == 3, got %p\n", (void *)c); + ok(d == MAXUINT_PTR - 4, "expected d == MAXUINT_PTR - 4, got %p\n", (void *)d); + ok(e == 5, "expected e == 5, got %p\n", (void *)e); +} + +static void CDECL fork_float_cb(float a, float b, float c, float d, float e) +{ + ok(1.4999 < a && a < 1.5001, "expected a == 1.5, got %f\n", a); + ok(2.4999 < b && b < 2.5001, "expected b == 2.5, got %f\n", b); + ok(3.4999 < c && c < 3.5001, "expected c == 3.5, got %f\n", c); + ok(4.4999 < d && d < 4.5001, "expected d == 4.5, got %f\n", d); + ok(5.4999 < e && e < 5.5001, "expected e == 5.5, got %f\n", e); +} + +static void test_vcomp_fork(void) +{ + LONG a, b, c, d, e; + int max_threads = pomp_get_max_threads(); + pomp_set_num_threads(4); + + a = 0; b = 1; c = 2; d = 3; e = 4; + p_vcomp_fork(FALSE, 5, fork_ptr_cb, &a, &b, &c, &d, &e); + ok(a == 1, "expected a == 1, got %d\n", a); + ok(b == 2, "expected b == 2, got %d\n", b); + ok(c == 3, "expected c == 3, got %d\n", c); + ok(d == 4, "expected d == 4, got %d\n", d); + ok(e == 5, "expected e == 5, got %d\n", e); + + a = 0; b = 1; c = 2; d = 3; e = 4; + p_vcomp_fork(TRUE, 5, fork_ptr_cb, &a, &b, &c, &d, &e); + ok(a == 4, "expected a == 4, got %d\n", a); + ok(b == 5, "expected b == 5, got %d\n", b); + ok(c == 6, "expected c == 6, got %d\n", c); + ok(d == 7, "expected d == 7, got %d\n", d); + ok(e == 8, "expected e == 8, got %d\n", e); + + p_vcomp_fork(TRUE, 5, fork_uintptr_cb, (UINT_PTR)1, (UINT_PTR)(MAXUINT_PTR - 2), + (UINT_PTR)3, (UINT_PTR)(MAXUINT_PTR - 4), (UINT_PTR)5); + + if (sizeof(int) < sizeof(void *)) + skip("skipping float test on x86_64\n"); + else + { + void (CDECL *func)(BOOL, int, void *, float, float, float, float, float) = (void *)p_vcomp_fork; + func(TRUE, 5, fork_float_cb, 1.5f, 2.5f, 3.5f, 4.5f, 5.5f); + } + + pomp_set_num_threads(max_threads); +} + START_TEST(vcomp) { if (!init_vcomp()) @@ -285,6 +349,7 @@ START_TEST(vcomp) test_omp_get_num_threads(FALSE); test_omp_get_num_threads(TRUE); + test_vcomp_fork(); release_vcomp(); }
1
0
0
0
Sebastian Lackner : vcomp/tests: Add initial tests.
by Alexandre Julliard
17 Jul '15
17 Jul '15
Module: wine Branch: master Commit: c0a664456e39eff20610c41715e996e17702a178 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=c0a664456e39eff20610c4171…
Author: Sebastian Lackner <sebastian(a)fds-team.de> Date: Thu Jul 16 15:00:48 2015 +0200 vcomp/tests: Add initial tests. --- configure | 1 + configure.ac | 1 + dlls/vcomp/tests/Makefile.in | 4 + dlls/vcomp/tests/vcomp.c | 290 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 296 insertions(+) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=c0a664456e39eff20610c…
1
0
0
0
Sebastian Lackner : vcomp: Implement _vcomp_barrier.
by Alexandre Julliard
17 Jul '15
17 Jul '15
Module: wine Branch: master Commit: e26a9fb4ad099e22ea478f5bf376373793a729a9 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=e26a9fb4ad099e22ea478f5bf…
Author: Sebastian Lackner <sebastian(a)fds-team.de> Date: Thu Jul 16 15:00:33 2015 +0200 vcomp: Implement _vcomp_barrier. --- dlls/vcomp/main.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/dlls/vcomp/main.c b/dlls/vcomp/main.c index 3830879..f085f7c 100644 --- a/dlls/vcomp/main.c +++ b/dlls/vcomp/main.c @@ -70,6 +70,10 @@ struct vcomp_team_data int nargs; void *wrapper; __ms_va_list valist; + + /* barrier */ + unsigned int barrier; + int barrier_count; }; #if defined(__i386__) @@ -256,7 +260,27 @@ void CDECL omp_set_num_threads(int num_threads) void CDECL _vcomp_barrier(void) { - TRACE("stub\n"); + struct vcomp_team_data *team_data = vcomp_init_thread_data()->team; + + TRACE("()\n"); + + if (!team_data) + return; + + EnterCriticalSection(&vcomp_section); + if (++team_data->barrier_count >= team_data->num_threads) + { + team_data->barrier++; + team_data->barrier_count = 0; + WakeAllConditionVariable(&team_data->cond); + } + else + { + unsigned int barrier = team_data->barrier; + while (team_data->barrier == barrier) + SleepConditionVariableCS(&team_data->cond, &vcomp_section, INFINITE); + } + LeaveCriticalSection(&vcomp_section); } void CDECL _vcomp_set_num_threads(int num_threads) @@ -342,6 +366,8 @@ void WINAPIV _vcomp_fork(BOOL ifval, int nargs, void *wrapper, ...) team_data.nargs = nargs; team_data.wrapper = wrapper; __ms_va_start(team_data.valist, wrapper); + team_data.barrier = 0; + team_data.barrier_count = 0; thread_data.team = &team_data; thread_data.thread_num = 0;
1
0
0
0
Sebastian Lackner : vcomp: Add multithreaded implementation for _vcomp_fork.
by Alexandre Julliard
17 Jul '15
17 Jul '15
Module: wine Branch: master Commit: ee34265f8f7a45a998ef076bbb5967637347f635 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=ee34265f8f7a45a998ef076bb…
Author: Sebastian Lackner <sebastian(a)fds-team.de> Date: Thu Jul 16 15:00:20 2015 +0200 vcomp: Add multithreaded implementation for _vcomp_fork. --- dlls/vcomp/main.c | 180 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 172 insertions(+), 8 deletions(-) diff --git a/dlls/vcomp/main.c b/dlls/vcomp/main.c index 93d418e..3830879 100644 --- a/dlls/vcomp/main.c +++ b/dlls/vcomp/main.c @@ -4,6 +4,7 @@ * * Copyright 2011 Austin English * Copyright 2012 Dan Kegel + * Copyright 2015 Sebastian Lackner * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -23,22 +24,52 @@ #include "config.h" #include <stdarg.h> +#include <assert.h> #include "windef.h" #include "winbase.h" #include "wine/debug.h" +#include "wine/list.h" WINE_DEFAULT_DEBUG_CHANNEL(vcomp); +static struct list vcomp_idle_threads = LIST_INIT(vcomp_idle_threads); static DWORD vcomp_context_tls = TLS_OUT_OF_INDEXES; +static HMODULE vcomp_module; static int vcomp_max_threads; static int vcomp_num_threads; static BOOL vcomp_nested_fork = FALSE; +static RTL_CRITICAL_SECTION vcomp_section; +static RTL_CRITICAL_SECTION_DEBUG critsect_debug = +{ + 0, 0, &vcomp_section, + { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList }, + 0, 0, { (DWORD_PTR)(__FILE__ ": vcomp_section") } +}; +static RTL_CRITICAL_SECTION vcomp_section = { &critsect_debug, -1, 0, 0, 0, 0 }; + struct vcomp_thread_data { + struct vcomp_team_data *team; int thread_num; int fork_threads; + + /* only used for concurrent tasks */ + struct list entry; + CONDITION_VARIABLE cond; +}; + +struct vcomp_team_data +{ + CONDITION_VARIABLE cond; + int num_threads; + int finished_threads; + + /* callback arguments */ + int nargs; + void *wrapper; + __ms_va_list valist; }; #if defined(__i386__) @@ -145,8 +176,9 @@ static struct vcomp_thread_data *vcomp_init_thread_data(void) ExitProcess(1); } - thread_data->thread_num = 0; - thread_data->fork_threads = 0; + thread_data->team = NULL; + thread_data->thread_num = 0; + thread_data->fork_threads = 0; vcomp_set_thread_data(thread_data); return thread_data; @@ -187,8 +219,9 @@ int CDECL omp_get_num_procs(void) int CDECL omp_get_num_threads(void) { - TRACE("stub\n"); - return 1; + struct vcomp_team_data *team_data = vcomp_init_thread_data()->team; + TRACE("()\n"); + return team_data ? team_data->num_threads : 1; } int CDECL omp_get_thread_num(void) @@ -244,15 +277,145 @@ void CDECL _vcomp_single_end(void) TRACE("stub\n"); } +static DWORD WINAPI _vcomp_fork_worker(void *param) +{ + struct vcomp_thread_data *thread_data = param; + vcomp_set_thread_data(thread_data); + + TRACE("starting worker thread for %p\n", thread_data); + + EnterCriticalSection(&vcomp_section); + for (;;) + { + struct vcomp_team_data *team = thread_data->team; + if (team != NULL) + { + LeaveCriticalSection(&vcomp_section); + _vcomp_fork_call_wrapper(team->wrapper, team->nargs, team->valist); + EnterCriticalSection(&vcomp_section); + + thread_data->team = NULL; + list_remove(&thread_data->entry); + list_add_tail(&vcomp_idle_threads, &thread_data->entry); + if (++team->finished_threads >= team->num_threads) + WakeAllConditionVariable(&team->cond); + } + + if (!SleepConditionVariableCS(&thread_data->cond, &vcomp_section, 5000) && + GetLastError() == ERROR_TIMEOUT && !thread_data->team) + { + break; + } + } + list_remove(&thread_data->entry); + LeaveCriticalSection(&vcomp_section); + + TRACE("terminating worker thread for %p\n", thread_data); + + HeapFree(GetProcessHeap(), 0, thread_data); + vcomp_set_thread_data(NULL); + FreeLibraryAndExitThread(vcomp_module, 0); + return 0; +} + void WINAPIV _vcomp_fork(BOOL ifval, int nargs, void *wrapper, ...) { - __ms_va_list valist; + struct vcomp_thread_data *prev_thread_data = vcomp_init_thread_data(); + struct vcomp_thread_data thread_data; + struct vcomp_team_data team_data; + int num_threads; TRACE("(%d, %d, %p, ...)\n", ifval, nargs, wrapper); - __ms_va_start(valist, wrapper); - _vcomp_fork_call_wrapper(wrapper, nargs, valist); - __ms_va_end(valist); + if (!ifval) + num_threads = 1; + else if (prev_thread_data->team && !vcomp_nested_fork) + num_threads = 1; + else if (prev_thread_data->fork_threads) + num_threads = prev_thread_data->fork_threads; + else + num_threads = vcomp_num_threads; + + InitializeConditionVariable(&team_data.cond); + team_data.num_threads = 1; + team_data.finished_threads = 0; + team_data.nargs = nargs; + team_data.wrapper = wrapper; + __ms_va_start(team_data.valist, wrapper); + + thread_data.team = &team_data; + thread_data.thread_num = 0; + thread_data.fork_threads = 0; + list_init(&thread_data.entry); + InitializeConditionVariable(&thread_data.cond); + + if (num_threads > 1) + { + struct list *ptr; + EnterCriticalSection(&vcomp_section); + + /* reuse existing threads (if any) */ + while (team_data.num_threads < num_threads && (ptr = list_head(&vcomp_idle_threads))) + { + struct vcomp_thread_data *data = LIST_ENTRY(ptr, struct vcomp_thread_data, entry); + data->team = &team_data; + data->thread_num = team_data.num_threads++; + data->fork_threads = 0; + list_remove(&data->entry); + list_add_tail(&thread_data.entry, &data->entry); + WakeAllConditionVariable(&data->cond); + } + + /* spawn additional threads */ + while (team_data.num_threads < num_threads) + { + struct vcomp_thread_data *data; + HMODULE module; + HANDLE thread; + + data = HeapAlloc(GetProcessHeap(), 0, sizeof(*data)); + if (!data) break; + + data->team = &team_data; + data->thread_num = team_data.num_threads; + data->fork_threads = 0; + InitializeConditionVariable(&data->cond); + + thread = CreateThread(NULL, 0, _vcomp_fork_worker, data, 0, NULL); + if (!thread) + { + HeapFree(GetProcessHeap(), 0, data); + break; + } + + GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, + (const WCHAR *)vcomp_module, &module); + team_data.num_threads++; + list_add_tail(&thread_data.entry, &data->entry); + CloseHandle(thread); + } + + LeaveCriticalSection(&vcomp_section); + } + + vcomp_set_thread_data(&thread_data); + _vcomp_fork_call_wrapper(team_data.wrapper, team_data.nargs, team_data.valist); + vcomp_set_thread_data(prev_thread_data); + prev_thread_data->fork_threads = 0; + + if (team_data.num_threads > 1) + { + EnterCriticalSection(&vcomp_section); + + team_data.finished_threads++; + while (team_data.finished_threads < team_data.num_threads) + SleepConditionVariableCS(&team_data.cond, &vcomp_section, INFINITE); + + LeaveCriticalSection(&vcomp_section); + assert(list_empty(&thread_data.entry)); + } + + __ms_va_end(team_data.valist); } BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved) @@ -275,6 +438,7 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved) } GetSystemInfo(&sysinfo); + vcomp_module = instance; vcomp_max_threads = sysinfo.dwNumberOfProcessors; vcomp_num_threads = sysinfo.dwNumberOfProcessors; break;
1
0
0
0
← Newer
1
...
20
21
22
23
24
25
26
...
57
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
Results per page:
10
25
50
100
200