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
March 2019
----- 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
1097 discussions
Start a n
N
ew thread
Nikolay Sivov : mfplat: Implement waiting items with ability to cancel.
by Alexandre Julliard
01 Mar '19
01 Mar '19
Module: wine Branch: master Commit: 1a53a655d19249c06799f4ca5195049acdd0d7a3 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=1a53a655d19249c06799f4ca…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Fri Mar 1 11:03:12 2019 +0300 mfplat: Implement waiting items with ability to cancel. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mfplat/mfplat.spec | 1 + dlls/mfplat/queue.c | 288 +++++++++++++++++++++++++++++++++++---------- dlls/mfplat/tests/mfplat.c | 5 +- 3 files changed, 233 insertions(+), 61 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=1a53a655d19249c06799…
1
0
0
0
Nikolay Sivov : mfplat/tests: Add some tests for serial queues.
by Alexandre Julliard
01 Mar '19
01 Mar '19
Module: wine Branch: master Commit: 859f9bacc2ac0202b836f711d644f039590cb898 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=859f9bacc2ac0202b836f711…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Fri Mar 1 11:03:11 2019 +0300 mfplat/tests: Add some tests for serial queues. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mfplat/tests/mfplat.c | 62 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index cc8a0f4..e5e074e 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -44,6 +44,7 @@ static HRESULT (WINAPI *pMFCreateMemoryBuffer)(DWORD max_length, IMFMediaBuffer static void* (WINAPI *pMFHeapAlloc)(SIZE_T size, ULONG flags, char *file, int line, EAllocationType type); static void (WINAPI *pMFHeapFree)(void *p); static HRESULT (WINAPI *pMFPutWaitingWorkItem)(HANDLE event, LONG priority, IMFAsyncResult *result, MFWORKITEM_KEY *key); +static HRESULT (WINAPI *pMFAllocateSerialWorkQueue)(DWORD queue, DWORD *serial_queue); DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0); @@ -312,7 +313,8 @@ static void init_functions(void) { HMODULE mod = GetModuleHandleA("mfplat.dll"); -#define X(f) if (!(p##f = (void*)GetProcAddress(mod, #f))) return; +#define X(f) p##f = (void*)GetProcAddress(mod, #f) + X(MFAllocateSerialWorkQueue); X(MFCopyImage); X(MFCreateSourceResolver); X(MFCreateMFByteStreamOnStream); @@ -1092,6 +1094,63 @@ todo_wine ok(hr == S_OK, "Failed to shutdown, hr %#x.\n", hr); } +static void test_serial_queue(void) +{ + static const DWORD queue_ids[] = + { + MFASYNC_CALLBACK_QUEUE_STANDARD, + MFASYNC_CALLBACK_QUEUE_RT, + MFASYNC_CALLBACK_QUEUE_IO, + MFASYNC_CALLBACK_QUEUE_TIMER, + MFASYNC_CALLBACK_QUEUE_MULTITHREADED, + MFASYNC_CALLBACK_QUEUE_LONG_FUNCTION, + }; + DWORD queue, serial_queue; + unsigned int i; + HRESULT hr; + + if (!pMFAllocateSerialWorkQueue) + { + skip("Serial queues are not supported.\n"); + return; + } + + hr = MFStartup(MF_VERSION, MFSTARTUP_FULL); + ok(hr == S_OK, "Failed to start up, hr %#x.\n", hr); + + for (i = 0; i < ARRAY_SIZE(queue_ids); ++i) + { + BOOL broken_types = queue_ids[i] == MFASYNC_CALLBACK_QUEUE_TIMER || + queue_ids[i] == MFASYNC_CALLBACK_QUEUE_LONG_FUNCTION; + + hr = pMFAllocateSerialWorkQueue(queue_ids[i], &serial_queue); + ok(hr == S_OK || broken(broken_types && hr == E_INVALIDARG) /* Win8 */, + "%u: failed to allocate a queue, hr %#x.\n", i, hr); + + if (SUCCEEDED(hr)) + { + hr = MFUnlockWorkQueue(serial_queue); + ok(hr == S_OK, "%u: failed to unlock the queue, hr %#x.\n", i, hr); + } + } + + /* Chain them together. */ + hr = pMFAllocateSerialWorkQueue(MFASYNC_CALLBACK_QUEUE_STANDARD, &serial_queue); + ok(hr == S_OK, "Failed to allocate a queue, hr %#x.\n", hr); + + hr = pMFAllocateSerialWorkQueue(serial_queue, &queue); + ok(hr == S_OK, "Failed to allocate a queue, hr %#x.\n", hr); + + hr = MFUnlockWorkQueue(serial_queue); + ok(hr == S_OK, "Failed to unlock the queue, hr %#x.\n", hr); + + hr = MFUnlockWorkQueue(queue); + ok(hr == S_OK, "Failed to unlock the queue, hr %#x.\n", hr); + + hr = MFShutdown(); + ok(hr == S_OK, "Failed to shut down, hr %#x.\n", hr); +} + START_TEST(mfplat) { CoInitialize(NULL); @@ -1114,6 +1173,7 @@ START_TEST(mfplat) test_MFCreateCollection(); test_MFHeapAlloc(); test_scheduled_items(); + test_serial_queue(); CoUninitialize(); }
1
0
0
0
Nikolay Sivov : mfplat: Add basic support for submitting work items.
by Alexandre Julliard
01 Mar '19
01 Mar '19
Module: wine Branch: master Commit: c0759107e7e2f1286242c5f14e460b77fd6066f3 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=c0759107e7e2f1286242c5f1…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Fri Mar 1 11:03:10 2019 +0300 mfplat: Add basic support for submitting work items. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mfplat/queue.c | 150 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 147 insertions(+), 3 deletions(-) diff --git a/dlls/mfplat/queue.c b/dlls/mfplat/queue.c index 3b59984..8c7cf19 100644 --- a/dlls/mfplat/queue.c +++ b/dlls/mfplat/queue.c @@ -33,9 +33,16 @@ WINE_DEFAULT_DEBUG_CHANNEL(mfplat); #define FIRST_USER_QUEUE_HANDLE 5 #define MAX_USER_QUEUE_HANDLES 124 +struct work_item +{ + LONG refcount; + IMFAsyncResult *result; +}; + struct queue { TP_POOL *pool; + TP_CALLBACK_ENVIRON env; }; struct queue_handle @@ -86,9 +93,104 @@ enum system_queue_index static struct queue system_queues[SYS_QUEUE_COUNT]; +static struct queue *get_system_queue(DWORD queue_id) +{ + switch (queue_id) + { + case MFASYNC_CALLBACK_QUEUE_STANDARD: + case MFASYNC_CALLBACK_QUEUE_RT: + case MFASYNC_CALLBACK_QUEUE_IO: + case MFASYNC_CALLBACK_QUEUE_TIMER: + case MFASYNC_CALLBACK_QUEUE_MULTITHREADED: + case MFASYNC_CALLBACK_QUEUE_LONG_FUNCTION: + return &system_queues[queue_id - 1]; + default: + return NULL; + } +} + +static void CALLBACK standard_queue_cleanup_callback(void *object_data, void *group_data) +{ +} + +static struct work_item * alloc_work_item(struct queue *queue, IMFAsyncResult *result) +{ + struct work_item *item; + + item = heap_alloc_zero(sizeof(*item)); + item->result = result; + IMFAsyncResult_AddRef(item->result); + item->refcount = 1; + + return item; +} + +static void release_work_item(struct work_item *item) +{ + if (InterlockedDecrement(&item->refcount) == 0) + { + IMFAsyncResult_Release(item->result); + heap_free(item); + } +} + static void init_work_queue(MFASYNC_WORKQUEUE_TYPE queue_type, struct queue *queue) { + unsigned int max_thread; + queue->pool = CreateThreadpool(NULL); + queue->env.Version = 1; + queue->env.Pool = queue->pool; + queue->env.CleanupGroup = CreateThreadpoolCleanupGroup(); + queue->env.CleanupGroupCancelCallback = standard_queue_cleanup_callback; + + max_thread = (queue_type == MF_STANDARD_WORKQUEUE || queue_type == MF_WINDOW_WORKQUEUE) ? 1 : 4; + + SetThreadpoolThreadMinimum(queue->pool, 1); + SetThreadpoolThreadMaximum(queue->pool, max_thread); + + if (queue_type == MF_WINDOW_WORKQUEUE) + FIXME("MF_WINDOW_WORKQUEUE is not supported.\n"); +} + +static HRESULT grab_queue(DWORD queue_id, struct queue **ret) +{ + struct queue *queue = get_system_queue(queue_id); + MFASYNC_WORKQUEUE_TYPE queue_type; + struct queue_handle *entry; + + if (!system_queues[SYS_QUEUE_STANDARD].pool) + return MF_E_SHUTDOWN; + + if (queue && queue->pool) + { + *ret = queue; + return S_OK; + } + else if (queue) + { + EnterCriticalSection(&queues_section); + switch (queue_id) + { + case MFASYNC_CALLBACK_QUEUE_IO: + case MFASYNC_CALLBACK_QUEUE_MULTITHREADED: + case MFASYNC_CALLBACK_QUEUE_LONG_FUNCTION: + queue_type = MF_MULTITHREADED_WORKQUEUE; + break; + default: + queue_type = MF_STANDARD_WORKQUEUE; + } + init_work_queue(queue_type, queue); + LeaveCriticalSection(&queues_section); + *ret = queue; + return S_OK; + } + + /* Handles user queues. */ + if ((entry = get_queue_obj(queue_id))) + *ret = entry->obj; + + return *ret ? S_OK : MF_E_INVALID_WORKQUEUE; } void init_system_queues(void) @@ -113,6 +215,7 @@ static void shutdown_queue(struct queue *queue) if (!queue->pool) return; + CloseThreadpoolCleanupGroupMembers(queue->env.CleanupGroup, TRUE, NULL); CloseThreadpool(queue->pool); queue->pool = NULL; } @@ -131,6 +234,47 @@ void shutdown_system_queues(void) LeaveCriticalSection(&queues_section); } +static void CALLBACK standard_queue_worker(TP_CALLBACK_INSTANCE *instance, void *context, TP_WORK *work) +{ + struct work_item *item = context; + MFASYNCRESULT *result = (MFASYNCRESULT *)item->result; + + TRACE("result object %p.\n", result); + + IMFAsyncCallback_Invoke(result->pCallback, item->result); + + release_work_item(item); +} + +static HRESULT queue_submit_item(struct queue *queue, IMFAsyncResult *result) +{ + struct work_item *item; + TP_WORK *work_object; + + if (!(item = alloc_work_item(queue, result))) + return E_OUTOFMEMORY; + + work_object = CreateThreadpoolWork(standard_queue_worker, item, &queue->env); + SubmitThreadpoolWork(work_object); + + TRACE("dispatched %p.\n", result); + + return S_OK; +} + +static HRESULT queue_put_work_item(DWORD queue_id, IMFAsyncResult *result) +{ + struct queue *queue; + HRESULT hr; + + if (FAILED(hr = grab_queue(queue_id, &queue))) + return hr; + + hr = queue_submit_item(queue, result); + + return hr; +} + static HRESULT alloc_user_queue(MFASYNC_WORKQUEUE_TYPE queue_type, DWORD *queue_id) { struct queue_handle *entry; @@ -440,7 +584,7 @@ HRESULT WINAPI MFPutWorkItem(DWORD queue, IMFAsyncCallback *callback, IUnknown * if (FAILED(hr = MFCreateAsyncResult(NULL, callback, state, &result))) return hr; - hr = MFPutWorkItemEx(queue, result); + hr = queue_put_work_item(queue, result); IMFAsyncResult_Release(result); @@ -452,9 +596,9 @@ HRESULT WINAPI MFPutWorkItem(DWORD queue, IMFAsyncCallback *callback, IUnknown * */ HRESULT WINAPI MFPutWorkItemEx(DWORD queue, IMFAsyncResult *result) { - FIXME("%#x, %p\n", queue, result); + TRACE("%#x, %p\n", queue, result); - return E_NOTIMPL; + return queue_put_work_item(queue, result); } /***********************************************************************
1
0
0
0
Nikolay Sivov : mfplat: Add a helper to create async result objects.
by Alexandre Julliard
01 Mar '19
01 Mar '19
Module: wine Branch: master Commit: 3a433af207cfa6a471af1afe83a1344a3f9f2342 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=3a433af207cfa6a471af1afe…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Fri Mar 1 11:03:09 2019 +0300 mfplat: Add a helper to create async result objects. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mfplat/queue.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/dlls/mfplat/queue.c b/dlls/mfplat/queue.c index 70efac3..3b59984 100644 --- a/dlls/mfplat/queue.c +++ b/dlls/mfplat/queue.c @@ -345,12 +345,10 @@ static const IMFAsyncResultVtbl async_result_vtbl = async_result_GetStateNoAddRef, }; -HRESULT WINAPI MFCreateAsyncResult(IUnknown *object, IMFAsyncCallback *callback, IUnknown *state, IMFAsyncResult **out) +static HRESULT create_async_result(IUnknown *object, IMFAsyncCallback *callback, IUnknown *state, IMFAsyncResult **out) { struct async_result *result; - TRACE("%p, %p, %p, %p.\n", object, callback, state, out); - if (!out) return E_INVALIDARG; @@ -374,10 +372,22 @@ HRESULT WINAPI MFCreateAsyncResult(IUnknown *object, IMFAsyncCallback *callback, *out = &result->result.AsyncResult; + TRACE("Created async result object %p.\n", *out); + return S_OK; } /*********************************************************************** + * MFCreateAsyncResult (mfplat.@) + */ +HRESULT WINAPI MFCreateAsyncResult(IUnknown *object, IMFAsyncCallback *callback, IUnknown *state, IMFAsyncResult **out) +{ + TRACE("%p, %p, %p, %p.\n", object, callback, state, out); + + return create_async_result(object, callback, state, out); +} + +/*********************************************************************** * MFAllocateWorkQueue (mfplat.@) */ HRESULT WINAPI MFAllocateWorkQueue(DWORD *queue)
1
0
0
0
Nikolay Sivov : mfplat: Add MFAllocateWorkQueueEx().
by Alexandre Julliard
01 Mar '19
01 Mar '19
Module: wine Branch: master Commit: 493c2c323e5194b20bf2939f022acb71d26da1e9 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=493c2c323e5194b20bf2939f…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Fri Mar 1 11:03:08 2019 +0300 mfplat: Add MFAllocateWorkQueueEx(). Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mfplat/mfplat.spec | 2 +- dlls/mfplat/queue.c | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/dlls/mfplat/mfplat.spec b/dlls/mfplat/mfplat.spec index 39fd7a9..a218087 100644 --- a/dlls/mfplat/mfplat.spec +++ b/dlls/mfplat/mfplat.spec @@ -17,7 +17,7 @@ @ stub LFGetGlobalPool @ stub MFAddPeriodicCallback @ stdcall MFAllocateWorkQueue(ptr) -@ stub MFAllocateWorkQueueEx +@ stdcall MFAllocateWorkQueueEx(long ptr) @ stub MFAppendCollection @ stub MFAverageTimePerFrameToFrameRate @ stub MFBeginCreateFile diff --git a/dlls/mfplat/queue.c b/dlls/mfplat/queue.c index 9a3922f..70efac3 100644 --- a/dlls/mfplat/queue.c +++ b/dlls/mfplat/queue.c @@ -388,6 +388,16 @@ HRESULT WINAPI MFAllocateWorkQueue(DWORD *queue) } /*********************************************************************** + * MFAllocateWorkQueueEx (mfplat.@) + */ +HRESULT WINAPI MFAllocateWorkQueueEx(MFASYNC_WORKQUEUE_TYPE queue_type, DWORD *queue) +{ + TRACE("%d, %p.\n", queue_type, queue); + + return alloc_user_queue(queue_type, queue); +} + +/*********************************************************************** * MFLockWorkQueue (mfplat.@) */ HRESULT WINAPI MFLockWorkQueue(DWORD queue)
1
0
0
0
Nikolay Sivov : mfplat: Initialize system queues on startup.
by Alexandre Julliard
01 Mar '19
01 Mar '19
Module: wine Branch: master Commit: 7a120b0b2c75de8be2007de91b2ecf7501abc432 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=7a120b0b2c75de8be2007de9…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Fri Mar 1 11:03:07 2019 +0300 mfplat: Initialize system queues on startup. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mfplat/main.c | 26 +++++++-- dlls/mfplat/mfplat_private.h | 20 +++++++ dlls/mfplat/queue.c | 123 ++++++++++++++++++++++++++++++++++--------- include/mfapi.h | 8 +++ include/mfobjects.idl | 1 + 5 files changed, 150 insertions(+), 28 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=7a120b0b2c75de8be200…
1
0
0
0
Nikolay Sivov : mfplat/tests: Add a test for deferred item posting.
by Alexandre Julliard
01 Mar '19
01 Mar '19
Module: wine Branch: master Commit: f42b3a1f102db932d033e7d4e04ecf6166a795c2 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=f42b3a1f102db932d033e7d4…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Fri Mar 1 11:03:06 2019 +0300 mfplat/tests: Add a test for deferred item posting. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mfplat/mfplat.spec | 6 ++--- dlls/mfplat/queue.c | 47 +++++++++++++++++++++++++++++++++++ dlls/mfplat/tests/mfplat.c | 62 ++++++++++++++++++++++++++++++++++++++++++++-- include/mfapi.h | 2 ++ 4 files changed, 112 insertions(+), 5 deletions(-) diff --git a/dlls/mfplat/mfplat.spec b/dlls/mfplat/mfplat.spec index c4e0b2a..39fd7a9 100644 --- a/dlls/mfplat/mfplat.spec +++ b/dlls/mfplat/mfplat.spec @@ -28,7 +28,7 @@ @ stub MFCalculateBitmapImageSize @ stub MFCalculateImageSize @ stub MFCancelCreateFile -@ stub MFCancelWorkItem +@ stdcall MFCancelWorkItem(int64) @ stub MFCompareFullToPartialMediaType @ stub MFCompareSockaddrAddresses @ stub MFConvertColorInfoFromDXVA @@ -124,8 +124,8 @@ @ stdcall MFPutWorkItemEx(long ptr) @ stub MFRecordError @ stub MFRemovePeriodicCallback -@ stub MFScheduleWorkItem -@ stub MFScheduleWorkItemEx +@ stdcall MFScheduleWorkItem(ptr ptr int64 ptr) +@ stdcall MFScheduleWorkItemEx(ptr int64 ptr) @ stub MFSerializeAttributesToStream @ stub MFSerializeEvent @ stub MFSerializeMediaTypeToStream diff --git a/dlls/mfplat/queue.c b/dlls/mfplat/queue.c index ebc2ad4..7c8790b 100644 --- a/dlls/mfplat/queue.c +++ b/dlls/mfplat/queue.c @@ -385,3 +385,50 @@ HRESULT WINAPI MFInvokeCallback(IMFAsyncResult *result) return hr; } + +static HRESULT schedule_work_item(IMFAsyncResult *result, INT64 timeout, MFWORKITEM_KEY *key) +{ + FIXME("%p, %s, %p.\n", result, wine_dbgstr_longlong(timeout), key); + + return E_NOTIMPL; +} + +/*********************************************************************** + * MFScheduleWorkItemEx (mfplat.@) + */ +HRESULT WINAPI MFScheduleWorkItemEx(IMFAsyncResult *result, INT64 timeout, MFWORKITEM_KEY *key) +{ + TRACE("%p, %s, %p.\n", result, wine_dbgstr_longlong(timeout), key); + + return schedule_work_item(result, timeout, key); +} + +/*********************************************************************** + * MFScheduleWorkItemEx (mfplat.@) + */ +HRESULT WINAPI MFScheduleWorkItem(IMFAsyncCallback *callback, IUnknown *state, INT64 timeout, MFWORKITEM_KEY *key) +{ + IMFAsyncResult *result; + HRESULT hr; + + TRACE("%p, %p, %s, %p.\n", callback, state, wine_dbgstr_longlong(timeout), key); + + if (FAILED(hr = MFCreateAsyncResult(NULL, callback, state, &result))) + return hr; + + hr = schedule_work_item(result, timeout, key); + + IMFAsyncResult_Release(result); + + return hr; +} + +/*********************************************************************** + * MFCancelWorkItem (mfplat.@) + */ +HRESULT WINAPI MFCancelWorkItem(MFWORKITEM_KEY key) +{ + FIXME("%s.\n", wine_dbgstr_longlong(key)); + + return E_NOTIMPL; +} diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 609faa5..cc8a0f4 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -43,6 +43,7 @@ static HRESULT (WINAPI *pMFCreateMFByteStreamOnStream)(IStream *stream, IMFByteS static HRESULT (WINAPI *pMFCreateMemoryBuffer)(DWORD max_length, IMFMediaBuffer **buffer); static void* (WINAPI *pMFHeapAlloc)(SIZE_T size, ULONG flags, char *file, int line, EAllocationType type); static void (WINAPI *pMFHeapFree)(void *p); +static HRESULT (WINAPI *pMFPutWaitingWorkItem)(HANDLE event, LONG priority, IMFAsyncResult *result, MFWORKITEM_KEY *key); DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0); @@ -318,6 +319,7 @@ static void init_functions(void) X(MFCreateMemoryBuffer); X(MFHeapAlloc); X(MFHeapFree); + X(MFPutWaitingWorkItem); #undef X } @@ -718,13 +720,13 @@ static ULONG WINAPI testcallback_Release(IMFAsyncCallback *iface) static HRESULT WINAPI testcallback_GetParameters(IMFAsyncCallback *iface, DWORD *flags, DWORD *queue) { - ok(0, "Unexpected call.\n"); + ok(flags != NULL && queue != NULL, "Unexpected arguments.\n"); return E_NOTIMPL; } static HRESULT WINAPI testcallback_Invoke(IMFAsyncCallback *iface, IMFAsyncResult *result) { - ok(0, "Unexpected call.\n"); + ok(result != NULL, "Unexpected result object.\n"); return E_NOTIMPL; } @@ -1035,6 +1037,61 @@ static void test_MFHeapAlloc(void) pMFHeapFree(res); } +static void test_scheduled_items(void) +{ + IMFAsyncCallback callback = { &testcallbackvtbl }; + IMFAsyncResult *result; + MFWORKITEM_KEY key, key2; + HRESULT hr; + + hr = MFStartup(MF_VERSION, MFSTARTUP_FULL); + ok(hr == S_OK, "Failed to start up, hr %#x.\n", hr); + + hr = MFScheduleWorkItem(&callback, NULL, -5000, &key); +todo_wine + ok(hr == S_OK, "Failed to schedule item, hr %#x.\n", hr); + + hr = MFCancelWorkItem(key); +todo_wine + ok(hr == S_OK, "Failed to cancel item, hr %#x.\n", hr); + + hr = MFCancelWorkItem(key); +todo_wine + ok(hr == MF_E_NOT_FOUND || broken(hr == S_OK) /* < win10 */, "Unexpected hr %#x.\n", hr); + + if (!pMFPutWaitingWorkItem) + { + skip("Waiting items are not supported.\n"); + return; + } + + hr = MFCreateAsyncResult(NULL, &callback, NULL, &result); + ok(hr == S_OK, "Failed to create result, hr %#x.\n", hr); + + hr = pMFPutWaitingWorkItem(NULL, 0, result, &key); + ok(hr == S_OK, "Failed to add waiting item, hr %#x.\n", hr); + + hr = pMFPutWaitingWorkItem(NULL, 0, result, &key2); + ok(hr == S_OK, "Failed to add waiting item, hr %#x.\n", hr); + + hr = MFCancelWorkItem(key); + ok(hr == S_OK, "Failed to cancel item, hr %#x.\n", hr); + + hr = MFCancelWorkItem(key2); + ok(hr == S_OK, "Failed to cancel item, hr %#x.\n", hr); + + IMFAsyncResult_Release(result); + + hr = MFScheduleWorkItem(&callback, NULL, -5000, &key); + ok(hr == S_OK, "Failed to schedule item, hr %#x.\n", hr); + + hr = MFCancelWorkItem(key); + ok(hr == S_OK, "Failed to cancel item, hr %#x.\n", hr); + + hr = MFShutdown(); + ok(hr == S_OK, "Failed to shutdown, hr %#x.\n", hr); +} + START_TEST(mfplat) { CoInitialize(NULL); @@ -1056,6 +1113,7 @@ START_TEST(mfplat) test_MFCopyImage(); test_MFCreateCollection(); test_MFHeapAlloc(); + test_scheduled_items(); CoUninitialize(); } diff --git a/include/mfapi.h b/include/mfapi.h index 7c47213..4b7d758 100644 --- a/include/mfapi.h +++ b/include/mfapi.h @@ -115,6 +115,8 @@ HRESULT WINAPI MFInvokeCallback(IMFAsyncResult *result); HRESULT WINAPI MFLockPlatform(void); HRESULT WINAPI MFPutWorkItem(DWORD queue, IMFAsyncCallback *callback, IUnknown *state); HRESULT WINAPI MFPutWorkItemEx(DWORD queue, IMFAsyncResult *result); +HRESULT WINAPI MFScheduleWorkItem(IMFAsyncCallback *callback, IUnknown *state, INT64 timeout, MFWORKITEM_KEY *key); +HRESULT WINAPI MFScheduleWorkItemEx(IMFAsyncResult *result, INT64 timeout, MFWORKITEM_KEY *key); HRESULT WINAPI MFTRegister(CLSID clsid, GUID category, LPWSTR name, UINT32 flags, UINT32 cinput, MFT_REGISTER_TYPE_INFO *input_types, UINT32 coutput, MFT_REGISTER_TYPE_INFO *output_types, IMFAttributes *attributes);
1
0
0
0
Alistair Leslie-Hughes : vbscript: Move variable declaration outside of for.
by Alexandre Julliard
01 Mar '19
01 Mar '19
Module: wine Branch: master Commit: b75627ec1060e4a539cdbbdb6626876d61429970 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=b75627ec1060e4a539cdbbdb…
Author: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com> Date: Thu Feb 28 22:37:25 2019 +0000 vbscript: Move variable declaration outside of for. This stops a compile error under gcc 4.8.4. Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/vbscript/tests/run.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dlls/vbscript/tests/run.c b/dlls/vbscript/tests/run.c index 49066ce..6be6c7f 100644 --- a/dlls/vbscript/tests/run.c +++ b/dlls/vbscript/tests/run.c @@ -828,8 +828,9 @@ static HRESULT WINAPI testObj_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD { "resume", DISPID_TESTOBJ_KEYWORD, NULL }, { "goto", DISPID_TESTOBJ_KEYWORD, NULL }, }; + int i; - for (int i = 0; i < ARRAY_SIZE(dispids); i++) { + for (i = 0; i < ARRAY_SIZE(dispids); i++) { if(!stricmp_wa(bstrName, dispids[i].name)) { dispid_t *d = &dispids[i]; if(d->expect) {
1
0
0
0
Michael Stefaniuc : ole32: Remove useless casts to self.
by Alexandre Julliard
01 Mar '19
01 Mar '19
Module: wine Branch: master Commit: 59fc5cfc3e47ec4c98ef6c674ae3384630eabd6d URL:
https://source.winehq.org/git/wine.git/?a=commit;h=59fc5cfc3e47ec4c98ef6c67…
Author: Michael Stefaniuc <mstefani(a)winehq.org> Date: Thu Feb 28 21:39:48 2019 +0100 ole32: Remove useless casts to self. Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ole32/datacache.c | 2 +- dlls/ole32/tests/compobj.c | 6 +++--- dlls/ole32/tests/marshal.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dlls/ole32/datacache.c b/dlls/ole32/datacache.c index 3eff569..6d4bcca 100644 --- a/dlls/ole32/datacache.c +++ b/dlls/ole32/datacache.c @@ -1003,7 +1003,7 @@ static HRESULT save_mfpict(DataCacheEntry *entry, BOOL contents, IStream *stream meta_place_rec.bounding_box[3] = (LONGLONG)mfpict->yExt * meta_place_rec.inch / 2540; GlobalUnlock(entry->stgmedium.u.hMetaFilePict); - for (check = (WORD *)&meta_place_rec; check != (WORD *)&meta_place_rec.checksum; check++) + for (check = (WORD *)&meta_place_rec; check != &meta_place_rec.checksum; check++) meta_place_rec.checksum ^= *check; hr = IStream_Write(stream, &meta_place_rec, sizeof(struct meta_placeable), NULL); if (hr == S_OK && data_size) diff --git a/dlls/ole32/tests/compobj.c b/dlls/ole32/tests/compobj.c index b4dd83e..aebe967 100644 --- a/dlls/ole32/tests/compobj.c +++ b/dlls/ole32/tests/compobj.c @@ -1031,7 +1031,7 @@ static HRESULT WINAPI PSFactoryBuffer_CreateStub( { CHECK_EXPECT(CreateStub); - ok(pUnkServer == (IUnknown*)&Test_Unknown, "unexpected pUnkServer %p\n", pUnkServer); + ok(pUnkServer == &Test_Unknown, "unexpected pUnkServer %p\n", pUnkServer); if(!ps_factory_buffer) return E_NOTIMPL; @@ -3753,10 +3753,10 @@ static DWORD CALLBACK implicit_mta_proc(void *param) hr = CoRegisterMessageFilter(NULL, NULL); ok(hr == CO_E_NOT_SUPPORTED, "got %#x\n", hr); - hr = CoLockObjectExternal((IUnknown *)&Test_Unknown, TRUE, TRUE); + hr = CoLockObjectExternal(&Test_Unknown, TRUE, TRUE); ok_ole_success(hr, "CoLockObjectExternal"); - hr = CoDisconnectObject((IUnknown *)&Test_Unknown, 0); + hr = CoDisconnectObject(&Test_Unknown, 0); ok_ole_success(hr, "CoDisconnectObject"); return 0; diff --git a/dlls/ole32/tests/marshal.c b/dlls/ole32/tests/marshal.c index c53acf2..33b155d 100644 --- a/dlls/ole32/tests/marshal.c +++ b/dlls/ole32/tests/marshal.c @@ -329,7 +329,7 @@ static HRESULT WINAPI Test_IClassFactory_CreateInstance( LPVOID *ppvObj) { if (pUnkOuter) return CLASS_E_NOAGGREGATION; - return IUnknown_QueryInterface((IUnknown*)&Test_Unknown, riid, ppvObj); + return IUnknown_QueryInterface(&Test_Unknown, riid, ppvObj); } static HRESULT WINAPI Test_IClassFactory_LockServer(
1
0
0
0
Gabriel Ivăncescu : user32/listbox: Implement LBS_NODATA for multi-selection listboxes.
by Alexandre Julliard
01 Mar '19
01 Mar '19
Module: wine Branch: master Commit: 7a1b96f6b7be849b36c303cdff7ce659a41b9df3 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=7a1b96f6b7be849b36c303cd…
Author: Gabriel Ivăncescu <gabrielopcode(a)gmail.com> Date: Thu Feb 28 15:10:31 2019 +0200 user32/listbox: Implement LBS_NODATA for multi-selection listboxes. Use a byte array to store selection state of items, since we don't need any other data for LBS_NODATA multi-selection listboxes. This improves memory usage dramatically for large lists, and performance boosts are nice too. Signed-off-by: Gabriel Ivăncescu <gabrielopcode(a)gmail.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/user32/listbox.c | 72 ++++++++++++++++++++++++++++++++------------------- 1 file changed, 45 insertions(+), 27 deletions(-) diff --git a/dlls/user32/listbox.c b/dlls/user32/listbox.c index 219910b..95621b8 100644 --- a/dlls/user32/listbox.c +++ b/dlls/user32/listbox.c @@ -17,8 +17,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * - * TODO: - * - LBS_NODATA for multi-selection listboxes */ #include <string.h> @@ -66,7 +64,11 @@ typedef struct UINT style; /* Window style */ INT width; /* Window width */ INT height; /* Window height */ - LB_ITEMDATA *items; /* Array of items */ + union + { + LB_ITEMDATA *items; /* Array of items */ + BYTE *nodata_items; /* For multi-selection LBS_NODATA */ + } u; INT nb_items; /* Number of items */ UINT items_size; /* Total number of allocated items in the array */ INT top_item; /* Top visible item */ @@ -122,9 +124,19 @@ static TIMER_DIRECTION LISTBOX_Timer = LB_TIMER_NONE; static LRESULT LISTBOX_GetItemRect( const LB_DESCR *descr, INT index, RECT *rect ); +/* + For listboxes without LBS_NODATA, an array of LB_ITEMDATA is allocated + to store the states of each item into descr->u.items. + + For single-selection LBS_NODATA listboxes, no storage is allocated, + and thus descr->u.nodata_items will always be NULL. + + For multi-selection LBS_NODATA listboxes, one byte per item is stored + for the item's selection state into descr->u.nodata_items. +*/ static size_t get_sizeof_item( const LB_DESCR *descr ) { - return sizeof(LB_ITEMDATA); + return (descr->style & LBS_NODATA) ? sizeof(BYTE) : sizeof(LB_ITEMDATA); } static BOOL resize_storage(LB_DESCR *descr, UINT items_size) @@ -137,20 +149,20 @@ static BOOL resize_storage(LB_DESCR *descr, UINT items_size) items_size = (items_size + LB_ARRAY_GRANULARITY - 1) & ~(LB_ARRAY_GRANULARITY - 1); if ((descr->style & (LBS_NODATA | LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) != LBS_NODATA) { - items = heap_realloc(descr->items, items_size * get_sizeof_item(descr)); + items = heap_realloc(descr->u.items, items_size * get_sizeof_item(descr)); if (!items) { SEND_NOTIFICATION(descr, LBN_ERRSPACE); return FALSE; } - descr->items = items; + descr->u.items = items; } descr->items_size = items_size; } - if ((descr->style & LBS_NODATA) && descr->items && items_size > descr->nb_items) + if ((descr->style & LBS_NODATA) && descr->u.nodata_items && items_size > descr->nb_items) { - memset(&descr->items[descr->nb_items], 0, + memset(descr->u.nodata_items + descr->nb_items, 0, (items_size - descr->nb_items) * get_sizeof_item(descr)); } return TRUE; @@ -158,69 +170,75 @@ static BOOL resize_storage(LB_DESCR *descr, UINT items_size) static ULONG_PTR get_item_data( const LB_DESCR *descr, UINT index ) { - return (descr->style & LBS_NODATA) ? 0 : descr->items[index].data; + return (descr->style & LBS_NODATA) ? 0 : descr->u.items[index].data; } static void set_item_data( LB_DESCR *descr, UINT index, ULONG_PTR data ) { - if (!(descr->style & LBS_NODATA)) descr->items[index].data = data; + if (!(descr->style & LBS_NODATA)) descr->u.items[index].data = data; } static WCHAR *get_item_string( const LB_DESCR *descr, UINT index ) { - return HAS_STRINGS(descr) ? descr->items[index].str : NULL; + return HAS_STRINGS(descr) ? descr->u.items[index].str : NULL; } static void set_item_string( const LB_DESCR *descr, UINT index, WCHAR *string ) { - if (!(descr->style & LBS_NODATA)) descr->items[index].str = string; + if (!(descr->style & LBS_NODATA)) descr->u.items[index].str = string; } static UINT get_item_height( const LB_DESCR *descr, UINT index ) { - return (descr->style & LBS_NODATA) ? 0 : descr->items[index].height; + return (descr->style & LBS_NODATA) ? 0 : descr->u.items[index].height; } static void set_item_height( LB_DESCR *descr, UINT index, UINT height ) { - if (!(descr->style & LBS_NODATA)) descr->items[index].height = height; + if (!(descr->style & LBS_NODATA)) descr->u.items[index].height = height; } static BOOL is_item_selected( const LB_DESCR *descr, UINT index ) { if (!(descr->style & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL))) return index == descr->selected_item; - return descr->items[index].selected; + if (descr->style & LBS_NODATA) + return descr->u.nodata_items[index]; + else + return descr->u.items[index].selected; } static void set_item_selected_state(LB_DESCR *descr, UINT index, BOOL state) { if (descr->style & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) - descr->items[index].selected = state; + { + if (descr->style & LBS_NODATA) + descr->u.nodata_items[index] = state; + else + descr->u.items[index].selected = state; + } } static void insert_item_data(LB_DESCR *descr, UINT index) { size_t size = get_sizeof_item(descr); - LB_ITEMDATA *item; + BYTE *p = descr->u.nodata_items + index * size; - if (!descr->items) return; + if (!descr->u.items) return; - item = descr->items + index; if (index < descr->nb_items) - memmove(item + 1, item, (descr->nb_items - index) * size); + memmove(p + size, p, (descr->nb_items - index) * size); } static void remove_item_data(LB_DESCR *descr, UINT index) { size_t size = get_sizeof_item(descr); - LB_ITEMDATA *item; + BYTE *p = descr->u.nodata_items + index * size; - if (!descr->items) return; + if (!descr->u.items) return; - item = descr->items + index; if (index < descr->nb_items) - memmove(item, item + 1, (descr->nb_items - index) * size); + memmove(p, p + size, (descr->nb_items - index) * size); } /********************************************************************* @@ -1792,14 +1810,14 @@ static void LISTBOX_ResetContent( LB_DESCR *descr ) if (!(descr->style & LBS_NODATA)) for (i = descr->nb_items - 1; i >= 0; i--) LISTBOX_DeleteItem(descr, i); - HeapFree( GetProcessHeap(), 0, descr->items ); + HeapFree( GetProcessHeap(), 0, descr->u.items ); descr->nb_items = 0; descr->top_item = 0; descr->selected_item = -1; descr->focus_item = 0; descr->anchor_item = -1; descr->items_size = 0; - descr->items = NULL; + descr->u.items = NULL; } @@ -2550,7 +2568,7 @@ static BOOL LISTBOX_Create( HWND hwnd, LPHEADCOMBO lphc ) descr->style = GetWindowLongW( descr->self, GWL_STYLE ); descr->width = rect.right - rect.left; descr->height = rect.bottom - rect.top; - descr->items = NULL; + descr->u.items = NULL; descr->items_size = 0; descr->nb_items = 0; descr->top_item = 0;
1
0
0
0
← Newer
1
...
106
107
108
109
110
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
Results per page:
10
25
50
100
200